Skip to content

Commit 0f207b7

Browse files
committed
Fix JSON5 parsing to make block comments non-greedy
1 parent 1439182 commit 0f207b7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fragment EXP
8484

8585
// Multi-line comments (ignored)
8686
MULTILINE_COMMENT
87-
: '/*' .* '*/' -> skip
87+
: '/*' .*? '*/' -> skip
8888
;
8989

9090
// Single-line comments (ignored)

convex-core/src/test/java/convex/core/utils/JSONUtilsTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public void testParse() {
7676
assertEquals(Strings.NIL,JSONUtils.parse("\"nil\""));
7777

7878
assertSame(Maps.empty(),JSONUtils.parse("{}"));
79+
assertSame(Maps.empty(),JSONUtils.parse("{ /* foo */ } /*bar*/ /*baz*/"));
7980
assertEquals(Maps.of(Strings.NIL,1),JSONUtils.parse("{\"nil\": 1}"));
8081
assertEquals(Maps.of(Strings.EMPTY,Vectors.empty()),JSONUtils.parse("{\"\": []}"));
8182

0 commit comments

Comments
 (0)