diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/parse.go | 14 | ||||
-rw-r--r-- | internal/parse_test.go | 2 |
2 files changed, 3 insertions, 13 deletions
diff --git a/internal/parse.go b/internal/parse.go index 121857b..b11aae6 100644 --- a/internal/parse.go +++ b/internal/parse.go @@ -264,7 +264,6 @@ type Parser struct { // // [ array: waiting for item to start or ']' // a array: reading item / waiting for ',' or ']' - // ] array: waiting for item to start // // Within each element type, the stack item is replaced, not pushed. // @@ -308,7 +307,7 @@ type Parser struct { // a" [" // a" ["x // a ["x" - // ] ["x", + // a? ["x", // a" ["x"," // a" ["x","y // a ["x","y" @@ -513,21 +512,12 @@ func (par *Parser) HandleRune(c rune) (RuneType, error) { par.pushState(runeTypeAny) return par.HandleRune(c) } - case RuneTypeArrayEnd: // waiting for item - switch c { - case 0x0020, 0x000A, 0x000D, 0x0009: - return RuneTypeSpace, nil - default: - par.replaceState(RuneTypeArrayComma) - par.pushState(runeTypeAny) - return par.HandleRune(c) - } case RuneTypeArrayComma: // waiting for ',' or ']' switch c { case 0x0020, 0x000A, 0x000D, 0x0009: return RuneTypeSpace, nil case ',': - par.replaceState(RuneTypeArrayEnd) + par.pushState(runeTypeAny) return RuneTypeArrayComma, nil case ']': par.popState() diff --git a/internal/parse_test.go b/internal/parse_test.go index 91cd277..34977fb 100644 --- a/internal/parse_test.go +++ b/internal/parse_test.go @@ -51,7 +51,7 @@ func TestParserHandleRune(t *testing.T) { `a"`, // [" `a"`, // ["x `a`, // ["x" - `]`, // ["x", + `a?`, // ["x", `a"`, // ["x"," `a"`, // ["x","y `a`, // ["x","y" |