File tree Expand file tree Collapse file tree
lib/interscript/isc/grammar Expand file tree Collapse file tree Load diff Large diffs are not rendered by default.
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments