ferret 0.10.14 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/index.h CHANGED
@@ -14,6 +14,7 @@
14
14
 
15
15
  typedef struct IndexReader IndexReader;
16
16
  typedef struct MultiReader MultiReader;
17
+ typedef struct Deleter Deleter;
17
18
 
18
19
  /****************************************************************************
19
20
  *
@@ -130,6 +131,7 @@ extern void fi_deref(FieldInfo *fi);
130
131
  ****************************************************************************/
131
132
 
132
133
  #define FIELD_INFOS_INIT_CAPA 4
134
+ /* carry changes over to dummy_fis in test/test_segments.c */
133
135
  typedef struct FieldInfos
134
136
  {
135
137
  int store;
@@ -147,8 +149,8 @@ extern FieldInfo *fis_add_field(FieldInfos *fis, FieldInfo *fi);
147
149
  extern FieldInfo *fis_get_field(FieldInfos *fis, const char *name);
148
150
  extern int fis_get_field_num(FieldInfos *fis, const char *name);
149
151
  extern FieldInfo *fis_get_or_add_field(FieldInfos *fis, const char *name);
150
- extern void fis_write(FieldInfos *fis, Store *store);
151
- extern FieldInfos *fis_read(Store *store);
152
+ extern void fis_write(FieldInfos *fis, OutStream *os);
153
+ extern FieldInfos *fis_read(InStream *is);
152
154
  extern char *fis_to_s(FieldInfos *fis);
153
155
  extern void fis_deref(FieldInfos *fis);
154
156
 
@@ -159,19 +161,26 @@ extern void fis_deref(FieldInfos *fis);
159
161
  ****************************************************************************/
160
162
 
161
163
  #define SEGMENT_NAME_MAX_LENGTH 100
164
+ #define SEGMENTS_FILE_NAME "segments"
162
165
 
163
166
  typedef struct SegmentInfo
164
167
  {
168
+ int ref_cnt;
165
169
  char *name;
166
- int doc_cnt;
167
170
  Store *store;
171
+ int doc_cnt;
172
+ int del_gen;
173
+ int *norm_gens;
174
+ int norm_gens_size;
175
+ bool use_compound_file;
168
176
  } SegmentInfo;
169
177
 
170
178
  extern SegmentInfo *si_new(char *name, int doc_cnt, Store *store);
171
- extern void si_destroy(SegmentInfo *si);
179
+ extern void si_deref(SegmentInfo *si);
172
180
  extern bool si_has_deletions(SegmentInfo *si);
173
181
  extern bool si_uses_compound_file(SegmentInfo *si);
174
182
  extern bool si_has_separate_norms(SegmentInfo *si);
183
+ extern void si_advance_norm_gen(SegmentInfo *si, int field_num);
175
184
 
176
185
  /****************************************************************************
177
186
  *
@@ -181,25 +190,32 @@ extern bool si_has_separate_norms(SegmentInfo *si);
181
190
 
182
191
  typedef struct SegmentInfos
183
192
  {
193
+ FieldInfos *fis;
184
194
  f_u64 counter;
185
195
  f_u64 version;
186
- f_u32 format;
196
+ f_i64 generation;
197
+ f_i32 format;
187
198
  Store *store;
188
199
  SegmentInfo **segs;
189
200
  int size;
190
201
  int capa;
191
202
  } SegmentInfos;
192
203
 
193
- extern SegmentInfos *sis_new();
204
+ extern char *fn_for_generation(char *buf, char *base, char *ext, f_i64 gen);
205
+
206
+ extern SegmentInfos *sis_new(FieldInfos *fis);
194
207
  extern SegmentInfo *sis_new_segment(SegmentInfos *sis, int dcnt, Store *store);
195
208
  extern SegmentInfo *sis_add_si(SegmentInfos *sis, SegmentInfo *si);
196
209
  extern void sis_del_at(SegmentInfos *sis, int at);
197
210
  extern void sis_del_from_to(SegmentInfos *sis, int from, int to);
198
211
  extern void sis_clear(SegmentInfos *sis);
199
212
  extern SegmentInfos *sis_read(Store *store);
200
- extern void sis_write(SegmentInfos *sis, Store *store);
213
+ extern void sis_write(SegmentInfos *sis, Store *store, Deleter *deleter);
201
214
  extern f_u64 sis_read_current_version(Store *store);
202
215
  extern void sis_destroy(SegmentInfos *sis);
216
+ extern f_i64 sis_current_segment_generation(Store *store);
217
+ extern char *sis_curr_seg_file_name(char *buf, Store *store);
218
+ extern void sis_put(SegmentInfos *sis, FILE *stream);
203
219
 
204
220
  /****************************************************************************
205
221
  *
@@ -394,7 +410,7 @@ typedef struct SegmentTermDocEnum SegmentTermDocEnum;
394
410
  struct SegmentTermDocEnum
395
411
  {
396
412
  TermDocEnum tde;
397
- void (*seek_prox)(SegmentTermDocEnum *stde, int prx_ptr);
413
+ void (*seek_prox)(SegmentTermDocEnum *stde, off_t prx_ptr);
398
414
  void (*skip_prox)(SegmentTermDocEnum *stde);
399
415
  TermInfosReader *tir;
400
416
  InStream *frq_in;
@@ -409,11 +425,11 @@ struct SegmentTermDocEnum
409
425
  int skip_interval;
410
426
  int skip_count;
411
427
  int skip_doc;
412
- int frq_ptr;
413
- int prx_ptr;
414
- int skip_ptr;
415
428
  int prx_cnt;
416
429
  int position;
430
+ off_t frq_ptr;
431
+ off_t prx_ptr;
432
+ off_t skip_ptr;
417
433
  bool have_skipped : 1;
418
434
  };
419
435
 
@@ -683,6 +699,31 @@ extern void fw_add_postings(FieldsWriter *fw,
683
699
  int offset_count);
684
700
  extern void fw_write_tv_index(FieldsWriter *fw);
685
701
 
702
+ /****************************************************************************
703
+ *
704
+ * Deleter
705
+ *
706
+ * A utility class (used by both IndexReader and IndexWriter) to keep track of
707
+ * files that need to be deleted because they are no longer referenced by the
708
+ * index.
709
+ *
710
+ ****************************************************************************/
711
+
712
+ struct Deleter
713
+ {
714
+ Store *store;
715
+ SegmentInfos *sis;
716
+ HashSet *pending;
717
+ };
718
+
719
+ extern Deleter *deleter_new(SegmentInfos *sis, Store *store);
720
+ extern void deleter_destroy(Deleter *dlr);
721
+ extern void deleter_clear_pending_files(Deleter *dlr);
722
+ extern void deleter_delete_file(Deleter *dlr, char *file_name);
723
+ extern void deleter_find_deletable_files(Deleter *dlr);
724
+ extern void deleter_commit_pending_files(Deleter *dlr);
725
+ extern void deleter_delete_files(Deleter *dlr, char **files, int file_cnt);
726
+
686
727
  /****************************************************************************
687
728
  *
688
729
  * IndexReader
@@ -718,9 +759,11 @@ struct IndexReader
718
759
  uchar val);
719
760
  void (*delete_doc_i)(IndexReader *ir, int doc_num);
720
761
  void (*undelete_all_i)(IndexReader *ir);
762
+ void (*set_deleter_i)(IndexReader *ir, Deleter *dlr);
721
763
  void (*commit_i)(IndexReader *ir);
722
764
  void (*close_i)(IndexReader *ir);
723
765
  int ref_cnt;
766
+ Deleter *deleter;
724
767
  Store *store;
725
768
  Lock *write_lock;
726
769
  SegmentInfos *sis;
@@ -824,7 +867,7 @@ typedef struct IndexWriter IndexWriter;
824
867
  typedef struct DocWriter
825
868
  {
826
869
  Store *store;
827
- const char *segment;
870
+ SegmentInfo *si;
828
871
  FieldInfos *fis;
829
872
  TermVectorsWriter *tvw;
830
873
  FieldsWriter *fw;
@@ -843,10 +886,10 @@ typedef struct DocWriter
843
886
  int max_buffered_docs;
844
887
  } DocWriter;
845
888
 
846
- extern DocWriter *dw_open(IndexWriter *is, const char *segment);
889
+ extern DocWriter *dw_open(IndexWriter *is, SegmentInfo *si);
847
890
  extern void dw_close(DocWriter *dw);
848
891
  extern void dw_add_doc(DocWriter *dw, Document *doc);
849
- extern void dw_new_segment(DocWriter *dw, char *segment);
892
+ extern void dw_new_segment(DocWriter *dw, SegmentInfo *si);
850
893
 
851
894
  /****************************************************************************
852
895
  *
@@ -871,9 +914,11 @@ struct IndexWriter
871
914
  DocWriter *dw;
872
915
  Similarity *similarity;
873
916
  Lock *write_lock;
917
+ Deleter *deleter;
874
918
  };
875
919
 
876
920
  extern void index_create(Store *store, FieldInfos *fis);
921
+ extern bool index_is_locked(Store *store);
877
922
  extern IndexWriter *iw_open(Store *store, volatile Analyzer *analyzer,
878
923
  const Config *config);
879
924
  extern void iw_delete_term(IndexWriter *iw, const char *field,
data/ext/q_boolean.c CHANGED
@@ -1326,10 +1326,11 @@ static MatchVector *bq_get_matchv_i(Query *self, MatchVector *mv,
1326
1326
  static Query *bq_rewrite(Query *self, IndexReader *ir)
1327
1327
  {
1328
1328
  int i;
1329
-
1329
+ const int clause_cnt = BQ(self)->clause_cnt;
1330
1330
  bool rewritten = false;
1331
+ bool has_non_prohibited_clause = false;
1331
1332
 
1332
- if (BQ(self)->clause_cnt == 1) {
1333
+ if (clause_cnt == 1) {
1333
1334
  /* optimize 1-clause queries */
1334
1335
  BooleanClause *clause = BQ(self)->clauses[0];
1335
1336
  if (! clause->is_prohibited) {
@@ -1357,18 +1358,21 @@ static Query *bq_rewrite(Query *self, IndexReader *ir)
1357
1358
 
1358
1359
  self->ref_cnt++;
1359
1360
  /* replace each clause's query with its rewritten query */
1360
- for (i = 0; i < BQ(self)->clause_cnt; i++) {
1361
+ for (i = 0; i < clause_cnt; i++) {
1361
1362
  BooleanClause *clause = BQ(self)->clauses[i];
1362
1363
  Query *rq = clause->query->rewrite(clause->query, ir);
1364
+ /* check for at least one non-prohibited clause */
1365
+ if (clause->is_prohibited == false) has_non_prohibited_clause = true;
1363
1366
  if (rq != clause->query) {
1364
1367
  if (!rewritten) {
1365
1368
  int j;
1366
1369
  Query *new_self = q_new(BooleanQuery);
1367
1370
  memcpy(new_self, self, sizeof(BooleanQuery));
1368
- BQ(new_self)->clauses = ALLOC_N(BooleanClause *, BQ(self)->clause_capa);
1371
+ BQ(new_self)->clauses = ALLOC_N(BooleanClause *,
1372
+ BQ(self)->clause_capa);
1369
1373
  memcpy(BQ(new_self)->clauses, BQ(self)->clauses,
1370
1374
  BQ(self)->clause_capa * sizeof(BooleanClause *));
1371
- for (j = 0; j < BQ(self)->clause_cnt; j++) {
1375
+ for (j = 0; j < clause_cnt; j++) {
1372
1376
  REF(BQ(self)->clauses[j]);
1373
1377
  }
1374
1378
  self->ref_cnt--;
@@ -1382,6 +1386,9 @@ static Query *bq_rewrite(Query *self, IndexReader *ir)
1382
1386
  DEREF(rq);
1383
1387
  }
1384
1388
  }
1389
+ if (clause_cnt > 0 && !has_non_prohibited_clause) {
1390
+ bq_add_query_nr(self, maq_new(), BC_MUST);
1391
+ }
1385
1392
 
1386
1393
  return self;
1387
1394
  }
data/ext/q_parser.c CHANGED
@@ -1,7 +1,9 @@
1
- /* A Bison parser, made by GNU Bison 2.1. */
1
+ /* A Bison parser, made by GNU Bison 2.3. */
2
2
 
3
- /* Skeleton parser for Yacc-like parsing with Bison,
4
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3
+ /* Skeleton implementation for Bison's Yacc-like parsers in C
4
+
5
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
+ Free Software Foundation, Inc.
5
7
 
6
8
  This program is free software; you can redistribute it and/or modify
7
9
  it under the terms of the GNU General Public License as published by
@@ -18,13 +20,21 @@
18
20
  Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
21
  Boston, MA 02110-1301, USA. */
20
22
 
21
- /* As a special exception, when this file is copied by Bison into a
22
- Bison output file, you may use that output file without restriction.
23
- This special exception was added by the Free Software Foundation
24
- in version 1.24 of Bison. */
23
+ /* As a special exception, you may create a larger work that contains
24
+ part or all of the Bison parser skeleton and distribute that work
25
+ under terms of your choice, so long as that work isn't itself a
26
+ parser generator using the skeleton or a modified version thereof
27
+ as a parser skeleton. Alternatively, if you modify or redistribute
28
+ the parser skeleton itself, you may (at your option) remove this
29
+ special exception, which will cause the skeleton and the resulting
30
+ Bison output files to be licensed under the GNU General Public
31
+ License without this special exception.
32
+
33
+ This special exception was added by the Free Software Foundation in
34
+ version 2.2 of Bison. */
25
35
 
26
- /* Written by Richard Stallman by simplifying the original so called
27
- ``semantic'' parser. */
36
+ /* C LALR(1) parser skeleton written by Richard Stallman, by
37
+ simplifying the original so-called "semantic" parser. */
28
38
 
29
39
  /* All symbols defined below should begin with yy or YY, to avoid
30
40
  infringing on user name space. This should be done even for local
@@ -37,7 +47,7 @@
37
47
  #define YYBISON 1
38
48
 
39
49
  /* Bison version. */
40
- #define YYBISON_VERSION "2.1"
50
+ #define YYBISON_VERSION "2.3"
41
51
 
42
52
  /* Skeleton name. */
43
53
  #define YYSKELETON_NAME "yacc.c"
@@ -125,18 +135,20 @@ int qp_default_fuzzy_pre_len = 0;
125
135
  # define YYTOKEN_TABLE 0
126
136
  #endif
127
137
 
128
- #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
138
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
139
+ typedef union YYSTYPE
129
140
  #line 26 "src/q_parser.y"
130
- typedef union YYSTYPE {
141
+ {
131
142
  Query *query;
132
143
  BooleanClause *bcls;
133
144
  BCArray *bclss;
134
145
  HashSet *hashset;
135
146
  Phrase *phrase;
136
147
  char *str;
137
- } YYSTYPE;
138
- /* Line 196 of yacc.c. */
139
- #line 140 "y.tab.c"
148
+ }
149
+ /* Line 193 of yacc.c. */
150
+ #line 151 "y.tab.c"
151
+ YYSTYPE;
140
152
  # define yystype YYSTYPE /* obsolescent; will be withdrawn */
141
153
  # define YYSTYPE_IS_DECLARED 1
142
154
  # define YYSTYPE_IS_TRIVIAL 1
@@ -199,23 +211,56 @@ static Query *get_r_q(QParser *qp, char *field, char *from, char *to,
199
211
  } while (0)
200
212
 
201
213
 
202
- /* Line 219 of yacc.c. */
203
- #line 204 "y.tab.c"
214
+ /* Line 216 of yacc.c. */
215
+ #line 216 "y.tab.c"
204
216
 
205
- #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
206
- # define YYSIZE_T __SIZE_TYPE__
217
+ #ifdef short
218
+ # undef short
207
219
  #endif
208
- #if ! defined (YYSIZE_T) && defined (size_t)
209
- # define YYSIZE_T size_t
220
+
221
+ #ifdef YYTYPE_UINT8
222
+ typedef YYTYPE_UINT8 yytype_uint8;
223
+ #else
224
+ typedef unsigned char yytype_uint8;
210
225
  #endif
211
- #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
212
- # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
213
- # define YYSIZE_T size_t
226
+
227
+ #ifdef YYTYPE_INT8
228
+ typedef YYTYPE_INT8 yytype_int8;
229
+ #elif (defined __STDC__ || defined __C99__FUNC__ \
230
+ || defined __cplusplus || defined _MSC_VER)
231
+ typedef signed char yytype_int8;
232
+ #else
233
+ typedef short int yytype_int8;
214
234
  #endif
215
- #if ! defined (YYSIZE_T)
216
- # define YYSIZE_T unsigned int
235
+
236
+ #ifdef YYTYPE_UINT16
237
+ typedef YYTYPE_UINT16 yytype_uint16;
238
+ #else
239
+ typedef unsigned short int yytype_uint16;
217
240
  #endif
218
241
 
242
+ #ifdef YYTYPE_INT16
243
+ typedef YYTYPE_INT16 yytype_int16;
244
+ #else
245
+ typedef short int yytype_int16;
246
+ #endif
247
+
248
+ #ifndef YYSIZE_T
249
+ # ifdef __SIZE_TYPE__
250
+ # define YYSIZE_T __SIZE_TYPE__
251
+ # elif defined size_t
252
+ # define YYSIZE_T size_t
253
+ # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
254
+ || defined __cplusplus || defined _MSC_VER)
255
+ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
256
+ # define YYSIZE_T size_t
257
+ # else
258
+ # define YYSIZE_T unsigned int
259
+ # endif
260
+ #endif
261
+
262
+ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
263
+
219
264
  #ifndef YY_
220
265
  # if YYENABLE_NLS
221
266
  # if ENABLE_NLS
@@ -228,7 +273,32 @@ static Query *get_r_q(QParser *qp, char *field, char *from, char *to,
228
273
  # endif
229
274
  #endif
230
275
 
231
- #if ! defined (yyoverflow) || YYERROR_VERBOSE
276
+ /* Suppress unused-variable warnings by "using" E. */
277
+ #if ! defined lint || defined __GNUC__
278
+ # define YYUSE(e) ((void) (e))
279
+ #else
280
+ # define YYUSE(e) /* empty */
281
+ #endif
282
+
283
+ /* Identity function, used to suppress warnings about constant conditions. */
284
+ #ifndef lint
285
+ # define YYID(n) (n)
286
+ #else
287
+ #if (defined __STDC__ || defined __C99__FUNC__ \
288
+ || defined __cplusplus || defined _MSC_VER)
289
+ static int
290
+ YYID (int i)
291
+ #else
292
+ static int
293
+ YYID (i)
294
+ int i;
295
+ #endif
296
+ {
297
+ return i;
298
+ }
299
+ #endif
300
+
301
+ #if ! defined yyoverflow || YYERROR_VERBOSE
232
302
 
233
303
  /* The parser invokes alloca or malloc; define the necessary symbols. */
234
304
 
@@ -236,64 +306,76 @@ static Query *get_r_q(QParser *qp, char *field, char *from, char *to,
236
306
  # if YYSTACK_USE_ALLOCA
237
307
  # ifdef __GNUC__
238
308
  # define YYSTACK_ALLOC __builtin_alloca
309
+ # elif defined __BUILTIN_VA_ARG_INCR
310
+ # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
311
+ # elif defined _AIX
312
+ # define YYSTACK_ALLOC __alloca
313
+ # elif defined _MSC_VER
314
+ # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
315
+ # define alloca _alloca
239
316
  # else
240
317
  # define YYSTACK_ALLOC alloca
241
- # if defined (__STDC__) || defined (__cplusplus)
318
+ # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
319
+ || defined __cplusplus || defined _MSC_VER)
242
320
  # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
243
- # define YYINCLUDED_STDLIB_H
321
+ # ifndef _STDLIB_H
322
+ # define _STDLIB_H 1
323
+ # endif
244
324
  # endif
245
325
  # endif
246
326
  # endif
247
327
  # endif
248
328
 
249
329
  # ifdef YYSTACK_ALLOC
250
- /* Pacify GCC's `empty if-body' warning. */
251
- # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
330
+ /* Pacify GCC's `empty if-body' warning. */
331
+ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
252
332
  # ifndef YYSTACK_ALLOC_MAXIMUM
253
333
  /* The OS might guarantee only one guard page at the bottom of the stack,
254
334
  and a page size can be as small as 4096 bytes. So we cannot safely
255
335
  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
256
336
  to allow for a few compiler-allocated temporary stack slots. */
257
- # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
337
+ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
258
338
  # endif
259
339
  # else
260
340
  # define YYSTACK_ALLOC YYMALLOC
261
341
  # define YYSTACK_FREE YYFREE
262
342
  # ifndef YYSTACK_ALLOC_MAXIMUM
263
- # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
343
+ # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
264
344
  # endif
265
- # ifdef __cplusplus
266
- extern "C" {
345
+ # if (defined __cplusplus && ! defined _STDLIB_H \
346
+ && ! ((defined YYMALLOC || defined malloc) \
347
+ && (defined YYFREE || defined free)))
348
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
349
+ # ifndef _STDLIB_H
350
+ # define _STDLIB_H 1
351
+ # endif
267
352
  # endif
268
353
  # ifndef YYMALLOC
269
354
  # define YYMALLOC malloc
270
- # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
271
- && (defined (__STDC__) || defined (__cplusplus)))
355
+ # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
356
+ || defined __cplusplus || defined _MSC_VER)
272
357
  void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
273
358
  # endif
274
359
  # endif
275
360
  # ifndef YYFREE
276
361
  # define YYFREE free
277
- # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
278
- && (defined (__STDC__) || defined (__cplusplus)))
362
+ # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
363
+ || defined __cplusplus || defined _MSC_VER)
279
364
  void free (void *); /* INFRINGES ON USER NAME SPACE */
280
365
  # endif
281
366
  # endif
282
- # ifdef __cplusplus
283
- }
284
- # endif
285
367
  # endif
286
- #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
368
+ #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
287
369
 
288
370
 
289
- #if (! defined (yyoverflow) \
290
- && (! defined (__cplusplus) \
291
- || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
371
+ #if (! defined yyoverflow \
372
+ && (! defined __cplusplus \
373
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
292
374
 
293
375
  /* A type that is properly aligned for any stack member. */
294
376
  union yyalloc
295
377
  {
296
- short int yyss;
378
+ yytype_int16 yyss;
297
379
  YYSTYPE yyvs;
298
380
  };
299
381
 
@@ -303,13 +385,13 @@ union yyalloc
303
385
  /* The size of an array large to enough to hold all stacks, each with
304
386
  N elements. */
305
387
  # define YYSTACK_BYTES(N) \
306
- ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
388
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
307
389
  + YYSTACK_GAP_MAXIMUM)
308
390
 
309
391
  /* Copy COUNT objects from FROM to TO. The source and destination do
310
392
  not overlap. */
311
393
  # ifndef YYCOPY
312
- # if defined (__GNUC__) && 1 < __GNUC__
394
+ # if defined __GNUC__ && 1 < __GNUC__
313
395
  # define YYCOPY(To, From, Count) \
314
396
  __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
315
397
  # else
@@ -320,7 +402,7 @@ union yyalloc
320
402
  for (yyi = 0; yyi < (Count); yyi++) \
321
403
  (To)[yyi] = (From)[yyi]; \
322
404
  } \
323
- while (0)
405
+ while (YYID (0))
324
406
  # endif
325
407
  # endif
326
408
 
@@ -338,28 +420,22 @@ union yyalloc
338
420
  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
339
421
  yyptr += yynewbytes / sizeof (*yyptr); \
340
422
  } \
341
- while (0)
423
+ while (YYID (0))
342
424
 
343
425
  #endif
344
426
 
345
- #if defined (__STDC__) || defined (__cplusplus)
346
- typedef signed char yysigned_char;
347
- #else
348
- typedef short int yysigned_char;
349
- #endif
350
-
351
- /* YYFINAL -- State number of the termination state. */
427
+ /* YYFINAL -- State number of the termination state. */
352
428
  #define YYFINAL 39
353
429
  /* YYLAST -- Last index in YYTABLE. */
354
430
  #define YYLAST 126
355
431
 
356
- /* YYNTOKENS -- Number of terminals. */
432
+ /* YYNTOKENS -- Number of terminals. */
357
433
  #define YYNTOKENS 26
358
- /* YYNNTS -- Number of nonterminals. */
434
+ /* YYNNTS -- Number of nonterminals. */
359
435
  #define YYNNTS 16
360
- /* YYNRULES -- Number of rules. */
436
+ /* YYNRULES -- Number of rules. */
361
437
  #define YYNRULES 51
362
- /* YYNRULES -- Number of states. */
438
+ /* YYNRULES -- Number of states. */
363
439
  #define YYNSTATES 80
364
440
 
365
441
  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
@@ -370,7 +446,7 @@ union yyalloc
370
446
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
371
447
 
372
448
  /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
373
- static const unsigned char yytranslate[] =
449
+ static const yytype_uint8 yytranslate[] =
374
450
  {
375
451
  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
376
452
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -404,7 +480,7 @@ static const unsigned char yytranslate[] =
404
480
  #if YYDEBUG
405
481
  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
406
482
  YYRHS. */
407
- static const unsigned char yyprhs[] =
483
+ static const yytype_uint8 yyprhs[] =
408
484
  {
409
485
  0, 0, 3, 4, 6, 8, 12, 16, 19, 22,
410
486
  25, 27, 29, 33, 35, 38, 42, 44, 46, 48,
@@ -414,8 +490,8 @@ static const unsigned char yyprhs[] =
414
490
  158, 162
415
491
  };
416
492
 
417
- /* YYRHS -- A `-1'-separated list of the rules' RHS. */
418
- static const yysigned_char yyrhs[] =
493
+ /* YYRHS -- A `-1'-separated list of the rules' RHS. */
494
+ static const yytype_int8 yyrhs[] =
419
495
  {
420
496
  27, 0, -1, -1, 28, -1, 29, -1, 28, 7,
421
497
  29, -1, 28, 6, 29, -1, 28, 29, -1, 9,
@@ -437,7 +513,7 @@ static const yysigned_char yyrhs[] =
437
513
  };
438
514
 
439
515
  /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
440
- static const unsigned char yyrline[] =
516
+ static const yytype_uint8 yyrline[] =
441
517
  {
442
518
  0, 102, 102, 103, 105, 106, 107, 108, 110, 111,
443
519
  112, 114, 115, 117, 118, 119, 120, 121, 122, 123,
@@ -450,7 +526,7 @@ static const unsigned char yyrline[] =
450
526
 
451
527
  #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
452
528
  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
453
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
529
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
454
530
  static const char *const yytname[] =
455
531
  {
456
532
  "$end", "error", "$undefined", "QWRD", "WILD_STR", "LOW", "OR", "AND",
@@ -464,7 +540,7 @@ static const char *const yytname[] =
464
540
  # ifdef YYPRINT
465
541
  /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
466
542
  token YYLEX-NUM. */
467
- static const unsigned short int yytoknum[] =
543
+ static const yytype_uint16 yytoknum[] =
468
544
  {
469
545
  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
470
546
  58, 265, 94, 40, 41, 126, 42, 124, 34, 60,
@@ -473,7 +549,7 @@ static const unsigned short int yytoknum[] =
473
549
  # endif
474
550
 
475
551
  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
476
- static const unsigned char yyr1[] =
552
+ static const yytype_uint8 yyr1[] =
477
553
  {
478
554
  0, 26, 27, 27, 28, 28, 28, 28, 29, 29,
479
555
  29, 30, 30, 31, 31, 31, 31, 31, 31, 31,
@@ -484,7 +560,7 @@ static const unsigned char yyr1[] =
484
560
  };
485
561
 
486
562
  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
487
- static const unsigned char yyr2[] =
563
+ static const yytype_uint8 yyr2[] =
488
564
  {
489
565
  0, 2, 0, 1, 1, 3, 3, 2, 2, 2,
490
566
  1, 1, 3, 1, 2, 3, 1, 1, 1, 1,
@@ -497,7 +573,7 @@ static const unsigned char yyr2[] =
497
573
  /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
498
574
  STATE-NUM when YYTABLE doesn't specify something else to do. Zero
499
575
  means the default is an error. */
500
- static const unsigned char yydefact[] =
576
+ static const yytype_uint8 yydefact[] =
501
577
  {
502
578
  2, 20, 23, 0, 0, 0, 26, 0, 0, 0,
503
579
  0, 0, 0, 3, 4, 10, 11, 13, 19, 16,
@@ -509,8 +585,8 @@ static const unsigned char yydefact[] =
509
585
  39, 0, 38, 40, 41, 42, 43, 25, 28, 32
510
586
  };
511
587
 
512
- /* YYDEFGOTO[NTERM-NUM]. */
513
- static const yysigned_char yydefgoto[] =
588
+ /* YYDEFGOTO[NTERM-NUM]. */
589
+ static const yytype_int8 yydefgoto[] =
514
590
  {
515
591
  -1, 12, 13, 14, 15, 16, 17, 18, 19, 77,
516
592
  28, 78, 20, 21, 32, 22
@@ -519,7 +595,7 @@ static const yysigned_char yydefgoto[] =
519
595
  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
520
596
  STATE-NUM. */
521
597
  #define YYPACT_NINF -30
522
- static const yysigned_char yypact[] =
598
+ static const yytype_int8 yypact[] =
523
599
  {
524
600
  83, -4, -30, 102, 102, 64, -30, 7, -2, -1,
525
601
  6, 15, 31, 45, -30, -30, 29, -30, -30, -30,
@@ -532,7 +608,7 @@ static const yysigned_char yypact[] =
532
608
  };
533
609
 
534
610
  /* YYPGOTO[NTERM-NUM]. */
535
- static const yysigned_char yypgoto[] =
611
+ static const yytype_int8 yypgoto[] =
536
612
  {
537
613
  -30, -30, 89, -13, 56, -29, -30, -30, -30, -30,
538
614
  -30, -30, -30, -30, -30, -30
@@ -543,7 +619,7 @@ static const yysigned_char yypgoto[] =
543
619
  number is the opposite. If zero, do what YYDEFACT says.
544
620
  If YYTABLE_NINF, syntax error. */
545
621
  #define YYTABLE_NINF -30
546
- static const yysigned_char yytable[] =
622
+ static const yytype_int8 yytable[] =
547
623
  {
548
624
  42, 33, 35, 59, 61, 44, -29, 55, 56, 37,
549
625
  29, 23, 45, -29, 42, 66, 73, 74, 38, 68,
@@ -560,7 +636,7 @@ static const yysigned_char yytable[] =
560
636
  7, 8, 9, 10, 0, 0, 11
561
637
  };
562
638
 
563
- static const yysigned_char yycheck[] =
639
+ static const yytype_int8 yycheck[] =
564
640
  {
565
641
  13, 3, 3, 3, 3, 10, 10, 22, 23, 3,
566
642
  3, 15, 17, 17, 27, 44, 22, 23, 3, 48,
@@ -579,7 +655,7 @@ static const yysigned_char yycheck[] =
579
655
 
580
656
  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
581
657
  symbol of state STATE-NUM. */
582
- static const unsigned char yystos[] =
658
+ static const yytype_uint8 yystos[] =
583
659
  {
584
660
  0, 3, 4, 8, 9, 13, 16, 18, 19, 20,
585
661
  21, 24, 27, 28, 29, 30, 31, 32, 33, 34,
@@ -616,7 +692,7 @@ do \
616
692
  yychar = (Token); \
617
693
  yylval = (Value); \
618
694
  yytoken = YYTRANSLATE (yychar); \
619
- YYPOPSTACK; \
695
+ YYPOPSTACK (1); \
620
696
  goto yybackup; \
621
697
  } \
622
698
  else \
@@ -624,7 +700,7 @@ do \
624
700
  yyerror (qp, YY_("syntax error: cannot back up")); \
625
701
  YYERROR; \
626
702
  } \
627
- while (0)
703
+ while (YYID (0))
628
704
 
629
705
 
630
706
  #define YYTERROR 1
@@ -639,7 +715,7 @@ while (0)
639
715
  #ifndef YYLLOC_DEFAULT
640
716
  # define YYLLOC_DEFAULT(Current, Rhs, N) \
641
717
  do \
642
- if (N) \
718
+ if (YYID (N)) \
643
719
  { \
644
720
  (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
645
721
  (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
@@ -653,7 +729,7 @@ while (0)
653
729
  (Current).first_column = (Current).last_column = \
654
730
  YYRHSLOC (Rhs, 0).last_column; \
655
731
  } \
656
- while (0)
732
+ while (YYID (0))
657
733
  #endif
658
734
 
659
735
 
@@ -665,8 +741,8 @@ while (0)
665
741
  # if YYLTYPE_IS_TRIVIAL
666
742
  # define YY_LOCATION_PRINT(File, Loc) \
667
743
  fprintf (File, "%d.%d-%d.%d", \
668
- (Loc).first_line, (Loc).first_column, \
669
- (Loc).last_line, (Loc).last_column)
744
+ (Loc).first_line, (Loc).first_column, \
745
+ (Loc).last_line, (Loc).last_column)
670
746
  # else
671
747
  # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
672
748
  # endif
@@ -693,36 +769,99 @@ while (0)
693
769
  do { \
694
770
  if (yydebug) \
695
771
  YYFPRINTF Args; \
696
- } while (0)
772
+ } while (YYID (0))
697
773
 
698
- # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
699
- do { \
700
- if (yydebug) \
701
- { \
702
- YYFPRINTF (stderr, "%s ", Title); \
703
- yysymprint (stderr, \
704
- Type, Value); \
705
- YYFPRINTF (stderr, "\n"); \
706
- } \
707
- } while (0)
774
+ # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
775
+ do { \
776
+ if (yydebug) \
777
+ { \
778
+ YYFPRINTF (stderr, "%s ", Title); \
779
+ yy_symbol_print (stderr, \
780
+ Type, Value, qp); \
781
+ YYFPRINTF (stderr, "\n"); \
782
+ } \
783
+ } while (YYID (0))
784
+
785
+
786
+ /*--------------------------------.
787
+ | Print this symbol on YYOUTPUT. |
788
+ `--------------------------------*/
789
+
790
+ /*ARGSUSED*/
791
+ #if (defined __STDC__ || defined __C99__FUNC__ \
792
+ || defined __cplusplus || defined _MSC_VER)
793
+ static void
794
+ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, QParser *qp)
795
+ #else
796
+ static void
797
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, qp)
798
+ FILE *yyoutput;
799
+ int yytype;
800
+ YYSTYPE const * const yyvaluep;
801
+ QParser *qp;
802
+ #endif
803
+ {
804
+ if (!yyvaluep)
805
+ return;
806
+ YYUSE (qp);
807
+ # ifdef YYPRINT
808
+ if (yytype < YYNTOKENS)
809
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
810
+ # else
811
+ YYUSE (yyoutput);
812
+ # endif
813
+ switch (yytype)
814
+ {
815
+ default:
816
+ break;
817
+ }
818
+ }
819
+
820
+
821
+ /*--------------------------------.
822
+ | Print this symbol on YYOUTPUT. |
823
+ `--------------------------------*/
824
+
825
+ #if (defined __STDC__ || defined __C99__FUNC__ \
826
+ || defined __cplusplus || defined _MSC_VER)
827
+ static void
828
+ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, QParser *qp)
829
+ #else
830
+ static void
831
+ yy_symbol_print (yyoutput, yytype, yyvaluep, qp)
832
+ FILE *yyoutput;
833
+ int yytype;
834
+ YYSTYPE const * const yyvaluep;
835
+ QParser *qp;
836
+ #endif
837
+ {
838
+ if (yytype < YYNTOKENS)
839
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
840
+ else
841
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
842
+
843
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, qp);
844
+ YYFPRINTF (yyoutput, ")");
845
+ }
708
846
 
709
847
  /*------------------------------------------------------------------.
710
848
  | yy_stack_print -- Print the state stack from its BOTTOM up to its |
711
849
  | TOP (included). |
712
850
  `------------------------------------------------------------------*/
713
851
 
714
- #if defined (__STDC__) || defined (__cplusplus)
852
+ #if (defined __STDC__ || defined __C99__FUNC__ \
853
+ || defined __cplusplus || defined _MSC_VER)
715
854
  static void
716
- yy_stack_print (short int *bottom, short int *top)
855
+ yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
717
856
  #else
718
857
  static void
719
858
  yy_stack_print (bottom, top)
720
- short int *bottom;
721
- short int *top;
859
+ yytype_int16 *bottom;
860
+ yytype_int16 *top;
722
861
  #endif
723
862
  {
724
863
  YYFPRINTF (stderr, "Stack now");
725
- for (/* Nothing. */; bottom <= top; ++bottom)
864
+ for (; bottom <= top; ++bottom)
726
865
  YYFPRINTF (stderr, " %d", *bottom);
727
866
  YYFPRINTF (stderr, "\n");
728
867
  }
@@ -731,37 +870,46 @@ yy_stack_print (bottom, top)
731
870
  do { \
732
871
  if (yydebug) \
733
872
  yy_stack_print ((Bottom), (Top)); \
734
- } while (0)
873
+ } while (YYID (0))
735
874
 
736
875
 
737
876
  /*------------------------------------------------.
738
877
  | Report that the YYRULE is going to be reduced. |
739
878
  `------------------------------------------------*/
740
879
 
741
- #if defined (__STDC__) || defined (__cplusplus)
880
+ #if (defined __STDC__ || defined __C99__FUNC__ \
881
+ || defined __cplusplus || defined _MSC_VER)
742
882
  static void
743
- yy_reduce_print (int yyrule)
883
+ yy_reduce_print (YYSTYPE *yyvsp, int yyrule, QParser *qp)
744
884
  #else
745
885
  static void
746
- yy_reduce_print (yyrule)
886
+ yy_reduce_print (yyvsp, yyrule, qp)
887
+ YYSTYPE *yyvsp;
747
888
  int yyrule;
889
+ QParser *qp;
748
890
  #endif
749
891
  {
892
+ int yynrhs = yyr2[yyrule];
750
893
  int yyi;
751
894
  unsigned long int yylno = yyrline[yyrule];
752
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
753
- yyrule - 1, yylno);
754
- /* Print the symbols being reduced, and their result. */
755
- for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
756
- YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
757
- YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
895
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
896
+ yyrule - 1, yylno);
897
+ /* The symbols being reduced. */
898
+ for (yyi = 0; yyi < yynrhs; yyi++)
899
+ {
900
+ fprintf (stderr, " $%d = ", yyi + 1);
901
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
902
+ &(yyvsp[(yyi + 1) - (yynrhs)])
903
+ , qp);
904
+ fprintf (stderr, "\n");
905
+ }
758
906
  }
759
907
 
760
908
  # define YY_REDUCE_PRINT(Rule) \
761
909
  do { \
762
910
  if (yydebug) \
763
- yy_reduce_print (Rule); \
764
- } while (0)
911
+ yy_reduce_print (yyvsp, Rule, qp); \
912
+ } while (YYID (0))
765
913
 
766
914
  /* Nonzero means print parse trace. It is left uninitialized so that
767
915
  multiple parsers can coexist. */
@@ -795,42 +943,44 @@ int yydebug;
795
943
  #if YYERROR_VERBOSE
796
944
 
797
945
  # ifndef yystrlen
798
- # if defined (__GLIBC__) && defined (_STRING_H)
946
+ # if defined __GLIBC__ && defined _STRING_H
799
947
  # define yystrlen strlen
800
948
  # else
801
949
  /* Return the length of YYSTR. */
950
+ #if (defined __STDC__ || defined __C99__FUNC__ \
951
+ || defined __cplusplus || defined _MSC_VER)
802
952
  static YYSIZE_T
803
- # if defined (__STDC__) || defined (__cplusplus)
804
953
  yystrlen (const char *yystr)
805
- # else
954
+ #else
955
+ static YYSIZE_T
806
956
  yystrlen (yystr)
807
- const char *yystr;
808
- # endif
957
+ const char *yystr;
958
+ #endif
809
959
  {
810
- const char *yys = yystr;
811
-
812
- while (*yys++ != '\0')
960
+ YYSIZE_T yylen;
961
+ for (yylen = 0; yystr[yylen]; yylen++)
813
962
  continue;
814
-
815
- return yys - yystr - 1;
963
+ return yylen;
816
964
  }
817
965
  # endif
818
966
  # endif
819
967
 
820
968
  # ifndef yystpcpy
821
- # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
969
+ # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
822
970
  # define yystpcpy stpcpy
823
971
  # else
824
972
  /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
825
973
  YYDEST. */
974
+ #if (defined __STDC__ || defined __C99__FUNC__ \
975
+ || defined __cplusplus || defined _MSC_VER)
826
976
  static char *
827
- # if defined (__STDC__) || defined (__cplusplus)
828
977
  yystpcpy (char *yydest, const char *yysrc)
829
- # else
978
+ #else
979
+ static char *
830
980
  yystpcpy (yydest, yysrc)
831
- char *yydest;
832
- const char *yysrc;
833
- # endif
981
+ char *yydest;
982
+ const char *yysrc;
983
+ #endif
834
984
  {
835
985
  char *yyd = yydest;
836
986
  const char *yys = yysrc;
@@ -856,7 +1006,7 @@ yytnamerr (char *yyres, const char *yystr)
856
1006
  {
857
1007
  if (*yystr == '"')
858
1008
  {
859
- size_t yyn = 0;
1009
+ YYSIZE_T yyn = 0;
860
1010
  char const *yyp = yystr;
861
1011
 
862
1012
  for (;;)
@@ -891,65 +1041,136 @@ yytnamerr (char *yyres, const char *yystr)
891
1041
  }
892
1042
  # endif
893
1043
 
894
- #endif /* YYERROR_VERBOSE */
895
-
896
-
897
-
898
- #if YYDEBUG
899
- /*--------------------------------.
900
- | Print this symbol on YYOUTPUT. |
901
- `--------------------------------*/
902
-
903
- #if defined (__STDC__) || defined (__cplusplus)
904
- static void
905
- yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
906
- #else
907
- static void
908
- yysymprint (yyoutput, yytype, yyvaluep)
909
- FILE *yyoutput;
910
- int yytype;
911
- YYSTYPE *yyvaluep;
912
- #endif
1044
+ /* Copy into YYRESULT an error message about the unexpected token
1045
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
1046
+ including the terminating null byte. If YYRESULT is null, do not
1047
+ copy anything; just return the number of bytes that would be
1048
+ copied. As a special case, return 0 if an ordinary "syntax error"
1049
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1050
+ size calculation. */
1051
+ static YYSIZE_T
1052
+ yysyntax_error (char *yyresult, int yystate, int yychar)
913
1053
  {
914
- /* Pacify ``unused variable'' warnings. */
915
- (void) yyvaluep;
1054
+ int yyn = yypact[yystate];
916
1055
 
917
- if (yytype < YYNTOKENS)
918
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1056
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1057
+ return 0;
919
1058
  else
920
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1059
+ {
1060
+ int yytype = YYTRANSLATE (yychar);
1061
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1062
+ YYSIZE_T yysize = yysize0;
1063
+ YYSIZE_T yysize1;
1064
+ int yysize_overflow = 0;
1065
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1066
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1067
+ int yyx;
1068
+
1069
+ # if 0
1070
+ /* This is so xgettext sees the translatable formats that are
1071
+ constructed on the fly. */
1072
+ YY_("syntax error, unexpected %s");
1073
+ YY_("syntax error, unexpected %s, expecting %s");
1074
+ YY_("syntax error, unexpected %s, expecting %s or %s");
1075
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1076
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1077
+ # endif
1078
+ char *yyfmt;
1079
+ char const *yyf;
1080
+ static char const yyunexpected[] = "syntax error, unexpected %s";
1081
+ static char const yyexpecting[] = ", expecting %s";
1082
+ static char const yyor[] = " or %s";
1083
+ char yyformat[sizeof yyunexpected
1084
+ + sizeof yyexpecting - 1
1085
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1086
+ * (sizeof yyor - 1))];
1087
+ char const *yyprefix = yyexpecting;
1088
+
1089
+ /* Start YYX at -YYN if negative to avoid negative indexes in
1090
+ YYCHECK. */
1091
+ int yyxbegin = yyn < 0 ? -yyn : 0;
1092
+
1093
+ /* Stay within bounds of both yycheck and yytname. */
1094
+ int yychecklim = YYLAST - yyn + 1;
1095
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1096
+ int yycount = 1;
1097
+
1098
+ yyarg[0] = yytname[yytype];
1099
+ yyfmt = yystpcpy (yyformat, yyunexpected);
1100
+
1101
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1102
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1103
+ {
1104
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1105
+ {
1106
+ yycount = 1;
1107
+ yysize = yysize0;
1108
+ yyformat[sizeof yyunexpected - 1] = '\0';
1109
+ break;
1110
+ }
1111
+ yyarg[yycount++] = yytname[yyx];
1112
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1113
+ yysize_overflow |= (yysize1 < yysize);
1114
+ yysize = yysize1;
1115
+ yyfmt = yystpcpy (yyfmt, yyprefix);
1116
+ yyprefix = yyor;
1117
+ }
921
1118
 
1119
+ yyf = YY_(yyformat);
1120
+ yysize1 = yysize + yystrlen (yyf);
1121
+ yysize_overflow |= (yysize1 < yysize);
1122
+ yysize = yysize1;
922
1123
 
923
- # ifdef YYPRINT
924
- if (yytype < YYNTOKENS)
925
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
926
- # endif
927
- switch (yytype)
928
- {
929
- default:
930
- break;
1124
+ if (yysize_overflow)
1125
+ return YYSIZE_MAXIMUM;
1126
+
1127
+ if (yyresult)
1128
+ {
1129
+ /* Avoid sprintf, as that infringes on the user's name space.
1130
+ Don't have undefined behavior even if the translation
1131
+ produced a string with the wrong number of "%s"s. */
1132
+ char *yyp = yyresult;
1133
+ int yyi = 0;
1134
+ while ((*yyp = *yyf) != '\0')
1135
+ {
1136
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1137
+ {
1138
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
1139
+ yyf += 2;
1140
+ }
1141
+ else
1142
+ {
1143
+ yyp++;
1144
+ yyf++;
1145
+ }
1146
+ }
1147
+ }
1148
+ return yysize;
931
1149
  }
932
- YYFPRINTF (yyoutput, ")");
933
1150
  }
1151
+ #endif /* YYERROR_VERBOSE */
1152
+
934
1153
 
935
- #endif /* ! YYDEBUG */
936
1154
  /*-----------------------------------------------.
937
1155
  | Release the memory associated to this symbol. |
938
1156
  `-----------------------------------------------*/
939
1157
 
940
- #if defined (__STDC__) || defined (__cplusplus)
1158
+ /*ARGSUSED*/
1159
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1160
+ || defined __cplusplus || defined _MSC_VER)
941
1161
  static void
942
- yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1162
+ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, QParser *qp)
943
1163
  #else
944
1164
  static void
945
- yydestruct (yymsg, yytype, yyvaluep)
1165
+ yydestruct (yymsg, yytype, yyvaluep, qp)
946
1166
  const char *yymsg;
947
1167
  int yytype;
948
1168
  YYSTYPE *yyvaluep;
1169
+ QParser *qp;
949
1170
  #endif
950
1171
  {
951
- /* Pacify ``unused variable'' warnings. */
952
- (void) yyvaluep;
1172
+ YYUSE (yyvaluep);
1173
+ YYUSE (qp);
953
1174
 
954
1175
  if (!yymsg)
955
1176
  yymsg = "Deleting";
@@ -959,7 +1180,7 @@ yydestruct (yymsg, yytype, yyvaluep)
959
1180
  {
960
1181
 
961
1182
  default:
962
- break;
1183
+ break;
963
1184
  }
964
1185
  }
965
1186
 
@@ -967,13 +1188,13 @@ yydestruct (yymsg, yytype, yyvaluep)
967
1188
  /* Prevent warnings from -Wmissing-prototypes. */
968
1189
 
969
1190
  #ifdef YYPARSE_PARAM
970
- # if defined (__STDC__) || defined (__cplusplus)
1191
+ #if defined __STDC__ || defined __cplusplus
971
1192
  int yyparse (void *YYPARSE_PARAM);
972
- # else
1193
+ #else
973
1194
  int yyparse ();
974
- # endif
1195
+ #endif
975
1196
  #else /* ! YYPARSE_PARAM */
976
- #if defined (__STDC__) || defined (__cplusplus)
1197
+ #if defined __STDC__ || defined __cplusplus
977
1198
  int yyparse (QParser *qp);
978
1199
  #else
979
1200
  int yyparse ();
@@ -990,14 +1211,18 @@ int yyparse ();
990
1211
  `----------*/
991
1212
 
992
1213
  #ifdef YYPARSE_PARAM
993
- # if defined (__STDC__) || defined (__cplusplus)
994
- int yyparse (void *YYPARSE_PARAM)
995
- # else
996
- int yyparse (YYPARSE_PARAM)
997
- void *YYPARSE_PARAM;
998
- # endif
1214
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1215
+ || defined __cplusplus || defined _MSC_VER)
1216
+ int
1217
+ yyparse (void *YYPARSE_PARAM)
1218
+ #else
1219
+ int
1220
+ yyparse (YYPARSE_PARAM)
1221
+ void *YYPARSE_PARAM;
1222
+ #endif
999
1223
  #else /* ! YYPARSE_PARAM */
1000
- #if defined (__STDC__) || defined (__cplusplus)
1224
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1225
+ || defined __cplusplus || defined _MSC_VER)
1001
1226
  int
1002
1227
  yyparse (QParser *qp)
1003
1228
  #else
@@ -1023,6 +1248,12 @@ int yynerrs;
1023
1248
  int yyerrstatus;
1024
1249
  /* Look-ahead token as an internal (translated) token number. */
1025
1250
  int yytoken = 0;
1251
+ #if YYERROR_VERBOSE
1252
+ /* Buffer for error messages, and its allocated size. */
1253
+ char yymsgbuf[128];
1254
+ char *yymsg = yymsgbuf;
1255
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1256
+ #endif
1026
1257
 
1027
1258
  /* Three stacks and their tools:
1028
1259
  `yyss': related to states,
@@ -1033,9 +1264,9 @@ int yynerrs;
1033
1264
  to reallocate them elsewhere. */
1034
1265
 
1035
1266
  /* The state stack. */
1036
- short int yyssa[YYINITDEPTH];
1037
- short int *yyss = yyssa;
1038
- short int *yyssp;
1267
+ yytype_int16 yyssa[YYINITDEPTH];
1268
+ yytype_int16 *yyss = yyssa;
1269
+ yytype_int16 *yyssp;
1039
1270
 
1040
1271
  /* The semantic value stack. */
1041
1272
  YYSTYPE yyvsa[YYINITDEPTH];
@@ -1044,7 +1275,7 @@ int yynerrs;
1044
1275
 
1045
1276
 
1046
1277
 
1047
- #define YYPOPSTACK (yyvsp--, yyssp--)
1278
+ #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1048
1279
 
1049
1280
  YYSIZE_T yystacksize = YYINITDEPTH;
1050
1281
 
@@ -1053,9 +1284,9 @@ int yynerrs;
1053
1284
  YYSTYPE yyval;
1054
1285
 
1055
1286
 
1056
- /* When reducing, the number of symbols on the RHS of the reduced
1057
- rule. */
1058
- int yylen;
1287
+ /* The number of symbols on the RHS of the reduced rule.
1288
+ Keep to zero when no symbol should be popped. */
1289
+ int yylen = 0;
1059
1290
 
1060
1291
  YYDPRINTF ((stderr, "Starting parse\n"));
1061
1292
 
@@ -1079,8 +1310,7 @@ int yynerrs;
1079
1310
  `------------------------------------------------------------*/
1080
1311
  yynewstate:
1081
1312
  /* In all cases, when you get here, the value and location stacks
1082
- have just been pushed. so pushing a state here evens the stacks.
1083
- */
1313
+ have just been pushed. So pushing a state here evens the stacks. */
1084
1314
  yyssp++;
1085
1315
 
1086
1316
  yysetstate:
@@ -1093,11 +1323,11 @@ int yynerrs;
1093
1323
 
1094
1324
  #ifdef yyoverflow
1095
1325
  {
1096
- /* Give user a chance to reallocate the stack. Use copies of
1326
+ /* Give user a chance to reallocate the stack. Use copies of
1097
1327
  these so that the &'s don't force the real ones into
1098
1328
  memory. */
1099
1329
  YYSTYPE *yyvs1 = yyvs;
1100
- short int *yyss1 = yyss;
1330
+ yytype_int16 *yyss1 = yyss;
1101
1331
 
1102
1332
 
1103
1333
  /* Each stack pointer address is followed by the size of the
@@ -1125,7 +1355,7 @@ int yynerrs;
1125
1355
  yystacksize = YYMAXDEPTH;
1126
1356
 
1127
1357
  {
1128
- short int *yyss1 = yyss;
1358
+ yytype_int16 *yyss1 = yyss;
1129
1359
  union yyalloc *yyptr =
1130
1360
  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1131
1361
  if (! yyptr)
@@ -1160,12 +1390,10 @@ int yynerrs;
1160
1390
  `-----------*/
1161
1391
  yybackup:
1162
1392
 
1163
- /* Do appropriate processing given the current state. */
1164
- /* Read a look-ahead token if we need one and don't already have one. */
1165
- /* yyresume: */
1393
+ /* Do appropriate processing given the current state. Read a
1394
+ look-ahead token if we need one and don't already have one. */
1166
1395
 
1167
1396
  /* First try to decide what to do without reference to look-ahead token. */
1168
-
1169
1397
  yyn = yypact[yystate];
1170
1398
  if (yyn == YYPACT_NINF)
1171
1399
  goto yydefault;
@@ -1207,22 +1435,21 @@ yybackup:
1207
1435
  if (yyn == YYFINAL)
1208
1436
  YYACCEPT;
1209
1437
 
1438
+ /* Count tokens shifted since error; after three, turn off error
1439
+ status. */
1440
+ if (yyerrstatus)
1441
+ yyerrstatus--;
1442
+
1210
1443
  /* Shift the look-ahead token. */
1211
1444
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1212
1445
 
1213
- /* Discard the token being shifted unless it is eof. */
1446
+ /* Discard the shifted token unless it is eof. */
1214
1447
  if (yychar != YYEOF)
1215
1448
  yychar = YYEMPTY;
1216
1449
 
1450
+ yystate = yyn;
1217
1451
  *++yyvsp = yylval;
1218
1452
 
1219
-
1220
- /* Count tokens shifted since error; after three, turn off error
1221
- status. */
1222
- if (yyerrstatus)
1223
- yyerrstatus--;
1224
-
1225
- yystate = yyn;
1226
1453
  goto yynewstate;
1227
1454
 
1228
1455
 
@@ -1264,47 +1491,47 @@ yyreduce:
1264
1491
 
1265
1492
  case 3:
1266
1493
  #line 103 "src/q_parser.y"
1267
- { qp->result = (yyval.query) = get_bool_q((yyvsp[0].bclss)); }
1494
+ { qp->result = (yyval.query) = get_bool_q((yyvsp[(1) - (1)].bclss)); }
1268
1495
  break;
1269
1496
 
1270
1497
  case 4:
1271
1498
  #line 105 "src/q_parser.y"
1272
- { (yyval.bclss) = first_cls((yyvsp[0].bcls)); }
1499
+ { (yyval.bclss) = first_cls((yyvsp[(1) - (1)].bcls)); }
1273
1500
  break;
1274
1501
 
1275
1502
  case 5:
1276
1503
  #line 106 "src/q_parser.y"
1277
- { (yyval.bclss) = add_and_cls((yyvsp[-2].bclss), (yyvsp[0].bcls)); }
1504
+ { (yyval.bclss) = add_and_cls((yyvsp[(1) - (3)].bclss), (yyvsp[(3) - (3)].bcls)); }
1278
1505
  break;
1279
1506
 
1280
1507
  case 6:
1281
1508
  #line 107 "src/q_parser.y"
1282
- { (yyval.bclss) = add_or_cls((yyvsp[-2].bclss), (yyvsp[0].bcls)); }
1509
+ { (yyval.bclss) = add_or_cls((yyvsp[(1) - (3)].bclss), (yyvsp[(3) - (3)].bcls)); }
1283
1510
  break;
1284
1511
 
1285
1512
  case 7:
1286
1513
  #line 108 "src/q_parser.y"
1287
- { (yyval.bclss) = add_default_cls(qp, (yyvsp[-1].bclss), (yyvsp[0].bcls)); }
1514
+ { (yyval.bclss) = add_default_cls(qp, (yyvsp[(1) - (2)].bclss), (yyvsp[(2) - (2)].bcls)); }
1288
1515
  break;
1289
1516
 
1290
1517
  case 8:
1291
1518
  #line 110 "src/q_parser.y"
1292
- { (yyval.bcls) = get_bool_cls((yyvsp[0].query), BC_MUST); }
1519
+ { (yyval.bcls) = get_bool_cls((yyvsp[(2) - (2)].query), BC_MUST); }
1293
1520
  break;
1294
1521
 
1295
1522
  case 9:
1296
1523
  #line 111 "src/q_parser.y"
1297
- { (yyval.bcls) = get_bool_cls((yyvsp[0].query), BC_MUST_NOT); }
1524
+ { (yyval.bcls) = get_bool_cls((yyvsp[(2) - (2)].query), BC_MUST_NOT); }
1298
1525
  break;
1299
1526
 
1300
1527
  case 10:
1301
1528
  #line 112 "src/q_parser.y"
1302
- { (yyval.bcls) = get_bool_cls((yyvsp[0].query), BC_SHOULD); }
1529
+ { (yyval.bcls) = get_bool_cls((yyvsp[(1) - (1)].query), BC_SHOULD); }
1303
1530
  break;
1304
1531
 
1305
1532
  case 12:
1306
1533
  #line 115 "src/q_parser.y"
1307
- { if ((yyvsp[-2].query)) sscanf((yyvsp[0].str),"%f",&((yyvsp[-2].query)->boost)); (yyval.query)=(yyvsp[-2].query); }
1534
+ { if ((yyvsp[(1) - (3)].query)) sscanf((yyvsp[(3) - (3)].str),"%f",&((yyvsp[(1) - (3)].query)->boost)); (yyval.query)=(yyvsp[(1) - (3)].query); }
1308
1535
  break;
1309
1536
 
1310
1537
  case 14:
@@ -1314,27 +1541,27 @@ yyreduce:
1314
1541
 
1315
1542
  case 15:
1316
1543
  #line 119 "src/q_parser.y"
1317
- { (yyval.query) = get_bool_q((yyvsp[-1].bclss)); }
1544
+ { (yyval.query) = get_bool_q((yyvsp[(2) - (3)].bclss)); }
1318
1545
  break;
1319
1546
 
1320
1547
  case 20:
1321
1548
  #line 125 "src/q_parser.y"
1322
- { FLDS((yyval.query), get_term_q(qp, field, (yyvsp[0].str))); }
1549
+ { FLDS((yyval.query), get_term_q(qp, field, (yyvsp[(1) - (1)].str))); }
1323
1550
  break;
1324
1551
 
1325
1552
  case 21:
1326
1553
  #line 126 "src/q_parser.y"
1327
- { FLDS((yyval.query), get_fuzzy_q(qp, field, (yyvsp[-2].str), (yyvsp[0].str))); }
1554
+ { FLDS((yyval.query), get_fuzzy_q(qp, field, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str))); }
1328
1555
  break;
1329
1556
 
1330
1557
  case 22:
1331
1558
  #line 127 "src/q_parser.y"
1332
- { FLDS((yyval.query), get_fuzzy_q(qp, field, (yyvsp[-1].str), NULL)); }
1559
+ { FLDS((yyval.query), get_fuzzy_q(qp, field, (yyvsp[(1) - (2)].str), NULL)); }
1333
1560
  break;
1334
1561
 
1335
1562
  case 23:
1336
1563
  #line 129 "src/q_parser.y"
1337
- { FLDS((yyval.query), get_wild_q(qp, field, (yyvsp[0].str))); }
1564
+ { FLDS((yyval.query), get_wild_q(qp, field, (yyvsp[(1) - (1)].str))); }
1338
1565
  break;
1339
1566
 
1340
1567
  case 24:
@@ -1344,7 +1571,7 @@ yyreduce:
1344
1571
 
1345
1572
  case 25:
1346
1573
  #line 132 "src/q_parser.y"
1347
- { (yyval.query) = (yyvsp[-1].query); }
1574
+ { (yyval.query) = (yyvsp[(3) - (4)].query); }
1348
1575
  break;
1349
1576
 
1350
1577
  case 26:
@@ -1359,27 +1586,27 @@ yyreduce:
1359
1586
 
1360
1587
  case 28:
1361
1588
  #line 134 "src/q_parser.y"
1362
- { (yyval.query) = (yyvsp[-1].query); }
1589
+ { (yyval.query) = (yyvsp[(4) - (5)].query); }
1363
1590
  break;
1364
1591
 
1365
1592
  case 29:
1366
1593
  #line 136 "src/q_parser.y"
1367
- { (yyval.hashset) = first_field(qp, (yyvsp[0].str)); }
1594
+ { (yyval.hashset) = first_field(qp, (yyvsp[(1) - (1)].str)); }
1368
1595
  break;
1369
1596
 
1370
1597
  case 30:
1371
1598
  #line 137 "src/q_parser.y"
1372
- { (yyval.hashset) = add_field(qp, (yyvsp[0].str));}
1599
+ { (yyval.hashset) = add_field(qp, (yyvsp[(3) - (3)].str));}
1373
1600
  break;
1374
1601
 
1375
1602
  case 31:
1376
1603
  #line 139 "src/q_parser.y"
1377
- { (yyval.query) = get_phrase_q(qp, (yyvsp[-1].phrase), NULL); }
1604
+ { (yyval.query) = get_phrase_q(qp, (yyvsp[(2) - (3)].phrase), NULL); }
1378
1605
  break;
1379
1606
 
1380
1607
  case 32:
1381
1608
  #line 140 "src/q_parser.y"
1382
- { (yyval.query) = get_phrase_q(qp, (yyvsp[-3].phrase), (yyvsp[0].str)); }
1609
+ { (yyval.query) = get_phrase_q(qp, (yyvsp[(2) - (5)].phrase), (yyvsp[(5) - (5)].str)); }
1383
1610
  break;
1384
1611
 
1385
1612
  case 33:
@@ -1394,7 +1621,7 @@ yyreduce:
1394
1621
 
1395
1622
  case 35:
1396
1623
  #line 144 "src/q_parser.y"
1397
- { (yyval.phrase) = ph_first_word((yyvsp[0].str)); }
1624
+ { (yyval.phrase) = ph_first_word((yyvsp[(1) - (1)].str)); }
1398
1625
  break;
1399
1626
 
1400
1627
  case 36:
@@ -1404,90 +1631,88 @@ yyreduce:
1404
1631
 
1405
1632
  case 37:
1406
1633
  #line 146 "src/q_parser.y"
1407
- { (yyval.phrase) = ph_add_word((yyvsp[-1].phrase), (yyvsp[0].str)); }
1634
+ { (yyval.phrase) = ph_add_word((yyvsp[(1) - (2)].phrase), (yyvsp[(2) - (2)].str)); }
1408
1635
  break;
1409
1636
 
1410
1637
  case 38:
1411
1638
  #line 147 "src/q_parser.y"
1412
- { (yyval.phrase) = ph_add_word((yyvsp[-2].phrase), NULL); }
1639
+ { (yyval.phrase) = ph_add_word((yyvsp[(1) - (3)].phrase), NULL); }
1413
1640
  break;
1414
1641
 
1415
1642
  case 39:
1416
1643
  #line 148 "src/q_parser.y"
1417
- { (yyval.phrase) = ph_add_multi_word((yyvsp[-2].phrase), (yyvsp[0].str)); }
1644
+ { (yyval.phrase) = ph_add_multi_word((yyvsp[(1) - (3)].phrase), (yyvsp[(3) - (3)].str)); }
1418
1645
  break;
1419
1646
 
1420
1647
  case 40:
1421
1648
  #line 150 "src/q_parser.y"
1422
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-2].str), (yyvsp[-1].str), true, true)); }
1649
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), true, true)); }
1423
1650
  break;
1424
1651
 
1425
1652
  case 41:
1426
1653
  #line 151 "src/q_parser.y"
1427
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-2].str), (yyvsp[-1].str), true, false)); }
1654
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), true, false)); }
1428
1655
  break;
1429
1656
 
1430
1657
  case 42:
1431
1658
  #line 152 "src/q_parser.y"
1432
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-2].str), (yyvsp[-1].str), false, true)); }
1659
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), false, true)); }
1433
1660
  break;
1434
1661
 
1435
1662
  case 43:
1436
1663
  #line 153 "src/q_parser.y"
1437
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-2].str), (yyvsp[-1].str), false, false)); }
1664
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].str), false, false)); }
1438
1665
  break;
1439
1666
 
1440
1667
  case 44:
1441
1668
  #line 154 "src/q_parser.y"
1442
- { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[-1].str), false, false)); }
1669
+ { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[(2) - (3)].str), false, false)); }
1443
1670
  break;
1444
1671
 
1445
1672
  case 45:
1446
1673
  #line 155 "src/q_parser.y"
1447
- { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[-1].str), false, true)); }
1674
+ { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[(2) - (3)].str), false, true)); }
1448
1675
  break;
1449
1676
 
1450
1677
  case 46:
1451
1678
  #line 156 "src/q_parser.y"
1452
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-1].str), NULL,true, false)); }
1679
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (3)].str), NULL,true, false)); }
1453
1680
  break;
1454
1681
 
1455
1682
  case 47:
1456
1683
  #line 157 "src/q_parser.y"
1457
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[-1].str), NULL,false, false)); }
1684
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (3)].str), NULL,false, false)); }
1458
1685
  break;
1459
1686
 
1460
1687
  case 48:
1461
1688
  #line 158 "src/q_parser.y"
1462
- { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[0].str), false, false)); }
1689
+ { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[(2) - (2)].str), false, false)); }
1463
1690
  break;
1464
1691
 
1465
1692
  case 49:
1466
1693
  #line 159 "src/q_parser.y"
1467
- { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[0].str), false, true)); }
1694
+ { FLDS((yyval.query), get_r_q(qp, field, NULL,(yyvsp[(3) - (3)].str), false, true)); }
1468
1695
  break;
1469
1696
 
1470
1697
  case 50:
1471
1698
  #line 160 "src/q_parser.y"
1472
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[0].str), NULL,true, false)); }
1699
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(3) - (3)].str), NULL,true, false)); }
1473
1700
  break;
1474
1701
 
1475
1702
  case 51:
1476
1703
  #line 161 "src/q_parser.y"
1477
- { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[0].str), NULL,false, false)); }
1704
+ { FLDS((yyval.query), get_r_q(qp, field, (yyvsp[(2) - (2)].str), NULL,false, false)); }
1478
1705
  break;
1479
1706
 
1480
1707
 
1708
+ /* Line 1267 of yacc.c. */
1709
+ #line 1710 "y.tab.c"
1481
1710
  default: break;
1482
1711
  }
1712
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1483
1713
 
1484
- /* Line 1126 of yacc.c. */
1485
- #line 1486 "y.tab.c"
1486
-
1487
- yyvsp -= yylen;
1488
- yyssp -= yylen;
1489
-
1490
-
1714
+ YYPOPSTACK (yylen);
1715
+ yylen = 0;
1491
1716
  YY_STACK_PRINT (yyss, yyssp);
1492
1717
 
1493
1718
  *++yyvsp = yyval;
@@ -1516,110 +1741,41 @@ yyerrlab:
1516
1741
  if (!yyerrstatus)
1517
1742
  {
1518
1743
  ++yynerrs;
1519
- #if YYERROR_VERBOSE
1520
- yyn = yypact[yystate];
1521
-
1522
- if (YYPACT_NINF < yyn && yyn < YYLAST)
1523
- {
1524
- int yytype = YYTRANSLATE (yychar);
1525
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1526
- YYSIZE_T yysize = yysize0;
1527
- YYSIZE_T yysize1;
1528
- int yysize_overflow = 0;
1529
- char *yymsg = 0;
1530
- # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
1531
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1532
- int yyx;
1533
-
1534
- #if 0
1535
- /* This is so xgettext sees the translatable formats that are
1536
- constructed on the fly. */
1537
- YY_("syntax error, unexpected %s");
1538
- YY_("syntax error, unexpected %s, expecting %s");
1539
- YY_("syntax error, unexpected %s, expecting %s or %s");
1540
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1541
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1542
- #endif
1543
- char *yyfmt;
1544
- char const *yyf;
1545
- static char const yyunexpected[] = "syntax error, unexpected %s";
1546
- static char const yyexpecting[] = ", expecting %s";
1547
- static char const yyor[] = " or %s";
1548
- char yyformat[sizeof yyunexpected
1549
- + sizeof yyexpecting - 1
1550
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1551
- * (sizeof yyor - 1))];
1552
- char const *yyprefix = yyexpecting;
1553
-
1554
- /* Start YYX at -YYN if negative to avoid negative indexes in
1555
- YYCHECK. */
1556
- int yyxbegin = yyn < 0 ? -yyn : 0;
1557
-
1558
- /* Stay within bounds of both yycheck and yytname. */
1559
- int yychecklim = YYLAST - yyn;
1560
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1561
- int yycount = 1;
1562
-
1563
- yyarg[0] = yytname[yytype];
1564
- yyfmt = yystpcpy (yyformat, yyunexpected);
1565
-
1566
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1567
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1744
+ #if ! YYERROR_VERBOSE
1745
+ yyerror (qp, YY_("syntax error"));
1746
+ #else
1747
+ {
1748
+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1749
+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1750
+ {
1751
+ YYSIZE_T yyalloc = 2 * yysize;
1752
+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1753
+ yyalloc = YYSTACK_ALLOC_MAXIMUM;
1754
+ if (yymsg != yymsgbuf)
1755
+ YYSTACK_FREE (yymsg);
1756
+ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1757
+ if (yymsg)
1758
+ yymsg_alloc = yyalloc;
1759
+ else
1568
1760
  {
1569
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1570
- {
1571
- yycount = 1;
1572
- yysize = yysize0;
1573
- yyformat[sizeof yyunexpected - 1] = '\0';
1574
- break;
1575
- }
1576
- yyarg[yycount++] = yytname[yyx];
1577
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1578
- yysize_overflow |= yysize1 < yysize;
1579
- yysize = yysize1;
1580
- yyfmt = yystpcpy (yyfmt, yyprefix);
1581
- yyprefix = yyor;
1761
+ yymsg = yymsgbuf;
1762
+ yymsg_alloc = sizeof yymsgbuf;
1582
1763
  }
1764
+ }
1583
1765
 
1584
- yyf = YY_(yyformat);
1585
- yysize1 = yysize + yystrlen (yyf);
1586
- yysize_overflow |= yysize1 < yysize;
1587
- yysize = yysize1;
1588
-
1589
- if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
1590
- yymsg = (char *) YYSTACK_ALLOC (yysize);
1591
- if (yymsg)
1592
- {
1593
- /* Avoid sprintf, as that infringes on the user's name space.
1594
- Don't have undefined behavior even if the translation
1595
- produced a string with the wrong number of "%s"s. */
1596
- char *yyp = yymsg;
1597
- int yyi = 0;
1598
- while ((*yyp = *yyf))
1599
- {
1600
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1601
- {
1602
- yyp += yytnamerr (yyp, yyarg[yyi++]);
1603
- yyf += 2;
1604
- }
1605
- else
1606
- {
1607
- yyp++;
1608
- yyf++;
1609
- }
1610
- }
1611
- yyerror (qp, yymsg);
1612
- YYSTACK_FREE (yymsg);
1613
- }
1614
- else
1615
- {
1616
- yyerror (qp, YY_("syntax error"));
1766
+ if (0 < yysize && yysize <= yymsg_alloc)
1767
+ {
1768
+ (void) yysyntax_error (yymsg, yystate, yychar);
1769
+ yyerror (qp, yymsg);
1770
+ }
1771
+ else
1772
+ {
1773
+ yyerror (qp, YY_("syntax error"));
1774
+ if (yysize != 0)
1617
1775
  goto yyexhaustedlab;
1618
- }
1619
- }
1620
- else
1621
- #endif /* YYERROR_VERBOSE */
1622
- yyerror (qp, YY_("syntax error"));
1776
+ }
1777
+ }
1778
+ #endif
1623
1779
  }
1624
1780
 
1625
1781
 
@@ -1630,14 +1786,15 @@ yyerrlab:
1630
1786
  error, discard it. */
1631
1787
 
1632
1788
  if (yychar <= YYEOF)
1633
- {
1789
+ {
1634
1790
  /* Return failure if at end of input. */
1635
1791
  if (yychar == YYEOF)
1636
1792
  YYABORT;
1637
- }
1793
+ }
1638
1794
  else
1639
1795
  {
1640
- yydestruct ("Error: discarding", yytoken, &yylval);
1796
+ yydestruct ("Error: discarding",
1797
+ yytoken, &yylval, qp);
1641
1798
  yychar = YYEMPTY;
1642
1799
  }
1643
1800
  }
@@ -1655,11 +1812,14 @@ yyerrorlab:
1655
1812
  /* Pacify compilers like GCC when the user code never invokes
1656
1813
  YYERROR and the label yyerrorlab therefore never appears in user
1657
1814
  code. */
1658
- if (0)
1815
+ if (/*CONSTCOND*/ 0)
1659
1816
  goto yyerrorlab;
1660
1817
 
1661
- yyvsp -= yylen;
1662
- yyssp -= yylen;
1818
+ /* Do not reclaim the symbols of the rule which action triggered
1819
+ this YYERROR. */
1820
+ YYPOPSTACK (yylen);
1821
+ yylen = 0;
1822
+ YY_STACK_PRINT (yyss, yyssp);
1663
1823
  yystate = *yyssp;
1664
1824
  goto yyerrlab1;
1665
1825
 
@@ -1689,8 +1849,9 @@ yyerrlab1:
1689
1849
  YYABORT;
1690
1850
 
1691
1851
 
1692
- yydestruct ("Error: popping", yystos[yystate], yyvsp);
1693
- YYPOPSTACK;
1852
+ yydestruct ("Error: popping",
1853
+ yystos[yystate], yyvsp, qp);
1854
+ YYPOPSTACK (1);
1694
1855
  yystate = *yyssp;
1695
1856
  YY_STACK_PRINT (yyss, yyssp);
1696
1857
  }
@@ -1701,7 +1862,7 @@ yyerrlab1:
1701
1862
  *++yyvsp = yylval;
1702
1863
 
1703
1864
 
1704
- /* Shift the error token. */
1865
+ /* Shift the error token. */
1705
1866
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1706
1867
 
1707
1868
  yystate = yyn;
@@ -1735,18 +1896,27 @@ yyexhaustedlab:
1735
1896
  yyreturn:
1736
1897
  if (yychar != YYEOF && yychar != YYEMPTY)
1737
1898
  yydestruct ("Cleanup: discarding lookahead",
1738
- yytoken, &yylval);
1899
+ yytoken, &yylval, qp);
1900
+ /* Do not reclaim the symbols of the rule which action triggered
1901
+ this YYABORT or YYACCEPT. */
1902
+ YYPOPSTACK (yylen);
1903
+ YY_STACK_PRINT (yyss, yyssp);
1739
1904
  while (yyssp != yyss)
1740
1905
  {
1741
1906
  yydestruct ("Cleanup: popping",
1742
- yystos[*yyssp], yyvsp);
1743
- YYPOPSTACK;
1907
+ yystos[*yyssp], yyvsp, qp);
1908
+ YYPOPSTACK (1);
1744
1909
  }
1745
1910
  #ifndef yyoverflow
1746
1911
  if (yyss != yyssa)
1747
1912
  YYSTACK_FREE (yyss);
1748
1913
  #endif
1749
- return yyresult;
1914
+ #if YYERROR_VERBOSE
1915
+ if (yymsg != yymsgbuf)
1916
+ YYSTACK_FREE (yymsg);
1917
+ #endif
1918
+ /* Make sure YYID is used. */
1919
+ return YYID (yyresult);
1750
1920
  }
1751
1921
 
1752
1922
 
@@ -1754,7 +1924,7 @@ yyreturn:
1754
1924
 
1755
1925
 
1756
1926
  const char *special_char = "&:()[]{}!\"~^|<>=*?+-";
1757
- const char *not_word = " \t:()[]{}!\"~^|<>=";
1927
+ const char *not_word = " \t()[]{}!\"~^|<>=";
1758
1928
 
1759
1929
  static int get_word(YYSTYPE *lvalp, QParser *qp)
1760
1930
  {
@@ -1772,10 +1942,10 @@ static int get_word(YYSTYPE *lvalp, QParser *qp)
1772
1942
 
1773
1943
  qp->qstrp--; /* need to back up one character */
1774
1944
 
1775
- while (!strchr(not_word, (c=*qp->qstrp++))) {
1945
+ while (!strchr(not_word, (c = *qp->qstrp++))) {
1776
1946
  switch (c) {
1777
1947
  case '\\':
1778
- if ((c=*qp->qstrp) == '\0') {
1948
+ if ((c = *qp->qstrp) == '\0') {
1779
1949
  *bufp++ = '\\';
1780
1950
  }
1781
1951
  else {
@@ -1783,6 +1953,16 @@ static int get_word(YYSTYPE *lvalp, QParser *qp)
1783
1953
  qp->qstrp++;
1784
1954
  }
1785
1955
  break;
1956
+ case ':':
1957
+ if ((*qp->qstrp) == ':') {
1958
+ qp->qstrp++;
1959
+ *bufp++ = ':';
1960
+ *bufp++ = ':';
1961
+ }
1962
+ else {
1963
+ goto get_word_done;
1964
+ }
1965
+ break;
1786
1966
  case '*': case '?':
1787
1967
  is_wild = true;
1788
1968
  /* fall through */
@@ -1798,6 +1978,7 @@ static int get_word(YYSTYPE *lvalp, QParser *qp)
1798
1978
  bufp = buf + MAX_WORD_SIZE;
1799
1979
  }
1800
1980
  }
1981
+ get_word_done:
1801
1982
  qp->qstrp--;
1802
1983
  /* check for keywords. There are only four so we have a bit of a hack which
1803
1984
  * just checks for all of them. */
@@ -1915,7 +2096,14 @@ static Query *get_bool_q(BCArray *bca)
1915
2096
  }
1916
2097
  else if (clause_count == 1) {
1917
2098
  BooleanClause *bc = bca->clauses[0];
1918
- q = bc->query;
2099
+ if (bc->is_prohibited) {
2100
+ q = bq_new(false);
2101
+ bq_add_query_nr(q, bc->query, BC_MUST_NOT);
2102
+ bq_add_query_nr(q, maq_new(), BC_MUST);
2103
+ }
2104
+ else {
2105
+ q = bc->query;
2106
+ }
1919
2107
  free(bc);
1920
2108
  free(bca->clauses);
1921
2109
  }
@@ -2287,6 +2475,15 @@ static Query *get_r_q(QParser *qp, char *field, char *from, char *to,
2287
2475
  bool inc_lower, bool inc_upper)
2288
2476
  {
2289
2477
  Query *rq;
2478
+ if (qp->wild_lower) {
2479
+ if (from) {
2480
+ lower_str(from);
2481
+ }
2482
+ if (to) {
2483
+ lower_str(to);
2484
+ }
2485
+ }
2486
+ /*
2290
2487
  if (from) {
2291
2488
  TokenStream *stream = get_cached_ts(qp, field, from);
2292
2489
  Token *token = ts_next(stream);
@@ -2297,10 +2494,9 @@ static Query *get_r_q(QParser *qp, char *field, char *from, char *to,
2297
2494
  Token *token = ts_next(stream);
2298
2495
  to = token ? estrdup(token->text) : NULL;
2299
2496
  }
2497
+ */
2300
2498
 
2301
2499
  rq = rq_new(field, from, to, inc_lower, inc_upper);
2302
- if (from) free(from);
2303
- if (to) free(to);
2304
2500
  return rq;
2305
2501
  }
2306
2502
 
@@ -2475,7 +2671,7 @@ Query *qp_get_bad_query(QParser *qp, char *str)
2475
2671
 
2476
2672
  Query *qp_parse(QParser *self, char *qstr)
2477
2673
  {
2478
- Query *result;
2674
+ Query *result = NULL;
2479
2675
  mutex_lock(&self->mutex);
2480
2676
  if (self->clean_str) {
2481
2677
  self->qstrp = self->qstr = qp_clean_str(qstr);
@@ -2486,9 +2682,12 @@ Query *qp_parse(QParser *self, char *qstr)
2486
2682
  self->fields = self->def_fields;
2487
2683
  self->result = NULL;
2488
2684
 
2489
- yyparse(self);
2490
-
2491
- result = self->result;
2685
+ TRY
2686
+ yyparse(self);
2687
+ result = self->result;
2688
+ XCATCHALL
2689
+ if (self->handle_parse_errors) HANDLED();
2690
+ XENDTRY
2492
2691
  if (!result && self->handle_parse_errors) {
2493
2692
  result = qp_get_bad_query(self, self->qstr);
2494
2693
  }
@@ -2503,4 +2702,3 @@ Query *qp_parse(QParser *self, char *qstr)
2503
2702
  return result;
2504
2703
  }
2505
2704
 
2506
-