fix scanner error

This commit is contained in:
ulic-youthlic 2025-03-26 10:37:08 +08:00
parent ee5791b1c8
commit 29b5b6c1f3
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
5 changed files with 26 additions and 1 deletions

View file

@ -182,7 +182,6 @@ BLOCK_COMMENT \/\*(.|\n)*?\*\/
. { . {
errors += 1; errors += 1;
fprintf(stderr, "Error type A at Line %d: Mysterious character \"%s\".\n", yylineno, yytext); fprintf(stderr, "Error type A at Line %d: Mysterious character \"%s\".\n", yylineno, yytext);
return YYerror;
} }
%% %%

5
test1 Normal file
View file

@ -0,0 +1,5 @@
int main()
{
int i = 1;
int j = ~i;
}

7
test2 Normal file
View file

@ -0,0 +1,7 @@
int main()
{
float a[10,2];
int i;
a[5,3] = 1.5;
if (a[1][2] == 0) i = 1 else i = 0;
}

5
test3 Normal file
View file

@ -0,0 +1,5 @@
int inc()
{
int i;
i = i + 1;
}

9
test4 Normal file
View file

@ -0,0 +1,9 @@
struct Complex
{
float real, image;
};
int main()
{
struct Complex x;
y.image = 3.5;
}