-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
TypeScript missing critical class definition exports #4110
Comments
As a principle, I only export what is strictly required, excluding internal classes. |
I'm still going through with the creation of the template for TypeScript. So far, it's just Recognizer, which is easy to fix. But, I'll let you know what else may be missing, probably not much because the JavaScript target was working fine. |
CharStreams : There is and it is exported. Please check beta 5 ? |
Thanks so much, again!! |
|
Let me check that |
In TypeScript, CharStreams is a class, and the methods are static methods. import { CharStreams } from 'antlr4';
const stream = CharStreams.fromPath(path); I have added Recognizer, and fixed another issue in beta 6. |
If you're loading content from files you might want to upgrade to beta 8, I just added the encoding parameter to the FileStream API |
Excellent. Thank you. Two other things that would be nice to have are: Otherwise, this works great. Already, the TypeScript port has shown a few problems with the JavaScript driver code I wrote. This is a great port. It's JavaScript finally done right. |
Done, check beta 9 |
and thanks for the compliment |
You bet! This is a wonderful port. And we already have our first "customer" in grammars-v4. |
Looks like CommonToken is used in a number of grammar base classes, including the python/python3 grammar. That's somewhat easy even for me to fix.
The python/python3 grammar base class tries to set _token, but it can't because emitToken() is not available in the TypeScript code. We're also going to need skip(), more(), mode(d) declared in Lexer.d.ts. |
Can you submit a PR ? That would avoid me adding stuff in the wrong place... |
…ethods from Lexer. These are needed for TypeScript ports of various grammars in grammars-v4. Issue antlr#4110.
@kaby76 I think we can close this ? |
Excuse me. |
Aargh... it's missing. Can you propose a PR to fix that ? |
* added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants based on: https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L59 https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L65 Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> * added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants #4110 (comment) Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> --------- Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
* added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants based on: https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L59 https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L65 Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> * added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants antlr/antlr4#4110 (comment) Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> --------- Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
* added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants based on: https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L59 https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L65 Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> * added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants antlr/antlr4#4110 (comment) Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> --------- Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
* added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants based on: https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L59 https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L65 Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> * added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants antlr/antlr4#4110 (comment) Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> --------- Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
I would need additional features that are missing from the TypeScript runtime:
|
Hi. Sure. Can you submit a PR ? |
* fix: TypeScript: incorrect type in CommonTokenStream Signed-off-by: Johannes Heesterman <johannes@elfsquad.io> * added Token.DEFAULT_CHANNEL and Token.HIDDEN_CHANNEL (#4516) * added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants based on: https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L59 https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L65 Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> * added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants antlr/antlr4#4110 (comment) Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> --------- Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> --------- Signed-off-by: Johannes Heesterman <johannes@elfsquad.io> Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> Co-authored-by: Johannes Heesterman <johannes@elfsquad.io> Co-authored-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
* fix: TypeScript: incorrect type in CommonTokenStream Signed-off-by: Johannes Heesterman <johannes@elfsquad.io> * added Token.DEFAULT_CHANNEL and Token.HIDDEN_CHANNEL (#4516) * added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants based on: https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L59 https://github.com/antlr/antlr4/blob/ebb511a04a60ae5a605aba65471c07dd854e9303/runtime/JavaScript/src/antlr4/Token.js#L65 Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> * added DEFAULT_CHANNEL and HIDDEN_CHANNEL constants antlr/antlr4#4110 (comment) Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> --------- Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> --------- Signed-off-by: Johannes Heesterman <johannes@elfsquad.io> Signed-off-by: Robert Einhorn <robert.einhorn.hu@gmail.com> Co-authored-by: Johannes Heesterman <johannes@elfsquad.io> Co-authored-by: Robert Einhorn <robert.einhorn.hu@gmail.com>
I was trying to write a template for TypeScript for testing the new target on grammars-v4. There is (are) important classes that need to be exported. Otherwise, I am blocked, and there will be no testing of the target in grammars-v4 because the trgen templates require a consistent runtime API in order to provide consistent functionality across targets.
antlr4/runtime/JavaScript/src/antlr4/index.d.ts
Line 10 in c2bfa34
antlr4/runtime/JavaScript/src/antlr4/index.d.ts
Line 1 in c2bfa34
I don't know why certain classes do not have corresponding TypeScript
export class
definition files. It should be identical to the list of exported symbols in Java.The text was updated successfully, but these errors were encountered: