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

Do not use string concatenation on _serializedATN in generated lexer file #379

Open
PatrickHofman opened this issue Oct 13, 2022 · 8 comments

Comments

@PatrickHofman
Copy link

In a very large token file, the generated lexer file contains a lot of string concatenations in the _serializedATN string. This causes Visual Studio and MS Build to crash with a StackOverflowException (as reported and to be fixed here: dotnet/runtime#76953).

Is it possible to use one long string instead of a long list of string concatenations? Any other options or ideas?

Repro Visual Studio solution containing the generated token file can be found here: dotnet/runtime#76953 (comment).

@KvanTTT
Copy link

KvanTTT commented Oct 13, 2022

The issue is not actual since ANTLR 4.10. It's int[] instead of big string for C# runtime. Meanwhile, this repository and target is outdated.

Is it possible to use one long string instead of a long list of string concatenations?

It's not frendly for text editors since generated string is very long.

@CyrusNajmabadi
Copy link

It's not frendly for text editors since generated string is very long.

It's a binary encoding in string form. I'm not sure it's meant to be friendly :)

@KvanTTT
Copy link

KvanTTT commented Oct 13, 2022

But if you turn on "word wrap", the file will look weird.

@CyrusNajmabadi
Copy link

But if you turn on "word wrap", the file will look weird.

how so?

@PatrickHofman
Copy link
Author

@KvanTTT I only see 4.6.6 on Nuget. Is there another way to get 4.10+?

@KvanTTT
Copy link

KvanTTT commented Oct 18, 2022

how so?

Like the following. Too much different line heights:

Screenshot from 2022-10-18 15-05-47

@KvanTTT I only see 4.6.6 on Nuget. Is there another way to get 4.10+?

Unfortunately not. It's a fork of the official repository. I can only advise you to use either official JavaScript target or wait for the official support of TypeScript. Also, you can try to ask @sharwell to update the fork.

@CyrusNajmabadi
Copy link

Like the following. Too much different line heights:

I don't see any issue with that.

@lextm
Copy link

lextm commented Sep 9, 2023

You should migrate to the new packages and newer ANTLR versions as #381

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

4 participants