mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
Add make_flex.sh and update lexer/parser generation documentation.
This commit is contained in:
parent
57341d4425
commit
05e97fc7c7
3 changed files with 24 additions and 21 deletions
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# regenerate parser from bison input files as documented at the top of
|
||||
# pars0lex.l.
|
||||
# generate parser files from bison input files.
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
20
pars/make_flex.sh
Executable file
20
pars/make_flex.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# generate lexer files from flex input files.
|
||||
|
||||
set -eu
|
||||
|
||||
TMPFILE=_flex_tmp.c
|
||||
OUTFILE=lexyy.c
|
||||
|
||||
flex -o $TMPFILE pars0lex.l
|
||||
|
||||
# AIX needs its includes done in a certain order, so include "univ.i" first
|
||||
# to be sure we get it right.
|
||||
echo '#include "univ.i"' > $OUTFILE
|
||||
|
||||
# flex assigns a pointer to an int in one place without a cast, resulting in
|
||||
# a warning on Win64. this adds the cast.
|
||||
sed -e 's/int offset = (yy_c_buf_p) - (yytext_ptr);/int offset = (int)((yy_c_buf_p) - (yytext_ptr));/;' < $TMPFILE >> $OUTFILE
|
||||
|
||||
rm $TMPFILE
|
|
@ -12,27 +12,11 @@ not automatically generate them from pars0grm.y and pars0lex.l.
|
|||
|
||||
How to make the InnoDB parser and lexer C files:
|
||||
|
||||
1. First do
|
||||
bison -d pars0grm.y
|
||||
That generates pars0grm.tab.c and pars0grm.tab.h.
|
||||
1. Run ./make_flex.sh to generate lexer files.
|
||||
|
||||
2. Rename pars0grm.tab.c to pars0grm.c and pars0grm.tab.h to pars0grm.h.
|
||||
2. Run ./make_bison.sh to generate parser files.
|
||||
|
||||
3. Copy pars0grm.h also to /innobase/include
|
||||
|
||||
4. Do
|
||||
flex pars0lex.l
|
||||
That generates lex.yy.c.
|
||||
|
||||
5. Rename lex.yy.c to lexyy.c.
|
||||
|
||||
6. Add '#include "univ.i"' before #include <stdio.h> in lexyy.c
|
||||
(Needed for AIX)
|
||||
|
||||
7. Add a type cast to int to the assignment below the comment
|
||||
'need more input.' (Removes a warning on Win64)
|
||||
|
||||
These instructions seem to work at least with bison-1.28 and flex-2.5.4 on
|
||||
These instructions seem to work at least with bison-1.875d and flex-2.5.31 on
|
||||
Linux.
|
||||
*******************************************************/
|
||||
|
||||
|
|
Loading…
Reference in a new issue