Hi, All
My name is Vlad. This is my first post at the mailing list.
I'm having an issue. I'm doing something like the following:
[code]
function run()
input = ANTLRStringStream('10110')
lexer = SaranLexer(input)
tokens = CommonTokenStream(lexer)
parser = SaranParser(tokens)
// Run the parser.
parser.topRule()
end
[/code]
This causes a problem in RegcognitionException, because in the constructor
it does:
[code]
self.c =
self.input.LA(1)
self.line =
self.input.getLine()
self.index =
self.input.index()
self.charPositionInLine =
self.input.getCharPositionInLine()
[/code]
The issue is that, at this point, input refers to CommonTokenStream, not
ANTLRStringStream.
The exception is raised in the codegen-template function:
dfaState(k, edges, eotPredictsAlt, description, stateNumber, semPredState)
::=
Specifically, when throwing the exception:
NoViableAltException("<description>", <decisionNumber>, <stateNumber>,
input)
At first, I checked if input was of type CommonTokenStream, and then tried
getTokenSource(), but that returns the Lexer, not ANTLRStringStream, which
is what RecognitionException seems to expect (or one of the other
ANTLR*Stream). Also, Lexer doesn't have a getInput function.
I must be doing something funky. I figured that input would automatically
point to the correct source, and I wouldn't have to add/hack my own code in
the codegen-template function.
Any advice?
Regards,
Vlad
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address