Adding some tokinizer checks for strings and comments

This commit is contained in:
IlushaShurupov 2023-08-07 19:02:32 +03:00
parent 9c8771a378
commit 5fab9ee507
2 changed files with 6 additions and 5 deletions

View file

@ -82,9 +82,10 @@ Parser::Parser() {
{ "true", Token::CONST_TRUE },
{ "false", Token::CONST_FALSE },
{ "((\\-)|(\\+))?[0-9]+i?", Token::CONST_INT },
{ "((\\-)|(\\+))?([0-9]+)(\\.)([0-9]*)?f?", Token::CONST_FLOAT },
{ "(/\\*){\\*-\\*}*(\\*/)", Token::COMMENT_BLOCK },
{ "\"{\"-\"}*\"", Token::CONST_STRING },
{ R"(((\-)|(\+))?([0-9]+)(\.)([0-9]*)?f?)", Token::CONST_FLOAT },
{ R"((/\*){\*-\*}*(\*/))", Token::COMMENT_BLOCK },
{ R"("{"-"}*")", Token::CONST_STRING },
{ "([a-z]|[A-Z]|_)+([a-z]|[A-Z]|[0-9]|_)*", Token::ID },
});
}

View file

@ -14,12 +14,12 @@ const char* script =
R"(
/* yea
comment */
comment "and string inside" with int 123 and float 0.123f */
-1.f;
if (+1.f) {
var string = "string value
var string = "string value some &&characters inside string&& -= asdf 09a
another line";
}