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

View File

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