diff --git a/zcl/json/scanner.go b/zcl/json/scanner.go index c399443..7367e2f 100644 --- a/zcl/json/scanner.go +++ b/zcl/json/scanner.go @@ -165,7 +165,7 @@ Byte: for i = 0; i < len(buf); i++ { b := buf[i] switch { - case b >= 'a' || b <= 'z' || b >= 'A' || b <= 'Z' || b == '_': + case (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_': p.Pos.Byte++ p.Pos.Column++ default: diff --git a/zcl/json/scanner_test.go b/zcl/json/scanner_test.go index e5471c2..4275a52 100644 --- a/zcl/json/scanner_test.go +++ b/zcl/json/scanner_test.go @@ -510,6 +510,74 @@ func TestScan(t *testing.T) { }, }, }, + { + `[true]`, + []token{ + { + Type: tokenBrackO, + Bytes: []byte(`[`), + Range: zcl.Range{ + Start: zcl.Pos{ + Byte: 0, + Line: 1, + Column: 1, + }, + End: zcl.Pos{ + Byte: 1, + Line: 1, + Column: 2, + }, + }, + }, + { + Type: tokenKeyword, + Bytes: []byte(`true`), + Range: zcl.Range{ + Start: zcl.Pos{ + Byte: 1, + Line: 1, + Column: 2, + }, + End: zcl.Pos{ + Byte: 5, + Line: 1, + Column: 6, + }, + }, + }, + { + Type: tokenBrackC, + Bytes: []byte(`]`), + Range: zcl.Range{ + Start: zcl.Pos{ + Byte: 5, + Line: 1, + Column: 6, + }, + End: zcl.Pos{ + Byte: 6, + Line: 1, + Column: 7, + }, + }, + }, + { + Type: tokenEOF, + Range: zcl.Range{ + Start: zcl.Pos{ + Byte: 6, + Line: 1, + Column: 7, + }, + End: zcl.Pos{ + Byte: 6, + Line: 1, + Column: 7, + }, + }, + }, + }, + }, { `""`, []token{