Fix case-sensitivity bug with aliases

This commit is contained in:
Vikram Rangnekar 2020-01-08 00:48:04 -05:00
parent c40ff38b05
commit 0d0d63d8d1
1 changed files with 4 additions and 2 deletions

View File

@ -329,17 +329,19 @@ func (p *Parser) parseFields(fields []Field) ([]Field, error) {
func (p *Parser) parseField(f *Field) error { func (p *Parser) parseField(f *Field) error {
var err error var err error
f.Name = p.vall(p.next()) v := p.next()
if p.peek(itemColon) { if p.peek(itemColon) {
p.ignore() p.ignore()
if p.peek(itemName) { if p.peek(itemName) {
f.Alias = f.Name f.Alias = p.val(v)
f.Name = p.vall(p.next()) f.Name = p.vall(p.next())
} else { } else {
return errors.New("expecting an aliased field name") return errors.New("expecting an aliased field name")
} }
} else {
f.Name = p.vall(v)
} }
if p.peek(itemArgsOpen) { if p.peek(itemArgsOpen) {