Skip to content

Commit a4287b4

Browse files
committed
fix: accept 4-hex-digit \U escapes
The corpus converter emits \U040E-style escapes (gki-bel, mvd-bel, odni-bel); the Ruby grammar demanded 8 hex digits for \U and rejected the files. Accept 4..8 in both the DSL grammar and the .parg. Gate: 283/285 (remaining: un-mar has converter-corrupted escape output needing a maps-repo fix; odni-kor has a 2-element comment-parallel capture delta).
1 parent b48e1b2 commit a4287b4

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎isc.artifact.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎lib/interscript/isc/grammar/concerns/primitives.rb‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ module Primitives
6262
str('"').as(:dquote) |
6363
str("\\").as(:backslash) |
6464
(str("u") >> match(/[0-9a-fA-F]/).repeat(4, 4).as(:unicode)) |
65-
(str("U") >> match(/[0-9a-fA-F]/).repeat(8, 8).as(:unicode))
65+
# The corpus converter emits \U with 4 hex digits too
66+
# (gki-bel "\U040E") — accept 4..8, don't be stricter than
67+
# the corpus.
68+
(str("U") >> match(/[0-9a-fA-F]/).repeat(4, 8).as(:unicode))
6669
)
6770
end
6871

‎lib/interscript/isc/grammar/isc.parg‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ grammar InterscriptIsc version "0.1.0" {
3838
esc_dq = "\"" as dquote
3939
esc_bs = "\\" as backslash
4040
esc_uni4 = "u" (4hexd) as unicode
41-
esc_uni8 = "U" (8hexd) as unicode
41+
esc_uni8 = "U" (4*8hexd) as unicode
4242
escape_sequence = "\\" (esc_nl / esc_cr / esc_tab / esc_dq / esc_bs / esc_uni4 / esc_uni8)
4343

4444
raw_run = 1*(!("\\" / "\"") chr)

0 commit comments

Comments
 (0)