Package org.antlr.runtime

Examples of org.antlr.runtime.Token


     */
    private void enumerative( EnumDeclarationDescrBuilder declare ) {
        EnumLiteralDescrBuilder literal = null;
        String lit = null;
        try {
            Token enumLit = match( input,
                    DRL6Lexer.ID,
                    null,
                    null,
                    DroolsEditorType.IDENTIFIER );
            lit = enumLit.getText();
            if ( state.failed ) return;
        } catch ( RecognitionException re ) {
            reportError( re );
        }

View Full Code Here


                if ( state.failed ) return null;
                if ( state.backtracking == 0 ) function.returnType( type );
            }

            // name
            Token id = match( input,
                              DRL6Lexer.ID,
                              null,
                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            if ( state.backtracking == 0 ) {
                function.name( id.getText() );
                helper.setParaphrasesValue( DroolsParaphraseTypes.FUNCTION,
                                            "\"" + id.getText() + "\"" );
            }

            // arguments
            parameters( function,
                        true );
View Full Code Here

    private Token match( TokenStream input,
                         int ttype,
                         String text,
                         int[] follow,
                         DroolsEditorType etype ) throws RecognitionException {
        Token matchedSymbol = null;
        matchedSymbol = input.LT( 1 );
        if ( input.LA( 1 ) == ttype && (text == null || text.equals( matchedSymbol.getText() )) ) {
            input.consume();
            state.errorRecovery = false;
            state.failed = false;
            helper.emit( matchedSymbol,
                         etype );
View Full Code Here

            e = new UnwantedTokenException( ttype,
                                            input );
            input.consume(); // simply delete extra token
            reportError( e ); // report after consuming so AW sees the token in the exception
            // we want to return the token we're actually matching
            Token matchedSymbol = input.LT( 1 );
            input.consume(); // move past ttype token as if all were ok
            return matchedSymbol;
        }
        // can't recover with single token deletion, try insertion
        if ( mismatchIsMissingToken( input,
View Full Code Here

            String type = type();
            if ( state.backtracking == 0 ) global.type( type );
            if ( state.failed ) return null;

            // identifier
            Token id = match( input,
                              DRL5Lexer.ID,
                              null,
                              null,
                              DroolsEditorType.IDENTIFIER_TYPE );
            if ( state.failed ) return null;
            if ( state.backtracking == 0 ) {
                global.identifier( id.getText() );
                helper.setParaphrasesValue( DroolsParaphraseTypes.GLOBAL,
                                            id.getText() );
            }

        } catch ( RecognitionException re ) {
            reportError( re );
        } finally {
View Full Code Here

                   DroolsSoftKeywords.WINDOW,
                   null,
                   DroolsEditorType.KEYWORD );
            if ( state.failed ) return null;

            Token id = match( input,
                              DRL5Lexer.ID,
                              null,
                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            window = id.getText();
           
            if( state.backtracking == 0 ) {
                declare.name( window );
            }
View Full Code Here

     */
    private void enumerative( EnumDeclarationDescrBuilder declare ) {
        EnumLiteralDescrBuilder literal = null;
        String lit = null;
        try {
            Token enumLit = match( input,
                    DRL5Lexer.ID,
                    null,
                    null,
                    DroolsEditorType.IDENTIFIER );
            lit = enumLit.getText();
            if ( state.failed ) return;
        } catch ( RecognitionException re ) {
            reportError( re );
        }

View Full Code Here

                if ( state.failed ) return null;
                if ( state.backtracking == 0 ) function.returnType( type );
            }

            // name
            Token id = match( input,
                              DRL5Lexer.ID,
                              null,
                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            if ( state.backtracking == 0 ) {
                function.name( id.getText() );
                helper.setParaphrasesValue( DroolsParaphraseTypes.FUNCTION,
                                            "\"" + id.getText() + "\"" );
            }

            // arguments
            parameters( function,
                        true );
View Full Code Here

     * @return
     * @throws RecognitionException
     */
    private String stringId() throws RecognitionException {
        if ( input.LA( 1 ) == DRL5Lexer.ID ) {
            Token id = match( input,
                              DRL5Lexer.ID,
                              null,
                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            return id.getText();
        } else if ( input.LA( 1 ) == DRL5Lexer.STRING ) {
            Token id = match( input,
                              DRL5Lexer.STRING,
                              null,
                              null,
                              DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return null;
            return StringUtils.unescapeJava( safeStripStringDelimiters( id.getText() ) );
        } else {
            throw new MismatchedTokenException( DRL5Lexer.ID,
                                                input );
        }
    }
View Full Code Here

                                          builder.toString() );
            }

            String value = "true";
            if ( input.LA( 1 ) == DRL5Lexer.BOOL ) {
                Token bool = match( input,
                                    DRL5Lexer.BOOL,
                                    null,
                                    null,
                                    DroolsEditorType.KEYWORD );
                if ( state.failed ) return null;
                value = bool.getText();
            }
            if ( state.backtracking == 0 ) {
                attribute.value( value );
                attribute.type( AttributeDescr.Type.BOOLEAN );
            }
View Full Code Here

TOP

Related Classes of org.antlr.runtime.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.