Skip to content

[BUG] Linter counts parentheses/quotes inside string literals — false unbalanced warnings #30

Description

@alphacrack

File: maithili_dsl/transpiler/linter.py:48-51

Parenthesis/quote balance is counted over the raw line, including characters inside string literals:

Input:   छपाउ("(क")
Linter:  पंक्ति 1: गोल ब्रैकेट असंतुलित अछि    # false positive (verified)

Related gap in the same block: only " quotes are counted — a line using '...' strings is never checked, and an apostrophe inside a double-quoted string would confuse a naive fix.

Fix: strip string-literal contents from the line before counting — the transpiler already has exactly the right tool (_tokenize_preserving_strings in transpile.py); import it and count only the code tokens. That fixes both the false positive and lets you count ' properly.

Tests: parens/quotes inside strings (no error), genuinely unbalanced lines (still error), single-quoted strings.

Good first issue: the tokenizer already exists — this is wiring + tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority: nice to havearea:lintermaithili_dsl/transpiler/linter.pybugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions