~ubuntu-branches/ubuntu/hardy/qgis/hardy

« back to all changes in this revision

Viewing changes to src/core/qgssearchstringlexer.ll

  • Committer: Bazaar Package Importer
  • Author(s): William Grant
  • Date: 2007-05-06 13:42:32 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070506134232-pyli6t388w5asd8x
Tags: 0.8.0-3ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - debian/rules, debian/qgis.install, debian/qgis.dirs debian/qgis.desktop:
    Add and install .desktop.
* debian/qgis.desktop: Remove Applications category; it's not real.
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          qgssearchstringparser.ll
 
3
          Rules for lexical analysis of search strings done by Flex
 
4
                          --------------------
 
5
    begin                : 2005-07-26
 
6
    copyright            : (C) 2005 by Martin Dobias
 
7
    email                : won.der at centrum.sk
 
8
***************************************************************************/
 
9
 
 
10
/***************************************************************************
 
11
 *                                                                         *
 
12
 *   This program is free software; you can redistribute it and/or modify  *
 
13
 *   it under the terms of the GNU General Public License as published by  *
 
14
 *   the Free Software Foundation; either version 2 of the License, or     *
 
15
 *   (at your option) any later version.                                   *
 
16
 *                                                                         *
 
17
 ***************************************************************************/
 
18
 /* $Id: qgssearchstringlexer.ll 5939 2006-10-12 16:24:55Z wonder $ */
 
19
 
 
20
%option noyywrap
 
21
%option case-insensitive
 
22
 
 
23
 // ensure that lexer will be 8-bit (and not just 7-bit)
 
24
%option 8bit
 
25
 
 
26
%{
 
27
  
 
28
#include <stdlib.h>  // atof()
 
29
  
 
30
#include "qgssearchtreenode.h"
 
31
#include "qgssearchstringparser.h"
 
32
 
 
33
%}
 
34
 
 
35
white       [ \t\r\n]+
 
36
 
 
37
non_ascii    [\x80-\xFF]
 
38
 
 
39
col_first    [A-Za-z_]|{non_ascii}
 
40
col_next     [A-Za-z0-9_]|{non_ascii}
 
41
column_ref  {col_first}{col_next}*
 
42
 
 
43
dig     [0-9]
 
44
num1    {dig}+\.?([eE][-+]?{dig}+)?
 
45
num2    {dig}*\.{dig}+([eE][-+]?{dig}+)?
 
46
number  {num1}|{num2}
 
47
 
 
48
str_char    ('')|(\\.)|[^'\\]
 
49
string      "'"{str_char}*"'"
 
50
 
 
51
%%
 
52
 
 
53
"NOT"    { return NOT; }
 
54
"AND"   { return AND;  }
 
55
"OR"    { return OR; }
 
56
 
 
57
"="   {  yylval.op = QgsSearchTreeNode::opEQ; return COMPARISON; }
 
58
"!="  {  yylval.op = QgsSearchTreeNode::opNE; return COMPARISON; }
 
59
"<="  {  yylval.op = QgsSearchTreeNode::opLE; return COMPARISON; }
 
60
">="  {  yylval.op = QgsSearchTreeNode::opGE; return COMPARISON; }
 
61
"<>"  {  yylval.op = QgsSearchTreeNode::opNE; return COMPARISON; }
 
62
"<"   {  yylval.op = QgsSearchTreeNode::opLT; return COMPARISON; }
 
63
">"   {  yylval.op = QgsSearchTreeNode::opGT; return COMPARISON; }
 
64
"~"   {  yylval.op = QgsSearchTreeNode::opRegexp; return COMPARISON; }
 
65
"LIKE" { yylval.op = QgsSearchTreeNode::opLike; return COMPARISON; }
 
66
 
 
67
[+-/*]    { return yytext[0]; }
 
68
 
 
69
[()]      { return yytext[0]; }
 
70
 
 
71
{number}  { yylval.number  = atof(yytext); return NUMBER; }
 
72
 
 
73
{string}  { return STRING; }
 
74
 
 
75
{column_ref}   { return COLUMN_REF; }
 
76
 
 
77
{white}    /* skip blanks and tabs */
 
78
 
 
79
.       { return UNKNOWN_CHARACTER; }
 
80
 
 
81
%%
 
82
 
 
83
void set_input_buffer(const char* buffer)
 
84
{
 
85
  yy_scan_string(buffer);
 
86
}
 
87