Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func (lexer *Lexer) consumeUnquotedIdentifier() token {
start := lexer.currentPos - lexer.lastWidth
for {
r := lexer.next()
if r < 0 || r > 128 || identifierTrailingBits[uint64(r)/64]&(1<<(uint64(r)%64)) == 0 {
if r < 0 || r >= 128 || identifierTrailingBits[uint64(r)/64]&(1<<(uint64(r)%64)) == 0 {
lexer.back()
break
}
Expand Down
4 changes: 4 additions & 0 deletions lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ var lexingErrorTests = []struct {
}{
{"'foo", "Missing closing single quote"},
{"[?foo==bar?]", "Unknown char '?'"},
// U+0080 is the first rune outside the ASCII bit mask used for
// unquoted identifiers. It must be rejected rather than indexed.
{"a\u0080", "Unknown char '\\u0080'"},
{"a\u0080b", "Unknown char '\\u0080'"},
}

func TestLexingErrors(t *testing.T) {
Expand Down