diff options
Diffstat (limited to 'parse.go')
-rw-r--r-- | parse.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -238,6 +238,7 @@ 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. // @@ -454,12 +455,21 @@ func (par *Parser) HandleRune(c rune) (RuneType, error) { par.pushState(RuneTypeError) 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(RuneTypeError) + return par.HandleRune(c) + } case RuneTypeArrayComma: // waiting for ',' or ']' switch c { case 0x0020, 0x000A, 0x000D, 0x0009: return RuneTypeSpace, nil case ',': - par.replaceState(RuneTypeArrayBeg) + par.replaceState(RuneTypeArrayEnd) return RuneTypeArrayComma, nil case ']': par.popState() |