Skip to content

Commit 89e1e85

Browse files
committed
JSON5 grammar edits
1 parent 16b48a1 commit 89e1e85

File tree

1 file changed

+10
-4
lines changed
  • convex-core/src/main/antlr4/convex/core/json/reader/antlr

1 file changed

+10
-4
lines changed

convex-core/src/main/antlr4/convex/core/json/reader/antlr/JSON.g4

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/** Adapted from: https://github.com/antlr/grammars-v4/blob/master/json/JSON.g4 */
22

3+
// See also : https://github.com/antlr/grammars-v4/blob/master/json5/JSON5.g4
4+
35
// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
46
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
57

@@ -15,9 +17,13 @@ obj
1517
;
1618

1719
pair
18-
: string ':' value
20+
: key ':' value
1921
;
20-
22+
23+
key
24+
: string
25+
;
26+
2127
// Note single training comma allowed after values
2228
array
2329
: '[' value (',' value)* ','? ']'
@@ -79,7 +85,7 @@ fragment INT
7985

8086
fragment EXP
8187
// exponent number permits leading 0s (e.g. `1e01`)
82-
: [Ee] [+-]? [0-9]+
88+
: [Ee] [+-]? [0-9]*
8389
;
8490

8591
// Multi-line comments (ignored)
@@ -93,6 +99,6 @@ SINGLELINE_COMMENT
9399
;
94100

95101
WS
96-
: [ \t\n\r]+ -> skip
102+
: [ \t\n\r\u00A0\uFEFF\u2003]+ -> skip
97103
;
98104

0 commit comments

Comments
 (0)