xref: /freebsd/contrib/byacc/test/pure_error.y (revision b652778e426d00b6a1df29bbd86869db86f36e25)
1 %{
2 
3 #ifdef YYBISON
4 #define YYSTYPE int
5 #define YYLEX_PARAM &yylval
6 #define YYLEX_DECL() yylex(YYSTYPE *yylval)
7 #define YYERROR_DECL() yyerror(const char *s)
8 int YYLEX_DECL();
9 static void YYERROR_DECL();
10 #endif
11 
12 %}
13 
14 %%
15 S: error
16 %%
17 
18 #include <stdio.h>
19 
20 #ifdef YYBYACC
21 extern int YYLEX_DECL();
22 #endif
23 
24 int
main(void)25 main(void)
26 {
27     printf("yyparse() = %d\n", yyparse());
28     return 0;
29 }
30 
31 int
yylex(YYSTYPE * value)32 yylex(YYSTYPE *value)
33 {
34     return value ? 0 : -1;
35 }
36 
37 static void
yyerror(const char * s)38 yyerror(const char* s)
39 {
40     printf("%s\n", s);
41 }
42