Skip to content

Export recognizer class for dart target #3119

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

Merged
merged 3 commits into from
Oct 14, 2021

Conversation

lingyv-li
Copy link
Member

fixes #3108

Exports recognizer, interval and intervalset classes.

@renancaraujo
Copy link

I guess this could be merged before #3116 since after that PR the runtime will no longer be compatible with projects that uses dart pre 2.12.

@lingyv-li
Copy link
Member Author

Yeah I agree. @ericvergnaud can you please help review this PR?

Since this is a target runtime only change, when merged I'll make a patch release (like 4.9.2+1) with Dart runtime only without needing to release the whole ANTLR.

@kaby76
Copy link
Contributor

kaby76 commented Mar 30, 2021

@lingyv-li This is a good change but it's incomplete. It does not fix the bug because Interval is still missing, which I noted in the bug. For grammars-v4/sql/mysql/pom.xml, the parser requires a class that rewrites the character input stream to uppercase. I've implemented this for all targets, but I can't do this for Dart because Interrval is not exported, required by the Antlr stream class I am trying to create. I can't proceed further with the Dart target for this type of rewrite stream parsing. (Note, as noted by Mike Lischke, a unilateral uppercase rewrite of the character stream is really a bad way to do this, a lazy person's way out of writing the grammar properly, but that's what's done right now for the mysql grammar.) All types that are exported in Java should be reviewed and exported for Dart. This should be checked against the other targets as well.

@kaby76
Copy link
Contributor

kaby76 commented Mar 30, 2021

It seems I have a workaround: I can continue to develop a case insensitive stream by providing a "noSuchMethod()" method to my class (which is based on CharStream). So, I don't actually need to define a method that I can't define (getText(Interval))! This is a strange, unsafe language.

@lingyv-li
Copy link
Member Author

It does not fix the bug because Interval is still missing

Can you please elaborate or show the error? The Interval class is defined in the src/interval_set.dart file which is exported.

All types that are exported in Java should be reviewed and exported for Dart.

Good point, though I checked Java target and found all top level classes except for 3 are exported. org.antlr.v4.runtime.tree.pattern.Chunk, org.antlr.v4.runtime.tree.pattern.TagChunk, org.antlr.v4.runtime.tree.pattern.TextChunk.

We can follow Java target and export all types, but not sure if it's a good idea.

@kaby76
Copy link
Contributor

kaby76 commented Mar 31, 2021

Can you please elaborate or show the error? The Interval class is defined in the src/interval_set.dart file which is exported.

@lingyv-li ,

Actually, I was wrong. Not only was I not testing against the changes in the PR (pubspec.yaml references 4.9.2), but I forgot that the Interval and IntervalSet classes are in one file, which is confusing because it's unlike the Java and CSharp runtimes. Thanks for fixing this.

@parrt parrt added this to the 4.9.3 milestone Oct 14, 2021
@parrt parrt merged commit 3e46cc7 into antlr:master Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dart runtime 4.9.1 does not export Recognizer, Interval, IntervalSet
4 participants