// Override default lexer error reporting
d_lexer->rec->reportError = &lexerError;
// Override default nextToken function, just to prevent exceptions escaping.
- d_lexer->rec->state->tokSource->nextToken = &nextToken;
+ d_lexer->rec->state->tokSource->nextToken = &nextTokenStr;
}
void AntlrInput::setParser(Parser *parser) {
static AntlrInput* newInput(InputLanguage lang, AntlrInputStream *inputStream);
/** Retrieve the text associated with a token. */
- inline static std::string tokenText(pANTLR3_COMMON_TOKEN token);
+ static std::string tokenText(pANTLR3_COMMON_TOKEN token);
/** Retrieve an unsigned from the text of a token */
- inline static unsigned tokenToUnsigned( pANTLR3_COMMON_TOKEN token );
+ static unsigned tokenToUnsigned( pANTLR3_COMMON_TOKEN token );
/** Retrieve an Integer from the text of a token */
- inline static Integer tokenToInteger( pANTLR3_COMMON_TOKEN token );
+ static Integer tokenToInteger( pANTLR3_COMMON_TOKEN token );
/** Retrieve a Rational from the text of a token */
- inline static Rational tokenToRational(pANTLR3_COMMON_TOKEN token);
+ static Rational tokenToRational(pANTLR3_COMMON_TOKEN token);
protected:
/** Create an input. This input takes ownership of the given input stream,
void setParser(Parser *parser);
};
-std::string AntlrInput::tokenText(pANTLR3_COMMON_TOKEN token) {
+inline std::string AntlrInput::tokenText(pANTLR3_COMMON_TOKEN token) {
ANTLR3_MARKER start = token->getStartIndex(token);
ANTLR3_MARKER end = token->getStopIndex(token);
/* start and end are boundary pointers. The text is a string
return txt;
}
-unsigned AntlrInput::tokenToUnsigned(pANTLR3_COMMON_TOKEN token) {
+inline unsigned AntlrInput::tokenToUnsigned(pANTLR3_COMMON_TOKEN token) {
unsigned result;
std::stringstream ss;
ss << tokenText(token);
return result;
}
-
-Integer AntlrInput::tokenToInteger(pANTLR3_COMMON_TOKEN token) {
+inline Integer AntlrInput::tokenToInteger(pANTLR3_COMMON_TOKEN token) {
Integer i( tokenText(token) );
return i;
}
-Rational AntlrInput::tokenToRational(pANTLR3_COMMON_TOKEN token) {
+inline Rational AntlrInput::tokenToRational(pANTLR3_COMMON_TOKEN token) {
Rational r( tokenText(token) );
return r;
}