Home | History | Annotate | Line # | Download | only in test
      1 /*	$NetBSD: pure_error.y,v 1.1.1.6 2016/01/09 21:59:45 christos Exp $	*/
      2 
      3 %{
      4 
      5 #ifdef YYBISON
      6 #define YYSTYPE int
      7 #define YYLEX_PARAM &yylval
      8 #define YYLEX_DECL() yylex(YYSTYPE *yylval)
      9 #define YYERROR_DECL() yyerror(const char *s)
     10 int YYLEX_DECL();
     11 static void YYERROR_DECL();
     12 #endif
     13 
     14 %}
     15 
     16 %%
     17 S: error
     18 %%
     19 
     20 #include <stdio.h>
     21 
     22 #ifdef YYBYACC
     23 extern int YYLEX_DECL();
     24 #endif
     25 
     26 int
     27 main(void)
     28 {
     29     printf("yyparse() = %d\n", yyparse());
     30     return 0;
     31 }
     32 
     33 int
     34 yylex(YYSTYPE *value)
     35 {
     36     return value ? 0 : -1;
     37 }
     38 
     39 static void
     40 yyerror(const char* s)
     41 {
     42     printf("%s\n", s);
     43 }
     44