blob: a80db9b1b15ac7b34174f30fdd92be7dd1dffdd4 [file] [log] [blame]
Joachim Bingel6003b852014-12-18 14:20:55 +00001// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2// //
3// COSMAS II zeilenorientierten Suchanfragesprache (C2 plain syntax) //
4// lokale Grammatik für #OV() und #OV(Options). //
5// 17.12.12/FB //
6// v-0.1 //
7// //
8// Opts nimmt eine oder mehrere, durch Kommata getrennte Optionen auf: //
9// - Positionsoptionen (POS): L, R, F, FE, FI, X, -. //
10// - Ausschließungsoptionen (EXCL): %, -. //
11// - Gruppenbildungsoptionen (GROUP): min, max, -. //
12// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
13
14grammar c2ps_opOV;
15
16options {output=AST;}
17tokens {OPOV;
18 POS;
19 EXCL; YES;
20 GROUP; MIN; MAX; }
21@header {package de.ids_mannheim.korap.query.parse.cosmas;}
22@lexer::header {package de.ids_mannheim.korap.query.parse.cosmas;}
23
24// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
25//
26// Lexer
27//
28// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
29
30WS : (' ')+ {skip();};
31
32POSTYP : 'L'|'l'|'R'|'r'|'F'|'f'|'FE'|'fe'|'FI'|'fi'|'N'|'n'|'X'|'x' ;
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
35//
36// Parser
37//
38// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
39
40opOV : '#OV' -> ^(OPOV)
41 | '#OV(' opts? ')' -> ^(OPOV opts?);
42
43opts : opt (',' opt)* -> opt*;
44
45opt : (optPos | optExcl | optGrp);
46
47// Position:
48optPos : POSTYP
49
50 -> ^(POS POSTYP);
51
52optExcl : '%'
53
54 -> ^(EXCL YES);
55
56optGrp : ('MIN' | 'min') -> ^(GROUP MIN)
57 | ('MAX' | 'max') -> ^(GROUP MAX) ;
58