antlr4
antlr4 copied to clipboard
[CSharp] tokenStartCharIndex inaccessible in CSharp target.
A copy of the official Oracle MySQL is in grammars-v4. This port is written by @mike-lischke using Antlr4ng, and uses the tokenStartCharIndex field. It writes the value of the field to the location following a '.' in qualified identifiers (e.g., ST.ID). The intent is so that the next token that is recognized after the '.' is ID, not .ID. That is because the token is created using _tokenStartCharIndex in Emit() for Java, and all the other targets.
Unfortunately, the accessibility of the field varies across targets. (I don't know about the other fields/properties).
CSharp
For the CSharp runtime, _tokenStartCharIndex is a private field in Lexer.cs, and it has only a read-only property. I can probably work around this by overriding Emit() and defining the field over in the lexer base class for the MySQL grammar.
Cpp
The field tokenStartCharIndex is public.
Dart
The field tokenStartCharIndex is public. The name does not begin with an underscore.
Go
TokenStartCharIndex is public. The name of the field begins with a capital letter.
Java
Field _tokenStartCharIndex is public.
JavaScript
_tokenStartCharIndex is public.
TypeScript
_tokenStartCharIndex is public.
Python3
_tokenStartCharIndex is public.
Swift
_tokenStartCharIndex is public.