All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.eBus.text.TokenLexerContext Maven / Gradle / Ivy

The newest version!
/*
 * ex: set ro:
 * DO NOT EDIT.
 * generated by smc (http://smc.sourceforge.net/)
 * from file : TokenLexer.sm.sm
 */


//
// Copyright 2001 - 2008, 2011 Charles W. Rapp
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
// Tokens
//       ::= [A-Za-z][A-Za-z0-9_]*
//               ;
//    ::= [+-]{0,1}[0-9]+
//               ;
//      ::= [+-]{0,1}[0-9]*"."[0-9]+
//               | [+-]{0,1}[0-9]+"."[0-9]*
//               ;
//     ::= "*"
//               ;
//  ::= '.'
//               ;
//   ::= [punctuation]+ (user defined)
//               ;
//  ::= [punctuation] (user defined)
//               ;


package net.sf.eBus.text;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.invoke.MethodType;
import statemap.FSMContext7;
import statemap.State7;
import statemap.TransitionHandle;

public class TokenLexerContext
    extends FSMContext7
{
//---------------------------------------------------------------
// Member methods.
//

    //-----------------------------------------------------------
    // Constructors.
    //

    public TokenLexerContext(final TokenLexer owner)
    {
        this (owner, sStates[TokenMap_Start_STATE_ID]);
    }

    public TokenLexerContext(final TokenLexer owner, final int initStateId)
    {
        this (owner, sStates[initStateId]);    }

    public TokenLexerContext(final TokenLexer owner, final State7 initState)
    {
        super (initState);

        ctxt = owner;
    }

    //
    // end of Constructors.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // FSMContext7 Abstract Method Override.
    //

    @Override
    protected void executeAction(final MethodHandle mh)
    {
        try
        {
            mh.invokeExact(this);
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
    }

    //
    // end of FSMContext7 Abstract Method Override.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // Transitions.
    //

    public void EOF()
    {
        mTransition = "EOF";
        try
        {
            final TransitionHandle th =
                getState().transition(EOF6_TRANSITION_ID);

            (th.handle()).invokeExact(this);
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void EOL(char c)
    {
        mTransition = "EOL";
        try
        {
            final TransitionHandle th =
                getState().transition(EOL2_TRANSITION_ID);

            if (th.isDefault())
            {
                (th.handle()).invokeExact(this);
            }
            else
            {
                (th.handle()).invokeExact(this, c);
            }
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void alpha(char c)
    {
        mTransition = "alpha";
        try
        {
            final TransitionHandle th =
                getState().transition(alpha3_TRANSITION_ID);

            if (th.isDefault())
            {
                (th.handle()).invokeExact(this);
            }
            else
            {
                (th.handle()).invokeExact(this, c);
            }
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void characterDone()
    {
        mTransition = "characterDone";
        try
        {
            final TransitionHandle th =
                getState().transition(characterDone10_TRANSITION_ID);

            (th.handle()).invokeExact(this);
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void characterError()
    {
        mTransition = "characterError";
        try
        {
            final TransitionHandle th =
                getState().transition(characterError11_TRANSITION_ID);

            (th.handle()).invokeExact(this);
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void commentDone()
    {
        mTransition = "commentDone";
        try
        {
            final TransitionHandle th =
                getState().transition(commentDone13_TRANSITION_ID);

            (th.handle()).invokeExact(this);
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void digit(char c)
    {
        mTransition = "digit";
        try
        {
            final TransitionHandle th =
                getState().transition(digit4_TRANSITION_ID);

            if (th.isDefault())
            {
                (th.handle()).invokeExact(this);
            }
            else
            {
                (th.handle()).invokeExact(this, c);
            }
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void punctuation(char c)
    {
        mTransition = "punctuation";
        try
        {
            final TransitionHandle th =
                getState().transition(punctuation5_TRANSITION_ID);

            if (th.isDefault())
            {
                (th.handle()).invokeExact(this);
            }
            else
            {
                (th.handle()).invokeExact(this, c);
            }
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void stringDone()
    {
        mTransition = "stringDone";
        try
        {
            final TransitionHandle th =
                getState().transition(stringDone8_TRANSITION_ID);

            (th.handle()).invokeExact(this);
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void stringError()
    {
        mTransition = "stringError";
        try
        {
            final TransitionHandle th =
                getState().transition(stringError9_TRANSITION_ID);

            (th.handle()).invokeExact(this);
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void unicode(char c)
    {
        mTransition = "unicode";
        try
        {
            final TransitionHandle th =
                getState().transition(unicode12_TRANSITION_ID);

            if (th.isDefault())
            {
                (th.handle()).invokeExact(this);
            }
            else
            {
                (th.handle()).invokeExact(this, c);
            }
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    public void whitespace(char c)
    {
        mTransition = "whitespace";
        try
        {
            final TransitionHandle th =
                getState().transition(whitespace1_TRANSITION_ID);

            if (th.isDefault())
            {
                (th.handle()).invokeExact(this);
            }
            else
            {
                (th.handle()).invokeExact(this, c);
            }
        }
        catch (Throwable tex)
        {
            debugOutput(tex);

            if (RuntimeException.class.isInstance(tex))
            {
                throw ((RuntimeException) tex);
            }
        }
        mTransition = "";
    }

    //
    // end of Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.Default State Transitions.
    //

    private void TokenMap_Default_unicode(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
            ctxt.badToken("invalid character");
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void TokenMap_Default_EOL(char c)
    {
        final int stateId = mState.getId();


    }


    //
    // end of TokenMap.Default State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.Start State Transitions.
    //

    private void TokenMap_Start_Default()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("invalid character.");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Start_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.EOF);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Start_EOL(char c)
    {
        final int stateId = mState.getId();


    }


    private void TokenMap_Start_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[TokenMap_Name_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Start_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[TokenMap_Number_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Start_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (ctxt.isDelimiter(c) == true)
        {
            try
            {
                clearState();
                ctxt.appendToken(c);
                ctxt.endToken(ctxt.delimiterType(c));
            }
            finally
            {
                setState(sStates[stateId]);
            }

        }
        else if (c == '+')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_SignOperator_STATE_ID]);
            }

            enterState();
        }
        else if (c == '-')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_SignOperator_STATE_ID]);
            }

            enterState();
        }
        else if (c == '.')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_Period_STATE_ID]);
            }

            enterState();
        }
        else if (c == '/')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_CommentStart_STATE_ID]);
            }

            enterState();
        }
        else if (c == '"')
        {
            try
            {
                // No actions.
            }
            finally
            {
                setState(sStates[TokenMap_DoubleQuoteString_STATE_ID]);
                enterState();
                pushState(sStates[StringMap_Start_STATE_ID]);
            }

            enterState();
        }
        else if (c == '\'')
        {
            try
            {
                // No actions.
            }
            finally
            {
                setState(sStates[TokenMap_SingleQuoteString_STATE_ID]);
                enterState();
                pushState(sStates[CharacterMap_Start_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_Operator_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_Start_whitespace(char c)
    {
        final int stateId = mState.getId();


    }


    //
    // end of TokenMap.Start State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.DoubleQuoteString State Transitions.
    //

    private void TokenMap_DoubleQuoteString_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("malformed string");
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.EOF);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_DoubleQuoteString_stringDone()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.STRING);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_DoubleQuoteString_stringError()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("malformed string");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.DoubleQuoteString State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.SingleQuoteString State Transitions.
    //

    private void TokenMap_SingleQuoteString_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("malformed single-quote character");
            ctxt.ungetChar();
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_SingleQuoteString_characterDone()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.CHARACTER);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_SingleQuoteString_characterError()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("malformed single-quote character");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.SingleQuoteString State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.Name State Transitions.
    //

    private void TokenMap_Name_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.NAME);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Name_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.NAME);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Name_alpha(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void TokenMap_Name_digit(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void TokenMap_Name_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '_')
        {
            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[stateId]);
            }

        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.endToken(TokenLexer.NAME);
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_Name_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[TokenMap_NameError_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Name_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.NAME);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.Name State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.NameError State Transitions.
    //

    private void TokenMap_NameError_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("malformed name");
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_NameError_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("malformed name");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_NameError_alpha(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void TokenMap_NameError_digit(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void TokenMap_NameError_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '_')
        {
            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[stateId]);
            }

        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.badToken("malformed name");
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_NameError_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[TokenMap_NameError_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_NameError_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("malformed name");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.NameError State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.Period State Transitions.
    //

    private void TokenMap_Period_EOF()
    {
        final int stateId = mState.getId();

        if (ctxt.isDelimiter('.') == true)
        {
            exitState();

            try
            {
                clearState();
                ctxt.endToken(ctxt.delimiterType('.'));
            }
            finally
            {
                setState(sStates[TokenMap_EndOfFile_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.endToken(TokenLexer.OPERATOR);
            }
            finally
            {
                setState(sStates[TokenMap_EndOfFile_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_Period_EOL(char c)
    {
        final int stateId = mState.getId();

        if (ctxt.isDelimiter('.') == true)
        {
            exitState();

            try
            {
                clearState();
                ctxt.endToken(ctxt.delimiterType('.'));
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.endToken(TokenLexer.OPERATOR);
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_Period_alpha(char c)
    {
        final int stateId = mState.getId();

        if (ctxt.isDelimiter('.') == true)
        {
            exitState();

            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.endToken(ctxt.delimiterType('.'));
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.endToken(TokenLexer.OPERATOR);
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_Period_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[TokenMap_Mantissa_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Period_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (ctxt.isDelimiter(c) == true)
        {
            exitState();

            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.endToken(TokenLexer.OPERATOR);
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_Operator_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_Period_whitespace(char c)
    {
        final int stateId = mState.getId();

        if (ctxt.isDelimiter('.') == true)
        {
            exitState();

            try
            {
                clearState();
                ctxt.endToken(ctxt.delimiterType('.'));
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.endToken(TokenLexer.OPERATOR);
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
    }


    //
    // end of TokenMap.Period State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.SignOperator State Transitions.
    //

    private void TokenMap_SignOperator_Default()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
        }
        finally
        {
            setState(sStates[TokenMap_Operator_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_SignOperator_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_SignOperator_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[TokenMap_Number_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_SignOperator_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '.')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_MantissaStart_STATE_ID]);
            }

            enterState();
        }
        else
        {
            TokenMap_SignOperator_Default();
        }

    }


    //
    // end of TokenMap.SignOperator State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.Number State Transitions.
    //

    private void TokenMap_Number_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.INTEGER);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Number_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.INTEGER);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Number_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.badToken("malformed number");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Number_digit(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void TokenMap_Number_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '.')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_MantissaStart_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.endToken(TokenLexer.INTEGER);
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_Number_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.badToken("malformed number");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Number_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.INTEGER);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.Number State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.MantissaStart State Transitions.
    //

    private void TokenMap_MantissaStart_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.FLOAT);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_MantissaStart_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.FLOAT);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_MantissaStart_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
            ctxt.badToken("malformed number");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_MantissaStart_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[TokenMap_Mantissa_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_MantissaStart_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '.')
        {
            exitState();

            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.badToken("malformed decimal number");
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.endToken(TokenLexer.FLOAT);
            }
            finally
            {
                setState(sStates[TokenMap_Start_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_MantissaStart_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
            ctxt.badToken("malformed number");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_MantissaStart_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.FLOAT);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.MantissaStart State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.Mantissa State Transitions.
    //

    private void TokenMap_Mantissa_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.FLOAT);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Mantissa_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.FLOAT);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Mantissa_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
            ctxt.badToken("malformed number");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Mantissa_digit(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void TokenMap_Mantissa_punctuation(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.FLOAT);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Mantissa_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
            ctxt.badToken("malformed number");
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Mantissa_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.FLOAT);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.Mantissa State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.Operator State Transitions.
    //

    private void TokenMap_Operator_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Operator_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Operator_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Operator_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Operator_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (ctxt.isDelimiter(c) == true)
        {
            try
            {
                clearState();
                ctxt.ungetChar();
                ctxt.endToken(TokenLexer.OPERATOR);
            }
            finally
            {
                setState(sStates[stateId]);
            }

        }
        else
        {
            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[stateId]);
            }

        }
    }


    private void TokenMap_Operator_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_Operator_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.Operator State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.CommentStart State Transitions.
    //

    private void TokenMap_CommentStart_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_CommentStart_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_CommentStart_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_CommentStart_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_CommentStart_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '*')
        {
            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_OldComment_STATE_ID]);
                enterState();
                pushState(sStates[OldCommentMap_Start_STATE_ID]);
            }

            enterState();
        }
        else if (c == '/')
        {
            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_NewComment_STATE_ID]);
                enterState();
                pushState(sStates[NewCommentMap_Start_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[TokenMap_Operator_STATE_ID]);
            }

            enterState();
        }
    }


    private void TokenMap_CommentStart_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.OPERATOR);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.CommentStart State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.OldComment State Transitions.
    //

    private void TokenMap_OldComment_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("missing */ to end comment.");
            ctxt.ungetChar();
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_OldComment_commentDone()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.COMMENT);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.OldComment State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.NewComment State Transitions.
    //

    private void TokenMap_NewComment_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.ungetChar();
            ctxt.endToken(TokenLexer.COMMENT);
        }
        finally
        {
            setState(sStates[TokenMap_EndOfFile_STATE_ID]);
        }

        enterState();

    }


    private void TokenMap_NewComment_commentDone()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.COMMENT);
        }
        finally
        {
            setState(sStates[TokenMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of TokenMap.NewComment State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // TokenMap.EndOfFile State Transitions.
    //

    private void TokenMap_EndOfFile_Default()
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.endToken(TokenLexer.EOF);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    //
    // end of TokenMap.EndOfFile State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // StringMap.Default State Transitions.
    //

    private void StringMap_Default_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[StringMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void StringMap_Default_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[StringMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void StringMap_Default_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[StringMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void StringMap_Default_punctuation(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[StringMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void StringMap_Default_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[StringMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void StringMap_Default_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            popState();
        }


        EOF();

    }


    //
    // end of StringMap.Default State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // StringMap.Start State Transitions.
    //

    private void StringMap_Start_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            popState();
        }


        stringError();

    }


    private void StringMap_Start_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("strings may not contain end-of-line");
        }
        finally
        {
            setState(sStates[StringMap_BadString_STATE_ID]);
        }

        enterState();

    }


    private void StringMap_Start_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '"')
        {
            exitState();

            try
            {
                // No actions.
            }
            finally
            {
                popState();
            }


            stringDone();
        }
        else if (c == '\\')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[StringMap_Escaped_STATE_ID]);
            }

            enterState();
        }
        else
        {
            StringMap_Default_punctuation(c);
        }

    }


    //
    // end of StringMap.Start State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // StringMap.Escaped State Transitions.
    //

    private void StringMap_Escaped_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.badToken("malformed string");
        }
        finally
        {
            setState(sStates[StringMap_Start_STATE_ID]);
        }

        enterState();

    }


    //
    // end of StringMap.Escaped State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // StringMap.BadString State Transitions.
    //

    private void StringMap_BadString_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '"')
        {
            exitState();

            try
            {
                // No actions.
            }
            finally
            {
                popState();
            }


            stringError();
        }
    }


    private void StringMap_BadString_unicode(char c)
    {
        final int stateId = mState.getId();


    }


    //
    // end of StringMap.BadString State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // CharacterMap.Default State Transitions.
    //

    private void CharacterMap_Default_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            popState();
        }


        EOF();

    }


    //
    // end of CharacterMap.Default State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // CharacterMap.Start State Transitions.
    //

    private void CharacterMap_Start_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            setState(sStates[CharacterMap_BadCharacter_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Start_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Start_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Start_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '\'')
        {
            exitState();

            try
            {
                // No actions.
            }
            finally
            {
                popState();
            }


            characterError();
        }
        else if (c == '\\')
        {
            exitState();

            try
            {
                // No actions.
            }
            finally
            {
                setState(sStates[CharacterMap_Escaped_STATE_ID]);
            }

            enterState();
        }
        else
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[CharacterMap_Done_STATE_ID]);
            }

            enterState();
        }
    }


    private void CharacterMap_Start_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Start_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    //
    // end of CharacterMap.Start State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // CharacterMap.Escaped State Transitions.
    //

    private void CharacterMap_Escaped_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Escaped_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Escaped_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Escaped_punctuation(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Escaped_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Escaped_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[CharacterMap_Done_STATE_ID]);
        }

        enterState();

    }


    //
    // end of CharacterMap.Escaped State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // CharacterMap.Done State Transitions.
    //

    private void CharacterMap_Done_Default()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            setState(sStates[CharacterMap_BadCharacter_STATE_ID]);
        }

        enterState();

    }


    private void CharacterMap_Done_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '\'')
        {
            exitState();

            try
            {
                // No actions.
            }
            finally
            {
                popState();
            }


            characterDone();
        }
        else
        {
            CharacterMap_Done_Default();
        }

    }


    //
    // end of CharacterMap.Done State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // CharacterMap.BadCharacter State Transitions.
    //

    private void CharacterMap_BadCharacter_Default()
    {
        final int stateId = mState.getId();


    }


    private void CharacterMap_BadCharacter_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '\'')
        {
            exitState();

            try
            {
                // No actions.
            }
            finally
            {
                popState();
            }


            characterError();
        }
        else
        {
            CharacterMap_BadCharacter_Default();
        }

    }


    //
    // end of CharacterMap.BadCharacter State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // OldCommentMap.Default State Transitions.
    //

    private void OldCommentMap_Default_alpha(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[OldCommentMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void OldCommentMap_Default_digit(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[OldCommentMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void OldCommentMap_Default_whitespace(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[OldCommentMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void OldCommentMap_Default_punctuation(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[OldCommentMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void OldCommentMap_Default_unicode(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[OldCommentMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void OldCommentMap_Default_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[OldCommentMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void OldCommentMap_Default_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            popState();
        }


        EOF();

    }


    //
    // end of OldCommentMap.Default State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // OldCommentMap.Start State Transitions.
    //

    private void OldCommentMap_Start_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '/')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[OldCommentMap_CommentStart_STATE_ID]);
            }

            enterState();
        }
        else if (c == '*')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[OldCommentMap_CommentEnd_STATE_ID]);
            }

            enterState();
        }
        else
        {
            OldCommentMap_Default_punctuation(c);
        }

    }


    //
    // end of OldCommentMap.Start State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // OldCommentMap.CommentStart State Transitions.
    //

    private void OldCommentMap_CommentStart_commentDone()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            setState(sStates[OldCommentMap_Start_STATE_ID]);
        }

        enterState();

    }


    private void OldCommentMap_CommentStart_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '*')
        {
            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[stateId]);
                pushState(sStates[OldCommentMap_Start_STATE_ID]);
            }

            enterState();
        }
        else if (c == '/')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[OldCommentMap_Start_STATE_ID]);
            }

            enterState();
        }
        else
        {
            OldCommentMap_Default_punctuation(c);
        }

    }


    //
    // end of OldCommentMap.CommentStart State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // OldCommentMap.CommentEnd State Transitions.
    //

    private void OldCommentMap_CommentEnd_punctuation(char c)
    {
        final int stateId = mState.getId();

        if (c == '*')
        {
            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                setState(sStates[stateId]);
            }

        }
        else if (c == '/')
        {
            exitState();

            try
            {
                clearState();
                ctxt.appendToken(c);
            }
            finally
            {
                popState();
            }


            commentDone();
        }
        else
        {
            OldCommentMap_Default_punctuation(c);
        }

    }


    //
    // end of OldCommentMap.CommentEnd State Transitions.
    //-----------------------------------------------------------

    //-----------------------------------------------------------
    // NewCommentMap.Start State Transitions.
    //

    private void NewCommentMap_Start_EOF()
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            popState();
        }


        EOF();

    }


    private void NewCommentMap_Start_EOL(char c)
    {
        final int stateId = mState.getId();

        exitState();

        try
        {
        }
        finally
        {
            popState();
        }


        commentDone();

    }


    private void NewCommentMap_Start_alpha(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void NewCommentMap_Start_digit(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void NewCommentMap_Start_punctuation(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void NewCommentMap_Start_unicode(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    private void NewCommentMap_Start_whitespace(char c)
    {
        final int stateId = mState.getId();

        try
        {
            clearState();
            ctxt.appendToken(c);
        }
        finally
        {
            setState(sStates[stateId]);
        }


    }


    //
    // end of NewCommentMap.Start State Transitions.
    //-----------------------------------------------------------

//---------------------------------------------------------------
// Member data.
//

    transient private TokenLexer ctxt;

    //-----------------------------------------------------------
    // Constants.
    //

    private static final long serialVersionUID = 1L;

    public static final int TokenMap_Start_STATE_ID = 0;
    public static final int TokenMap_DoubleQuoteString_STATE_ID = 1;
    public static final int TokenMap_SingleQuoteString_STATE_ID = 2;
    public static final int TokenMap_Name_STATE_ID = 3;
    public static final int TokenMap_NameError_STATE_ID = 4;
    public static final int TokenMap_Period_STATE_ID = 5;
    public static final int TokenMap_SignOperator_STATE_ID = 6;
    public static final int TokenMap_Number_STATE_ID = 7;
    public static final int TokenMap_MantissaStart_STATE_ID = 8;
    public static final int TokenMap_Mantissa_STATE_ID = 9;
    public static final int TokenMap_Operator_STATE_ID = 10;
    public static final int TokenMap_CommentStart_STATE_ID = 11;
    public static final int TokenMap_OldComment_STATE_ID = 12;
    public static final int TokenMap_NewComment_STATE_ID = 13;
    public static final int TokenMap_EndOfFile_STATE_ID = 14;

    public static final int StringMap_Start_STATE_ID = 15;
    public static final int StringMap_Escaped_STATE_ID = 16;
    public static final int StringMap_BadString_STATE_ID = 17;

    public static final int CharacterMap_Start_STATE_ID = 18;
    public static final int CharacterMap_Escaped_STATE_ID = 19;
    public static final int CharacterMap_Done_STATE_ID = 20;
    public static final int CharacterMap_BadCharacter_STATE_ID = 21;

    public static final int OldCommentMap_Start_STATE_ID = 22;
    public static final int OldCommentMap_CommentStart_STATE_ID = 23;
    public static final int OldCommentMap_CommentEnd_STATE_ID = 24;

    public static final int NewCommentMap_Start_STATE_ID = 25;

    private static final int STATE_COUNT = 26;

    private static final int EOF6_TRANSITION_ID = 1;
    private static final int EOL2_TRANSITION_ID = 2;
    private static final int alpha3_TRANSITION_ID = 3;
    private static final int characterDone10_TRANSITION_ID = 4;
    private static final int characterError11_TRANSITION_ID = 5;
    private static final int commentDone13_TRANSITION_ID = 6;
    private static final int digit4_TRANSITION_ID = 7;
    private static final int punctuation5_TRANSITION_ID = 8;
    private static final int stringDone8_TRANSITION_ID = 9;
    private static final int stringError9_TRANSITION_ID = 10;
    private static final int unicode12_TRANSITION_ID = 11;
    private static final int whitespace1_TRANSITION_ID = 12;

    private static final int TRANSITION_COUNT = 13;

    private static final MethodType[] TRANSITION_TYPES =
    {
        NO_ARGS_TYPE,
        NO_ARGS_TYPE,
        MethodType.methodType(void.class, char.class),
        MethodType.methodType(void.class, char.class),
        NO_ARGS_TYPE,
        NO_ARGS_TYPE,
        NO_ARGS_TYPE,
        MethodType.methodType(void.class, char.class),
        MethodType.methodType(void.class, char.class),
        NO_ARGS_TYPE,
        NO_ARGS_TYPE,
        MethodType.methodType(void.class, char.class),
        MethodType.methodType(void.class, char.class)
    };

    private static final String[] MAP_NAMES =
    {
        "TokenMap",
        "StringMap",
        "CharacterMap",
        "OldCommentMap",
        "NewCommentMap"
    };

    private static final String[][] STATE_NAMES =
    {
        new String[]
        {
            "Start",
            "DoubleQuoteString",
            "SingleQuoteString",
            "Name",
            "NameError",
            "Period",
            "SignOperator",
            "Number",
            "MantissaStart",
            "Mantissa",
            "Operator",
            "CommentStart",
            "OldComment",
            "NewComment",
            "EndOfFile"
        },

        new String[]
        {
            "Start",
            "Escaped",
            "BadString"
        },

        new String[]
        {
            "Start",
            "Escaped",
            "Done",
            "BadCharacter"
        },

        new String[]
        {
            "Start",
            "CommentStart",
            "CommentEnd"
        },

        new String[]
        {
            "Start"
        }
    };

    private static String[][] STATE_TRANSITIONS =
    {
        new String[]
        {
            "Default",
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "whitespace"
        },

        new String[]
        {
            "EOF",
            "stringDone",
            "stringError"
        },

        new String[]
        {
            "EOF",
            "characterDone",
            "characterError"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "whitespace"
        },

        new String[]
        {
            "Default",
            "EOF",
            "digit",
            "punctuation"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "whitespace"
        },

        new String[]
        {
            "EOF",
            "commentDone"
        },

        new String[]
        {
            "EOF",
            "commentDone"
        },

        new String[]
        {
            "Default"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "punctuation"
        },

        new String[]
        {
            "EOL"
        },

        new String[]
        {
            "punctuation",
            "unicode"
        },

        new String[]
        {
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        },

        new String[]
        {
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        },

        new String[]
        {
            "Default",
            "punctuation"
        },

        new String[]
        {
            "Default",
            "punctuation"
        },

        new String[]
        {
            "punctuation"
        },

        new String[]
        {
            "commentDone",
            "punctuation"
        },

        new String[]
        {
            "punctuation"
        },

        new String[]
        {
            "EOF",
            "EOL",
            "alpha",
            "digit",
            "punctuation",
            "unicode",
            "whitespace"
        }
    };

    private static final String[] TRANSITION_NAMES =
    {
        "Default",
        "EOF",
        "EOL",
        "alpha",
        "characterDone",
        "characterError",
        "commentDone",
        "digit",
        "punctuation",
        "stringDone",
        "stringError",
        "unicode",
        "whitespace"
    };

    private static final State7[] sStates = new State7[STATE_COUNT];

    static
    {
        final Lookup lookup = MethodHandles.lookup();
        final Class clazz = TokenLexerContext.class;
        final int mapSize = MAP_NAMES.length;
        int stateSize;
        int mapIndex;
        int stateIndex;
        int transIndex;
        int stateId = 0;
        String mapName;
        String stateName;
        String transName;
        String methodName;
        MethodType transType;
        MethodHandle entryHandle;
        MethodHandle exitHandle;
        TransitionHandle[] transitions;

        for (mapIndex = 0; mapIndex < mapSize; ++mapIndex)
        {
            mapName = MAP_NAMES[mapIndex];
            stateSize = STATE_NAMES[mapIndex].length;

            for (stateIndex = 0; stateIndex < stateSize; ++stateIndex, ++stateId)
            {
                stateName = STATE_NAMES[mapIndex][stateIndex];
                transitions = new TransitionHandle[TRANSITION_COUNT];

                methodName = String.format(ENTRY_NAME, mapName, stateName);
                entryHandle = lookupMethod(lookup, clazz, methodName, NO_ARGS_TYPE);
                methodName = String.format(EXIT_NAME, mapName, stateName);
                exitHandle = lookupMethod(lookup, clazz, methodName, NO_ARGS_TYPE);

                for (transIndex = 1; transIndex < TRANSITION_COUNT; ++transIndex)
                {
                    transName = TRANSITION_NAMES[transIndex];
                    transType = TRANSITION_TYPES[transIndex];
                    transitions[transIndex] =
                        lookupTransition(lookup, clazz, mapName, stateName, transName, transType);
                }

                sStates[stateId] =
                    new State7(
                        String.format(STATE_NAME_FORMAT, mapName, stateName),
                        stateId,
                        entryHandle,
                        exitHandle,
                        transitions,
                        STATE_TRANSITIONS[stateId]);
            }
        }
    }
}

/*
 * Local variables:
 *  buffer-read-only: t
 * End:
 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy