small changes
parent
db113a15d9
commit
7a923d1706
|
@ -3,14 +3,14 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int yylineno;
|
||||
int CURRENT_LINE_NUMBER;
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
"{" { return LBRACE; }
|
||||
"}" { return RBRACE; }
|
||||
\n { yylineno++; }
|
||||
\n { CURRENT_LINE_NUMBER++; }
|
||||
[^{}]+ {
|
||||
yylval.str = strdup(yytext);
|
||||
return TEXT;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int yylineno;
|
||||
extern int CURRENT_LINE_NUMBER;
|
||||
extern char *yytext;
|
||||
|
||||
void yyerror(const char *s) {
|
||||
|
@ -28,8 +28,10 @@ block:
|
|||
;
|
||||
|
||||
content:
|
||||
| content TEXT { printf("TOKEN ('%s')\n", $2); free($2); }
|
||||
| content block {}
|
||||
| content TEXT {
|
||||
printf("TOKEN ('%s')\n", $2);
|
||||
free($2); }
|
||||
| content block
|
||||
;
|
||||
%%
|
||||
|
||||
|
|
Loading…
Reference in New Issue