Fix DSN tokenizer to accept KiCad net names like /*52
Specctra's SpecCharASCII includes / and *, and an Identifier may start with /, so KiCad emits hierarchical net names such as /*52 and /53. The tokenizer treated any /* as a block-comment start and raised 'unterminated comment' when no */ followed — rejecting real KiCad DSN. Match FreeRouting's JFlex rule-order resolution: /* is a comment only when a closing */ exists; otherwise it is an ordinary name run. Validated against a KiCad 10.0.4 pcbnew-exported DSN (78 nets incl. /*52, /53).
This commit is contained in:
@@ -117,9 +117,16 @@ def test_unterminated_string_raises():
|
||||
tokenize('(a "no end')
|
||||
|
||||
|
||||
def test_unterminated_block_comment_raises():
|
||||
with pytest.raises(DsnSyntaxError):
|
||||
tokenize("(a /* no end")
|
||||
def test_unclosed_block_comment_is_name_token():
|
||||
# KiCad emits hierarchical net names like `/*52` (SpecCharASCII includes
|
||||
# `/` and `*`). With no closing `*/`, `/*...` is a name run, not an
|
||||
# unterminated comment — matching FreeRouting's JFlex rule-order resolution.
|
||||
assert texts("(net /*52)") == ["(", "net", "/*52", ")"]
|
||||
|
||||
|
||||
def test_closed_block_comment_is_stripped():
|
||||
# A properly closed `/* ... */` is still a comment and gets dropped.
|
||||
assert texts("(a /* c */ b)") == ["(", "a", "b", ")"]
|
||||
|
||||
|
||||
def test_hyphenated_pin_ref_is_single_atom():
|
||||
|
||||
Reference in New Issue
Block a user