Skip to content

Commit

Permalink
[Phase1] Fix lex.l to pass test cases 1-9
Browse files Browse the repository at this point in the history
  • Loading branch information
liqwang committed Oct 27, 2023
1 parent 0eae9c2 commit f486fa1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions phase1/lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ return {yylval=strdup("RETURN\n"); return RETURN;}
"*" {yylval=strdup("MUL\n"); return MUL;}
"/" {yylval=strdup("DIV\n"); return DIV;}
"&&" {yylval=strdup("AND\n"); return AND;}
"&" {lexical_error(yytext,yylineno); return AND;} //treat it as AND to prevent the syntax error later
"||" {yylval=strdup("OR\n"); return OR;}
"|" {lexical_error(yytext,yylineno); return OR;} //treat it as OR to prevent the syntax error later
"(" {yylval=strdup("LP\n"); return LP;}
")" {yylval=strdup("RP\n"); return RP;}
"[" {yylval=strdup("LB\n"); return LB;}
Expand Down

0 comments on commit f486fa1

Please sign in to comment.