From 061851e68fbe7656f9ee8174c74de03f4bbbe59f Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 1 Jan 2025 10:26:50 +0000 Subject: Update JSON5 parser to use character instead of code point index --- pom.xml | 2 +- src/main/java/org/shedlang/compiler/config/json/Json5Source.java | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index d76b55d4..fe8960ee 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ com.github.mwilliamson java-json5 - 73905f74f2ffbbac57bf4c15e103c9e0f4741426 + 318f61858ae40c8edcb972a10bbe7c1530fcbe37 org.pcollections 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() ); } } -- cgit v1.2.3