Created
June 23, 2011 16:48
-
-
Save baccigalupi/1042965 to your computer and use it in GitHub Desktop.
Customized Flex Meat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch ( yy_act ) | |
{ /* beginning of action switch */ | |
case 0: /* must back up */ | |
/* undo the effects of YY_DO_BEFORE_ACTION */ | |
*yy_cp = (yy_hold_char); | |
yy_cp = (yy_last_accepting_cpos); | |
yy_current_state = (yy_last_accepting_state); | |
goto yy_find_action; | |
case 1: | |
YY_RULE_SETUP | |
#line 18 "1_simple_calculator.lex" | |
{ printf("%s", yytext); token = Token(SC_NUMBER, yytext); token_queue.append(token); } | |
YY_BREAK | |
case 2: | |
YY_RULE_SETUP | |
#line 19 "1_simple_calculator.lex" | |
{ printf("+"); token = Token(SC_PLUS); token_queue.append(token); } | |
YY_BREAK | |
case 3: | |
YY_RULE_SETUP | |
#line 20 "1_simple_calculator.lex" | |
{ printf("-"); token = Token(SC_MINUS); token_queue.append(token); } | |
YY_BREAK | |
case 4: | |
YY_RULE_SETUP | |
#line 21 "1_simple_calculator.lex" | |
{ printf("*"); token = Token(SC_TIMES); token_queue.append(token);} | |
YY_BREAK | |
case 5: | |
YY_RULE_SETUP | |
#line 22 "1_simple_calculator.lex" | |
{ printf("/"); token = Token(SC_DIVIDE); token_queue.append(token);} | |
YY_BREAK | |
case 6: | |
/* rule 6 can match eol */ | |
YY_RULE_SETUP | |
#line 23 "1_simple_calculator.lex" | |
{ printf("=\n"); printf("%f\n\n", token_queue.calculate()); } | |
YY_BREAK | |
case 7: | |
YY_RULE_SETUP | |
#line 24 "1_simple_calculator.lex" | |
{} | |
YY_BREAK | |
case 8: | |
YY_RULE_SETUP | |
#line 25 "1_simple_calculator.lex" | |
{ printf("unknow input"); } | |
YY_BREAK | |
case 9: | |
YY_RULE_SETUP | |
#line 26 "1_simple_calculator.lex" | |
ECHO; | |
YY_BREAK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment