lib/DDC/PP/yyqparser.yp

filter: Statementstmt 45.6% 189 / 414 Branchbran 37.5% 3 / 8 Conditioncond 25.0% 1 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 40.4% 129 / 319 Podpod 25.0% 3 / 12 totaltotal 42.8% 325 / 759 CC 8 SCAR 5.3
CC
8
Cov
45%
newCFilter
6.0
newKeysQuery
6.0
newCountQuery
4.1
CRAP 1.7
« blib/lib/DDC/Utils.pm ↑ Summary blib/lib/DDC/PP.pm »
1 ## -*- Mode: CPerl -*-
2  
3 ################################################################
4 ##
5 ## File: DDC::yyqparser.yp
6 ## Author: Bryan Jurish <moocow@cpan.org>
7 ##
8 ## Description: Yapp parser specification for DDC queries
9 ## + last updated for ddc v2.2.8
10 ##
11 ################################################################
12  
13 ################################################################
14 ## Header section
15 ################################################################
16 %{
17  
18 ################################################################
19 ##
20 ## File: DDC::yyqparser.yp
21 ## Author: Bryan Jurish <moocow@cpan.org>
22 ##
23 ## Description: Yapp parser for DDC queries
24 ##
25 ################################################################
26  
27 ##==============================================================
28 ##
29 ## * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING *
30 ##
31 ##==============================================================
32 ##
33 ## Do *NOT* change yyqparser.pm directly, change yyqparser.yp
34 ## and re-call 'yapp' instead!
35 ##
36 ##==============================================================
37  
38 package DDC::PP::yyqparser;
39 20 ▶use DDC::Utils qw(:escape);
Subroutine BEGIN: called CC=1 SCAR=0.0
40 20 ▶use DDC::PP::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 20 ▶use DDC::PP::CQuery;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 20 ▶use DDC::PP::CQCount;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 20 ▶use DDC::PP::CQFilter;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 20 ▶use DDC::PP::CQueryOptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 ##----------------------------------------
47 ## API: Hints
48  
49 ## undef = $yyqparser->hint($hint_code,$curtok,$curval)
50 ##
51 0 ▶sub show_hint {
Subroutine show_hint: not called CC=1 SCAR=6.9
Pod documented
52 0 $_[0]->{USER}{'hint'} = $_[1];
53 0 $_[0]->YYCurtok($_[2]);
54 0 $_[0]->YYCurval($_[3]);
55 0 $_[0]->YYError;
56 }
57  
58 %}
59  
60 15 ▶##----------------------------------------
Subroutine new: called CC=2 SCAR=10.3
Pod documented
61 15 ## Grammar: Start symbol
62 15 ▶%start query
Branch: 1 branch
BranchTrueFalseTotal
ref $class and $class = ref $class 0 15 15
63  
64 ##----------------------------------------
65 ## Grammar: Precedence
66  
67 %nonassoc OP_CLAUSE_MATCHID
68 %nonassoc OP_CLAUSE_CONCAT
69 %nonassoc OP_CLAUSE_BOOL
70 %nonassoc OP_CLAUSE_BASIC
71  
72 #%nonassoc OP_CLAUSE
73 %nonassoc OP_PHRASE
74 %nonassoc OP_WORD
75  
76 %left OP_BOOL_AND OP_BOOL_OR
77 %nonassoc '!'
78  
79 %nonassoc COUNT
80 %nonassoc KEYS
81 %nonassoc NEAR
82 %left ','
83 %left WITH WITHOUT WITHOR
84 %left '='
85 %nonassoc '<'
86 %nonassoc '$'
87 %nonassoc '@' '^' '%' '#' '/' '~'
88  
89 # %left SIM_PRECISE //-- what was this for?
90  
91  
92 ##----------------------------------------
93 ## expect some shift/reduce conflicts:
94 ##---------------------------------------
95 #%expect 3
96  
97 %%
98 ################################################################
99 ## Rules Section
100 ################################################################
101  
102 ##-------------------------------------------------------------
103 ## query (q*): Top Level (Query Root)
104 query:
105 183 ▶ query_conditions q_directives { $_[0]->SetQuery($_[1]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
106 28 ▶ | count_query q_directives { $_[0]->SetQuery($_[1]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
107 ;
108  
109 ##-------------------------------------------------------------
110 ## count_query (count_*)
111  
112 count_query:
113 28 ▶ COUNT '(' query_conditions count_filters ')' count_filters { $_[0]->newCountQuery($_[3], {%{$_[4]}, %{$_[6]}}) }
Subroutine __ANON__: called CC=1 SCAR=0.0
114 ;
115  
116 ##-- count_filters: HASH-ref
117 count_filters:
118 56 ▶ { {} } ##-- empty
Subroutine __ANON__: called CC=1 SCAR=0.0
119 40 ▶ | count_filters count_filter { my $tmp={%{$_[1]}, %{$_[2]}}; $tmp }
Subroutine __ANON__: called CC=1 SCAR=0.0
120 ;
121  
122 ##-- count_filter: HASH-ref
123 count_filter:
124 28 ▶ count_by { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
125 2 ▶ | count_sample { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
126 0 ▶ | count_limit { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
127 4 ▶ | count_sort { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
128 6 ▶ | q_comment { {} }
Subroutine __ANON__: called CC=1 SCAR=0.0
129 ;
130  
131 count_by:
132 0 ▶ BY l_countkeys { {Keys=>$_[2]} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
133 28 ▶ | BY '[' l_countkeys ']' { {Keys=>$_[3]} }
Subroutine __ANON__: called CC=1 SCAR=0.0
134 ;
135  
136 count_sample:
137 0 ▶ SAMPLE integer { {Sample=>$_[2]} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
138 2 ▶ | SAMPLE '[' integer ']' { {Sample=>$_[3]} }
Subroutine __ANON__: called CC=1 SCAR=0.0
139 ;
140  
141 ##-- non-cqcount option
142 count_limit:
143 0 ▶ CLIMIT integer { {Limit=>$_[2]} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
144 0 ▶ | CLIMIT '[' integer ']' { {Limit=>$_[3]} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
145 ;
146  
147 count_sort:
148 4 ▶ count_sort_op count_sort_minmax { $_[2]->{Sort}=$_[1]; $_[2] }
Subroutine __ANON__: called CC=1 SCAR=0.0
149 ;
150  
151 count_sort_op:
152 2 ▶ LESS_BY_KEY { DDC::PP::LessByCountKey }
Subroutine __ANON__: called CC=1 SCAR=0.0
153 0 ▶ | GREATER_BY_KEY { DDC::PP::GreaterByCountKey }
Subroutine __ANON__: not called CC=1 SCAR=6.9
154 0 ▶ | LESS_BY_COUNT { DDC::PP::LessByCountValue }
Subroutine __ANON__: not called CC=1 SCAR=6.9
155 2 ▶ | GREATER_BY_COUNT { DDC::PP::GreaterByCountValue }
Subroutine __ANON__: called CC=1 SCAR=0.0
156 ;
157  
158 count_sort_minmax:
159 4 ▶ { {} } ##-- empty
Subroutine __ANON__: called CC=1 SCAR=0.0
160 0 ▶ | '[' ']' { {} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
161 0 ▶ | '[' ',' ']' { {} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
162 0 ▶ | '[' symbol ']' { {Lo=>$_[2]} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
163 0 ▶ | '[' symbol ',' ']' { {Lo=>$_[2]} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
164 0 ▶ | '[' ',' symbol ']' { {Hi=>$_[3]} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
165 0 ▶ | '[' symbol ',' symbol ']' { {Lo=>$_[2],Hi=>$_[4]} }
Subroutine __ANON__: not called CC=1 SCAR=6.9
166 ;
167  
168 ##-------------------------------------------------------------
169 ## query_conditions (q*)
170  
171 query_conditions:
172 211 ▶ q_clause q_filters { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
173 ;
174  
175 ##-------------------------------------------------------------
176 ## q_filters (qf*): Filters and Global Query Flags
177 q_filters:
178 211 ▶ { undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
179 11 ▶ | q_filters q_comment { undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
180 7 ▶ | q_filters q_flag { undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
181 20 ▶ | q_filters q_filter { undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
182 ;
183  
184 q_comment:
185 15 ▶ KW_COMMENT symbol { push(@{$_[0]->qopts->{Comments}}, $_[2]); undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
186 2 ▶ | KW_COMMENT '[' symbol ']' { push(@{$_[0]->qopts->{Comments}}, $_[3]); undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
187 ;
188  
189 q_flag:
190 2 ▶ CNTXT integer { $_[0]->qopts->{ContextSentencesCount} = $_[2]; undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
191 0 ▶ | CNTXT '[' integer ']' { $_[0]->qopts->{ContextSentencesCount} = $_[3]; undef }
Subroutine __ANON__: not called CC=1 SCAR=6.9
192 2 ▶ | WITHIN s_breakname { push(@{$_[0]->qopts->{Within}}, $_[2]); undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
193 3 ▶ | SEPARATE_HITS { $_[0]->qopts->{SeparateHits} = 1; undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
194 0 ▶ | NOSEPARATE_HITS { $_[0]->qopts->{SeparateHits} = 0; undef }
Subroutine __ANON__: not called CC=1 SCAR=6.9
195 0 ▶ | FILENAMES_ONLY { $_[0]->qopts->{EnableBibliography} = 0; undef }
Subroutine __ANON__: not called CC=1 SCAR=6.9
196 0 ▶ | '!' FILENAMES_ONLY { $_[0]->qopts->{EnableBibliography} = 1; undef }
Subroutine __ANON__: not called CC=1 SCAR=6.9
197 0 ▶ | DEBUG_RANK { $_[0]->qopts->{DebugRank} = 1; undef }
Subroutine __ANON__: not called CC=1 SCAR=6.9
198 0 ▶ | '!' DEBUG_RANK { $_[0]->qopts->{DebugRank} = 0; undef }
Subroutine __ANON__: not called CC=1 SCAR=6.9
199 ;
200  
201  
202 q_filter:
203 2 ▶ qf_has_field { $_[1]; }
Subroutine __ANON__: called CC=1 SCAR=0.0
204 0 ▶ | qf_rank_sort { $_[1]; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
205 0 ▶ | qf_context_sort { $_[1]; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
206 0 ▶ | qf_size_sort { $_[1]; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
207 14 ▶ | qf_date_sort { $_[1]; }
Subroutine __ANON__: called CC=1 SCAR=0.0
208 0 ▶ | qf_bibl_sort { $_[1]; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
209 0 ▶ | qf_random_sort { $_[1]; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
210 4 ▶ | qf_prune_sort { $_[1]; }
Subroutine __ANON__: called CC=1 SCAR=0.0
211 ;
212  
213 qf_has_field:
214 2 ▶ HAS_FIELD '[' s_biblname ',' symbol ']' { $_[0]->newf('CQFHasFieldValue', $_[3], $_[5]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
215 0 ▶ | HAS_FIELD '[' s_biblname ',' regex ']' { $_[0]->newf('CQFHasFieldRegex', $_[3], $_[5]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
216 0 ▶ | HAS_FIELD '[' s_biblname ',' neg_regex ']' { (my $f=$_[0]->newf('CQFHasFieldRegex', $_[3], $_[5]))->Negate(); $f }
Subroutine __ANON__: not called CC=1 SCAR=6.9
217 0 ▶ | HAS_FIELD '[' s_biblname ',' s_prefix ']' { $_[0]->newf('CQFHasFieldPrefix', $_[3],$_[5]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
218 0 ▶ | HAS_FIELD '[' s_biblname ',' s_suffix ']' { $_[0]->newf('CQFHasFieldSuffix', $_[3],$_[5]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
219 0 ▶ | HAS_FIELD '[' s_biblname ',' s_infix ']' { $_[0]->newf('CQFHasFieldInfix', $_[3],$_[5]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
220 0 ▶ | HAS_FIELD '[' s_biblname ',' '{' l_set '}' ']' { $_[0]->newf('CQFHasFieldSet', $_[3], $_[6]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
221 0 ▶ | '!' qf_has_field { $_[2]->Negate; $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
222 ;
223  
224 qf_rank_sort:
225 0 ▶ GREATER_BY_RANK { $_[0]->newf('CQFRankSort', DDC::PP::GreaterByRank) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
226 0 ▶ | LESS_BY_RANK { $_[0]->newf('CQFRankSort', DDC::PP::LessByRank) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
227 ;
228  
229 qf_context_sort:
230 0 ▶ LESS_BY_LEFT qfb_ctxsort { $_[0]->newCFilter(DDC::PP::LessByLeftContext, -1, $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
231 0 ▶ | GREATER_BY_LEFT qfb_ctxsort { $_[0]->newCFilter(DDC::PP::GreaterByLeftContext, -1, $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
232 0 ▶ | LESS_BY_RIGHT qfb_ctxsort { $_[0]->newCFilter(DDC::PP::LessByRightContext, 1, $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
233 0 ▶ | GREATER_BY_RIGHT qfb_ctxsort { $_[0]->newCFilter(DDC::PP::GreaterByRightContext, 1, $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
234 0 ▶ | LESS_BY_MIDDLE qfb_ctxsort { $_[0]->newCFilter(DDC::PP::LessByMiddleContext, 0, $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
235 0 ▶ | GREATER_BY_MIDDLE qfb_ctxsort { $_[0]->newCFilter(DDC::PP::GreaterByMiddleContext, 0, $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
236 ;
237  
238 qf_size_sort:
239 0 ▶ LESS_BY_SIZE qfb_int { $_[0]->newf('CQFSizeSort', DDC::PP::LessBySize, @{$_[2]}) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
240 0 ▶ | GREATER_BY_SIZE qfb_int { $_[0]->newf('CQFSizeSort', DDC::PP::GreaterBySize, @{$_[2]}) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
241 0 ▶ | IS_SIZE '[' int_str ']' { $_[0]->newf('CQFSizeSort', DDC::PP::LessBySize, $_[3],$_[3]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
242 ;
243  
244 qf_date_sort:
245 10 ▶ LESS_BY_DATE qfb_date { $_[0]->newf('CQFDateSort', DDC::PP::LessByDate, @{$_[2]}) }
Subroutine __ANON__: called CC=1 SCAR=0.0
246 0 ▶ | GREATER_BY_DATE qfb_date { $_[0]->newf('CQFDateSort', DDC::PP::GreaterByDate, @{$_[2]}) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
247 4 ▶ | IS_DATE '[' date ']' { $_[0]->newf('CQFDateSort', DDC::PP::LessByDate, $_[3],$_[3]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
248 ;
249  
250 qf_random_sort:
251 0 ▶ RANDOM { $_[0]->newf('CQFRandomSort') }
Subroutine __ANON__: not called CC=1 SCAR=6.9
252 0 ▶ | RANDOM '[' ']' { $_[0]->newf('CQFRandomSort') }
Subroutine __ANON__: not called CC=1 SCAR=6.9
253 0 ▶ | RANDOM '[' int_str ']' { $_[0]->newf('CQFRandomSort',$_[3]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
254 ;
255  
256 qf_bibl_sort:
257 0 ▶ LESS_BY '[' KW_DATE qfb_bibl ']' { $_[0]->newf('CQFDateSort', DDC::PP::LessByDate, @{$_[4]}) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
258 0 ▶ | GREATER_BY '[' KW_DATE qfb_bibl ']' { $_[0]->newf('CQFDateSort', DDC::PP::GreaterByDate, @{$_[4]}) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
259 0 ▶ | LESS_BY '[' s_biblname qfb_bibl ']' { $_[0]->newf('CQFBiblSort', DDC::PP::LessByFreeBiblField, $_[3], @{$_[4]}) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
260 0 ▶ | GREATER_BY '[' s_biblname qfb_bibl ']' { $_[0]->newf('CQFBiblSort', DDC::PP::LessByFreeBiblField, $_[3], @{$_[4]}) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
261 ;
262  
263 qf_prune_sort:
264 4 ▶ PRUNE_ASC '[' int_str l_prunekeys ']' { $_[0]->newf('CQFPrune', DDC::PP::LessByPruneKey, $_[3], $_[4]); }
Subroutine __ANON__: called CC=1 SCAR=0.0
265 0 ▶ | PRUNE_DESC '[' int_str l_prunekeys ']' { $_[0]->newf('CQFPrune', DDC::PP::GreaterByPruneKey, $_[3], $_[4]); }
Subroutine __ANON__: not called CC=1 SCAR=6.9
266 ;
267  
268 ##-------------------------------------------------------------
269 ## (qfb*): Filter Bounds
270  
271 ##-- qfb_int: [0:$lb,1:$ub]
272 qfb_int:
273 0 ▶ { [] } ##-- empty
Subroutine __ANON__: not called CC=1 SCAR=6.9
274 0 ▶ | '[' ']' { [] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
275 0 ▶ | '[' ',' ']' { [] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
276 0 ▶ | '[' int_str ']' { [$_[2]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
277 0 ▶ | '[' int_str ',' ']' { [$_[2]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
278 0 ▶ | '[' int_str ',' int_str ']' { [$_[2],$_[4]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
279 0 ▶ | '[' ',' int_str ']' { [undef,$_[3]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
280 ;
281  
282 ##-- qfb_date: [0:$lb,1:$ub]
283 qfb_date:
284 2 ▶ { [] } ##-- empty
Subroutine __ANON__: called CC=1 SCAR=0.0
285 0 ▶ | '[' ']' { [] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
286 0 ▶ | '[' date ']' { [$_[2]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
287 0 ▶ | '[' date ',' ']' { [$_[2]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
288 8 ▶ | '[' date ',' date ']' { [$_[2],$_[4]] }
Subroutine __ANON__: called CC=1 SCAR=0.0
289 0 ▶ | '[' ',' date ']' { [undef,$_[3]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
290 ;
291  
292 ##-- qfb_bibl: [0:$lb,1:$ub]
293 qfb_bibl:
294 0 ▶ { [] } ##-- empty
Subroutine __ANON__: not called CC=1 SCAR=6.9
295 0 ▶ | qfb_bibl_ne { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
296 ;
297  
298  
299 ##-- qfb_bibl_ne: [0:$lb,1:$ub]
300 qfb_bibl_ne:
301 0 ▶ ',' { [] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
302 0 ▶ | ',' ',' { [] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
303 0 ▶ | ',' symbol { [$_[2]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
304 0 ▶ | ',' symbol ',' { [$_[2]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
305 0 ▶ | ',' ',' symbol { [undef,$_[3]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
306 0 ▶ | ',' symbol ',' symbol { [$_[2],$_[4]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
307 ;
308  
309 ##-- qfb_ctxsort : [0:$field,1:$matchid,2:$offset,3:$lb,4:$ub]
310 qfb_ctxsort:
311 0 ▶ { [] } ##-- empty
Subroutine __ANON__: not called CC=1 SCAR=6.9
312 0 ▶ | '[' qfb_ctxkey ']' { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
313 0 ▶ | '[' qfb_ctxkey qfb_bibl_ne ']' { [@{$_[2]}, @{$_[3]}] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
314 ;
315  
316 ##-- qfb_ctxkey: [0:$field,1:$matchid,2:$offset]
317 qfb_ctxkey:
318 0 ▶ sym_str qfbc_matchref qfbc_offset { [$_[1],$_[2],$_[3]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
319 0 ▶ | qfbc_matchref qfbc_offset { [undef,$_[1],$_[2]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
320 ;
321  
322 ##-- qfbc_matchref: $matchid
323 qfbc_matchref:
324 0 ▶ { 0 } ##-- empty
Subroutine __ANON__: not called CC=1 SCAR=6.9
325 0 ▶ | matchid { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
326 ;
327  
328 ##-- qfbc_offset: offset
329 qfbc_offset:
330 0 ▶ { undef } ##-- empty: use filter-type default
Subroutine __ANON__: not called CC=1 SCAR=6.9
331 0 ▶ | integer { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
332 0 ▶ | '+' integer { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
333 0 ▶ | '-' integer { -$_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
334 ;
335  
336  
337 ##-------------------------------------------------------------
338 ## q_directives: global server directives
339  
340 q_directives:
341 211 ▶ { undef } ##-- empty: ignore
Subroutine __ANON__: called CC=1 SCAR=0.0
342 34 ▶ | q_directives qd_subcorpora { undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
343 ;
344  
345 qd_subcorpora:
346 34 ▶ ':' { @{$_[0]->qopts->{Subcorpora}}=qw(); } l_subcorpora { undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
347 ;
348  
349  
350 ##-------------------------------------------------------------
351 ## q_clause (qc*): query clauses (logical operations)
352  
353 q_clause:
354 224 ▶ qc_basic %prec OP_CLAUSE_BASIC { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
355 23 ▶ | qc_boolean %prec OP_CLAUSE_BOOL { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
356 10 ▶ | qc_concat %prec OP_CLAUSE_CONCAT { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
357 0 ▶ | qc_matchid %prec OP_CLAUSE_MATCHID { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
358 ;
359  
360 qc_matchid:
361 0 ▶ q_clause matchid { $_[1]->SetMatchId($_[2]); $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
362 0 ▶ | '(' qc_matchid ')' { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
363 ;
364  
365  
366 ##-------------------------------------------------------------
367 ## qc_boolean: query clause: complex boolean expression
368 qc_boolean:
369 21 ▶ q_clause OP_BOOL_AND q_clause { $_[0]->newq('CQAnd', $_[1],$_[3]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
370 2 ▶ | q_clause OP_BOOL_OR q_clause { $_[0]->newq('CQOr', $_[1],$_[3]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
371 0 ▶ | '!' q_clause { $_[2]->Negate; $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
372 0 ▶ | '(' qc_boolean ')' { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
373 ;
374  
375 ##-------------------------------------------------------------
376 ## qc_concat: query clause: implicit logical conjunction
377 qc_concat:
378 10 ▶ qc_basic qc_basic { $_[0]->newq('CQAndImplicit', $_[1],$_[2]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
379 0 ▶ | qc_concat qc_basic { $_[0]->newq('CQAndImplicit', $_[1],$_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
380 2 ▶ | '(' qc_concat ')' { $_[2] }
Subroutine __ANON__: called CC=1 SCAR=0.0
381 ;
382  
383  
384 ##-------------------------------------------------------------
385 ## qc_basic: query clause: basic (single logical condition)
386  
387 qc_basic:
388 244 ▶ qc_tokens %prec OP_PHRASE { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
389 0 ▶ | qc_near %prec OP_PHRASE { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
390 ;
391  
392 qc_near:
393 0 ▶ NEAR '(' qc_tokens ',' qc_tokens ',' integer ')' { $_[0]->newq('CQNear', $_[7],$_[3],$_[5]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
394 0 ▶ | NEAR '(' qc_tokens ',' qc_tokens ',' qc_tokens ',' integer ')' { $_[0]->newq('CQNear', $_[9],$_[3],$_[5],$_[7]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
395 0 ▶ | qc_near matchid { $_[1]->SetMatchId($_[2]); $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
396 0 ▶ | '(' qc_near ')' { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
397 ;
398  
399  
400 ##-------------------------------------------------------------
401 ## qc_tokens: condition with hit position (can be arg to NEAR()):
402  
403 qc_tokens:
404 242 ▶ qc_word %prec OP_WORD { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
405 2 ▶ | qc_phrase %prec OP_PHRASE { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
406 0 ▶ | qc_tokens matchid %prec OP_PHRASE { $_[1]->SetMatchId($_[2]); $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
407 ;
408  
409 qc_phrase:
410 2 ▶ '"' l_phrase '"' { $_[2] }
Subroutine __ANON__: called CC=1 SCAR=0.0
411 0 ▶ | '(' qc_phrase ')' { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
412 ;
413  
414  
415 ##-------------------------------------------------------------
416 ## qc_word (qw*): Single-Token Queries
417  
418 qc_word:
419 231 ▶ qw_bareword { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
420 4 ▶ | qw_exact { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
421 11 ▶ | qw_regex { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
422 0 ▶ | qw_any { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
423 0 ▶ | qw_set_infl { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
424 4 ▶ | qw_set_exact { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
425 0 ▶ | qw_infix { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
426 0 ▶ | qw_infix_set { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
427 4 ▶ | qw_prefix { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
428 0 ▶ | qw_prefix_set { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
429 0 ▶ | qw_suffix { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
430 0 ▶ | qw_suffix_set { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
431 0 ▶ | qw_thesaurus { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
432 0 ▶ | qw_morph { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
433 0 ▶ | qw_lemma { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
434 0 ▶ | qw_chunk { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
435 0 ▶ | qw_anchor { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
436 0 ▶ | qw_listfile { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
437 2 ▶ | qw_with { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
438 2 ▶ | qw_without { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
439 2 ▶ | qw_withor { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
440 0 ▶ | qw_keys { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
441 30 ▶ | qw_matchid { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
442 4 ▶ | '(' qc_word ')' { $_[2] }
Subroutine __ANON__: called CC=1 SCAR=0.0
443 ;
444  
445 qw_bareword:
446 225 ▶ s_word l_txchain { $_[0]->newq('CQTokInfl', "", $_[1], $_[2]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
447 6 ▶ | s_index '=' s_word l_txchain { $_[0]->newq('CQTokInfl', $_[1], $_[3], $_[4]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
448 ;
449  
450 qw_exact:
451 4 ▶ '@' s_word { $_[0]->newq('CQTokExact', "", $_[2]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
452 0 ▶ | s_index '=' '@' s_word { $_[0]->newq('CQTokExact', $_[1], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
453 ;
454  
455 qw_regex:
456 11 ▶ regex { $_[0]->newq('CQTokRegex', "", $_[1]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
457 0 ▶ | s_index '=' regex { $_[0]->newq('CQTokRegex', $_[1],$_[3]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
458 0 ▶ | neg_regex { $_[0]->newq('CQTokRegex', "", $_[1], 1) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
459 0 ▶ | s_index '=' neg_regex { $_[0]->newq('CQTokRegex', $_[1], $_[3], 1) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
460 ;
461  
462 qw_any:
463 0 ▶ '*' { $_[0]->newq('CQTokAny') }
Subroutine __ANON__: not called CC=1 SCAR=6.9
464 0 ▶ | s_index '=' '*' { $_[0]->newq('CQTokAny',$_[1]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
465 ;
466  
467 qw_set_exact:
468 4 ▶ AT_LBRACE l_set '}' { $_[0]->newq('CQTokSet', "", undef, $_[2]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
469 0 ▶ | s_index '=' AT_LBRACE l_set '}' { $_[0]->newq('CQTokSet', $_[1], undef, $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
470 ;
471  
472 qw_set_infl:
473 0 ▶ '{' l_set '}' l_txchain { $_[0]->newq('CQTokSetInfl', "", $_[2], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
474 0 ▶ | s_index '=' '{' l_set '}' l_txchain { $_[0]->newq('CQTokSetInfl', $_[1], $_[4], $_[6]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
475 ;
476  
477 qw_prefix:
478 4 ▶ s_prefix { $_[0]->newq('CQTokPrefix', "", $_[1]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
479 0 ▶ | s_index '=' s_prefix { $_[0]->newq('CQTokPrefix', $_[1], $_[3]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
480 ;
481  
482 qw_suffix:
483 0 ▶ s_suffix { $_[0]->newq('CQTokSuffix', "", $_[1]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
484 0 ▶ | s_index '=' s_suffix { $_[0]->newq('CQTokSuffix', $_[1], $_[3]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
485 ;
486  
487 qw_infix:
488 0 ▶ s_infix { $_[0]->newq('CQTokInfix', "", $_[1]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
489 0 ▶ | s_index '=' s_infix { $_[0]->newq('CQTokInfix', $_[1], $_[3]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
490 ;
491  
492 qw_infix_set:
493 0 ▶ STAR_LBRACE l_set RBRACE_STAR { $_[0]->newq('CQTokInfixSet', "", $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
494 0 ▶ | s_index '=' STAR_LBRACE l_set RBRACE_STAR { $_[0]->newq('CQTokInfixSet', $_[1], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
495 ;
496  
497 qw_prefix_set:
498 0 ▶ '{' l_set RBRACE_STAR { $_[0]->newq('CQTokPrefixSet',"", $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
499 0 ▶ | s_index '=' '{' l_set RBRACE_STAR { $_[0]->newq('CQTokPrefixSet',$_[1], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
500 ;
501  
502 qw_suffix_set:
503 0 ▶ STAR_LBRACE l_set '}' { $_[0]->newq('CQTokSuffixSet',"", $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
504 0 ▶ | s_index '=' STAR_LBRACE l_set '}' { $_[0]->newq('CQTokSuffixSet',$_[1], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
505 ;
506  
507 qw_thesaurus:
508 0 ▶ COLON_LBRACE s_semclass '}' { $_[0]->newq('CQTokThes', "Thes",$_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
509 0 ▶ | s_index '=' ':' '{' s_semclass '}' { $_[0]->newq('CQTokThes', $_[1], $_[5]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
510 ;
511  
512 qw_morph:
513 0 ▶ '[' l_morph ']' { $_[0]->newq('CQTokMorph', "MorphPattern", $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
514 0 ▶ | s_index '=' '[' l_morph ']' { $_[0]->newq('CQTokMorph', $_[1], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
515 ;
516  
517 qw_lemma:
518 0 ▶ '%' s_lemma { $_[0]->newq('CQTokLemma', "Lemma", $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
519 0 ▶ | s_index '=' '%' s_lemma { $_[0]->newq('CQTokLemma', $_[1], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
520 ;
521  
522 qw_chunk:
523 0 ▶ '^' s_chunk { $_[0]->newq('CQTokChunk', "", $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
524 0 ▶ | s_index '=' '^' s_chunk { $_[0]->newq('CQTokChunk', $_[1], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
525 ;
526  
527 qw_anchor:
528 0 ▶ DOLLAR_DOT '=' int_str { $_[0]->newq('CQTokAnchor', "", $_[3]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
529 0 ▶ | DOLLAR_DOT symbol '=' int_str { $_[0]->newq('CQTokAnchor', $_[2], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
530 ;
531  
532 qw_listfile:
533 0 ▶ '<' s_filename { $_[0]->newq('CQTokFile', "", $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
534 0 ▶ | s_index '=' '<' s_filename { $_[0]->newq('CQTokFile', $_[1], $_[4]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
535 ;
536  
537 qw_with:
538 2 ▶ qc_word WITH qc_word { $_[0]->newq('CQWith', $_[1],$_[3]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
539 ;
540  
541 qw_without:
542 2 ▶ qc_word WITHOUT qc_word { $_[0]->newq('CQWithout', $_[1],$_[3]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
543 ;
544  
545 qw_withor:
546 2 ▶ qc_word WITHOR qc_word { $_[0]->newq('CQWithor', $_[1],$_[3]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
547 ;
548  
549 qw_keys:
550 0 ▶ KEYS '(' qwk_countsrc ')' { $_[0]->newKeysQuery($_[3][0], $_[3][1]); }
Subroutine __ANON__: not called CC=1 SCAR=6.9
551 0 ▶ | qwk_indextuple '=' KEYS '(' qwk_countsrc ')' { $_[0]->newKeysQuery($_[5][0], $_[5][1], $_[1]); }
Subroutine __ANON__: not called CC=1 SCAR=6.9
552 ;
553  
554 qwk_indextuple:
555 0 ▶ '$' '(' l_indextuple ')' { $_[3] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
556 ;
557  
558 ##-- qwk_countsrc: [$qCount, \%keysOpts]
559 qwk_countsrc:
560 0 ▶ count_query { [$_[1], {}] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
561 0 ▶ | query_conditions count_filters { [$_[0]->newCountQuery($_[1], $_[2]), $_[2]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
562 ;
563  
564 qw_matchid:
565 30 ▶ qc_word matchid { $_[1]->SetMatchId($_[2]); $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
566 ;
567  
568  
569 ##-------------------------------------------------------------
570 ## l_*: List-like constituents
571  
572 l_set:
573 4 ▶ { [] } ##-- empty
Subroutine __ANON__: called CC=1 SCAR=0.0
574 8 ▶ | l_set s_word { push(@{$_[1]}, $_[2]); $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
575 4 ▶ | l_set ',' { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
576 # | l_set ';' { $_[1] }
577 ;
578  
579 l_morph:
580 0 ▶ { [] } ##-- empty
Subroutine __ANON__: not called CC=1 SCAR=6.9
581 0 ▶ | l_morph s_morphitem { push(@{$_[1]}, $_[2]); $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
582 0 ▶ | l_morph ',' { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
583 0 ▶ | l_morph ';' { $_[1] } ##-- backwards-compatible
Subroutine __ANON__: not called CC=1 SCAR=6.9
584 ;
585  
586 l_phrase :
587 2 ▶ qc_word { $_[0]->newq('CQSeq', [$_[1]]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
588 0 ▶ | l_phrase qc_word { $_[1]->Append($_[2]); $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
589 2 ▶ | l_phrase '#' integer qc_word { $_[1]->Append($_[4], $_[3]); $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
590 0 ▶ | l_phrase HASH_LESS integer qc_word { $_[1]->Append($_[4], $_[3], '<'); $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
591 0 ▶ | l_phrase HASH_GREATER integer qc_word { $_[1]->Append($_[4], $_[3], '>'); $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
592 2 ▶ | l_phrase HASH_EQUAL integer qc_word { $_[1]->Append($_[4], $_[3], '='); $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
593 ;
594  
595 l_txchain:
596 231 ▶ { []; } ##-- empty
Subroutine __ANON__: called CC=1 SCAR=0.0
597 4 ▶ | l_txchain s_expander { push(@{$_[1]}, $_[2]); $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
598 ;
599  
600 ##-- l_countkeys: CQCountKeyExprList
601 l_countkeys:
602 0 ▶ { $_[0]->newq('CQCountKeyExprList') }
Subroutine __ANON__: not called CC=1 SCAR=6.9
603 28 ▶ | count_key { $_[0]->newq('CQCountKeyExprList', Exprs=>[$_[1]]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
604 2 ▶ | l_countkeys ',' count_key { $_[1]->PushKey($_[3]); $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
605 ;
606  
607 ##-- l_prunekeys: CQCountKeyExprList
608 l_prunekeys:
609 4 ▶ { $_[0]->newq('CQCountKeyExprList') }
Subroutine __ANON__: called CC=1 SCAR=0.0
610 0 ▶ | prune_key { $_[0]->newq('CQCountKeyExprList', Exprs=>[$_[1]]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
611 4 ▶ | l_prunekeys ',' prune_key { $_[1]->PushKey($_[3]); $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
612 ;
613  
614 l_indextuple:
615 0 ▶ { [] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
616 0 ▶ | s_indextuple_item { [$_[1]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
617 0 ▶ | l_indextuple ',' s_indextuple_item { push(@{$_[1]},$_[3]); $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
618 ;
619  
620 l_subcorpora:
621 2 ▶ { undef } ##-- empty
Subroutine __ANON__: called CC=1 SCAR=0.0
622 32 ▶ | s_subcorpus { push(@{$_[0]->qopts->{Subcorpora}}, $_[1]); undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
623 18 ▶ | l_subcorpora ',' s_subcorpus { push(@{$_[0]->qopts->{Subcorpora}}, $_[3]); undef }
Subroutine __ANON__: called CC=1 SCAR=0.0
624 ;
625  
626 ##-------------------------------------------------------------
627 ## count_key, prune_key: count- and prune-key expressions
628  
629 count_key:
630 0 ▶ count_key_const { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
631 12 ▶ | count_key_meta { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
632 18 ▶ | count_key_token { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
633 2 ▶ | count_key '~' replace_regex { $_[0]->newq('CQCountKeyExprRegex', $_[1],@{$_[3]}) }
Subroutine __ANON__: called CC=1 SCAR=0.0
634 0 ▶ | '(' count_key ')' { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
635 ;
636  
637 prune_key:
638 0 ▶ count_key_const { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
639 4 ▶ | count_key_meta { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
640 0 ▶ | prune_key '~' replace_regex { $_[0]->newq('CQCountKeyExprRegex', $_[1],@{$_[3]}) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
641 0 ▶ | '(' prune_key ')' { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
642 ;
643  
644 count_key_const:
645 0 ▶ '*' { $_[0]->newq('CQCountKeyExprConstant', "*") }
Subroutine __ANON__: not called CC=1 SCAR=6.9
646 0 ▶ | '@' symbol { $_[0]->newq('CQCountKeyExprConstant', $_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
647 ;
648  
649 count_key_meta:
650 0 ▶ KW_FILEID { $_[0]->newq('CQCountKeyExprFileId', $_[1]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
651 0 ▶ | KW_FILENAME { $_[0]->newq('CQCountKeyExprFileName', $_[1]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
652 0 ▶ | KW_DATE { $_[0]->newq('CQCountKeyExprDate', $_[1]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
653 2 ▶ | KW_DATE '/' integer { $_[0]->newq('CQCountKeyExprDateSlice', $_[1],$_[3]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
654 14 ▶ | s_biblname { $_[0]->newq('CQCountKeyExprBibl', $_[1]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
655 ;
656  
657 count_key_token:
658 18 ▶ s_index ck_matchid ck_offset { $_[0]->newq('CQCountKeyExprToken', $_[1],$_[2],$_[3]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
659 ;
660  
661 ck_matchid:
662 8 ▶ { 0 } ##-- empty
Subroutine __ANON__: called CC=1 SCAR=0.0
663 10 ▶ | matchid { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
664 ;
665  
666 ck_offset:
667 2 ▶ { 0 } ##-- empty
Subroutine __ANON__: called CC=1 SCAR=0.0
668 16 ▶ | integer { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
669 0 ▶ | '+' integer { $_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
670 0 ▶ | '-' integer { -$_[2] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
671 ;
672  
673  
674 ##-------------------------------------------------------------
675 ## s_*: semantic sugar for symbols
676  
677 s_index:
678 0 ▶ '$' { '' }
Subroutine __ANON__: not called CC=1 SCAR=6.9
679 24 ▶ | index { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
680 ;
681  
682 s_indextuple_item:
683 0 ▶ s_index { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
684 0 ▶ | symbol { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
685 ;
686  
687 243 ▶s_word: symbol { $_[1] } ;
Subroutine __ANON__: called CC=1 SCAR=0.0
688 0 ▶s_semclass: symbol { $_[1] } ;
Subroutine __ANON__: not called CC=1 SCAR=6.9
689 0 ▶s_lemma: symbol { $_[1] } ;
Subroutine __ANON__: not called CC=1 SCAR=6.9
690 0 ▶s_chunk: symbol { $_[1] } ;
Subroutine __ANON__: not called CC=1 SCAR=6.9
691 0 ▶s_filename: symbol { $_[1] } ;
Subroutine __ANON__: not called CC=1 SCAR=6.9
692 0 ▶s_morphitem: symbol { $_[1] } ;
Subroutine __ANON__: not called CC=1 SCAR=6.9
693 50 ▶s_subcorpus: symbol { $_[1] } ;
Subroutine __ANON__: called CC=1 SCAR=0.0
694 16 ▶s_biblname: symbol { $_[1] } ;
Subroutine __ANON__: called CC=1 SCAR=0.0
695  
696 0 ▶s_breakname: symbol { $_[1] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
697 2 ▶ | KW_FILENAME { "file" }
Subroutine __ANON__: called CC=1 SCAR=0.0
698 ;
699  
700  
701 ##-------------------------------------------------------------
702 ## Preterminals
703  
704 symbol:
705 316 ▶ SYMBOL { unescape($_[1]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
706 8 ▶ | INTEGER { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
707 4 ▶ | DATE { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
708 ;
709  
710 index:
711 0 ▶ '$' { '' }
Subroutine __ANON__: not called CC=1 SCAR=6.9
712 24 ▶ | INDEX { unescape($_[1]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
713 ;
714  
715 0 ▶sym_str: SYMBOL { unescape($_[1]) } ;
Subroutine __ANON__: not called CC=1 SCAR=6.9
716  
717 4 ▶s_prefix: PREFIX { unescape($_[1]) } ;
Subroutine __ANON__: called CC=1 SCAR=0.0
718 0 ▶s_suffix: SUFFIX { unescape($_[1]) } ;
Subroutine __ANON__: not called CC=1 SCAR=6.9
719 0 ▶s_infix: INFIX { unescape($_[1]) } ;
Subroutine __ANON__: not called CC=1 SCAR=6.9
720  
721 4 ▶s_expander: EXPANDER { unescape($_[1]) } ;
Subroutine __ANON__: called CC=1 SCAR=0.0
722  
723 regex:
724 11 ▶ REGEX { $_[0]->newre($_[1]) }
Subroutine __ANON__: called CC=1 SCAR=0.0
725 0 ▶ | REGEX REGOPT { $_[0]->newre($_[1],$_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
726 ;
727  
728 neg_regex:
729 0 ▶ NEG_REGEX { $_[0]->newre($_[1]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
730 0 ▶ | NEG_REGEX REGOPT { $_[0]->newre($_[1],$_[2]) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
731 ;
732  
733 ##-- replace_regex: [$pattern,$replacement,$modifiers]
734 2 ▶replace_regex: REGEX_SEARCH REGEX_REPLACE { [$_[1],$_[2],''] }
Subroutine __ANON__: called CC=1 SCAR=0.0
735 0 ▶ | REGEX_SEARCH REGEX_REPLACE REGOPT { [$_[1],$_[2],$_[3]] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
736 ;
737  
738 70 ▶int_str: INTEGER { $_[1] } ;
Subroutine __ANON__: called CC=1 SCAR=0.0
739  
740 20 ▶integer: int_str { no warnings 'numeric'; ($_[1]+0) } ;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
741  
742 date:
743 8 ▶ DATE { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
744 12 ▶ | INTEGER { $_[1] }
Subroutine __ANON__: called CC=1 SCAR=0.0
745 ;
746  
747 40 ▶matchid: matchid_eq integer { $_[0]->yybegin('INITIAL'); $_[2] } ;
Subroutine __ANON__: called CC=1 SCAR=0.0
748  
749 40 ▶matchid_eq: '=' { $_[0]->yybegin('Q_MATCHID'); $_[1] } ;
Subroutine __ANON__: called CC=1 SCAR=0.0
750 15  
751 %%
752 ##############################################################
753 15 # Footer Section
754 ###############################################################
755  
756 package DDC::PP::yyqparser;
757 #require Exporter;
758  
759 ## $q = $yyqparser->newq($querySubclass, @queryArgs)
760 ## + just wraps DDC::PP::CQueryCompiler::newq
761 391 ▶sub newq {
Subroutine newq: called CC=1 SCAR=0.0
Pod undocumented
762 391 return $_[0]{USER}{qc}->newq(@_[1..$#_]);
763 }
764  
765 ## $qf = $yyqparser->newf($filterSubclass, @filterArgs)
766 ## + wraps DDC::PP::CQueryCompiler::newf and pushes filter onto current options' filter-list
767 20 ▶sub newf {
Subroutine newf: called CC=1 SCAR=0.0
Pod undocumented
768 20 my $f = $_[0]{USER}{qc}->newf(@_[1..$#_]);
769 20 push(@{$_[0]->qopts->{Filters}}, $f);
770 20 return $f;
771 }
772  
773 ## $cf = $yyqparser->newCFilter($filterSortType, $defaultOffset, \@args)
774 0 ▶sub newCFilter {
Subroutine newCFilter: not called CC=2 SCAR=17.9
Pod undocumented
775 0 my ($qp,$type,$off,$args) = @_;
776 #print STDERR "newCFilter: ", Data::Dumper->Dump([@_[1..$#_]]), "\n"; ##-- DEBUG
777 0 ▶ $args->[2] = $off if (!defined($args->[2]));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args->[2] 0 0 0
778 0 return $qp->newf('CQFContextSort', $type, @$args);
779 }
780  
781 ## $qc = $yyqparser->newCountQuery($qSrc, \%qcOpts)
782 28 ▶sub newCountQuery {
Subroutine newCountQuery: called CC=4 SCAR=14.1
Pod undocumented
783 28 my ($qp,$qsrc,$qcopts) = @_;
784 28 $qp->SetQuery($qsrc);
785 28 my $qc = $qp->newq('CQCount', $qsrc);
786 28 ▶ foreach my $key (keys %{$qcopts||{}}) {
Condition50%1/2
$qcopts || {}
l!l
280
MC/DC0%0/1
$qcopts || {}
$qcopts
Truth table50%1/2
A
A= $qcopts
Aresult
11
00
787 34 ▶ $qc->can("set$key")->($qc, $qcopts->{$key}) if ($qc->can("set$key"));
Branch: 1 branch
BranchTrueFalseTotal
if $qc->can("set$key") 34 0 34
788 }
789 28 return $qc;
790 }
791  
792 ## $qk = $yyqparser->newKeysQuery($qCount, \%qcOpts, $indexTuple)
793 0 ▶sub newKeysQuery {
Subroutine newKeysQuery: not called CC=2 SCAR=17.9
Pod undocumented
794 0 my ($qp,$qcount,$qcopts,$ituple) = @_;
795 0 ▶ return $qp->newq('CQKeys', $qcount, ($qcopts||{})->{Limit}, $ituple);
Condition0%0/2
$qcopts || {}
l!l
00
MC/DC0%0/1
$qcopts || {}
$qcopts
Truth table0%0/2
A
A= $qcopts
Aresult
11
00
796 }
797  
798 ## $re = $yyqparser->newre($regex, $regopt)
799 ## + wraps DDC::PP::CQueryCompiler::newre
800 11 ▶sub newre {
Subroutine newre: called CC=1 SCAR=0.0
Pod undocumented
801 11 return $_[0]{USER}{qc}->newre(@_[1..$#_]);
802 }
803  
804 ## $qo = $yyqparser->qopts()
805 ## + just wraps DDC::PP::CQueryCompiler::qopts()
806 606 ▶sub qopts {
Subroutine qopts: called CC=1 SCAR=0.0
Pod undocumented
807 606 return $_[0]{USER}{qc}->qopts(@_[1..$#_])
808 }
809  
810 ## $q = $yyqparser->SetQuery($q)
811 ## + sets compiler query and assigns its options
812 239 ▶sub SetQuery {
Subroutine SetQuery: called CC=2 SCAR=7.1
Pod undocumented
813 239 ▶ $_[1]->setOptions($_[0]->qopts) if ($_[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] 239 0 239
814 239 $_[0]->qopts(DDC::PP::CQueryOptions->new);
815 239 $_[0]{USER}{qc}->setQuery($_[1]);
816 }
817  
818 ## undef = $yyqparser->yycarp($message_template,\%macros)
819 0 ▶sub yycarp {
Subroutine yycarp: not called CC=1 SCAR=6.9
Pod documented
820 0 die($_[0]{USER}{qc}->setError(@_[1..$#_]));
821 }
822  
823 ## undef = $yyqparser->yybegin($q)
824 80 ▶sub yybegin {
Subroutine yybegin: called CC=1 SCAR=0.0
Pod undocumented
825 80 $_[0]{USER}{qc}{lexer}{state} = $_[1];
826 }
827  
828 ### $esc = $yyqparser->unescape($sym)
829 ### + wraps DDC::Query::Parser::unescape($sym)
830 #sub unescape {
831 # return $_[0]{USER}{qc}->unescape($_[1]);
832 #}
833  
834 1; ##-- be happy
835  
836 __END__
« blib/lib/DDC/Utils.pm ↑ Summary blib/lib/DDC/PP.pm »