Skip to content

Commit 071a826

Browse files
author
wonder
committedMar 11, 2006
Small tweaks in lexer.
Added flex+bison generated files under version control. (this allows that users don't have to install flex+bison for QGIS compilation) git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5004 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

4 files changed

+3383
-16
lines changed

4 files changed

+3383
-16
lines changed
 

‎src/core/qgssearchstringlexer.cc

Lines changed: 1859 additions & 0 deletions
Large diffs are not rendered by default.

‎src/core/qgssearchstringlexer.ll

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
%}
3131

32-
white [ \t\n]+
32+
white [ \t\r\n]+
3333

3434
col_first [A-Za-z_]
3535
col_next [A-Za-z0-9_]
@@ -43,22 +43,11 @@ number {num1}|{num2}
4343
str_char ('')|(\\.)|[^'\\]
4444
string "'"{str_char}*"'"
4545

46-
47-
comparison (">="|"<="|"<"|">"|"="|"!="|"<>"|"~"|"LIKE")
48-
49-
arithmetic [+-/*]
50-
5146
%%
5247

53-
{white} /* skip blanks and tabs */
54-
55-
[()] { return yytext[0]; }
56-
57-
{number} { yylval.number = atof(yytext); return NUMBER; }
58-
59-
"NOT " { return NOT; }
60-
" AND " { return AND; }
61-
" OR " { return OR; }
48+
"NOT" { return NOT; }
49+
"AND" { return AND; }
50+
"OR" { return OR; }
6251

6352
"=" { yylval.op = QgsSearchTreeNode::opEQ; return COMPARISON; }
6453
"!=" { yylval.op = QgsSearchTreeNode::opNE; return COMPARISON; }
@@ -70,12 +59,18 @@ arithmetic [+-/*]
7059
"~" { yylval.op = QgsSearchTreeNode::opRegexp; return COMPARISON; }
7160
"LIKE" { yylval.op = QgsSearchTreeNode::opLike; return COMPARISON; }
7261

73-
{arithmetic} { return yytext[0]; }
62+
[+-/*] { return yytext[0]; }
63+
64+
[()] { return yytext[0]; }
65+
66+
{number} { yylval.number = atof(yytext); return NUMBER; }
7467

7568
{string} { return STRING; }
7669

7770
{column_ref} { return COLUMN_REF; }
7871

72+
{white} /* skip blanks and tabs */
73+
7974
. { return UNKNOWN_CHARACTER; }
8075

8176
%%

‎src/core/qgssearchstringparser.cc

Lines changed: 1444 additions & 0 deletions
Large diffs are not rendered by default.

‎src/core/qgssearchstringparser.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/* A Bison parser, made by GNU Bison 1.875d. */
2+
3+
/* Skeleton parser for Yacc-like parsing with Bison,
4+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5+
6+
This program is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation; either version 2, or (at your option)
9+
any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, write to the Free Software
18+
Foundation, Inc., 59 Temple Place - Suite 330,
19+
Boston, MA 02111-1307, USA. */
20+
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. */
25+
26+
/* Tokens. */
27+
#ifndef YYTOKENTYPE
28+
# define YYTOKENTYPE
29+
/* Put the tokens into the symbol table, so that GDB and other debuggers
30+
know about them. */
31+
enum yytokentype {
32+
NUMBER = 258,
33+
COMPARISON = 259,
34+
STRING = 260,
35+
COLUMN_REF = 261,
36+
UNKNOWN_CHARACTER = 262,
37+
NOT = 263,
38+
AND = 264,
39+
OR = 265,
40+
UMINUS = 266
41+
};
42+
#endif
43+
#define NUMBER 258
44+
#define COMPARISON 259
45+
#define STRING 260
46+
#define COLUMN_REF 261
47+
#define UNKNOWN_CHARACTER 262
48+
#define NOT 263
49+
#define AND 264
50+
#define OR 265
51+
#define UMINUS 266
52+
53+
54+
55+
56+
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
57+
#line 60 "qgssearchstringparser.yy"
58+
typedef union YYSTYPE { QgsSearchTreeNode* node; double number; QgsSearchTreeNode::Operator op; } YYSTYPE;
59+
/* Line 1285 of yacc.c. */
60+
#line 61 "qgssearchstringparser.h"
61+
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
62+
# define YYSTYPE_IS_DECLARED 1
63+
# define YYSTYPE_IS_TRIVIAL 1
64+
#endif
65+
66+
extern YYSTYPE yylval;
67+
68+
69+

0 commit comments

Comments
 (0)
Please sign in to comment.