~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/pars/pars0lex.l

  • Committer: Brian Aker
  • Date: 2009-01-07 09:27:07 UTC
  • Revision ID: brian@tangent.org-20090107092707-bn67qpdllfcyh3j9
Removing dead field translator code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
4
 
 
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.
8
 
 
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.
12
 
 
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
16
 
 
17
 
*****************************************************************************/
18
 
 
19
1
/******************************************************
20
2
SQL parser lexical analyzer: input file for the GNU Flex lexer generator
21
3
 
 
4
(c) 1997 Innobase Oy
 
5
 
22
6
Created 12/14/1997 Heikki Tuuri
 
7
Published under the GPL version 2
 
8
 
 
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.
 
12
 
 
13
How to make the InnoDB parser and lexer C files:
 
14
 
 
15
1. Run ./make_flex.sh to generate lexer files.
 
16
 
 
17
2. Run ./make_bison.sh to generate parser files.
 
18
 
 
19
These instructions seem to work at least with bison-1.875d and flex-2.5.31 on
 
20
Linux.
23
21
*******************************************************/
24
22
 
25
23
%option nostdinit
34
32
%option noyy_scan_buffer
35
33
%option noyy_scan_bytes
36
34
%option noyy_scan_string
 
35
%option nounistd
37
36
 
38
37
%{
39
38
#define YYSTYPE que_node_t*
40
39
 
41
40
#include "univ.i"
42
41
#include "pars0pars.h"
43
 
#include "pars0grm.hh"
 
42
#include "pars0grm.h"
44
43
#include "pars0sym.h"
45
44
#include "mem0mem.h"
46
45
#include "os0proc.h"
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. */
60
59
static
61
60
void
62
61
string_append(
63
62
/*==========*/
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 */
66
65
{
67
66
        if (stringbuf == NULL) {
68
67
                stringbuf = malloc(1);
529
528
{ID}            {
530
529
                        yylval = sym_tab_add_id(pars_sym_tab_global,
531
530
                                                        (byte*)yytext,
532
 
                                                        strlen(yytext));
 
531
                                                        ut_strlen(yytext));
533
532
                        return(PARS_ID_TOKEN);
534
533
}
535
534
 
647
646
}
648
647
 
649
648
%%
650
 
 
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
654
 
*/
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)
662
 
#endif
663
 
 
664
 
/**********************************************************************
665
 
Release any resources used by the lexer. */
666
 
UNIV_INTERN
667
 
void
668
 
pars_lexer_close(void)
669
 
/*==================*/
670
 
{
671
 
        yylex_destroy();
672
 
        free(stringbuf);
673
 
        stringbuf = NULL;
674
 
        stringbuf_len_alloc = stringbuf_len = 0;
675
 
}