func (p *parser) parseList(annotations []Symbol) List {
	if item := p.next(); item.Type != lex.IonListStart {
		p.panicf("expected list start but found %s", item)
	}

	var values []Value
	var prev lex.Item
	for item := p.peekNonComment(); item.Type != lex.IonListEnd && item.Type != lex.IonError; prev, item = item, p.peekNonComment() {
		if item.Type == lex.IonComma {
			if prev.Type == 0 {
				p.panicf("list may not start with a comma")
			}
			if prev.Type == lex.IonComma {
				p.panicf("list must have a value defined between commas")
			}
			p.next()
			continue
		} else if prev.Type != lex.IonComma && prev.Type != 0 {
			p.panicf("list items must be separated by commas")
		}

		values = append(values, p.parseValue(false))
	}

	// Eat the end of the list.  An improperly terminated list creates an error
	// before we hit this spot, but check it just to be safe.
	if item := p.next(); item.Type != lex.IonListEnd {
		p.panicf("expected list end but found %s", item)
	}

	return List{annotations: annotations, values: values}
}
// This file contains text parsers for List, SExp, and Struct.
This file contains text parsers for List, SExp, and Struct.
// This file contains text parsers for List SExp and Struct .
func (p *parser) parseList(annotations []Symbol) List {
	if item := p.next(); item.Type != lex.IonListStart {
		p.panicf("expected list start but found %s", item)
	}
	var values []Value
	var prev lex.Item
	for item := p.peekNonComment(); item.Type != lex.IonListEnd && item.Type != lex.IonError; prev, item = item, p.peekNonComment() {
		if item.Type == lex.IonComma {
			if prev.Type == 0 {
				p.panicf("list may not start with a comma")
			}
			if prev.Type == lex.IonComma {
				p.panicf("list must have a value defined between commas")
			}
			p.next()
			continue
		} else if prev.Type != lex.IonComma && prev.Type != 0 {
			p.panicf("list items must be separated by commas")
		}
		values = append(values, p.parseValue(false))
	}
	if item := p.next(); item.Type != lex.IonListEnd {
		p.panicf("expected list end but found %s", item)
	}
	return List{annotations: annotations, values: values}
}
func ( p * parser ) parseList ( annotations [ ] Symbol ) List { if item := p . next ( ) ; item . Type != lex . IonListStart { p . panicf ( " " , item ) } var values [ ] Value var prev lex . Item for item := p . peekNonComment ( ) ; item . Type != lex . IonListEnd && item . Type != lex . IonError ; prev , item = item , p . peekNonComment ( ) { if item . Type == lex . IonComma { if prev . Type == 0 { p . panicf ( " " ) } if prev . Type == lex . IonComma { p . panicf ( " " ) } p . next ( ) continue } else if prev . Type != lex . IonComma && prev . Type != 0 { p . panicf ( " " ) } values = append ( values , p . parseValue ( false ) ) } if item := p . next ( ) ; item . Type != lex . IonListEnd { p . panicf ( " " , item ) } return List { annotations : annotations , values : values } }
This file contains text parsers for List, SExp, and Struct.
This file contains text parsers for List SExp and Struct .
// Eat the end of the list.  An improperly terminated list creates an error // before we hit this spot, but check it just to be safe.