Skip to content
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

Add some methods for Go runtime #4626

Closed
wants to merge 5 commits into from
Closed

Add some methods for Go runtime #4626

wants to merge 5 commits into from

Conversation

RobEin
Copy link
Contributor

@RobEin RobEin commented May 22, 2024

Added methods for CommonToken class:
SetChannel
SetStop
SetText // also exists in Token (Token.SetText may be unnecessary)
SetTokenType

Added constructor for CommonToken class:
CommonToken.NewCommonTokenFromToken

Removed method in CommonToken class:
Clone

Added methods for Lexer class:
GetModeStack
GetMode

The equivalent of the NewCommonTokenFromToken constructor can also be found in the Java CommonToken class.
The NewCommonTokenFromToken constructor is similar to the clone method, in that a cloned CommonToken instance is created in both.
NewCommonTokenFromToken accepts both Token and CommonToken parameters for cloning.
This made the clone method redundant.

andreasbuhr and others added 2 commits May 22, 2024 22:53
Signed-off-by: Andreas Buhr <andreas@andreasbuhr.de>
Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
Added methods for CommonToken class:
SetChannel
SetStop
SetText    // also exists in Token (Token.SetText may be unnecessary)
SetTokenType

Modified CommonToken class method:
Clone

Added methods for Lexer class:
GetModeStack
GetMode

Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
Copy link
Collaborator

@jimidle jimidle left a comment

Choose a reason for hiding this comment

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

I will take a look at these at the weekend and if all is good I will put it in with the generic tree walker

related issue: #4625

Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
@RobEin RobEin marked this pull request as draft June 1, 2024 04:47
Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
@RobEin RobEin closed this by deleting the head repository Jun 23, 2024
@RobEin
Copy link
Contributor Author

RobEin commented Sep 15, 2024

Can I expect a review on this?
I have developed a Go target (about 400 lines) for a Python parser where these new features would be needed.
I also spent a lot of time modifying the Go runtime for these new features.
So I had a lot of work in it and it may be useful for others.

@RobEin
Copy link
Contributor Author

RobEin commented Sep 23, 2024

Here is a Python parser with a Go port that already uses the above modifications.

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.

3 participants