small changes

deepseek
serr 2025-04-22 12:13:14 +03:00
parent db113a15d9
commit 7a923d1706
2 changed files with 7 additions and 5 deletions

View File

@ -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;

View File

@ -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
;
%%