-
Notifications
You must be signed in to change notification settings - Fork 220
Remove pure parser #1371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Remove pure parser #1371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start! I would personally probably separate the change out to three PRs:
- the entrypoints change
- clean up tests that are no longer relevant
- delete the old parser
But it's entirely up to you.
There are a bunch of additional stuff that can be cleaned up, like tests that get skipped with the native parser (these are typically error tests), or a large chunk of the ParserConfig and PartialParserConfig infrastructure. We could also move the utf8 conversion down to the rust layer which might help perf
def test_valid(self, **kwargs: Any) -> None: | ||
if not is_native() and kwargs.get("native_only", False): | ||
self.skipTest("Disabled for native parser") | ||
if "native_only" in kwargs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should clean these up too
parser: Optional[Callable[[str], cst.CSTNode]] = ( | ||
parse_statement if is_native() else None | ||
) | ||
parser: Optional[Callable[[str], cst.CSTNode]] = parse_statement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parser: Optional[Callable[[str], cst.CSTNode]] = parse_statement | |
parser: Callable[[str], cst.CSTNode] = parse_statement |
} | ||
) | ||
def test_parser( | ||
self, *, code: str, expected: cst.Module, enabled_for_native: bool = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enabled_for_native
param should also go away
native_parse_statement: Optional[Callable[[str], cst.CSTNode]] = ( | ||
parse_statement if is_native() else None | ||
) | ||
native_parse_statement: Optional[Callable[[str], cst.CSTNode]] = parse_statement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
native_parse_statement: Optional[Callable[[str], cst.CSTNode]] = parse_statement | |
native_parse_statement: Callable[[str], cst.CSTNode] = parse_statement |
) | ||
def test_versions(self, **kwargs: Any) -> None: | ||
if is_native() and not kwargs.get("expect_success", True): | ||
if not kwargs.get("expect_success", True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should delete test cases that are marked with expect_success
here
parser_type = "native" if is_native() else "pure" | ||
print(f"running tests with {parser_type!r} parser") | ||
|
||
print("running tests with native parser") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary anymore
Summary
#1370
Test Plan
CI