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

Provide access to hidden tokens in a stream #4

Open
sergun opened this issue Nov 24, 2020 · 2 comments
Open

Provide access to hidden tokens in a stream #4

sergun opened this issue Nov 24, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@sergun
Copy link

sergun commented Nov 24, 2020

Hi!

First of all thanks a lot for this great tool!

My question is:
I need (in Python) CommonTokenStream(lexer) class instance to get access to hidden tokens like comments with .getHiddenTokensToLeft/Right(...) methods of that stream. Am I right there is no easy way / workaround do get such instance from do_parse?

Sergey.

@amykyta3
Copy link
Owner

Currently the tool only supports transcribing tokens part of the visible grammar. I purposely have it discard everything else since a lot of the processing time is actually spent translating the parsed tree & tokens into Python objects.
I can look into what it would take to also transcribe these hidden tokens. I admit i have not used that feature before.

@amykyta3 amykyta3 changed the title CommonTokenStream Provide access to hidden tokens in a stream Dec 17, 2020
@amykyta3 amykyta3 added the enhancement New feature or request label Dec 17, 2020
@sergun
Copy link
Author

sergun commented Feb 5, 2021

It would be nice if you can implement this.

BTW Do you have any ideas why ANTLR community still didn't implement cython backend? :-) Python backend is unusable in most cases.. And only projects like your makes it working. E.g. I deal with tens of SQL-scripts each with hundred of lines. Parsing of them in Python-backend takes minutes (((

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants