1
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
* Drizzle Execute Parser
5
* Copyright (C) 2011 Data Differential, http://datadifferential.com/
6
* Copyright (C) 2011 Vijay Samuel, vjsamuel1990@gmail.com
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions are
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
17
* * Redistributions in binary form must reproduce the above
18
* copyright notice, this list of conditions and the following disclaimer
19
* in the documentation and/or other materials provided with the
22
* * The names of its contributors may not be used to endorse or
23
* promote products derived from this software without specific prior
26
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
#include <drizzled/execute/parser.h>
44
#include <drizzled/execute/context.h>
45
#include <drizzled/execute/symbol.h>
46
#include <drizzled/lex_string.h>
48
using namespace drizzled;
50
#pragma GCC diagnostic ignored "-Wold-style-cast"
51
#pragma GCC diagnostic ignored "-Wsign-compare"
52
#pragma GCC diagnostic ignored "-Wunused-parameter"
53
#pragma GCC diagnostic ignored "-Wmissing-declarations"
55
#define YY_EXTRA_TYPE ::drizzled::execute::Context*
65
#define PARAM yyget_extra(yyscanner)
67
#define get_lex_chars(buffer, result, max_size, context) \
69
if (context->pos >= context->length) \
75
result= (int)(context->length - context->pos); \
76
(size_t)result > (size_t)max_size ? result= max_size : 0; \
77
memcpy(buffer, context->buf + context->pos, result); \
78
context->pos += result; \
83
#define YY_INPUT(buffer, result, max_size) get_lex_chars(buffer, result, max_size, PARAM)
88
UTF8_BYTE_ORDER_MARK [\xEF][\xBB][\xBF]
94
U2 [\xC2-\xDF][\x80-\xBF]
95
U3 [\xE0][\xA0-\xBF][\x80-\xBF]
96
U4 [\xE1-\xEC][\x80-\xBF][\x80-\xBF]
97
U5 [\xED][\x80-\x9F][\x80-\xBF]
98
U6 [\xEE-\xEF][\x80-\xBF][\x80-\xBF]
99
U7 [\nxF0][\x90-\xBF][\x80-\xBF][\x80-\xBF]
100
U8 [\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]
101
U9 [\xF4][\x80-\x8F][\x80-\xBF][\x80-\xBF]
103
LETTERS {ASCII}|{U2}|{U3}|{U4}|{U5}|{U6}|{U7}|{U8}|{U9}
104
ALNUM {LETTERS}|{DIGITS}
109
%option case-insensitive
113
%option outfile="drizzled/execute/scanner.cc" header-file="drizzled/execute/scanner.h"
115
%option prefix="execute_"
119
{UTF8_BYTE_ORDER_MARK} { /* Byte Order Mark */ }
121
[\t\r\n ] ; /* skip whitespace */
124
[[:punct:]]?{ALNUM}*["."{ALNUM}_-]*{ALNUM}*[[:punct:]]? {
125
yylval->string.str = yytext;
126
yylval->string.length = yyleng;
131
yyextra->begin= yytext;
139
void Context::init_scanner()
141
yylex_init(&scanner);
142
yyset_extra(this, scanner);
145
void Context::destroy_scanner()
147
yylex_destroy(scanner);
150
} // namespace execute
151
} // namespace drizzled