func (p *parser) parseSymbol(annotations []Symbol, allowOperator bool) Value {
	item := p.next()
	// Include IonString here since struct fields are ostensibly symbols, but
	// quoted strings can be used to express them.  IonOperator is basically a
	// specialized version of Symbol.  Long strings have more extensive parsing
	// so back up and kick off that process.
	switch item.Type {
	case lex.IonOperator:
		if !allowOperator {
			p.panicf("operator not allowed here: %v", item)
		}
	case lex.IonNull:
		// Null has its own special parsing, so backup and give that a go.
		p.backup()
		return p.parseNull(annotations)
	case lex.IonSymbol, lex.IonSymbolQuoted, lex.IonString:
	case lex.IonStringLong:
		p.backup()
		return p.parseLongString(annotations)
	default:
		p.panicf("expected operation, symbol, quoted symbol, or string but found %v", item)
	}

	quoted := item.Type == lex.IonSymbolQuoted || item.Type == lex.IonString || item.Type == lex.IonStringLong
	if !quoted {
		switch string(item.Val) {
		case "true":
			return Bool{annotations: annotations, isSet: true, value: true}
		case "false":
			return Bool{annotations: annotations, isSet: true, value: false}
		case "nan":
			nan := math.NaN()
			return Float{isSet: true, value: &nan}
		case "null":
			return Null{annotations: annotations}
		}
	}

	// TODO: Figure out why the bytes in item.Val get overwritten when we don't
	//       make an explicit copy of the data.
	//return Symbol{annotations: annotations, quoted: quoted, text: doStringReplacements(item.Val)}
	return Symbol{annotations: annotations, quoted: quoted, text: append([]byte{}, p.doStringReplacements(item.Val)...)}
}
// parseSymbol parses a quoted or unquoted symbol.  There are several reserved symbols
// that hold special meaning, e.g. null.bool, that the lexer does not differentiate
// from other symbols.  This method treats the reserved symbols differently and returns
// the correct type.
parseSymbol parses a quoted or unquoted symbol.  There are several reserved symbols
that hold special meaning, e.g. null.bool, that the lexer does not differentiate
from other symbols.  This method treats the reserved symbols differently and returns
the correct type.
// parseSymbol parses a quoted or unquoted symbol . There are several reserved symbols // that hold special meaning e . g . null . bool that the lexer does not differentiate // from other symbols . This method treats the reserved symbols differently and returns // the correct type .
func (p *parser) parseSymbol(annotations []Symbol, allowOperator bool) Value {
	item := p.next()
	switch item.Type {
	case lex.IonOperator:
		if !allowOperator {
			p.panicf("operator not allowed here: %v", item)
		}
	case lex.IonNull:
		p.backup()
		return p.parseNull(annotations)
	case lex.IonSymbol, lex.IonSymbolQuoted, lex.IonString:
	case lex.IonStringLong:
		p.backup()
		return p.parseLongString(annotations)
	default:
		p.panicf("expected operation, symbol, quoted symbol, or string but found %v", item)
	}
	quoted := item.Type == lex.IonSymbolQuoted || item.Type == lex.IonString || item.Type == lex.IonStringLong
	if !quoted {
		switch string(item.Val) {
		case "true":
			return Bool{annotations: annotations, isSet: true, value: true}
		case "false":
			return Bool{annotations: annotations, isSet: true, value: false}
		case "nan":
			nan := math.NaN()
			return Float{isSet: true, value: &nan}
		case "null":
			return Null{annotations: annotations}
		}
	}
	return Symbol{annotations: annotations, quoted: quoted, text: append([]byte{}, p.doStringReplacements(item.Val)...)}
}
func ( p * parser ) parseSymbol ( annotations [ ] Symbol , allowOperator bool ) Value { item := p . next ( ) switch item . Type { case lex . IonOperator : if ! allowOperator { p . panicf ( " " , item ) } case lex . IonNull : p . backup ( ) return p . parseNull ( annotations ) case lex . IonSymbol , lex . IonSymbolQuoted , lex . IonString : case lex . IonStringLong : p . backup ( ) return p . parseLongString ( annotations ) default : p . panicf ( " " , item ) } quoted := item . Type == lex . IonSymbolQuoted || item . Type == lex . IonString || item . Type == lex . IonStringLong if ! quoted { switch string ( item . Val ) { case " " : return Bool { annotations : annotations , isSet : true , value : true } case " " : return Bool { annotations : annotations , isSet : true , value : false } case " " : nan := math . NaN ( ) return Float { isSet : true , value : & nan } case " " : return Null { annotations : annotations } } } return Symbol { annotations : annotations , quoted : quoted , text : append ( [ ] byte { } , p . doStringReplacements ( item . Val ) ... ) } }
parseSymbol parses a quoted or unquoted symbol.
parseSymbol parses a quoted or unquoted symbol .
// Include IonString here since struct fields are ostensibly symbols, but // quoted strings can be used to express them.  IonOperator is basically a // specialized version of Symbol.  Long strings have more extensive parsing // so back up and kick off that process. // Null has its own special parsing, so backup and give that a go. // TODO: Figure out why the bytes in item.Val get overwritten when we don't //       make an explicit copy of the data. //return Symbol{annotations: annotations, quoted: quoted, text: doStringReplacements(item.Val)}