% Copyright 2012-2014, Alexander Shibakov
% This file is part of SPLinT
%
% SPLinT is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% SPLinT is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with SPLinT.  If not, see <http://www.gnu.org/licenses/>.

% parser environment

\def\basicparserinit{%
    \yytext{}%
    \yytextpure{}%
    \yytextseenpure{}%
    \yytextseen{}%
    \yybyte{}%
    \yyfbyte{}\yysbyte{}%
    \yystash{}%
    \yystashseen{}%
    \yyformat{}%
    \yyformatseen{}%
    \yyfutureyytext{}%
    \yyinitstack\yystatestack
    \yyfmark=\z@
    \yysmark=\z@
    \yyfmarklast=\z@
    \formatmarker=\z@
    \yysmarklast=\z@
    \stashmarker=\z@
    \yytextbackupfalse
    \yyg@yyinit=\z@
    \yyg@yystart=\z@
    \YYATBOL=\@ne
    \yyparsefailfalse
    \YYEOBLASTMATCHtrue
}

% optimization options

\def\optimizeall{%
        % lexer
    \ifnum\optimization>\z@
        \optimize{yynxt}%
        \optimize{yyaccept}%
        \optimize{yydef}%
        \optimize{yychk}%
        \optimize{yybase}%
        \optimize{yyec}%
        \optimize{yymeta}%
        \tracingstats=\@ne
    \fi
        % parser
    \ifnum\optimization>\@ne
        \optimize{yytranslate}%
        \optimize{yyrone}%
        \optimize{yyrtwo}%
        \optimize{yyrthree}%
        \optimize{yydefact}%
        \optimize{yydefgoto}%
        \optimize{yypact}%
        \optimize{yypgoto}%
        \optimize{yytable}%
        \optimize{yycheck}%
        \optimize{yyprhs}%
        \optimize{yyrhs}%
        \optimize{yytoknum}%
        \optimize{yystos}%
        \optimizetext{yytname}%
    \fi
}

