1
/*****************************************************************************
3
Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
Place, Suite 330, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
1
/******************************************************
20
2
SQL parser lexical analyzer: input file for the GNU Flex lexer generator
22
6
Created 12/14/1997 Heikki Tuuri
7
Published under the GPL version 2
9
The InnoDB parser is frozen because MySQL takes care of SQL parsing.
10
Therefore we normally keep the InnoDB parser C files as they are, and do
11
not automatically generate them from pars0grm.y and pars0lex.l.
13
How to make the InnoDB parser and lexer C files:
15
1. Run ./make_flex.sh to generate lexer files.
17
2. Run ./make_bison.sh to generate parser files.
19
These instructions seem to work at least with bison-1.875d and flex-2.5.31 on
23
21
*******************************************************/
56
55
static ulint stringbuf_len_alloc = 0; /* Allocated length */
57
56
static ulint stringbuf_len = 0; /* Current length */
58
57
static char* stringbuf; /* Start of buffer */
59
/** Appends a string to the buffer. */
58
/* Appends a string to the buffer. */
64
const char* str, /*!< in: string to be appended */
65
ulint len) /*!< in: length of the string */
63
const char* str, /* in: string to be appended */
64
ulint len) /* in: length of the string */
67
66
if (stringbuf == NULL) {
68
67
stringbuf = malloc(1);
651
/* yylex_destroy() is not defined before Flex 2.5.9
652
so we attempt to define something that should be good enough
653
for old Flex - such as that found on CentOS 5
655
#if !defined(YY_FLEX_MAJOR_VERSION) || YY_FLEX_MAJOR_VERSION < 2 \
656
|| (YY_FLEX_MAJOR_VERSION == 2 \
657
&& (!defined(YY_FLEX_MINOR_VERSION) || YY_FLEX_MINOR_VERSION < 5 \
658
|| (YY_FLEX_MINOR_VERSION == 5 \
659
&& (!defined(YY_FLEX_SUBMINOR_VERSION) \
660
|| YY_FLEX_SUBMINOR_VERSION < 9))))
661
# define yylex_destroy() yy_delete_buffer(YY_CURRENT_BUFFER)
664
/**********************************************************************
665
Release any resources used by the lexer. */
668
pars_lexer_close(void)
669
/*==================*/
674
stringbuf_len_alloc = stringbuf_len = 0;