Skip to content

Commit 85673a3

Browse files
authored
Merge pull request #782 from interscript/feat/parg-complete
fix: .parg gate to 283/285 — alias-stop guard and 4-hex \U escapes
2 parents e772d25 + a4287b4 commit 85673a3

3 files changed

Lines changed: 8 additions & 4 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: 3 additions & 2 deletions
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)
@@ -129,8 +129,9 @@ grammar InterscriptIsc version "0.1.0" {
129129

130130
item_atom_start = "\"" / "'" / ident_first
131131
cont_stop = "to" / "before" / "after" / "not_before" / "not_after" / "}"
132+
alias_decl_stop = identifier [ws] "="
132133
item_atom = quoted_string / none_lit / zw_primitive / any_char_lit / any_ctor / capture_ctor / maybe_ctor / some_ctor / fn_lit / capture_reference / alias_reference
133-
item = (item_atom 0*(item_sep !cont_stop &item_atom_start item_atom)) as concatenation
134+
item = (item_atom 0*(item_sep !cont_stop !(alias_decl_stop) &item_atom_start item_atom)) as concatenation
134135

135136
# -- rules and stages ---------------------------------------------------
136137

0 commit comments

Comments
 (0)