Reputation: 8863
I'm currently following the "Building a Translator with a Listener" tutorial of "The Definitive ANTLR 4 Reference", but I'm using C# and translate the examples into that.
However, I got stuck at a variable declaration of the type "TokenStream" which I seem to be missing in C# (I can't find it anywhere). The tutorials Java code says
TokenStream tokens = parser.getTokenStream();
Beyond the missing TokenStream type in C#, I can't even find an equivalent method of the Parser class. How is this done with the C# implementation of ANTLR?
Upvotes: 3
Views: 1230
Reputation: 21
I had trouble using the CommonTokenStream class in Antlr 4.7.2 for C#.
I needed to add a declaration to the top of my Listener class:
using Antlr4.Runtime;
Upvotes: 0
Reputation: 170257
Probably ITokenStream
.
AFAIK, the ANTLR4 Java and C# runtime libraries are pretty much the same except that C#'s interfaces have an I
in front of them, and the C# runtime (obviously) follows the C# naming conventions (method names start with an upper case, etc.).
Upvotes: 3