2 /* $XConsortium: boolyac.y /main/1 1996/03/29 17:04:13 cde-ibm $
4 * (c) Copyright 1996 Digital Equipment Corporation.
5 * (c) Copyright 1996 Hewlett-Packard Company.
6 * (c) Copyright 1996 International Business Machines Corp.
7 * (c) Copyright 1996 Sun Microsystems, Inc.
8 * (c) Copyright 1996 Novell, Inc.
9 * (c) Copyright 1996 FUJITSU LIMITED.
10 * (c) Copyright 1996 Hitachi.
13 * COMPONENT_NAME: austext
21 * (C) COPYRIGHT International Business Machines Corp. 1996,1996
23 * Licensed Materials - Property of IBM
24 * US Government Users Restricted Rights - Use, duplication or
25 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
27 /********************* BOOLYAC.Y ********************
28 * $Id: boolyac.y /main/1 1996/03/29 17:04:13 cde-ibm $
30 * AusText/DtSearch yacc-based boolean query parser.
31 * Converts boolean query into stems array and truth table
32 * for subsequent search. This is the yacc source.
33 * After processing by yacc, it becomes boolyac.c and boolyac.h.
34 * Boolpars.c contains all the related C source code: yylex,
35 * action functions, and the main driver function, boolean_parse.
38 * Revision 1.1 1996/03/05 15:52:05 miker
51 %token <truthtab> WORD_TOKEN
52 %left '|' /* left associative, lowest precedence */
53 %left '&' /* left associative, higher precedence */
54 %right '~' /* right associative */
55 %token <int_val> COLLOC_TOKEN
56 %token ERROR_TOKEN /* highest precedence */
58 %type <truthtab> expr query
61 /*********** Top Level Start Rule ****************/
64 if (parser_invalid_wordcount > 0)
72 { $$ = copy_final_truthtab ($1); }
75 { add_syntax_errmsg(2); YYABORT; }
80 $$ = copy_final_truthtab ($1);
88 { add_syntax_errmsg(2); YYABORT; }
91 { add_syntax_errmsg(2); YYABORT; }
94 { add_syntax_errmsg(3); YYABORT; }
97 { add_syntax_errmsg(4); YYABORT; }
100 { add_syntax_errmsg(5); YYABORT; }
103 { add_syntax_errmsg(5); YYABORT; }
105 | ERROR_TOKEN { YYABORT; }
108 /*********** Valid Expressions ************/
113 { $$ = boolyac_AND ($1, $3); }
116 { $$ = boolyac_OR ($1, $3); }
122 { $$ = boolyac_NOT ($2); }
124 | WORD_TOKEN COLLOC_TOKEN WORD_TOKEN %prec COLLOC_TOKEN
126 $$ = boolyac_COLLOC ($1, $2, $3);
133 /********************* BOOLYAC.Y ********************/