Skip to content

Conversation

@alessiostalla
Copy link
Member

Not everything was copied from Kolasu, just the bare minimum to have this usable in a project.

Fixes #18

…rything was copied from Kolasu, just the bare minimum to have this usable in a project.
@alessiostalla alessiostalla marked this pull request as ready for review July 22, 2025 12:24
Copy link
Member

@ftomassetti ftomassetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added minor comments

for field in fields:
if field.name == name and PYLASU_FEATURE in field.metadata:
feature = field.metadata[PYLASU_FEATURE]
for fld in fields:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why renaming field into fld?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't passing the linter because it shadowed an import

@@ -1,0 +1 @@
from .results import FirstStageParsingResult, ParsingResultWithFirstStage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch!

You should extend this class to implement the parts that are specific to your language.
Note: instances of this class are thread-safe and they're meant to be reused. Do not create a new PylasuANTLRParser
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this come verbatim from Kolasu or is this class really thread-safe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It comes from Kolasu but I don't see why it shouldn't apply here too

position=Position(token_end_point(last_token), token_end_point(last_token))
)
)
# TODO Kolasu also traverses the parse tree searching for exceptions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we should do here?
Should we add a test for this? Or perhaps add an issue to come back to this later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add an issue



@dataclass
class LexingResult(WithIssues):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need also the LexingResult, in case just lexing is invoked?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need it but it has a different structure in Kolasu, at the moment it's not used (because we don't have the lex methods). I'll open an issue about that too

@alessiostalla alessiostalla merged commit ffba370 into master Jul 23, 2025
6 checks passed
@alessiostalla alessiostalla deleted the feature/pylasu-antlr-parser branch July 23, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce the PylasuParser class

3 participants