diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-11-07 14:47:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-07 14:47:35 +0100 |
| commit | f84bdee1ba8aa34db164f6b620c24b84ea62ec04 (patch) | |
| tree | af744a9bbca0e6a495761d6754029c9191200c39 /core/encoding/json/parser.odin | |
| parent | 40eed2952787415d90d403f11452850286e8c574 (diff) | |
| parent | 5b074ceee519a97b13d71aa0257defcd04cc4a63 (diff) | |
Merge pull request #1279 from DanielGavin/fix-json
Add json encoding test + fix enum not being set on success.
Diffstat (limited to 'core/encoding/json/parser.odin')
| -rw-r--r-- | core/encoding/json/parser.odin | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/encoding/json/parser.odin b/core/encoding/json/parser.odin index af32e7266..c682ec9bd 100644 --- a/core/encoding/json/parser.odin +++ b/core/encoding/json/parser.odin @@ -106,6 +106,7 @@ parse_comma :: proc(p: ^Parser) -> (do_break: bool) { } parse_value :: proc(p: ^Parser) -> (value: Value, err: Error) { + err = .None token := p.curr_token #partial switch token.kind { case .Null: @@ -175,6 +176,7 @@ parse_value :: proc(p: ^Parser) -> (value: Value, err: Error) { } parse_array :: proc(p: ^Parser) -> (value: Value, err: Error) { + err = .None expect_token(p, .Open_Bracket) or_return array: Array @@ -266,15 +268,14 @@ parse_object_body :: proc(p: ^Parser, end_token: Token_Kind) -> (obj: Object, er break } } - return + return obj, .None } parse_object :: proc(p: ^Parser) -> (value: Value, err: Error) { expect_token(p, .Open_Brace) or_return obj := parse_object_body(p, .Close_Brace) or_return expect_token(p, .Close_Brace) or_return - value = obj - return + return obj, .None } |