@q Copyright 2012-2022, Alexander Shibakov@>
@q This file is part of SPLinT@>
@q SPLinT is free software: you can redistribute it and/or modify@>
@q it under the terms of the GNU General Public License as published by@>
@q the Free Software Foundation, either version 3 of the License, or@>
@q (at your option) any later version.@>
@q SPLinT is distributed in the hope that it will be useful,@>
@q but WITHOUT ANY WARRANTY; without even the implied warranty of@>
@q MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the@>
@q GNU General Public License for more details.@>
@q You should have received a copy of the GNU General Public License@>
@q along with SPLinT. If not, see .@>
@*1\eatone{Flex}\flex\ specific routines. The output of the scanner automaton
follows the steps similar to the ones taken during the parser output.
The major difference is in the output of actions and constants.
@*2 Tables.
As in the case of a parser we start with all the table names.
@=
_register_table_d(yy_accept)@;
_register_table_d(yy_ec)@;
_register_table_d(yy_meta)@;
_register_table_d(yy_base)@;
_register_table_d(yy_def)@;
_register_table_d(yy_nxt)@;
_register_table_d(yy_chk)@;
@*2Actions. The scanner function, |yylex()|, has been reverse
engineered to execute all portions of
the action code. The method chosen here makes sure that none of the
tables gets written past its last element.
@=
int max_yybase_entry = 0;
int max_yyaccept_entry = 0;
int max_yynxt_entry = 0;
int max_yy_ec_entry = 0;
@ The `exotic' scanner constants treated below are the constants used
to control the scanner code itself. Unfortunately they are not given
any names that can be used by the `driver' to output them in a simple
way.
@=
{
int i;
for ( i = 0; i < sizeof( yy_base )/sizeof( yy_base[0] ); i++ ) {
if ( yy_base[i] > max_yybase_entry ) {
max_yybase_entry = yy_base[i];
}
}
for ( i = 0; i < sizeof( yy_nxt )/sizeof( yy_nxt[0] ); i++ ) {
if ( yy_nxt[i] > max_yynxt_entry ) {
max_yynxt_entry = yy_nxt[i];
}
}
for ( i = 0; i < sizeof( yy_accept )/sizeof( yy_accept[0] ); i++ ) {
if ( yy_accept[i] > max_yyaccept_entry ) {
max_yyaccept_entry = yy_accept[i];
}
}
for ( i = 0; i < sizeof( yy_ec )/sizeof( yy_ec[0] ); i++ ) {
if ( yy_ec[i] > max_yy_ec_entry ) {
max_yy_ec_entry = yy_ec[i];
}
}
}
@ @