changed output to be non-cascarding when using -n switch
[yaz-moved-to-github.git] / src / cqlstd.y
1 /* $Id: cqlstd.y,v 1.3 2006-03-02 09:38:41 adam Exp $ 
2   YACC CQL grammar taken verbatim from the official spec. We don't
3   use that in YAZ but I don't know of a better place to put it.
4  */
5 %term GE LE NE AND OR NOT PROX CHARSTRING1 CHARSTRING2 SORTBY
6
7 %%
8 sortedQuery : prefixAssignment sortedQuery 
9             | scopedClause
10             | scopedClause SORTBY sortSpec;
11
12 sortSpec : sortSpec singleSpec | singleSpec;
13 singleSpec : index modifierList | index ;
14
15 cqlQuery : prefixAssignment cqlQuery | scopedClause;
16
17 prefixAssignment : '>' prefix '=' uri | '>' uri;
18
19 scopedClause : scopedClause booleanGroup searchClause | searchClause ;
20
21 booleanGroup: boolean | boolean modifierList;
22
23 boolean : AND | OR | NOT | PROX ;
24
25 searchClause : '(' cqlQuery ')'
26              | index relation searchClause
27              | searchTerm
28              ;
29
30 relation : comparitor | comparitor modifierList;
31
32 comparitor : comparitorSymbol | namedComparitor ;
33
34 comparitorSymbol : '=' | '>' | '<' | GE | LE | NE;
35
36 namedComparitor : identifier;
37
38 modifierList : modifierList modifier  | modifier;
39
40 modifier : '/' modifierName 
41          | '/' modifierName comparitorSymbol modifierValue
42          ;
43      
44
45 prefix : term;
46 uri : term;
47 modifierName: term;
48 modifierValue: term;
49 searchTerm: term;
50 index: term;
51
52 term: identifier | AND | OR | NOT | PROX | SORTBY ;
53
54 identifier: CHARSTRING1 | CHARSTRING2;
55
56 %%