Skip to content

Commit a8bdd95

Browse files
committed
feat(isc): allow item expressions inside any([...]) lists
The set_arg rule now accepts any item (including concat like 'boundary + "X"') as a list element, not just quoted strings. Verification: 162/289 maps equivalent (56%).
1 parent b686024 commit a8bdd95

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • lib/interscript/isc/grammar/concerns

lib/interscript/isc/grammar/concerns/items.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,16 @@ module Items
6262
rule(:set_arg) do
6363
quoted_string.as(:single) |
6464
(str("[") >> whitespace? >>
65-
(quoted_string >> ((comma | whitespace) >> quoted_string).repeat).as(:list) >>
65+
(list_item >> ((comma | whitespace) >> list_item).repeat).as(:list) >>
6666
whitespace? >> str("]"))
6767
end
6868

69+
# A list item can be a quoted string OR a more complex expression
70+
# (e.g., `boundary + "X"` for concat inside a list).
71+
rule(:list_item) do
72+
quoted_string | item
73+
end
74+
6975
rule(:alias_reference) do
7076
(keyword.absent? >> identifier >> str("{").absent?).as(:alias)
7177
end
@@ -105,11 +111,13 @@ module Items
105111

106112
# Positive lookahead: the next thing is a valid item_atom continuation.
107113
# Excludes keywords that end the item (to, before, after, not_before,
108-
# not_after, and the closing brace).
114+
# not_after, the closing brace, AND `identifier =` which signals a
115+
# new alias declaration).
109116
rule(:item_continuation) do
110117
(str("to") | str("before") | str("after") |
111118
str("not_before") | str("not_after") |
112119
str("}")).absent? >>
120+
(identifier >> whitespace? >> str("=")).absent? >>
113121
item_atom_start
114122
end
115123

0 commit comments

Comments
 (0)