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

Terminal token name: "x" not found #950

Closed
jgromero7 opened this issue Apr 23, 2019 · 4 comments
Closed

Terminal token name: "x" not found #950

jgromero7 opened this issue Apr 23, 2019 · 4 comments

Comments

@jgromero7
Copy link

I am following up on this issue
#896
And of its solutions as explained in the following answer
#896 (comment)
From which I did not obtain the expected result, following the following example:
https://github.com/SAP/chevrotain/tree/master/examples/parser/serialized_grammar
Getting the following result or error message.
Unexpected token *

Important note, I am working on Angular 6 and TypeScript

My questions are the following:

  1. Is there a way in which the token was not affected at the time of making a mystification in my project?
  2. In case the number 1 is correct, what would be a clear example?
  3. There are some clear examples of typescript that are related to https://github.com/SAP/chevrotain/tree/master/examples/parser/serialized_grammar

I appreciate any help you can provide

@bd82
Copy link
Member

bd82 commented Apr 23, 2019

Hello @jgromero7

I don't think I can add anything beyond the discussion in #896 there just are not many new details in this issue. did you try "ng eject" and customize the minification options?

My suggestion is that you would re-produce the problem in a small example repo which can be cloned and inspected I don't have enough (any 😄 ) familiarity with angular CLI tools to answer this without debugging the code...

@jgromero7
Copy link
Author

Hola @bd82 According to what is mentioned in your answer, I attached the link of the repository with the reply of what I am doing in the project.
Repository

I can make use of all the resources when I use
ng build

But when I use the following command
ng build --prod --build-optimizer --output-hashing all
Errors begin to appear, I hope you can help me with this.

All the logic of the token is in the following route
Service

I appreciate any help and I hope I have provided all the details

@bd82
Copy link
Member

bd82 commented Apr 25, 2019

Hello.

This is not really a minimal example, it is your whole repo 😄

Option 1 - Serialization

Anyhow I am not seeing that you are using serialization of the grammar at all:

Option 2 - Custom Webpack Configuration

It seems like the Angular CLI are in the process of removing the ng eject option so it makes it even harder to provide custom webpack configurations. But there also seems to be a 3rd party package which may allow providing custom webpack configurations:

So you may be able to use this to modify the minification options to avoid breaking your Chevrotain grammar.

Option 3 - Separate the Parser's build.

You could also try implementing your Parser as a separate module, i.e not part of your angular
application, that way you could build/bundle it using more customizable build tools (e.g using webpack directly). The question in that case if you could then consume it in your angular app
in a manner that would avoid re-bundling it and breaking things again, so we are kind back to the original problem of angular-cli limited custom workflows 😢

@bd82
Copy link
Member

bd82 commented May 2, 2019

Closing this due to inactivity, re-open if any more help is needed

@bd82 bd82 closed this as completed May 2, 2019
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

No branches or pull requests

2 participants