Commit 057eeec3 authored by Tobias WEBER's avatar Tobias WEBER
Browse files

small bugfix in lexer

parent 90ba4609
......@@ -16,25 +16,15 @@
sign [-+]
integer {sign}?[0-9]+
real {integer}(\.[0-9]*)?|{sign}?\.[0-9]+
uinteger [0-9]+
real {uinteger}(\.[0-9]*)?|\.[0-9]+
%%
{real}([eE]{integer})? {
//std::cerr << "matched: " << yytext << std::endl;
return yy::CliParser::make_TOK_REAL(str_to_real<t_real_cli>(yytext));
}
["'][^"'\n]*["'] {
auto str = std::string(yytext+1, yytext+yyleng-1);
return yy::CliParser::make_TOK_STRING(str);
}
[A-Za-z_]+[A-Za-z0-9_]* {
return yy::CliParser::make_TOK_IDENT(yytext);
}
[;\n] { return yy::CliParser::make_TOK_NEWLINE(); }
[ \t] /* eps */
"(" { return yy::CliParser::make_TOK_BRACKET_OPEN(); }
")" { return yy::CliParser::make_TOK_BRACKET_CLOSE(); }
......@@ -50,8 +40,21 @@ real {integer}(\.[0-9]*)?|{sign}?\.[0-9]+
"." { return yy::CliParser::make_TOK_MEMBER_ACCESS(); }
"," { return yy::CliParser::make_TOK_COMMA(); }
[;\n] { return yy::CliParser::make_TOK_NEWLINE(); }
[ \t] /* eps */
{real}([eE]{integer})? {
//std::cerr << "matched: " << yytext << std::endl;
return yy::CliParser::make_TOK_REAL(str_to_real<t_real_cli>(yytext));
}
["'][^"'\n]*["'] {
auto str = std::string(yytext+1, yytext+yyleng-1);
return yy::CliParser::make_TOK_STRING(str);
}
[A-Za-z_]+[A-Za-z0-9_]* {
return yy::CliParser::make_TOK_IDENT(yytext);
}
. {
context.PrintError(std::string("Lexer error: Unknown token: \"") + yytext + std::string("\""));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment