congo-cc / congo-parser-generator

The CongoCC Parser Generator, the Next Generation of JavaCC 21, which in turn was the next generation of JavaCC
https://discuss.congocc.org/
Other
36 stars 11 forks source link

make Parser field DUMMY_START_TOKEN static #31

Closed stbischof closed 1 year ago

revusky commented 1 year ago

I don't think the suggestion is a good idea. You should understand that a Token object is, in principle, associated with a specific TokenSource/Lexer object. That's what the getTokenSource() API is about. It is true that this dummy start token is not having that field set at the moment (but that could be an oversight, come to think of it) But anyway, in principle, the tokenSource field could be used.. Once we (or maybe somebody) uses the getTokenSource/setTokenSource API's, then that would tend to cause the code to be thread-unsafe. It's certainly a possibility and the memory savings from making this a static field is infinitesimal really, so....

stbischof commented 1 year ago

Ah. I see. The upper case of the name was missleading for me.