Skip to content

Commit 5d2ad92

Browse files
committed
fix: convert_set converts non-string entries
any([boundary, ZWNJ, ZWJ]) leaked the boundary primitive as a raw Isc::Items::Primitive into Any's value; the Ruby compiler then baked the object's inspect string into the compiled character class character-by-character, and the rule's lookahead matched positions it must not. Set entries now convert through the alias/primitive paths.
1 parent 30bf057 commit 5d2ad92

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎lib/interscript/isc/node_adapter.rb‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,21 @@ def convert_concat(concat)
202202

203203
def convert_set(set)
204204
Interscript::Node::Item::Any.new(
205-
set.chars.map { |c| Interscript::Node::Item::String.new(c) }
205+
set.chars.map do |c|
206+
# Entries may be primitives/alias refs (e.g. any([boundary,
207+
# "\u200c", "\u200d"])) — stringifying them baked an object
208+
# inspect into the compiled character class.
209+
case c
210+
when ::String
211+
Interscript::Node::Item::String.new(c)
212+
when Items::Primitive
213+
convert_primitive(c)
214+
when Items::AliasRef
215+
convert_alias_ref(c)
216+
else
217+
convert_item(c)
218+
end
219+
end
206220
)
207221
end
208222
end

0 commit comments

Comments
 (0)