Skip to content

Backtracking parser does not ignore newlines/comments #2759

@isidentical

Description

@isidentical

The regular parser ignores token.NL/token.COMMENT since the grammar assumes there can be any number of them during parsing. This is actually handled in the driver rather than parser, so when the parser got implemented initially we did not specifically instruct this. But seems like it is now needed.

https://github.com/pantsbuild/pants/blob/aa1d38d4f3b791509bff773a65c2b07490bacad3/src/python/pants/util/enums_test.py#L33-L41

This seem to only cover cases where a standalone match or case is used in a newline fashion:

match(
     something
)

It does not include re.match() or other variants as far as I can see. The fix is should be really easy, just ignoring those tokens on the recorder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions