Skip to content

Issue: Cascading Errors in IronPython Parser #1974

@nagu1137

Description

@nagu1137

When parsing Python scripts using IronPython’s parser, we observe that a single syntax error (such as a missing quote in a print() statement) sometimes causes multiple errorrx. Instead of reporting only the actual error line, the parser marks all subsequent statements as erroneous. This cascading error behavior is inconsistent and seems to occur mostly with statements involving parentheses or quotation marks (e.g., print(),write(),sys.stdout.write("Hello ") etc).

using (IronPython.Compiler.Parser parser = IronPython.Compiler.Parser.CreateParser(context, new PythonOptions()))

Observed Behavior
A single syntax error (e.g., missing quote in print("Hello)) causes error highlights on all subsequent lines.
This does not happen for all types of syntax errors.
The issue is most frequent with print() .stdout.write("Hello " ,etc statements and string literals.

Expected Behavior
Only the actual error line should be highlighted.
The parser should recover gracefully and not cascade errors to subsequent lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions