diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-01-01 10:26:50 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-01-01 10:26:50 +0000 |
| commit | 061851e68fbe7656f9ee8174c74de03f4bbbe59f (patch) | |
| tree | bedff6f7b19ed08da8dff684458fa9fbba67f521 | |
| parent | 34a783f9a6a796bd2477f7596327867a9be3683c (diff) | |
Update JSON5 parser to use character instead of code point index
| -rw-r--r-- | pom.xml | 2 | ||||
| -rw-r--r-- | src/main/java/org/shedlang/compiler/config/json/Json5Source.java | 7 |
2 files changed, 3 insertions, 6 deletions
@@ -55,7 +55,7 @@ <dependency> <groupId>com.github.mwilliamson</groupId> <artifactId>java-json5</artifactId> - <version>73905f74f2ffbbac57bf4c15e103c9e0f4741426</version> + <version>318f61858ae40c8edcb972a10bbe7c1530fcbe37</version> </dependency> <dependency> <groupId>org.pcollections</groupId> diff --git a/src/main/java/org/shedlang/compiler/config/json/Json5Source.java b/src/main/java/org/shedlang/compiler/config/json/Json5Source.java index 6b761a6a..409dc265 100644 --- a/src/main/java/org/shedlang/compiler/config/json/Json5Source.java +++ b/src/main/java/org/shedlang/compiler/config/json/Json5Source.java @@ -7,12 +7,9 @@ public class Json5Source { private Json5Source() {} public static Source fromSourceRange(Source fullSource, Json5SourceRange sourceRange) { - // TODO: decide whether we're using code points or code units, and make - // consistent (currently Shed sources use UTF-16 code units, JSON5 - // sources use code points) return fullSource.at( - sourceRange.startCodePointIndex(), - sourceRange.endCodePointIndex() + sourceRange.start().characterIndex(), + sourceRange.end().characterIndex() ); } } |
