Skip to content

Commit 765810f

Browse files
committed
fix: NodeAdapter carries the system code into Document#name
The adapter read isc_doc[:system_code] but DocumentBuilder emits :systemCode — every ISC-parsed document got name: nil, and the Ruby compiler (which registers compiled maps under Document#name) compiled every ISC map under the empty string. Transliterate then crashed with 'undefined method call for nil' — the same crash the detector's full-corpus walk hit. Interp-vs-compiled divergence on iso-mal-Mlym-Latn-15919-2001 is also gone for the direct paths; the remaining sweep failures there are a separate codegen bug (an object inspect-string interpolated into a lookahead character class).
1 parent 4923e8e commit 765810f

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎lib/interscript/isc/node_adapter.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def build
2929
doc.aliases = build_aliases
3030
build_stages.each { |name, stage| doc.stages[name] = stage }
3131
build_dependencies(doc)
32-
doc.name = @isc_doc[:system_code]
32+
doc.name = @isc_doc[:systemCode]
3333
end
3434
end
3535

‎spec/interscript/isc/node_adapter_spec.rb‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,17 @@ def parse_and_adapt(src)
249249
end
250250
end
251251
end
252+
253+
RSpec.describe "NodeAdapter document identity" do
254+
it "carries the system code into the document name" do
255+
tree = Interscript::Isc::Parser.parse(
256+
'system "X:a-b:C-D:1" { stage main { sub { from "a" to "b" } } }'
257+
)
258+
doc = Interscript::Isc::DocumentBuilder.build(tree)
259+
node = Interscript::Isc::NodeAdapter.to_interscript_node(doc)
260+
# The Ruby compiler registers compiled maps under Document#name; a
261+
# nil name registered them under "" and every transliterate call
262+
# crashed on nil.call.
263+
expect(node.name).to eq("X:a-b:C-D:1")
264+
end
265+
end

0 commit comments

Comments
 (0)