Skip to content

File tree

4 files changed

+130
-255
lines changed

4 files changed

+130
-255
lines changed
 

‎src/core/qgssearchstringparser.cc

Lines changed: 113 additions & 241 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* A Bison parser, made by GNU Bison 2.1. */
1+
/* A Bison parser, made by GNU Bison 2.0. */
22

33
/* Skeleton parser for Yacc-like parsing with Bison,
4-
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
1515
1616
You should have received a copy of the GNU General Public License
1717
along with this program; if not, write to the Free Software
18-
Foundation, Inc., 51 Franklin Street, Fifth Floor,
19-
Boston, MA 02110-1301, USA. */
18+
Foundation, Inc., 59 Temple Place - Suite 330,
19+
Boston, MA 02111-1307, USA. */
2020

2121
/* As a special exception, when this file is copied by Bison into a
2222
Bison output file, you may use that output file without restriction.
@@ -36,9 +36,6 @@
3636
/* Identify Bison output. */
3737
#define YYBISON 1
3838

39-
/* Bison version. */
40-
#define YYBISON_VERSION "2.1"
41-
4239
/* Skeleton name. */
4340
#define YYSKELETON_NAME "yacc.c"
4441

@@ -67,7 +64,6 @@
6764
UMINUS = 266
6865
};
6966
#endif
70-
/* Tokens. */
7167
#define NUMBER 258
7268
#define COMPARISON 259
7369
#define STRING 260
@@ -136,16 +132,11 @@ void addToTmpNodes(QgsSearchTreeNode* node);
136132
# define YYERROR_VERBOSE 0
137133
#endif
138134

139-
/* Enabling the token table. */
140-
#ifndef YYTOKEN_TABLE
141-
# define YYTOKEN_TABLE 0
142-
#endif
143-
144135
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
145136
#line 60 "qgssearchstringparser.yy"
146137
typedef union YYSTYPE { QgsSearchTreeNode* node; double number; QgsSearchTreeNode::Operator op; } YYSTYPE;
147-
/* Line 196 of yacc.c. */
148-
#line 149 "qgssearchstringparser.cc"
138+
/* Line 190 of yacc.c. */
139+
#line 140 "qgssearchstringparser.cc"
149140
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
150141
# define YYSTYPE_IS_DECLARED 1
151142
# define YYSTYPE_IS_TRIVIAL 1
@@ -156,36 +147,17 @@ typedef union YYSTYPE { QgsSearchTreeNode* node; double number; QgsSearchTreeNod
156147
/* Copy the second part of user declarations. */
157148

158149

159-
/* Line 219 of yacc.c. */
160-
#line 161 "qgssearchstringparser.cc"
150+
/* Line 213 of yacc.c. */
151+
#line 152 "qgssearchstringparser.cc"
161152

162-
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
163-
# define YYSIZE_T __SIZE_TYPE__
164-
#endif
165-
#if ! defined (YYSIZE_T) && defined (size_t)
166-
# define YYSIZE_T size_t
167-
#endif
168-
#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
169-
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
170-
# define YYSIZE_T size_t
171-
#endif
172-
#if ! defined (YYSIZE_T)
173-
# define YYSIZE_T unsigned int
174-
#endif
153+
#if ! defined (yyoverflow) || YYERROR_VERBOSE
175154

176-
#ifndef YY_
177-
# if YYENABLE_NLS
178-
# if ENABLE_NLS
179-
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
180-
# define YY_(msgid) dgettext ("bison-runtime", msgid)
181-
# endif
155+
# ifndef YYFREE
156+
# define YYFREE free
182157
# endif
183-
# ifndef YY_
184-
# define YY_(msgid) msgid
158+
# ifndef YYMALLOC
159+
# define YYMALLOC malloc
185160
# endif
186-
#endif
187-
188-
#if ! defined (yyoverflow) || YYERROR_VERBOSE
189161

190162
/* The parser invokes alloca or malloc; define the necessary symbols. */
191163

@@ -195,50 +167,20 @@ typedef union YYSTYPE { QgsSearchTreeNode* node; double number; QgsSearchTreeNod
195167
# define YYSTACK_ALLOC __builtin_alloca
196168
# else
197169
# define YYSTACK_ALLOC alloca
198-
# if defined (__STDC__) || defined (__cplusplus)
199-
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
200-
# define YYINCLUDED_STDLIB_H
201-
# endif
202170
# endif
203171
# endif
204172
# endif
205173

206174
# ifdef YYSTACK_ALLOC
207175
/* Pacify GCC's `empty if-body' warning. */
208176
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
209-
# ifndef YYSTACK_ALLOC_MAXIMUM
210-
/* The OS might guarantee only one guard page at the bottom of the stack,
211-
and a page size can be as small as 4096 bytes. So we cannot safely
212-
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
213-
to allow for a few compiler-allocated temporary stack slots. */
214-
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
215-
# endif
216177
# else
178+
# if defined (__STDC__) || defined (__cplusplus)
179+
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
180+
# define YYSIZE_T size_t
181+
# endif
217182
# define YYSTACK_ALLOC YYMALLOC
218183
# define YYSTACK_FREE YYFREE
219-
# ifndef YYSTACK_ALLOC_MAXIMUM
220-
# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
221-
# endif
222-
# ifdef __cplusplus
223-
extern "C" {
224-
# endif
225-
# ifndef YYMALLOC
226-
# define YYMALLOC malloc
227-
# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
228-
&& (defined (__STDC__) || defined (__cplusplus)))
229-
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
230-
# endif
231-
# endif
232-
# ifndef YYFREE
233-
# define YYFREE free
234-
# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
235-
&& (defined (__STDC__) || defined (__cplusplus)))
236-
void free (void *); /* INFRINGES ON USER NAME SPACE */
237-
# endif
238-
# endif
239-
# ifdef __cplusplus
240-
}
241-
# endif
242184
# endif
243185
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
244186

@@ -273,7 +215,7 @@ union yyalloc
273215
# define YYCOPY(To, From, Count) \
274216
do \
275217
{ \
276-
YYSIZE_T yyi; \
218+
register YYSIZE_T yyi; \
277219
for (yyi = 0; yyi < (Count); yyi++) \
278220
(To)[yyi] = (From)[yyi]; \
279221
} \
@@ -323,7 +265,7 @@ union yyalloc
323265
#define YYUNDEFTOK 2
324266
#define YYMAXUTOK 266
325267

326-
#define YYTRANSLATE(YYX) \
268+
#define YYTRANSLATE(YYX) \
327269
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
328270

329271
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
@@ -386,8 +328,8 @@ static const unsigned char yyrline[] =
386328
};
387329
#endif
388330

389-
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
390-
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
331+
#if YYDEBUG || YYERROR_VERBOSE
332+
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
391333
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
392334
static const char *const yytname[] =
393335
{
@@ -493,6 +435,22 @@ static const unsigned char yystos[] =
493435
20, 20, 23, 23, 23, 23, 23
494436
};
495437

438+
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
439+
# define YYSIZE_T __SIZE_TYPE__
440+
#endif
441+
#if ! defined (YYSIZE_T) && defined (size_t)
442+
# define YYSIZE_T size_t
443+
#endif
444+
#if ! defined (YYSIZE_T)
445+
# if defined (__STDC__) || defined (__cplusplus)
446+
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
447+
# define YYSIZE_T size_t
448+
# endif
449+
#endif
450+
#if ! defined (YYSIZE_T)
451+
# define YYSIZE_T unsigned int
452+
#endif
453+
496454
#define yyerrok (yyerrstatus = 0)
497455
#define yyclearin (yychar = YYEMPTY)
498456
#define YYEMPTY (-2)
@@ -522,8 +480,8 @@ do \
522480
goto yybackup; \
523481
} \
524482
else \
525-
{ \
526-
yyerror (YY_("syntax error: cannot back up")); \
483+
{ \
484+
yyerror ("syntax error: cannot back up");\
527485
YYERROR; \
528486
} \
529487
while (0)
@@ -602,7 +560,7 @@ do { \
602560
if (yydebug) \
603561
{ \
604562
YYFPRINTF (stderr, "%s ", Title); \
605-
yysymprint (stderr, \
563+
yysymprint (stderr, \
606564
Type, Value); \
607565
YYFPRINTF (stderr, "\n"); \
608566
} \
@@ -650,13 +608,13 @@ yy_reduce_print (yyrule)
650608
#endif
651609
{
652610
int yyi;
653-
unsigned long int yylno = yyrline[yyrule];
654-
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
611+
unsigned int yylno = yyrline[yyrule];
612+
YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
655613
yyrule - 1, yylno);
656614
/* Print the symbols being reduced, and their result. */
657615
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
658-
YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
659-
YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
616+
YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
617+
YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
660618
}
661619

662620
# define YY_REDUCE_PRINT(Rule) \
@@ -685,7 +643,7 @@ int yydebug;
685643
if the built-in stack extension method is used).
686644
687645
Do not make this value too large; the results are undefined if
688-
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
646+
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
689647
evaluated with infinite-precision integer arithmetic. */
690648

691649
#ifndef YYMAXDEPTH
@@ -709,7 +667,7 @@ yystrlen (yystr)
709667
const char *yystr;
710668
# endif
711669
{
712-
const char *yys = yystr;
670+
register const char *yys = yystr;
713671

714672
while (*yys++ != '\0')
715673
continue;
@@ -734,8 +692,8 @@ yystpcpy (yydest, yysrc)
734692
const char *yysrc;
735693
# endif
736694
{
737-
char *yyd = yydest;
738-
const char *yys = yysrc;
695+
register char *yyd = yydest;
696+
register const char *yys = yysrc;
739697

740698
while ((*yyd++ = *yys++) != '\0')
741699
continue;
@@ -745,55 +703,7 @@ yystpcpy (yydest, yysrc)
745703
# endif
746704
# endif
747705

748-
# ifndef yytnamerr
749-
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
750-
quotes and backslashes, so that it's suitable for yyerror. The
751-
heuristic is that double-quoting is unnecessary unless the string
752-
contains an apostrophe, a comma, or backslash (other than
753-
backslash-backslash). YYSTR is taken from yytname. If YYRES is
754-
null, do not copy; instead, return the length of what the result
755-
would have been. */
756-
static YYSIZE_T
757-
yytnamerr (char *yyres, const char *yystr)
758-
{
759-
if (*yystr == '"')
760-
{
761-
size_t yyn = 0;
762-
char const *yyp = yystr;
763-
764-
for (;;)
765-
switch (*++yyp)
766-
{
767-
case '\'':
768-
case ',':
769-
goto do_not_strip_quotes;
770-
771-
case '\\':
772-
if (*++yyp != '\\')
773-
goto do_not_strip_quotes;
774-
/* Fall through. */
775-
default:
776-
if (yyres)
777-
yyres[yyn] = *yyp;
778-
yyn++;
779-
break;
780-
781-
case '"':
782-
if (yyres)
783-
yyres[yyn] = '\0';
784-
return yyn;
785-
}
786-
do_not_strip_quotes: ;
787-
}
788-
789-
if (! yyres)
790-
return yystrlen (yystr);
791-
792-
return yystpcpy (yyres, yystr) - yyres;
793-
}
794-
# endif
795-
796-
#endif /* YYERROR_VERBOSE */
706+
#endif /* !YYERROR_VERBOSE */
797707

798708

799709

@@ -913,13 +823,13 @@ yyparse (void)
913823
#else
914824
int
915825
yyparse ()
916-
;
826+
917827
#endif
918828
#endif
919829
{
920830

921-
int yystate;
922-
int yyn;
831+
register int yystate;
832+
register int yyn;
923833
int yyresult;
924834
/* Number of tokens to shift before error messages enabled. */
925835
int yyerrstatus;
@@ -937,12 +847,12 @@ yyparse ()
937847
/* The state stack. */
938848
short int yyssa[YYINITDEPTH];
939849
short int *yyss = yyssa;
940-
short int *yyssp;
850+
register short int *yyssp;
941851

942852
/* The semantic value stack. */
943853
YYSTYPE yyvsa[YYINITDEPTH];
944854
YYSTYPE *yyvs = yyvsa;
945-
YYSTYPE *yyvsp;
855+
register YYSTYPE *yyvsp;
946856

947857

948858

@@ -974,6 +884,9 @@ yyparse ()
974884
yyssp = yyss;
975885
yyvsp = yyvs;
976886

887+
888+
yyvsp[0] = yylval;
889+
977890
goto yysetstate;
978891

979892
/*------------------------------------------------------------.
@@ -1006,7 +919,7 @@ yyparse ()
1006919
data in use in that stack, in bytes. This used to be a
1007920
conditional around just the two extra args, but that might
1008921
be undefined if yyoverflow is a macro. */
1009-
yyoverflow (YY_("memory exhausted"),
922+
yyoverflow ("parser stack overflow",
1010923
&yyss1, yysize * sizeof (*yyssp),
1011924
&yyvs1, yysize * sizeof (*yyvsp),
1012925

@@ -1017,11 +930,11 @@ yyparse ()
1017930
}
1018931
#else /* no yyoverflow */
1019932
# ifndef YYSTACK_RELOCATE
1020-
goto yyexhaustedlab;
933+
goto yyoverflowlab;
1021934
# else
1022935
/* Extend the stack our own way. */
1023936
if (YYMAXDEPTH <= yystacksize)
1024-
goto yyexhaustedlab;
937+
goto yyoverflowlab;
1025938
yystacksize *= 2;
1026939
if (YYMAXDEPTH < yystacksize)
1027940
yystacksize = YYMAXDEPTH;
@@ -1031,7 +944,7 @@ yyparse ()
1031944
union yyalloc *yyptr =
1032945
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1033946
if (! yyptr)
1034-
goto yyexhaustedlab;
947+
goto yyoverflowlab;
1035948
YYSTACK_RELOCATE (yyss);
1036949
YYSTACK_RELOCATE (yyvs);
1037950

@@ -1240,11 +1153,10 @@ yyparse ()
12401153
break;
12411154

12421155

1243-
default: break;
12441156
}
12451157

1246-
/* Line 1126 of yacc.c. */
1247-
#line 1248 "qgssearchstringparser.cc"
1158+
/* Line 1037 of yacc.c. */
1159+
#line 1160 "qgssearchstringparser.cc"
12481160

12491161
yyvsp -= yylen;
12501162
yyssp -= yylen;
@@ -1283,105 +1195,61 @@ yyparse ()
12831195

12841196
if (YYPACT_NINF < yyn && yyn < YYLAST)
12851197
{
1198+
YYSIZE_T yysize = 0;
12861199
int yytype = YYTRANSLATE (yychar);
1287-
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1288-
YYSIZE_T yysize = yysize0;
1289-
YYSIZE_T yysize1;
1290-
int yysize_overflow = 0;
1291-
char *yymsg = 0;
1292-
# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
1293-
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1200+
const char* yyprefix;
1201+
char *yymsg;
12941202
int yyx;
12951203

1296-
#if 0
1297-
/* This is so xgettext sees the translatable formats that are
1298-
constructed on the fly. */
1299-
YY_("syntax error, unexpected %s");
1300-
YY_("syntax error, unexpected %s, expecting %s");
1301-
YY_("syntax error, unexpected %s, expecting %s or %s");
1302-
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1303-
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1304-
#endif
1305-
char *yyfmt;
1306-
char const *yyf;
1307-
static char const yyunexpected[] = "syntax error, unexpected %s";
1308-
static char const yyexpecting[] = ", expecting %s";
1309-
static char const yyor[] = " or %s";
1310-
char yyformat[sizeof yyunexpected
1311-
+ sizeof yyexpecting - 1
1312-
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1313-
* (sizeof yyor - 1))];
1314-
char const *yyprefix = yyexpecting;
1315-
13161204
/* Start YYX at -YYN if negative to avoid negative indexes in
13171205
YYCHECK. */
13181206
int yyxbegin = yyn < 0 ? -yyn : 0;
13191207

13201208
/* Stay within bounds of both yycheck and yytname. */
13211209
int yychecklim = YYLAST - yyn;
13221210
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1323-
int yycount = 1;
1324-
1325-
yyarg[0] = yytname[yytype];
1326-
yyfmt = yystpcpy (yyformat, yyunexpected);
1211+
int yycount = 0;
13271212

1213+
yyprefix = ", expecting ";
13281214
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
13291215
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
13301216
{
1331-
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1217+
yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1218+
yycount += 1;
1219+
if (yycount == 5)
13321220
{
1333-
yycount = 1;
1334-
yysize = yysize0;
1335-
yyformat[sizeof yyunexpected - 1] = '\0';
1221+
yysize = 0;
13361222
break;
13371223
}
1338-
yyarg[yycount++] = yytname[yyx];
1339-
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1340-
yysize_overflow |= yysize1 < yysize;
1341-
yysize = yysize1;
1342-
yyfmt = yystpcpy (yyfmt, yyprefix);
1343-
yyprefix = yyor;
13441224
}
1345-
1346-
yyf = YY_(yyformat);
1347-
yysize1 = yysize + yystrlen (yyf);
1348-
yysize_overflow |= yysize1 < yysize;
1349-
yysize = yysize1;
1350-
1351-
if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
1352-
yymsg = (char *) YYSTACK_ALLOC (yysize);
1353-
if (yymsg)
1225+
yysize += (sizeof ("syntax error, unexpected ")
1226+
+ yystrlen (yytname[yytype]));
1227+
yymsg = (char *) YYSTACK_ALLOC (yysize);
1228+
if (yymsg != 0)
13541229
{
1355-
/* Avoid sprintf, as that infringes on the user's name space.
1356-
Don't have undefined behavior even if the translation
1357-
produced a string with the wrong number of "%s"s. */
1358-
char *yyp = yymsg;
1359-
int yyi = 0;
1360-
while ((*yyp = *yyf))
1230+
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1231+
yyp = yystpcpy (yyp, yytname[yytype]);
1232+
1233+
if (yycount < 5)
13611234
{
1362-
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1363-
{
1364-
yyp += yytnamerr (yyp, yyarg[yyi++]);
1365-
yyf += 2;
1366-
}
1367-
else
1368-
{
1369-
yyp++;
1370-
yyf++;
1371-
}
1235+
yyprefix = ", expecting ";
1236+
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1237+
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1238+
{
1239+
yyp = yystpcpy (yyp, yyprefix);
1240+
yyp = yystpcpy (yyp, yytname[yyx]);
1241+
yyprefix = " or ";
1242+
}
13721243
}
13731244
yyerror (yymsg);
13741245
YYSTACK_FREE (yymsg);
13751246
}
13761247
else
1377-
{
1378-
yyerror (YY_("syntax error"));
1379-
goto yyexhaustedlab;
1380-
}
1248+
yyerror ("syntax error; also virtual memory exhausted");
13811249
}
13821250
else
13831251
#endif /* YYERROR_VERBOSE */
1384-
yyerror (YY_("syntax error"));
1252+
yyerror ("syntax error");
13851253
}
13861254

13871255

@@ -1393,9 +1261,18 @@ yyparse ()
13931261

13941262
if (yychar <= YYEOF)
13951263
{
1396-
/* Return failure if at end of input. */
1264+
/* If at end of input, pop the error token,
1265+
then the rest of the stack, then return failure. */
13971266
if (yychar == YYEOF)
1398-
YYABORT;
1267+
for (;;)
1268+
{
1269+
1270+
YYPOPSTACK;
1271+
if (yyssp == yyss)
1272+
YYABORT;
1273+
yydestruct ("Error: popping",
1274+
yystos[*yyssp], yyvsp);
1275+
}
13991276
}
14001277
else
14011278
{
@@ -1414,11 +1291,12 @@ yyparse ()
14141291
`---------------------------------------------------*/
14151292
yyerrorlab:
14161293

1417-
/* Pacify compilers like GCC when the user code never invokes
1418-
YYERROR and the label yyerrorlab therefore never appears in user
1419-
code. */
1294+
#ifdef __GNUC__
1295+
/* Pacify GCC when the user code never invokes YYERROR and the label
1296+
yyerrorlab therefore never appears in user code. */
14201297
if (0)
14211298
goto yyerrorlab;
1299+
#endif
14221300

14231301
yyvsp -= yylen;
14241302
yyssp -= yylen;
@@ -1481,29 +1359,23 @@ yyvsp -= yylen;
14811359
| yyabortlab -- YYABORT comes here. |
14821360
`-----------------------------------*/
14831361
yyabortlab:
1362+
yydestruct ("Error: discarding lookahead",
1363+
yytoken, &yylval);
1364+
yychar = YYEMPTY;
14841365
yyresult = 1;
14851366
goto yyreturn;
14861367

14871368
#ifndef yyoverflow
1488-
/*-------------------------------------------------.
1489-
| yyexhaustedlab -- memory exhaustion comes here. |
1490-
`-------------------------------------------------*/
1491-
yyexhaustedlab:
1492-
yyerror (YY_("memory exhausted"));
1369+
/*----------------------------------------------.
1370+
| yyoverflowlab -- parser overflow comes here. |
1371+
`----------------------------------------------*/
1372+
yyoverflowlab:
1373+
yyerror ("parser stack overflow");
14931374
yyresult = 2;
14941375
/* Fall through. */
14951376
#endif
14961377

14971378
yyreturn:
1498-
if (yychar != YYEOF && yychar != YYEMPTY)
1499-
yydestruct ("Cleanup: discarding lookahead",
1500-
yytoken, &yylval);
1501-
while (yyssp != yyss)
1502-
{
1503-
yydestruct ("Cleanup: popping",
1504-
yystos[*yyssp], yyvsp);
1505-
YYPOPSTACK;
1506-
}
15071379
#ifndef yyoverflow
15081380
if (yyss != yyssa)
15091381
YYSTACK_FREE (yyss);

‎src/core/qgssearchstringparser.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* A Bison parser, made by GNU Bison 2.1. */
1+
/* A Bison parser, made by GNU Bison 2.0. */
22

33
/* Skeleton parser for Yacc-like parsing with Bison,
4-
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
1515
1616
You should have received a copy of the GNU General Public License
1717
along with this program; if not, write to the Free Software
18-
Foundation, Inc., 51 Franklin Street, Fifth Floor,
19-
Boston, MA 02110-1301, USA. */
18+
Foundation, Inc., 59 Temple Place - Suite 330,
19+
Boston, MA 02111-1307, USA. */
2020

2121
/* As a special exception, when this file is copied by Bison into a
2222
Bison output file, you may use that output file without restriction.
@@ -40,7 +40,6 @@
4040
UMINUS = 266
4141
};
4242
#endif
43-
/* Tokens. */
4443
#define NUMBER 258
4544
#define COMPARISON 259
4645
#define STRING 260
@@ -57,8 +56,8 @@
5756
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
5857
#line 60 "qgssearchstringparser.yy"
5958
typedef union YYSTYPE { QgsSearchTreeNode* node; double number; QgsSearchTreeNode::Operator op; } YYSTYPE;
60-
/* Line 1447 of yacc.c. */
61-
#line 62 "y.tab.h"
59+
/* Line 1318 of yacc.c. */
60+
#line 61 "qgssearchstringparser.h"
6261
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
6362
# define YYSTYPE_IS_DECLARED 1
6463
# define YYSTYPE_IS_TRIVIAL 1

‎src/legend/qgslegend.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,23 +450,26 @@ int QgsLegend::getItemPos(QTreeWidgetItem* item)
450450

451451
void QgsLegend::addLayer( QgsMapLayer * layer )
452452
{
453-
QgsLegendLayer * llayer = new QgsLegendLayer(layer->name());
454-
mStateOfCheckBoxes.insert(std::make_pair(llayer, Qt::Checked)); //insert the check state into the map to query for changes later
453+
QgsLegendLayer * llayer = new QgsLegendLayer(layer->name());//generate entry for mStateOfCheckBoxes below
455454
QgsLegendLayerFileGroup * llfgroup = new QgsLegendLayerFileGroup(llayer,QString("Files"));
456455
QgsLegendLayerFile * llfile = new QgsLegendLayerFile(llfgroup, QgsLegendLayerFile::nameFromLayer(layer), layer);
457456
llayer->setLayerTypeIcon();
458457

459-
//set the correct check state
458+
//set the correct check states
460459
blockSignals(true);
461460
if(layer->visible())
462461
{
463462
llfile->setCheckState(0, Qt::Checked);
463+
llayer->setCheckState(0, Qt::Checked);
464464
mStateOfCheckBoxes.insert(std::make_pair(llfile, Qt::Checked)); //insert the check state into the map to query for changes later
465+
mStateOfCheckBoxes.insert(std::make_pair(llayer, Qt::Checked));
465466
}
466467
else
467468
{
468469
llfile->setCheckState(0, Qt::Unchecked);
470+
llayer->setCheckState(0, Qt::Unchecked);
469471
mStateOfCheckBoxes.insert(std::make_pair(llfile, Qt::Unchecked)); //insert the check state into the map to query for changes later
472+
mStateOfCheckBoxes.insert(std::make_pair(llayer, Qt::Unchecked));
470473
}
471474
blockSignals(false);
472475

‎src/legend/qgslegendlayer.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayer::accept(LEGEND_ITEM_TYPE type)
8888

8989
QgsLegendItem::DRAG_ACTION QgsLegendLayer::accept(const QgsLegendItem* li) const
9090
{
91-
#ifdef QGISDEBUG
92-
qWarning("in QgsLegendLayer::accept");
93-
#endif
9491
if(li && li != this)
9592
{
9693
LEGEND_ITEM_TYPE type = li->type();
@@ -103,7 +100,11 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayer::accept(const QgsLegendItem* li) const
103100
}
104101
else if(type == LEGEND_GROUP)
105102
{
106-
return REORDER;
103+
//only parent legend layers can change positions with groups
104+
if(parent() == 0)
105+
{
106+
return REORDER;
107+
}
107108
}
108109
}
109110
return NO_ACTION;

0 commit comments

Comments
 (0)
Please sign in to comment.