70
lex.yy.cc
70
lex.yy.cc
@@ -434,10 +434,9 @@ static const flex_int32_t yy_rule_can_match_eol[18] =
|
||||
#define YY_RESTORE_YY_MORE_OFFSET
|
||||
#line 1 "z5.l"
|
||||
#line 2 "z5.l"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "def.tab.hh"
|
||||
|
||||
#define INFILE_ERROR 1
|
||||
@@ -445,8 +444,10 @@ static const flex_int32_t yy_rule_can_match_eol[18] =
|
||||
|
||||
#define YY_DECL int yyFlexLexer::yylex()
|
||||
|
||||
#line 448 "lex.yy.cc"
|
||||
extern int yylineno;
|
||||
void yyerror(char *msg, ...);
|
||||
#line 449 "lex.yy.cc"
|
||||
#line 450 "lex.yy.cc"
|
||||
|
||||
#define INITIAL 0
|
||||
|
||||
@@ -578,8 +579,7 @@ YY_DECL
|
||||
}
|
||||
|
||||
{
|
||||
#line 19 "z5.l"
|
||||
|
||||
#line 20 "z5.l"
|
||||
|
||||
#line 584 "lex.yy.cc"
|
||||
|
||||
@@ -651,101 +651,98 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 21 "z5.l"
|
||||
{std::fprintf(stdout, "LET\n"); return LET;}
|
||||
{fprintf(stdout, "LET\n"); return LET;}
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 22 "z5.l"
|
||||
{std::fprintf(stdout, "INT_TYPE\n"); return INT_TYPE;}
|
||||
{fprintf(stdout, "INT_TYPE\n"); return INT_TYPE;}
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 23 "z5.l"
|
||||
{std::fprintf(stdout, ":\n"); return COLON;}
|
||||
{fprintf(stdout, ":\n"); return COLON;}
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 24 "z5.l"
|
||||
{std::fprintf(stdout, ";\n"); return SEMICOLON;}
|
||||
{fprintf(stdout, ";\n"); return SEMICOLON;}
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 25 "z5.l"
|
||||
{std::fprintf(stdout, "+\n"); return '+';}
|
||||
{fprintf(stdout, "+\n"); return '+';}
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 26 "z5.l"
|
||||
{std::fprintf(stdout, "*\n"); return '*';}
|
||||
{fprintf(stdout, "*\n"); return '*';}
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 27 "z5.l"
|
||||
{std::fprintf(stdout, "(\n"); return '(';}
|
||||
{fprintf(stdout, "(\n"); return '(';}
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 28 "z5.l"
|
||||
{std::fprintf(stdout, ")\n"); return ')';}
|
||||
{fprintf(stdout, ")\n"); return ')';}
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 29 "z5.l"
|
||||
{std::fprintf(stdout, "/\n"); return '/';}
|
||||
{fprintf(stdout, "/\n"); return '/';}
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 30 "z5.l"
|
||||
{std::fprintf(stdout, "-\n"); return '-';}
|
||||
{fprintf(stdout, "-\n"); return '-';}
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 31 "z5.l"
|
||||
{std::fprintf(stdout, "=\n"); return '=';}
|
||||
{fprintf(stdout, "=\n"); return '=';}
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 33 "z5.l"
|
||||
#line 32 "z5.l"
|
||||
{
|
||||
std::fprintf(stdout, "liczba: %s\n", yytext);
|
||||
fprintf(stdout, "liczba: %s\n", yytext);
|
||||
yylval.ival = atoi(yytext);
|
||||
return INT_LIT;
|
||||
}
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 39 "z5.l"
|
||||
#line 37 "z5.l"
|
||||
{
|
||||
std::fprintf(stdout, "identyfikator: %s\n", yytext);
|
||||
fprintf(stdout, "identyfikator: %s\n", yytext);
|
||||
yylval.text = strdup(yytext);
|
||||
return ID;
|
||||
}
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 45 "z5.l"
|
||||
{/* ignoruj białe znaki */}
|
||||
#line 42 "z5.l"
|
||||
{;}
|
||||
YY_BREAK
|
||||
case 15:
|
||||
/* rule 15 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 46 "z5.l"
|
||||
{/* nowa linia */}
|
||||
#line 43 "z5.l"
|
||||
{yylineno++;}
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 47 "z5.l"
|
||||
{
|
||||
std::fprintf(stderr, "Blad leksykalny w linii %d\n", lineno());
|
||||
exit(1);
|
||||
}
|
||||
#line 44 "z5.l"
|
||||
{yyerror("Blad leksykalny\n");}
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 52 "z5.l"
|
||||
#line 45 "z5.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 748 "lex.yy.cc"
|
||||
#line 745 "lex.yy.cc"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
@@ -1717,6 +1714,11 @@ void yyfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 52 "z5.l"
|
||||
#line 45 "z5.l"
|
||||
|
||||
void yyerror(char *msg, ...)
|
||||
{
|
||||
printf("%d: %s", yylineno, msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user