added more grammar; added testing
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user