xref: /minix3/external/bsd/byacc/dist/test/err_syntax12.y (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: err_syntax12.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $	*/
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc %{
4*0a6a1f1dSLionel Sambuc int yylex(void);
5*0a6a1f1dSLionel Sambuc static void yyerror(const char *);
6*0a6a1f1dSLionel Sambuc %}
7*0a6a1f1dSLionel Sambuc 
8*0a6a1f1dSLionel Sambuc %token text 123
9*0a6a1f1dSLionel Sambuc %token text 456
10*0a6a1f1dSLionel Sambuc 
11*0a6a1f1dSLionel Sambuc %%
12*0a6a1f1dSLionel Sambuc S: error
13*0a6a1f1dSLionel Sambuc %%
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc #include <stdio.h>
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc int
18*0a6a1f1dSLionel Sambuc main(void)
19*0a6a1f1dSLionel Sambuc {
20*0a6a1f1dSLionel Sambuc     printf("yyparse() = %d\n", yyparse());
21*0a6a1f1dSLionel Sambuc     return 0;
22*0a6a1f1dSLionel Sambuc }
23*0a6a1f1dSLionel Sambuc 
24*0a6a1f1dSLionel Sambuc int
yylex(void)25*0a6a1f1dSLionel Sambuc yylex(void)
26*0a6a1f1dSLionel Sambuc {
27*0a6a1f1dSLionel Sambuc     return -1;
28*0a6a1f1dSLionel Sambuc }
29*0a6a1f1dSLionel Sambuc 
30*0a6a1f1dSLionel Sambuc static void
yyerror(const char * s)31*0a6a1f1dSLionel Sambuc yyerror(const char* s)
32*0a6a1f1dSLionel Sambuc {
33*0a6a1f1dSLionel Sambuc     printf("%s\n", s);
34*0a6a1f1dSLionel Sambuc }
35