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