Build AST nodes from within the parser.

This commit is contained in:
Rhys Weatherley
2010-11-12 10:23:46 +10:00
parent 73f77a0b8e
commit 1f8f99df28
7 changed files with 973 additions and 774 deletions

View File

@@ -372,9 +372,12 @@ int Lexer::yylex_helper(const char **position, int *line)
_yyval.string = _engine->identifier(word, _it - word - 1);
return Parser::T_IDENTIFIER;
} else if (std::isdigit(ch)) {
const char *word = _it - 2;
while (std::isalnum(_yychar) || _yychar == '.') {
yyinp();
}
if (_engine)
_yyval.string = _engine->identifier(word, _it - word - 1);
return Parser::T_NUMBER;
}