finished string and char updates and testing updates task 03
This commit is contained in:
@ -6,8 +6,9 @@
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
DIGIT [0-9]
|
DIGIT [0-9]
|
||||||
CHAR \\\\n|\\\\t|\\\'|[^'\\\n\t]
|
CHAR \\n|\\t|\\'|[^'\n\t\\]
|
||||||
STRINGVAL CHAR | " "
|
SCHAR \\n|\\t|\\\"|[^\"\n\\]
|
||||||
|
|
||||||
%%
|
%%
|
||||||
/* rules */
|
/* rules */
|
||||||
{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );}
|
{DIGIT}+ {printf( "C_INTEGER: %s (%d)\n", yytext, atoi( yytext ) );}
|
||||||
@ -20,7 +21,7 @@ STRINGVAL CHAR | " "
|
|||||||
|
|
||||||
"false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );}
|
"false" {printf( "C_FALSE: %s (%d)\n", yytext, atoi( yytext ) );}
|
||||||
|
|
||||||
"{STRINGVAL}+" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );}
|
\"{SCHAR}+\" {printf( "C_STRING: %s (%d)\n", yytext, atoi( yytext ) );}
|
||||||
|
|
||||||
.|\n
|
.|\n
|
||||||
|
|
||||||
|
@ -18,7 +18,22 @@ true
|
|||||||
'\''
|
'\''
|
||||||
'\t'
|
'\t'
|
||||||
'\\'
|
'\\'
|
||||||
|
'n'
|
||||||
'\'
|
'\'
|
||||||
|
'fdsf'
|
||||||
|
'
|
||||||
|
'
|
||||||
|
' '
|
||||||
'''
|
'''
|
||||||
|
"STRINGwithnotSPaces"
|
||||||
|
' '
|
||||||
|
'\ '
|
||||||
|
"J"
|
||||||
|
""
|
||||||
|
" "
|
||||||
|
\"\"
|
||||||
|
"{SCHAR}"
|
||||||
|
"SCHAR"
|
||||||
|
"[SCHAR]"
|
||||||
|
"FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?"
|
||||||
|
"I'd think this is a legal \"string\" that contains several \\n \t escaped characters, isn't it?"
|
||||||
|
Reference in New Issue
Block a user