antlr4cs
antlr4cs copied to clipboard
Do not use string concatenation on _serializedATN in generated lexer file
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: https://github.com/dotnet/runtime/issues/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: https://github.com/dotnet/runtime/issues/76953#issuecomment-1276662286.
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.
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 :)
But if you turn on "word wrap", the file will look weird.
But if you turn on "word wrap", the file will look weird.
how so?
@KvanTTT I only see 4.6.6 on Nuget. Is there another way to get 4.10+?
how so?
Like the following. Too much different line heights:

@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.
Like the following. Too much different line heights:
I don't see any issue with that.
You should migrate to the new packages and newer ANTLR versions as #381