Line data Source code
1 : /* 2 : * Unix SMB/CIFS implementation. 3 : * 4 : * Window Search Service 5 : * 6 : * Copyright (c) Noel Power 7 : * 8 : * This program is free software; you can redistribute it and/or modify 9 : * it under the terms of the GNU General Public License as published by 10 : * the Free Software Foundation; either version 3 of the License, or 11 : * (at your option) any later version. 12 : * 13 : * This program is distributed in the hope that it will be useful, 14 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 : * GNU General Public License for more details. 17 : * 18 : * You should have received a copy of the GNU General Public License 19 : * along with this program; if not, see <http://www.gnu.org/licenses/>. 20 : */ 21 : 22 : %{ 23 : 24 : #include "includes.h" 25 : #include "libcli/wsp/wsp_aqs.h" 26 : #include "libcli/wsp/wsp_aqs_parser.tab.h" 27 : 28 : 29 : #include <stdio.h> 30 : 31 : #define YY_NO_INPUT 32 : 33 : %} 34 : 35 : %option warn nodefault nounput 36 : 37 : %option reentrant noyywrap never-interactive nounistd 38 : %option bison-bridge 39 : 40 : LPAREN "(" 41 : RPAREN ")" 42 : AND "AND" 43 : OR "OR" 44 : NOT "NOT" 45 : EQ "==" 46 : NE "!=" 47 : GE ">=" 48 : LE "<=" 49 : LESS "<" 50 : GREATER ">" 51 : COMMA "," 52 : WHERE "WHERE" 53 : SELECT "SELECT" 54 : PROP_EQUALS ":" 55 : TRUE "true" 56 : FALSE "false" 57 : 58 : TODAY "today" 59 : YESTERDAY "yesterday" 60 : THISWEEK "thisweek" 61 : LASTWEEK "lastweek" 62 : THISMONTH "thismonth" 63 : LASTMONTH "lastmonth" 64 : THISYEAR "thisyear" 65 : LASTYEAR "lastyear" 66 : 67 : EMPTY "empty" 68 : TINY "tiny" 69 : SMALL "small" 70 : MEDIUM "medium" 71 : LARGE "large" 72 : HUGE "huge" 73 : GIGANTIC "gigantic" 74 : 75 : STARTS_WITH "$<" 76 : EQUALS "$=" 77 : K "K" 78 : M "M" 79 : G "G" 80 : T "T" 81 : KB "KB" 82 : MB "MB" 83 : GB "GB" 84 : TB "TB" 85 : RANGE "-" 86 : 87 : 88 : NUMBER [0-9]+ 89 : WS [ \r\n\t]* 90 : IDENTIFIER [a-z\."A-Z_][a-z\."A-Z_0-9]* 91 : STRING_LITERAL L?\"(\\.|[^\\"])*\" 92 : 93 : %% 94 : 95 : {WS} { /* Skip blanks. */ } 96 : 97 15 : {NUMBER} { sscanf(yytext, "%"PRId64, &yylval->num); return TOKEN_NUMBER; } 98 : 99 : {AND} { return TOKEN_AND; } 100 3 : {OR} { return TOKEN_OR; } 101 3 : {NOT} { return TOKEN_NOT; } 102 3 : {EQ} { return TOKEN_EQ; } 103 0 : {NE} { return TOKEN_NE; } 104 2 : {GE} { return TOKEN_GE; } 105 3 : {LE} { return TOKEN_LE; } 106 2 : {LESS} { return TOKEN_LT; } 107 2 : {GREATER} { return TOKEN_GT; } 108 2 : {LPAREN} { return TOKEN_LPAREN; } 109 10 : {RPAREN} { return TOKEN_RPAREN; } 110 10 : {COMMA} { return TOKEN_COMMA; } 111 2 : {WHERE} { return TOKEN_WHERE; } 112 1 : {SELECT} { return TOKEN_SELECT; } 113 1 : {TRUE} { return TOKEN_TRUE; } 114 0 : {FALSE} { return TOKEN_FALSE; } 115 0 : {PROP_EQUALS} { return TOKEN_PROP_EQUALS; } 116 30 : 117 1 : {STARTS_WITH} { return TOKEN_STARTS_WITH;} 118 1 : {EQUALS} { return TOKEN_EQUALS;} 119 1 : 120 0 : {K} { return TOKEN_K; } 121 0 : {M} { return TOKEN_M; } 122 0 : {G} { return TOKEN_G; } 123 0 : {T} { return TOKEN_T; } 124 0 : {KB} { return TOKEN_KB; } 125 0 : {MB} { return TOKEN_MB; } 126 0 : {GB} { return TOKEN_GB; } 127 0 : {TB} { return TOKEN_TB; } 128 0 : {RANGE} { return TOKEN_RANGE; } 129 1 : {TODAY} { return TOKEN_TODAY; } 130 0 : {YESTERDAY} { return TOKEN_YESTERDAY;} 131 0 : {THISWEEK} { return TOKEN_THISWEEK;} 132 0 : {LASTWEEK} { return TOKEN_LASTWEEK;} 133 0 : {THISMONTH} { return TOKEN_THISMONTH; } 134 0 : {LASTMONTH} { return TOKEN_LASTMONTH; } 135 0 : {THISYEAR} { return TOKEN_THISYEAR; } 136 0 : {LASTYEAR} { return TOKEN_LASTYEAR; } 137 0 : {EMPTY} { return TOKEN_EMPTY; } 138 0 : {TINY} { return TOKEN_TINY; } 139 0 : {SMALL} { return TOKEN_SMALL; } 140 1 : {MEDIUM} { return TOKEN_MEDIUM; } 141 0 : {LARGE} { return TOKEN_LARGE; } 142 0 : {HUGE} { return TOKEN_HUGE; } 143 0 : {GIGANTIC} { return TOKEN_GIGANTIC; } 144 0 : 145 0 : 146 0 : {STRING_LITERAL} { yylval->strval = talloc_asprintf(talloc_tos(), "%s", yytext); return TOKEN_STRING_LITERAL; } 147 48 : 148 48 : {IDENTIFIER} { yylval->strval = talloc_asprintf(talloc_tos(), "%s", yytext); return TOKEN_IDENTIFIER; } 149 : . { } 150 : 151 0 : %% 152 24 :