added more grammar; added testing

This commit is contained in:
Ian Griffin
2023-05-29 16:38:56 +08:00
parent 8e1335eb4e
commit 3ff54b86e9
4 changed files with 20 additions and 11 deletions

View File

@@ -118,7 +118,7 @@ yywrap()
return(1);
}
comment()
void comment()
{
char c, c1;
@@ -138,7 +138,7 @@ loop:
int column = 0;
//­p¼Æ¾¹
//<EFBFBD>p<EFBFBD>ƾ<EFBFBD>
void count()
{
int i;

View File

@@ -12,6 +12,12 @@ IS (u|U|l|L)*
#include "lysator.tab.h"
void count();
void comment();
int yywrap();
int yylex();
void yyerror(char*);
int check_type();
%}
%%
@@ -115,13 +121,13 @@ L?\"(\\.|[^\\"])*\" { count(); return(STRING_LITERAL); }
%%
yywrap()
int yywrap()
{
return(1);
}
comment()
void comment()
{
char c, c1;

View File

@@ -421,15 +421,14 @@ function_definition
extern char yytext[];
extern int column;
extern int yylex();
int main() {
return yyparse();
}
yyerror(s)
char *s;
yyerror(char *s)
{
fflush(stdout);
printf("\n%*s\n%*s\n", column, "^", column, s);
}
int main() {
return yyparse();
}