Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

java_lexer.cpp


SourceForge.net Logo     CTTL on    
    SourceForge    
    Download    
    Latest    
    Documentation    
    Index    
    Library    
    News    
    CVS    
    Repository    
   Other    
   Links    

Working version of a bare lexer for the Java programming language. Feel free to modify for your own Java-related needs. This is a work in progress. Java grammar was taken "as is", directly from Sun web site, http://java.sun.com/docs/books/jls/second_edition/html/syntax.doc.html. Grammar optimizations soon to come!

File: java_lexer.cpp

// java_lexer.cpp

//#define NDEBUG    // define before assert.h to stop assertions from being compiled 
//#define CTTL_TRACE_EVERYTHING //define to turn tracing on
//#define CTTL_TRACE_RULES  //define to turn light tracing on

#include <iostream>
#include "utils/win32_specific.h"
#include "cttl/cttl.h"

#include "utils/fileio.h"
#include "utils/itos.h"
#include "utils/timeutils.h"

#include "utils/pipe_input.h"
#include "example/java_alphabet.cpp"
#include "example/java_lexer.h"

using namespace cttl;

int main(int argc, char* argv[])
{
    std::vector< std::string > vect_java_files;

    if ( argc == 2 ) {
        // assume one java file was specified as input argument
        vect_java_files.push_back( argv[1] );
    } else {
        // assume list of java input files was specified as pipe input
        pipe_input_2_vector( vect_java_files, ".java" );
    }

    assert( vect_java_files.size() );

    input<> inp;

    // construct universe to be parsed:
//  typedef edge< policy_space< flag_cpp_comments > > universe_T;
    typedef const_edge< policy_space< flag_cpp_comments > > universe_T;
    universe_T universe( new_edge( inp ) );

    // construct the parser:
    java_lexer< java_parser< universe_T > > parser;

    for ( size_t file_cnt = 0; file_cnt < vect_java_files.size(); ++file_cnt ) {
        std::cout
            << time2string( current_time() )
            << " processing "
            << vect_java_files[ file_cnt ]
            ;

        file2string( vect_java_files[ file_cnt ], inp.text() );
        size_t inp_length = inp.length();
        assert( inp_length );

        universe.first.go_bof();
        universe.second.go_eof();
        std::cout << "..." << universe.length() << " bytes";

        if ( parser.CompilationUnit( universe ) != std::string::npos ) {
            if ( inp_length != universe.second.offset() ) {
                string2file( vect_java_files[ file_cnt ], inp.text() );
                std::cout << "...saved " << universe.second.offset() << std::endl;

            } else {
                std::cout << "...no changes required" << std::endl;
            }

        } else {
            std::cout << "\t\t *** Java PARSER FAILED *** " << std::endl;
            return 1;
        }
    }

    return 0;
}

File: java_alphabet.cpp

// java_alphabet.cpp

namespace {
    // Java Abstract Alphabet
    const std::string LITERAL_EQ     = "=";
    const std::string LITERAL_ADD_EQ = "+=";
    const std::string LITERAL_SUB_EQ = "-=";
    const std::string LITERAL_AST_EQ = "*=";
    const std::string LITERAL_DIV_EQ = "/=";
    const std::string LITERAL_AMP_EQ = "&=";
    const std::string LITERAL_OR_EQ  = "|=";
    const std::string LITERAL_XOR_EQ = "^=";
    const std::string LITERAL_PCT_EQ = "%=";
    const std::string LITERAL_2LT_EQ = "<<=";
    const std::string LITERAL_2GT_EQ = ">>=";
    const std::string LITERAL_3GT_EQ = ">>>=";

    const std::string LITERAL_2OR    = "||" ;
    const std::string LITERAL_2AMP   = "&&" ;
    const std::string LITERAL_2EQ    = "==" ;
    const std::string LITERAL_BANG_EQ= "!=" ;
    const std::string LITERAL_OR     = "|"  ;
    const std::string LITERAL_LT_EQ  = "<=" ;
    const std::string LITERAL_GT_EQ  = ">=" ;
    const std::string LITERAL_2LT    = "<<" ;
    const std::string LITERAL_2GT    = ">>" ;
    const std::string LITERAL_3GT    = ">>>" ;
    const std::string LITERAL_XOR    = "^" ;
    const std::string LITERAL_AMP    = "&" ;
    const std::string LITERAL_LT     = "<" ;
    const std::string LITERAL_GT     = ">" ;
    const std::string LITERAL_ADD    = "+" ;
    const std::string LITERAL_SUB    = "-" ;
    const std::string LITERAL_AST    = "*" ;
    const std::string LITERAL_DIV    = "/" ;
    const std::string LITERAL_PCT    = "%" ;

    const std::string LITERAL_INC    = "++" ;
    const std::string LITERAL_DEC    = "--" ;
    const std::string LITERAL_BANG   = "!" ;
    const std::string LITERAL_TILDE  = "~" ;

    const std::string LITERAL_STRICTFP     = "strictfp" ;
    const std::string LITERAL_ABSTRACT     = "abstract" ;
    const std::string LITERAL_DOUBLE       = "double" ;
    const std::string LITERAL_INT          = "int" ;
    const std::string LITERAL_BOOLEAN      = "boolean" ;
    const std::string LITERAL_ELSE         = "else" ;
    const std::string LITERAL_INTERFACE    = "interface" ;
    const std::string LITERAL_SUPER        = "super" ;
    const std::string LITERAL_BREAK        = "break" ;
    const std::string LITERAL_EXTENDS      = "extends" ;
    const std::string LITERAL_LONG         = "long" ;
    const std::string LITERAL_SWITCH       = "switch" ;
    const std::string LITERAL_BYTE         = "byte" ;
    const std::string LITERAL_FINAL        = "final" ;
    const std::string LITERAL_NATIVE       = "native" ;
    const std::string LITERAL_SYNCHRONIZED = "synchronized" ;
    const std::string LITERAL_CASE         = "case" ;
    const std::string LITERAL_FINALLY      = "finally" ;
    const std::string LITERAL_NEW          = "new" ;
    const std::string LITERAL_THIS         = "this" ;
    const std::string LITERAL_CATCH        = "catch" ;
    const std::string LITERAL_FLOAT        = "float" ;
    const std::string LITERAL_PACKAGE      = "package" ;
    const std::string LITERAL_THROW        = "throw" ;
    const std::string LITERAL_CHAR         = "char" ;
    const std::string LITERAL_FOR          = "for" ;
    const std::string LITERAL_PRIVATE      = "private" ;
    const std::string LITERAL_THROWS       = "throws" ;
    const std::string LITERAL_CLASS        = "class" ;
    const std::string LITERAL_PROTECTED    = "protected" ;
    const std::string LITERAL_TRANSIENT    = "transient" ;
    const std::string LITERAL_IF           = "if" ;
    const std::string LITERAL_PUBLIC       = "public" ;
    const std::string LITERAL_TRY          = "try" ;
    const std::string LITERAL_CONTINUE     = "continue" ;
    const std::string LITERAL_IMPLEMENTS   = "implements" ;
    const std::string LITERAL_RETURN       = "return" ;
    const std::string LITERAL_VOID         = "void" ;
    const std::string LITERAL_DEFAULT      = "default" ;
    const std::string LITERAL_IMPORT       = "import" ;
    const std::string LITERAL_SHORT        = "short" ;
    const std::string LITERAL_VOLATILE     = "volatile" ;
    const std::string LITERAL_DO           = "do" ;
    const std::string LITERAL_INSTANCEOF   = "instanceof" ;
    const std::string LITERAL_STATIC       = "static" ;
    const std::string LITERAL_WHILE        = "while" ;
    
    const std::string LITERAL_TRUE         = "true" ;
    const std::string LITERAL_FALSE        = "false" ;
    const std::string LITERAL_NULL         = "null" ;
    
} // Java Abstract Alphabet

File: java_lexer.h

/*
http://home.bredband.no/gaulyk/java/grammar/JavaGrammar1.html
http://java.sun.com/docs/books/jls/second_edition/html/syntax.doc.html
http://www.cs.uiowa.edu/~fleck/JavaBNF.htm

This chapter presents a grammar for the Java programming language. 

The grammar presented piecemeal in the preceding chapters is much better
for exposition, but it is not ideally suited as a basis for a parser.
The grammar presented in this chapter is the basis for the reference implementation. 

The grammar below uses the following BNF-style conventions:

-----------------------------------------------------------------------
18.1 The Grammar of the Java Programming Language
-----------------------------------------------------------------------
*/

// java_lexer.h
// skeleton lexer for parsing and modifying java files.

#ifndef _CTTL_JAVA_LEXER_H_INCLUDED_
#define _CTTL_JAVA_LEXER_H_INCLUDED_

using namespace cttl;

template< typename UniverseT >
struct base_parser {
    // parser defines two kinds of universes:
    typedef UniverseT universe_T;
    typedef typename UniverseT::strict_edge_T strict_universe_T;

    // semantic actions:
    size_t semantic_action( strict_universe_T& ) const
    {
        return 0;
    }

};  // struct base_parser

template< typename UniverseT >
struct java_parser : public base_parser< UniverseT > {

    // parser defines two kinds of universes:
    typedef UniverseT universe_T;
    typedef typename UniverseT::strict_edge_T strict_universe_T;

    // semantic actions:
    size_t semantic_action( strict_universe_T& universe_ )
    {
        return universe_.second.offset();
    }

};  // struct java_parser

template< typename ParserT >
struct java_lexer : public ParserT {

    // Starting symbol is "CompilationUnit"

    // lexer defines two kinds of universes:
    typedef typename ParserT::universe_T universe_T;
    typedef typename universe_T::strict_edge_T strict_universe_T;

    std::set< std::string > set_AssignmentOperators;
    std::set< std::string > set_Infixops;
    std::set< std::string > set_PrefixOps;
    std::set< std::string > set_PostfixOp;
    std::set< std::string > set_BasicTypes;
    std::set< std::string > set_Modifiers;
    std::set< std::string > set_JavaKeywords;

    java_lexer()
    {
        set_AssignmentOperators.insert( LITERAL_EQ );
        set_AssignmentOperators.insert( LITERAL_ADD_EQ );
        set_AssignmentOperators.insert( LITERAL_SUB_EQ );
        set_AssignmentOperators.insert( LITERAL_AST_EQ );
        set_AssignmentOperators.insert( LITERAL_DIV_EQ );
        set_AssignmentOperators.insert( LITERAL_AMP_EQ );
        set_AssignmentOperators.insert( LITERAL_OR_EQ );
        set_AssignmentOperators.insert( LITERAL_XOR_EQ );
        set_AssignmentOperators.insert( LITERAL_PCT_EQ );
        set_AssignmentOperators.insert( LITERAL_2LT_EQ );
        set_AssignmentOperators.insert( LITERAL_2GT_EQ );
        set_AssignmentOperators.insert( LITERAL_3GT_EQ );

        set_Infixops.insert( LITERAL_2OR );
        set_Infixops.insert( LITERAL_2AMP );
        set_Infixops.insert( LITERAL_2EQ );
        set_Infixops.insert( LITERAL_BANG_EQ );
        set_Infixops.insert( LITERAL_OR );
        set_Infixops.insert( LITERAL_LT_EQ );
        set_Infixops.insert( LITERAL_GT_EQ );
        set_Infixops.insert( LITERAL_2LT );
        set_Infixops.insert( LITERAL_2GT );
        set_Infixops.insert( LITERAL_3GT );
        set_Infixops.insert( LITERAL_XOR );
        set_Infixops.insert( LITERAL_AMP );
        set_Infixops.insert( LITERAL_LT );
        set_Infixops.insert( LITERAL_GT );
        set_Infixops.insert( LITERAL_ADD );
        set_Infixops.insert( LITERAL_SUB );
        set_Infixops.insert( LITERAL_AST );
        set_Infixops.insert( LITERAL_DIV );
        set_Infixops.insert( LITERAL_PCT );

        set_PrefixOps.insert( LITERAL_INC );
        set_PrefixOps.insert( LITERAL_DEC );
        set_PrefixOps.insert( LITERAL_BANG );
        set_PrefixOps.insert( LITERAL_TILDE );
        set_PrefixOps.insert( LITERAL_ADD );
        set_PrefixOps.insert( LITERAL_SUB );

        set_PostfixOp.insert( LITERAL_INC );
        set_PostfixOp.insert( LITERAL_DEC );

        set_BasicTypes.insert( LITERAL_BYTE );
        set_BasicTypes.insert( LITERAL_SHORT );
        set_BasicTypes.insert( LITERAL_CHAR );
        set_BasicTypes.insert( LITERAL_INT );
        set_BasicTypes.insert( LITERAL_LONG );
        set_BasicTypes.insert( LITERAL_FLOAT );
        set_BasicTypes.insert( LITERAL_DOUBLE );
        set_BasicTypes.insert( LITERAL_BOOLEAN );

        set_Modifiers.insert( LITERAL_PUBLIC );
        set_Modifiers.insert( LITERAL_PROTECTED );
        set_Modifiers.insert( LITERAL_PRIVATE );
        set_Modifiers.insert( LITERAL_STATIC );
        set_Modifiers.insert( LITERAL_ABSTRACT );
        set_Modifiers.insert( LITERAL_FINAL );
        set_Modifiers.insert( LITERAL_NATIVE );
        set_Modifiers.insert( LITERAL_SYNCHRONIZED );
        set_Modifiers.insert( LITERAL_TRANSIENT );
        set_Modifiers.insert( LITERAL_VOLATILE );
        set_Modifiers.insert( LITERAL_STRICTFP );

        set_JavaKeywords.insert( LITERAL_ABSTRACT );
        set_JavaKeywords.insert( LITERAL_DOUBLE );
        set_JavaKeywords.insert( LITERAL_INT );
        set_JavaKeywords.insert( LITERAL_BOOLEAN );
        set_JavaKeywords.insert( LITERAL_ELSE );
        set_JavaKeywords.insert( LITERAL_INTERFACE );
        set_JavaKeywords.insert( LITERAL_SUPER );
        set_JavaKeywords.insert( LITERAL_BREAK );
        set_JavaKeywords.insert( LITERAL_EXTENDS );
        set_JavaKeywords.insert( LITERAL_LONG );
        set_JavaKeywords.insert( LITERAL_SWITCH );
        set_JavaKeywords.insert( LITERAL_BYTE );
        set_JavaKeywords.insert( LITERAL_FINAL );
        set_JavaKeywords.insert( LITERAL_NATIVE );
        set_JavaKeywords.insert( LITERAL_SYNCHRONIZED );
        set_JavaKeywords.insert( LITERAL_CASE );
        set_JavaKeywords.insert( LITERAL_FINALLY );
        set_JavaKeywords.insert( LITERAL_NEW );
        set_JavaKeywords.insert( LITERAL_THIS );
        set_JavaKeywords.insert( LITERAL_CATCH );
        set_JavaKeywords.insert( LITERAL_FLOAT );
        set_JavaKeywords.insert( LITERAL_PACKAGE );
        set_JavaKeywords.insert( LITERAL_THROW );
        set_JavaKeywords.insert( LITERAL_CHAR );
        set_JavaKeywords.insert( LITERAL_FOR );
        set_JavaKeywords.insert( LITERAL_PRIVATE );
        set_JavaKeywords.insert( LITERAL_THROWS );
        set_JavaKeywords.insert( LITERAL_CLASS );
        set_JavaKeywords.insert( LITERAL_PROTECTED );
        set_JavaKeywords.insert( LITERAL_TRANSIENT );
        set_JavaKeywords.insert( LITERAL_IF );
        set_JavaKeywords.insert( LITERAL_PUBLIC );
        set_JavaKeywords.insert( LITERAL_TRY );
        set_JavaKeywords.insert( LITERAL_CONTINUE );
        set_JavaKeywords.insert( LITERAL_IMPLEMENTS );
        set_JavaKeywords.insert( LITERAL_RETURN );
        set_JavaKeywords.insert( LITERAL_VOID );
        set_JavaKeywords.insert( LITERAL_DEFAULT );
        set_JavaKeywords.insert( LITERAL_IMPORT );
        set_JavaKeywords.insert( LITERAL_SHORT );
        set_JavaKeywords.insert( LITERAL_VOLATILE );
        set_JavaKeywords.insert( LITERAL_DO );
        set_JavaKeywords.insert( LITERAL_INSTANCEOF );
        set_JavaKeywords.insert( LITERAL_STATIC );
        set_JavaKeywords.insert( LITERAL_WHILE );
    }

    // Grammar rules
    
    size_t Identifier( universe_T& edge_ )
    {
        
        return (

            ( literal() - set_JavaKeywords )

            ).match( edge_ );
    }

    
    size_t QualifiedIdentifier( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            *(
                '.'
                +
                CTTL_RULE( java_lexer< ParserT >::Identifier )
            )

            ).match( edge_ );
    }

    
    size_t Literal( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::CharacterLiteral )
            |
            CTTL_RULE( java_lexer< ParserT >::StringLiteral )
            |
            CTTL_RULE( java_lexer< ParserT >::BooleanLiteral )
            |
            CTTL_RULE( java_lexer< ParserT >::NullLiteral )
            |
            CTTL_RULE( java_lexer< ParserT >::FloatingPointLiteral )    
            |
            CTTL_RULE( java_lexer< ParserT >::IntegerLiteral )

            ).match( edge_ );
    }

    
    size_t Expression( universe_T& edge_ )
    {
        
        return (

            (
                CTTL_RULE( java_lexer< ParserT >::Expression1 )
                +
                *entity(
                    CTTL_RULE( java_lexer< ParserT >::AssignmentOperator )
                    +
                    CTTL_RULE( java_lexer< ParserT >::Expression1 )
                )
            )

            ).match( edge_ );
    }

    
    size_t AssignmentOperator( universe_T& edge_ )
    {
        
        return (

            &LITERAL_3GT_EQ
            |
            (
                '='
                ^
                -symbol( '=' )
            )
            |
            (
                ( symbol() ^ symbol() )
                &
                set_AssignmentOperators
            )
            |
            (
                ( symbol() ^ symbol() ^ symbol() )
                &
                set_AssignmentOperators
            )

            ).match( edge_ );
    }

    
    size_t Type( universe_T& edge_ )
    {
        
        return (

            (
                CTTL_RULE( java_lexer< ParserT >::Identifier )
                +
                *( '.' + CTTL_RULE( java_lexer< ParserT >::Identifier ) )
                +
                CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
                //ik-added: not a function call
                -
                '('
            )
            |
            (
                CTTL_RULE( java_lexer< ParserT >::BasicType )
                +
                *CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
            )

            ).match( edge_ );
    }

    
    size_t StatementExpression( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Expression )

            ).match( edge_ );
    }

    
    size_t ConstantExpression( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Expression )

            ).match( edge_ );
    }

    
    size_t Expression1( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Expression2 )
            +
            entity( CTTL_RULE( java_lexer< ParserT >::Expression1Rest ) ) * 1

            ).match( edge_ );
    }

    
    size_t Expression1Rest( universe_T& edge_ )
    {
        
        return (

            entity(
                '?'
                +
                CTTL_RULE( java_lexer< ParserT >::Expression )
                +
                ':'
                +
                CTTL_RULE( java_lexer< ParserT >::Expression1 )
            ) * 1

            ).match( edge_ );
    }

    
    size_t Expression2( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Expression3 )
            +
            entity( CTTL_RULE( java_lexer< ParserT >::Expression2Rest ) ) * 1

            ).match( edge_ );
    }

    
    size_t Expression2Rest( universe_T& edge_ )
    {
        
        return (

            +(
                CTTL_RULE( java_lexer< ParserT >::Infixop )
                +
                CTTL_RULE( java_lexer< ParserT >::Expression3 )
                +
                *(
                    ( &LITERAL_INSTANCEOF & literal() )
                    +
                    CTTL_RULE( java_lexer< ParserT >::Type )
                )
            )
            |
            (
                ( &LITERAL_INSTANCEOF & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::Type )
                +
                *CTTL_RULE( java_lexer< ParserT >::Expression2Rest )
            )

            ).match( edge_ );
    }

    
    size_t Infixop( universe_T& edge_ )
    {
        
        return (

            (
                &LITERAL_3GT
                ^
                -symbol( '=' )
            )
            |
            (
                ( symbol() ^ symbol() )
                &
                set_Infixops
            )
            |
            (
                symbol()
                &
                set_Infixops
            )

            ).match( edge_ );
    }

    
    size_t Expression3( universe_T& edge_ )
    {
        
        return (

            (
                CTTL_RULE( java_lexer< ParserT >::PrefixOp )
                +
                CTTL_RULE( java_lexer< ParserT >::Expression3 )
            )
            |
            (
                '('
                +
                (
                    CTTL_RULE( java_lexer< ParserT >::Type )
                    |
                    CTTL_RULE( java_lexer< ParserT >::Expression )
                )
                +
                ')'
                +
                entity( CTTL_RULE( java_lexer< ParserT >::Expression3 ) ) * 1
                +
                *(CTTL_RULE( java_lexer< ParserT >::Selector ))
                +
                *(CTTL_RULE( java_lexer< ParserT >::PostfixOp ))
            )
            |
            (
                CTTL_RULE( java_lexer< ParserT >::Primary )
                +
                *(CTTL_RULE( java_lexer< ParserT >::Selector ))
                +
                *(CTTL_RULE( java_lexer< ParserT >::PostfixOp ))
            )

            ).match( edge_ );
    }

    
    size_t Primary( universe_T& edge_ )
    {
        
        return (

            ( '(' + CTTL_RULE( java_lexer< ParserT >::Expression ) + ')' )
            |
            ( ( &LITERAL_THIS & literal() ) + entity( CTTL_RULE( java_lexer< ParserT >::Arguments ) ) * 1 )
            |
            ( ( &LITERAL_SUPER & literal() ) + CTTL_RULE( java_lexer< ParserT >::SuperSuffix ) )
            |
            CTTL_RULE( java_lexer< ParserT >::Literal )
            |
            ( ( &LITERAL_NEW & literal() ) + CTTL_RULE( java_lexer< ParserT >::Creator ) )
            |
            (
                CTTL_RULE( java_lexer< ParserT >::Identifier )
                +
                *( '.' + CTTL_RULE( java_lexer< ParserT >::Identifier ) )
                +
                entity( CTTL_RULE( java_lexer< ParserT >::IdentifierSuffix ) ) * 1
            )
            |
            (
                CTTL_RULE( java_lexer< ParserT >::BasicType )
                +
                CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
                +
                '.'
                + ( &LITERAL_CLASS & literal() )
            )
            |
            ( ( &LITERAL_VOID & literal() ) + '.' + ( &LITERAL_CLASS & literal() ) )

            ).match( edge_ );
    }

    
    size_t IdentifierSuffix( universe_T& edge_ )
    {
        
        return (

            (
                symbol( '[' )
                +
                (
                    ( ']' + CTTL_RULE( java_lexer< ParserT >::BracketsOpt ) + '.' + ( &LITERAL_CLASS & literal() ) )
                    |
                    ( CTTL_RULE( java_lexer< ParserT >::Expression ) + ']' )
                )
            )
            |
            CTTL_RULE( java_lexer< ParserT >::Arguments )
            |
            (
                symbol( '.' )
                +
                (
                    ( &LITERAL_CLASS & literal() )
                    |
                    ( &LITERAL_THIS & literal() )
                    |
                    ( ( &LITERAL_SUPER & literal() ) + CTTL_RULE( java_lexer< ParserT >::Arguments ) )
                    |
                    ( ( &LITERAL_NEW & literal() ) + CTTL_RULE( java_lexer< ParserT >::InnerCreator ) )
                )
            )

            ).match( edge_ );
    }

    
    size_t PrefixOp( universe_T& edge_ )
    {
        
        return (

            (
                ( symbol() ^ symbol() )
                &
                set_PrefixOps
            )
            |
            (
                ( symbol() )
                &
                set_PrefixOps
            )
            

            ).match( edge_ );
    }

    
    size_t PostfixOp( universe_T& edge_ )
    {
        
        return (

            ( symbol() ^ symbol() )
            &
            set_PostfixOp

            ).match( edge_ );
    }

    
    size_t Selector( universe_T& edge_ )
    {
        
        return (

            (
                '.'
                +
                CTTL_RULE( java_lexer< ParserT >::Identifier )
                +
                entity( CTTL_RULE( java_lexer< ParserT >::Arguments ) ) * 1
            )
            |
            ( '.' + ( &LITERAL_THIS & literal() ) )
            |
            ( '.' + ( &LITERAL_SUPER & literal() ) + CTTL_RULE( java_lexer< ParserT >::SuperSuffix ) )
            |
            ( '.' + ( &LITERAL_NEW & literal() ) + CTTL_RULE( java_lexer< ParserT >::InnerCreator ) )
            |
            ( '[' + CTTL_RULE( java_lexer< ParserT >::Expression ) + ']' )

            ).match( edge_ );
    }

    
    size_t SuperSuffix( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Arguments )
            |
            (
                '.'
                +
                CTTL_RULE( java_lexer< ParserT >::Identifier )
                +
                entity( CTTL_RULE( java_lexer< ParserT >::Arguments ) ) * 1
            )

            ).match( edge_ );
    }

    
    size_t BasicType( universe_T& edge_ )
    {
        
        return (

            literal() & set_BasicTypes

            ).match( edge_ );
    }

    
    size_t ArgumentsOpt( universe_T& edge_ )
    {
        
        return (

            entity( CTTL_RULE( java_lexer< ParserT >::Arguments ) ) * 1

            ).match( edge_ );
    }

    
    size_t Arguments( universe_T& edge_ )
    {
        
        return (

            '('
            +
            entity(
                CTTL_RULE( java_lexer< ParserT >::Expression )
                +
                *( ',' + CTTL_RULE( java_lexer< ParserT >::Expression ) )
            ) * 1
            +
            ')'

            ).match( edge_ );
    }

    
    size_t BracketsOpt( universe_T& edge_ )
    {
        
        return (

            *( symbol( '[' ) + ']' )

            ).match( edge_ );
    }

    
    size_t Creator( universe_T& edge_ )
    {
        
        return (

            (
                CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifier )
                |
                CTTL_RULE( java_lexer< ParserT >::BasicType )   // ik-10/16/2003 added
            )
            +
            (
                CTTL_RULE( java_lexer< ParserT >::ArrayCreatorRest )
                |
                CTTL_RULE( java_lexer< ParserT >::ClassCreatorRest )
            )

            ).match( edge_ );
    }

    
    size_t InnerCreator( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            CTTL_RULE( java_lexer< ParserT >::ClassCreatorRest )

            ).match( edge_ );
    }

    
    size_t ArrayCreatorRest( universe_T& edge_ )
    {
        
        return (

            '['
            +
            (
                (
                    ']'
                    +
                    CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
                    +
                    CTTL_RULE( java_lexer< ParserT >::ArrayInitializer )
                )
                |
                (
                    CTTL_RULE( java_lexer< ParserT >::Expression )
                    +
                    ']'
                    +
                    *(
                        '['
                        +
                        CTTL_RULE( java_lexer< ParserT >::Expression )
                        +
                        ']'
                    )
                    +
                    CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
                )
            )

            ).match( edge_ );
    }

    
    size_t ClassCreatorRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Arguments )
            +
            entity( CTTL_RULE( java_lexer< ParserT >::ClassBody ) ) * 1

            ).match( edge_ );
    }

    
    size_t ArrayInitializer( universe_T& edge_ )
    {
        
        return (

            '{'
            +
            entity(
                CTTL_RULE( java_lexer< ParserT >::VariableInitializer )
                +
                *( ',' + CTTL_RULE( java_lexer< ParserT >::VariableInitializer ) )
                +
                ( symbol( ',' ) ) * 1
            ) * 1
            +
            '}'

            ).match( edge_ );
    }

    
    size_t VariableInitializer( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::ArrayInitializer )
            |
            CTTL_RULE( java_lexer< ParserT >::Expression )

            ).match( edge_ );
    }

    
    size_t ParExpression( universe_T& edge_ )
    {
        
        return (

            '(' + CTTL_RULE( java_lexer< ParserT >::Expression ) + ')'

            ).match( edge_ );
    }

    
    size_t Block( universe_T& edge_ )
    {
        
        return (

            '{' + CTTL_RULE( java_lexer< ParserT >::BlockStatements ) + '}'

            ).match( edge_ );
    }

    
    size_t BlockStatements( universe_T& edge_ )
    {
        
        return (

            *( CTTL_RULE( java_lexer< ParserT >::BlockStatement ) )

            ).match( edge_ );
    }

    
    size_t BlockStatement( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::LocalVariableDeclarationStatement )
            |
            CTTL_RULE( java_lexer< ParserT >::ClassOrInterfaceDeclaration )
            |
            (
                entity( CTTL_RULE( java_lexer< ParserT >::Identifier ) + ':' ) * 1
                +
                CTTL_RULE( java_lexer< ParserT >::Statement )
            )

            ).match( edge_ );
    }

    
    size_t LocalVariableDeclarationStatement( universe_T& edge_ )
    {
        
        return (

            entity( &LITERAL_FINAL & literal() ) * 1
            +
            CTTL_RULE( java_lexer< ParserT >::Type )
            +
            CTTL_RULE( java_lexer< ParserT >::VariableDeclarators )
            +
            ';'

            ).match( edge_ );
    }

    
    size_t Statement( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Block )
            |
            (
                ( &LITERAL_IF & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::ParExpression )
                +
                CTTL_RULE( java_lexer< ParserT >::Statement )
            )
            |
            (
                ( &LITERAL_ELSE & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::Statement )
            )
            |
            (
                ( &LITERAL_FOR & literal() )
                +
                '('
                +
                entity( CTTL_RULE( java_lexer< ParserT >::ForInit ) ) * 1
                +
                ';'
                +
                entity( CTTL_RULE( java_lexer< ParserT >::Expression ) ) * 1
                +
                ';'
                +
                entity( CTTL_RULE( java_lexer< ParserT >::ForUpdate ) ) * 1
                +
                ')'
                +
                CTTL_RULE( java_lexer< ParserT >::Statement )
            )
            |
            (
                ( &LITERAL_WHILE & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::ParExpression )
                +
                CTTL_RULE( java_lexer< ParserT >::Statement )
            )
            |
            (
                ( &LITERAL_DO & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::Statement )
                +
                ( &LITERAL_WHILE & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::ParExpression )
                +
                ';'
            )
            |
            (
                ( &LITERAL_TRY & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::Block )
                +
                (
                    entity( CTTL_RULE( java_lexer< ParserT >::Catches ) ) * 1
                    +
                    (
                        ( &LITERAL_FINALLY & literal() )
                        +
                        CTTL_RULE( java_lexer< ParserT >::Block )
                    ) * 1
                )
            )
            |
            (
                ( &LITERAL_SWITCH & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::ParExpression )
                +
                '{'
                +
                CTTL_RULE( java_lexer< ParserT >::SwitchBlockStatementGroups )
                +
                '}'
            )
            |
            (
                ( &LITERAL_SYNCHRONIZED & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::ParExpression )
                +
                CTTL_RULE( java_lexer< ParserT >::Block )
            )
            |
            (
                ( &LITERAL_RETURN & literal() )
                +
                entity( CTTL_RULE( java_lexer< ParserT >::Expression ) ) * 1
                +
                ';'
            )
            |
            ( ( &LITERAL_THROW & literal() ) + CTTL_RULE( java_lexer< ParserT >::Expression ) + ';' )
            |
            ( ( &LITERAL_BREAK & literal() ) + entity( CTTL_RULE( java_lexer< ParserT >::Identifier ) ) * 1 + ';' )
            |
            ( ( &LITERAL_CONTINUE & literal() ) + entity( CTTL_RULE( java_lexer< ParserT >::Identifier ) ) * 1 + ';' )
            |
            ';'
            |
            (
                CTTL_RULE( java_lexer< ParserT >::StatementExpression )
                +
                ';'
            )
            |
            (
                CTTL_RULE( java_lexer< ParserT >::Identifier )
                +
                ':'
                +
                CTTL_RULE( java_lexer< ParserT >::Statement )
            )

            ).match( edge_ );
    }

    
    size_t Catches( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::CatchClause )
            +
            *( CTTL_RULE( java_lexer< ParserT >::CatchClause ) )

            ).match( edge_ );
    }

    
    size_t CatchClause( universe_T& edge_ )
    {
        
        return (

            ( &LITERAL_CATCH & literal() )
            +
            '('
            +
            CTTL_RULE( java_lexer< ParserT >::FormalParameter )
            +
            ')'
            +
            CTTL_RULE( java_lexer< ParserT >::Block )

            ).match( edge_ );
    }

    
    size_t SwitchBlockStatementGroups( universe_T& edge_ )
    {
        
        return (

            +( CTTL_RULE( java_lexer< ParserT >::SwitchBlockStatementGroup ) )

            ).match( edge_ );
    }

    
    size_t SwitchBlockStatementGroup( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::SwitchLabel )
            +
            CTTL_RULE( java_lexer< ParserT >::BlockStatements )

            ).match( edge_ );
    }

    
    size_t SwitchLabel( universe_T& edge_ )
    {
        
        return (

            ( ( &LITERAL_CASE & literal() ) + CTTL_RULE( java_lexer< ParserT >::ConstantExpression ) + ':' )
            |
            ( ( &LITERAL_DEFAULT & literal() ) + ':' )

            ).match( edge_ );
    }

    
    size_t MoreStatementExpressions( universe_T& edge_ )
    {
        
        return (

            *( ',' + CTTL_RULE( java_lexer< ParserT >::StatementExpression ) )

            ).match( edge_ );
    }

    
    size_t ForInit( universe_T& edge_ )
    {
        
        return (

            (
                entity( &LITERAL_FINAL & literal() ) * 1
                +
                CTTL_RULE( java_lexer< ParserT >::Type )
                +
                CTTL_RULE( java_lexer< ParserT >::VariableDeclarators )
            )
            |
            (
                CTTL_RULE( java_lexer< ParserT >::StatementExpression )
                +
                CTTL_RULE( java_lexer< ParserT >::MoreStatementExpressions )
            )

            ).match( edge_ );
    }

    
    size_t ForUpdate( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::StatementExpression )
            +
            CTTL_RULE( java_lexer< ParserT >::MoreStatementExpressions )

            ).match( edge_ );
    }

    
    size_t ModifiersOpt( universe_T& edge_ )
    {
        
        return (

            *( CTTL_RULE( java_lexer< ParserT >::Modifier ) )

            ).match( edge_ );
    }

    
    size_t Modifier( universe_T& edge_ )
    {
        
        return (

            literal() & set_Modifiers

            ).match( edge_ );
    }

    
    size_t VariableDeclarators( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::VariableDeclarator )
            +
            *( ',' + CTTL_RULE( java_lexer< ParserT >::VariableDeclarator ) )

            ).match( edge_ );
    }

    
    size_t VariableDeclaratorsRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::VariableDeclaratorRest )
            +
            *( ',' + CTTL_RULE( java_lexer< ParserT >::VariableDeclarator ) )

            ).match( edge_ );
    }

    
    size_t ConstantDeclaratorsRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::ConstantDeclaratorRest )
            +
            *( ',' + CTTL_RULE( java_lexer< ParserT >::ConstantDeclarator ) )

            ).match( edge_ );
    }

    
    size_t VariableDeclarator( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            CTTL_RULE( java_lexer< ParserT >::VariableDeclaratorRest )

            ).match( edge_ );
    }

    
    size_t ConstantDeclarator( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            CTTL_RULE( java_lexer< ParserT >::ConstantDeclaratorRest )

            ).match( edge_ );
    }

    
    size_t VariableDeclaratorRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
            +
            entity(
                '='
                +
                CTTL_RULE( java_lexer< ParserT >::VariableInitializer )
            ) * 1

            ).match( edge_ );
    }

    
    size_t ConstantDeclaratorRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
            +
            '='
            +
            CTTL_RULE( java_lexer< ParserT >::VariableInitializer )

            ).match( edge_ );
    }

    
    size_t VariableDeclaratorId( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            CTTL_RULE( java_lexer< ParserT >::BracketsOpt )

            ).match( edge_ );
    }

    
    size_t CompilationUnit( universe_T& edge_ )
    {
        //CTTL_TRACE_SILENT( true );
        
        return (

            entity(
                ( &LITERAL_PACKAGE & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifier )
                +
                ';'
            ) * 1
            +
            *( CTTL_RULE( java_lexer< ParserT >::ImportDeclaration ) )
            +
            *( CTTL_RULE( java_lexer< ParserT >::TypeDeclaration ) )
            +
            end()

            ).match( edge_ );
    }

    
    size_t ImportDeclaration( universe_T& edge_ )
    {
        //CTTL_TRACE_SILENT( false );
        
        return (

            ( &LITERAL_IMPORT & literal() )
            +
            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            *(
                '.'
                +
                CTTL_RULE( java_lexer< ParserT >::Identifier )
            )
            +
            entity( symbol( '.' ) + '*' ) * 1 + ';'

            ).match( edge_ );
    }

    
    size_t TypeDeclaration( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::ClassOrInterfaceDeclaration )
            |
            ';'

            ).match( edge_ );
    }

    
    size_t ClassOrInterfaceDeclaration( universe_T& edge_ )
    {
        
        return (

            *CTTL_RULE( java_lexer< ParserT >::Modifier )
            +
            (
                CTTL_RULE( java_lexer< ParserT >::ClassDeclaration )
                |
                CTTL_RULE( java_lexer< ParserT >::InterfaceDeclaration )
            )

            ).match( edge_ );
    }

    
    size_t ClassDeclaration( universe_T& edge_ )
    {
        
        return (

            ( &LITERAL_CLASS & literal() )
            +
            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            entity(
                ( &LITERAL_EXTENDS & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::Type )
            ) * 1
            +
            entity(
                ( &LITERAL_IMPLEMENTS & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::TypeList )
            ) * 1
            +
            CTTL_RULE( java_lexer< ParserT >::ClassBody )

            ).match( edge_ );
    }

    
    size_t InterfaceDeclaration( universe_T& edge_ )
    {
        
        return (

            ( &LITERAL_INTERFACE & literal() )
            +
            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            entity(
                ( &LITERAL_EXTENDS & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::TypeList )
            ) * 1
            +
            CTTL_RULE( java_lexer< ParserT >::InterfaceBody )

            ).match( edge_ );
    }

    
    size_t TypeList( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Type )
            +
            *( ',' + CTTL_RULE( java_lexer< ParserT >::Type ) )

            ).match( edge_ );
    }

    
    size_t ClassBody( universe_T& edge_ )
    {
        
        return (

            '{' + *( CTTL_RULE( java_lexer< ParserT >::ClassBodyDeclaration ) ) + '}'

            ).match( edge_ );
    }

    
    size_t InterfaceBody( universe_T& edge_ )
    {
        
        return (

            '{' + *( CTTL_RULE( java_lexer< ParserT >::InterfaceBodyDeclaration ) ) + '}'

            ).match( edge_ );
    }

    
    size_t ClassBodyDeclaration( universe_T& edge_ )
    {
        
        return (

            ';'
            |
            (
                entity( &LITERAL_STATIC & literal() ) * 1
                +
                CTTL_RULE( java_lexer< ParserT >::Block )
            )
            |
            (
                *CTTL_RULE( java_lexer< ParserT >::Modifier )
                +
                CTTL_RULE( java_lexer< ParserT >::MemberDecl )
            )

            ).match( edge_ );
    }

    
    size_t MemberDecl( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::MethodOrFieldDecl )
            |
            (
                ( &LITERAL_VOID & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::Identifier )
                +
                CTTL_RULE( java_lexer< ParserT >::MethodDeclaratorRest )
            )
            |
            (
                CTTL_RULE( java_lexer< ParserT >::Identifier )
                +
                CTTL_RULE( java_lexer< ParserT >::ConstructorDeclaratorRest )
            )
            |
            CTTL_RULE( java_lexer< ParserT >::ClassOrInterfaceDeclaration )

            ).match( edge_ );
    }

    
    size_t MethodOrFieldDecl( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Type )
            +
            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            CTTL_RULE( java_lexer< ParserT >::MethodOrFieldRest )

            ).match( edge_ );
    }

    
    size_t MethodOrFieldRest( universe_T& edge_ )
    {
        
        return (

            entity( CTTL_RULE( java_lexer< ParserT >::VariableDeclaratorsRest ) )
            |
            CTTL_RULE( java_lexer< ParserT >::MethodDeclaratorRest )
            |
            true

            ).match( edge_ );
    }

    
    size_t InterfaceBodyDeclaration( universe_T& edge_ )
    {
        
        return (

            ';'
            |
            (
                *CTTL_RULE( java_lexer< ParserT >::Modifier )
                +
                CTTL_RULE( java_lexer< ParserT >::InterfaceMemberDecl )
            )

            ).match( edge_ );
    }

    
    size_t InterfaceMemberDecl( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::InterfaceMethodOrFieldDecl )
            |
            (
                ( &LITERAL_VOID & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::Identifier )
                +
                CTTL_RULE( java_lexer< ParserT >::VoidInterfaceMethodDeclaratorRest )
            )
            |
            CTTL_RULE( java_lexer< ParserT >::ClassOrInterfaceDeclaration )

            ).match( edge_ );
    }

    
    size_t InterfaceMethodOrFieldDecl( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Type )
            +
            CTTL_RULE( java_lexer< ParserT >::Identifier )
            +
            CTTL_RULE( java_lexer< ParserT >::InterfaceMethodOrFieldRest )

            ).match( edge_ );
    }

    
    size_t InterfaceMethodOrFieldRest( universe_T& edge_ )
    {
        
        return (

            ( CTTL_RULE( java_lexer< ParserT >::ConstantDeclaratorsRest ) + ';' )
            |
            CTTL_RULE( java_lexer< ParserT >::InterfaceMethodDeclaratorRest )

            ).match( edge_ );
    }

    
    size_t MethodDeclaratorRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::FormalParameters )
            +
            CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
            +
            entity(
                ( &LITERAL_THROWS & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifierList )
            ) * 1
            +
            (
                CTTL_RULE( java_lexer< ParserT >::MethodBody )
                |
                ';'
            )

            ).match( edge_ );
    }

    
    size_t VoidMethodDeclaratorRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::FormalParameters )
            +
            entity(
                ( &LITERAL_THROWS & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifierList )
            ) * 1
            +
            (
                CTTL_RULE( java_lexer< ParserT >::MethodBody )
                |
                ';'
            )

            ).match( edge_ );
    }

    
    size_t InterfaceMethodDeclaratorRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::FormalParameters )
            +
            CTTL_RULE( java_lexer< ParserT >::BracketsOpt )
            +
            entity(
                ( &LITERAL_THROWS & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifierList )
            ) * 1
            +
            ';'

            ).match( edge_ );
    }

    
    size_t VoidInterfaceMethodDeclaratorRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::FormalParameters )
            +
            entity(
                ( &LITERAL_THROWS & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifierList )
            ) * 1
            +
            ';'

            ).match( edge_ );
    }

    
    size_t ConstructorDeclaratorRest( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::FormalParameters )
            +
            entity(
                ( &LITERAL_THROWS & literal() )
                +
                CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifierList )
            ) * 1
            +
            CTTL_RULE( java_lexer< ParserT >::MethodBody )

            ).match( edge_ );
    }

    
    size_t QualifiedIdentifierList( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifier )
            +
            *(
                ','
                +
                CTTL_RULE( java_lexer< ParserT >::QualifiedIdentifier )
            )

            ).match( edge_ );
    }

    
    size_t FormalParameters( universe_T& edge_ )
    {
        
        return (

            '('
            +
            entity(
                CTTL_RULE( java_lexer< ParserT >::FormalParameter )
                +
                *( ',' + CTTL_RULE( java_lexer< ParserT >::FormalParameter ) )
            ) * 1
            +
            ')'

            ).match( edge_ );
    }

    
    size_t FormalParameter( universe_T& edge_ )
    {
        
        return (

            entity( &LITERAL_FINAL & literal() ) * 1
            +
            CTTL_RULE( java_lexer< ParserT >::Type )
            +
            CTTL_RULE( java_lexer< ParserT >::VariableDeclaratorId )

            ).match( edge_ );
    }

    
    size_t MethodBody( universe_T& edge_ )
    {
        
        return (

            CTTL_RULE( java_lexer< ParserT >::Block )

            ).match( edge_ );
    }

    // The folllowing Token-level definitions were taken from
    // http://www.cs.uiowa.edu/~fleck/JavaBNF.htm
    
    size_t IntegerLiteral( universe_T& edge_ )
    {
        
        return (

            (
                (
                    symbol( '0' )
                    ^
                    ( symbol( 'x' ) | 'X' )
                    ^
                    entity( isxdigit )
                )
                |
                // simplified: this is either <decimal integer literal> or <octal numeral>,
                // are defined as zero followed by octal digits:
                entity( isdigit )
            )
            +
            entity( symbol( 'l' ) | 'L' ) * 1

            ).match( edge_ );
    }

    
    
    size_t FloatingPointLiteral( universe_T& edge_ )
    {
        
        return (
            (
                entity( isdigit )
                +
                symbol( '.' )
                +
                entity( isdigit ) * 1
                +
                CTTL_RULE( java_lexer< ParserT >::FloatingPointExponentPart ) * 1
                +
                CTTL_RULE( java_lexer< ParserT >::FloatTypeSuffix ) * 1
            )
            |
            (
                '.'
                +
                entity( isdigit )
                +
                CTTL_RULE( java_lexer< ParserT >::FloatingPointExponentPart ) * 1
                +
                CTTL_RULE( java_lexer< ParserT >::FloatTypeSuffix ) * 1
            )
            |
            (
                entity( isdigit )
                +
                CTTL_RULE( java_lexer< ParserT >::FloatingPointExponentPart )
                +
                CTTL_RULE( java_lexer< ParserT >::FloatTypeSuffix ) * 1
            )
            |
            (
                entity( isdigit )
                +
                CTTL_RULE( java_lexer< ParserT >::FloatingPointExponentPart ) * 1
                +
                CTTL_RULE( java_lexer< ParserT >::FloatTypeSuffix )
            )

            ).match( edge_ );
    }

    
    size_t FloatingPointExponentPart( universe_T& edge_ )
    {
        
        return (

            ( symbol( 'e' ) | 'E' )
            +
            ( symbol( '-' ) ) * 1
            +
            entity( isdigit )

            ).match( edge_ );
    }

    
    size_t FloatTypeSuffix( universe_T& edge_ )
    {
        
        return (

            symbol( 'f' ) | 'F' | 'd' | 'D'

            ).match( edge_ );
    }

    
    size_t CharacterLiteral( universe_T& edge_ )
    {
        
        return (

            c_single_quote()

            ).match( edge_ );
    }

    
    size_t StringLiteral( universe_T& edge_ )
    {
        
        return (

            c_double_quote()

            ).match( edge_ );
    }

    
    size_t BooleanLiteral( universe_T& edge_ )
    {
        
        return (

            (
                symbol( &LITERAL_TRUE )
                |
                &LITERAL_FALSE
            )
            &
            literal()

            ).match( edge_ );
    }

    
    size_t NullLiteral( universe_T& edge_ )
    {
        
        return (

            ( &LITERAL_NULL & literal() )

            ).match( edge_ );
    }

};  // struct java_lexer

#endif //_CTTL_JAVA_LEXER_H_INCLUDED_



Copyright © 1997-2006 Igor Kholodov mailto:cttl@users.sourceforge.net.

Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.


Generated on Thu Nov 2 17:44:55 2006 for Common Text Transformation Library by  doxygen 1.3.9.1