]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/usr.bin/yacc/pure_error.y
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / usr.bin / yacc / pure_error.y
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
25 main(void)
26 {
27     printf("yyparse() = %d\n", yyparse());
28     return 0;
29 }
30
31 int
32 yylex(YYSTYPE *value)
33 {
34     return value ? 0 : -1;
35 }
36
37 static void
38 yyerror(const char* s)
39 {
40     printf("%s\n", s);
41 }