10 void yyerror (char const *);
23 %left EQ NEQ GE LE GT LT RE NRE
34 | boo '\n' { printf("%s\n",$1?"true":"false"); }
35 | error '\n' { yyerrok; }
38 boo: CONST EQ CONST { $$ = ! strcmp($1, $3); }
39 | CONST NEQ CONST { $$ = !! strcmp($1, $3); }
44 int ovector[OVECCOUNT];
46 brum=pcre_compile($3,0,&error,&erroroffset,NULL);
52 int res=pcre_exec(brum,NULL,$1,strlen($1),0,0,ovector,OVECCOUNT);
61 int ovector[OVECCOUNT];
63 brum=pcre_compile($3,0,&error,&erroroffset,NULL);
69 int res=pcre_exec(brum,NULL,$1,strlen($1),0,0,ovector,OVECCOUNT);
74 | NUM EQ NUM { $$ = $1 == $3 }
75 | NUM NEQ NUM { $$ = $1 != $3 }
76 | NUM GE NUM { $$ = $1 >= $3 }
77 | NUM LE NUM { $$ = $1 <= $3 }
78 | NUM GT NUM { $$ = $1 > $3 }
79 | NUM LT NUM { $$ = $1 < $3 }
80 | boo '|' boo { $$ = $1 || $3 }
81 | boo '&' boo { $$ = $1 && $3 }
82 | boo '^' boo { $$ = ($1 || $3) && !($1 && $3) }
83 | '!' boo { $$ = ! $2 }
100 while ((c = getchar ()) == ' ' || c == '\t');
105 if (!(yylval.str = malloc(BUFSIZE))){
109 while ((c = getchar()) != '"' || last == '\\'){
110 if (last=='\\' && c != '"')
120 yylval.str[i] = '\0';
128 if (!(yylval.str = malloc(BUFSIZE))){
132 while ((c = getchar()) != '\'' || last == '\\'){
133 if (last=='\\' && c != '\'')
143 yylval.str[i] = '\0';
151 if (!(yylval.str = malloc(BUFSIZE))){
155 while ((c = getchar()) != '/' || last == '\\'){
156 if (last=='\\' && c != '/')
166 yylval.str[i] = '\0';
173 scanf("%d",&yylval.n);
178 if ((c = getchar ()) == '=')
187 if ((c = getchar ()) == '=')
194 if ((c = getchar ()) == '=')
201 if ((c = getchar ()) == '=')
208 if ((c = getchar ()) == '~')
221 yyerror (char const *s)
223 fprintf (stderr, "%s\n", s);