Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Commit

Permalink
fix issue emicklei#37: allow keywords in namespaced identifiers but n…
Browse files Browse the repository at this point in the history
…ot as root namespace
  • Loading branch information
Ernest Micklei committed Dec 22, 2017
1 parent b64ec7f commit c5ae975
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (p *Parser) nextIdentifier() (pos scanner.Position, tok token, lit string)
}
p.next() // consume dot
pos, tok, lit := p.next()
if tIDENT != tok {
if tIDENT != tok && !isKeyword(tok) {
p.nextPut(pos, tok, lit)
break
}
Expand Down
12 changes: 12 additions & 0 deletions parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,15 @@ func TestNextIdentifier(t *testing.T) {
t.Errorf("got [%v] want [%v]", got, want)
}
}

func TestNextIdentifierWithKeyword(t *testing.T) {
ident := " aap.rpc.mies "
p := newParserOn(ident)
_, tok, lit := p.nextIdentifier()
if got, want := tok, tIDENT; got != want {
t.Errorf("got [%v] want [%v]", got, want)
}
if got, want := lit, strings.TrimSpace(ident); got != want {
t.Errorf("got [%v] want [%v]", got, want)
}
}

0 comments on commit c5ae975

Please sign in to comment.