Skip to content
Snippets Groups Projects
Commit 4bde5d0d authored by Clemens Paumgarten's avatar Clemens Paumgarten
Browse files

test

parent ba9c4586
No related branches found
No related tags found
No related merge requests found
......@@ -122,12 +122,13 @@ identifier [a-zA-Z_][a-zA-Z0-9_]*
{float_literal} { yylval->TK_FLOAT_LITERAL = atof(yytext); return TK_FLOAT_LITERAL; }
{string_literal} { /* https://stackoverflow.com/questions/14185172/lex-how-to-eliminate-double-quotes-from-a-string-literal */
char* str = (char*)malloc(strlen(yytext));
strcpy(str, "\\");
strncpy(str, yytext, yyleng-1);
str[yyleng+2] = '\0';
yylval->TK_STRING_LITERAL = str;
return TK_STRING_LITERAL; }
char* str = malloc(sizeof(char) * yyleng+3);
strcpy(str, "\\");
strncpy(str+1, yytext, yyleng-1);
strcpy(str+yyleng, "\\\"");
str[yyleng+2] = '\0';
yylval->TK_STRING_LITERAL = str;
return TK_STRING_LITERAL; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment