Package org.antlr.runtime

Examples of org.antlr.runtime.Token


                attribute = helper.start( (DescrBuilder< ? , ? >) as,
                                          AttributeDescrBuilder.class,
                                          builder.toString() );
            }

            Token value = match( input,
                                 DRL5Lexer.STRING,
                                 null,
                                 null,
                                 DroolsEditorType.STRING_CONST );
            if ( state.failed ) return null;
            if ( state.backtracking == 0 ) {
                attribute.value( StringUtils.unescapeJava( safeStripStringDelimiters( value.getText() ) ) );
                attribute.type( AttributeDescr.Type.STRING );
            }
        } finally {
            if ( attribute != null ) {
                helper.end( AttributeDescrBuilder.class,
View Full Code Here


                                          builder.toString() );
            }

            builder = new StringBuilder();
            builder.append( "[ " );
            Token value = match( input,
                                 DRL5Lexer.STRING,
                                 null,
                                 null,
                                 DroolsEditorType.STRING_CONST );
            if ( state.failed ) return null;
            builder.append( value.getText() );

            while ( input.LA( 1 ) == DRL5Lexer.COMMA ) {
                match( input,
                       DRL5Lexer.COMMA,
                       null,
                       null,
                       DroolsEditorType.SYMBOL );
                if ( state.failed ) return null;
                builder.append( ", " );
                value = match( input,
                               DRL5Lexer.STRING,
                               null,
                               null,
                               DroolsEditorType.STRING_CONST );
                if ( state.failed ) return null;
                builder.append( value.getText() );
            }
            builder.append( " ]" );
            if ( state.backtracking == 0 ) {
                attribute.value( builder.toString() );
                attribute.type( AttributeDescr.Type.LIST );
View Full Code Here

                    attribute.type( AttributeDescr.Type.EXPRESSION );
                }
            } else {
                String value = "";
                if ( input.LA( 1 ) == DRL5Lexer.PLUS ) {
                    Token sign = match( input,
                                        DRL5Lexer.PLUS,
                                        null,
                                        null,
                                        DroolsEditorType.NUMERIC_CONST );
                    if ( state.failed ) return null;
                    value += sign.getText();
                } else if ( input.LA( 1 ) == DRL5Lexer.MINUS ) {
                    Token sign = match( input,
                                        DRL5Lexer.MINUS,
                                        null,
                                        null,
                                        DroolsEditorType.NUMERIC_CONST );
                    if ( state.failed ) return null;
                    value += sign.getText();
                }
                Token nbr = match( input,
                                   DRL5Lexer.DECIMAL,
                                   null,
                                   null,
                                   DroolsEditorType.NUMERIC_CONST );
                if ( state.failed ) return null;
                value += nbr.getText();
                if ( state.backtracking == 0 ) {
                    attribute.value( value );
                    attribute.type( AttributeDescr.Type.NUMBER );
                }
            }
View Full Code Here

                   null,
                   null,
                   DroolsEditorType.SYMBOL );
            if ( state.failed ) return null;

            Token label = match( input,
                                 DRL5Lexer.ID,
                                 null,
                                 null,
                                 DroolsEditorType.SYMBOL );
            if ( state.failed ) return null;

            namedConsequence.name( label.getText() );

            match( input,
                   DRL5Lexer.RIGHT_SQUARE,
                   null,
                   null,
View Full Code Here

                   null,
                   null,
                   DroolsEditorType.SYMBOL );
            if ( state.failed ) return null;

            Token label = match( input,
                                 DRL5Lexer.ID,
                                 null,
                                 null,
                                 DroolsEditorType.SYMBOL );
            if ( state.failed ) return null;

            namedConsequence.name( label.getText() );
            namedConsequence.breaking(true);

            match( input,
                   DRL5Lexer.RIGHT_SQUARE,
                   null,
View Full Code Here

        int idx = input.index();
        final String expr;
        try{
            expr = conditionalExpression();
        } catch (RecognitionException e){
            final Token tempToken = helper.getLastTokenOnList(helper.getEditorInterface().getLast().getContent());
            if (tempToken != null){
                for (int i = tempToken.getTokenIndex() + 1; i < input.size(); i++) {
                    final Token token = input.get(i);
                    if (token.getType() == DRL5Lexer.EOF){
                        break;
                    }
                    helper.emit(token, DroolsEditorType.CODE_CHUNK);
                }
            }
View Full Code Here

                                      final boolean allowOr ) throws RecognitionException {
        PatternDescrBuilder< ? > pattern = null;
        CEDescrBuilder< ? , OrDescr> or = null;
        BaseDescr result = null;

        Token first = input.LT( 1 );
        pattern = helper.start( (DescrBuilder< ? , ? >) ce,
                                PatternDescrBuilder.class,
                                null );
        if ( pattern != null ) {
            result = pattern.getDescr();
View Full Code Here

     * label := ID COLON
     * @return
     * @throws RecognitionException
     */
    private String label( DroolsEditorType edType ) throws RecognitionException {
        Token label = match( input,
                             DRL5Lexer.ID,
                             null,
                             null,
                             edType );
        if ( state.failed ) return null;

        match( input,
               DRL5Lexer.COLON,
               null,
               null,
               DroolsEditorType.SYMBOL );
        if ( state.failed ) return null;

        return label.getText();
    }
View Full Code Here

     * unif := ID UNIFY
     * @return
     * @throws RecognitionException
     */
    private String unif( DroolsEditorType edType ) throws RecognitionException {
        Token label = match( input,
                             DRL5Lexer.ID,
                             null,
                             null,
                             edType );
        if ( state.failed ) return null;

        match( input,
               DRL5Lexer.UNIFY,
               null,
               null,
               DroolsEditorType.SYMBOL );
        if ( state.failed ) return null;

        return label.getText();
    }
View Full Code Here

                                                           null );
        try {
            String bName = label( DroolsEditorType.IDENTIFIER_PATTERN );
            if ( state.failed ) return;

            Token subtype = match( input,
                                   DRL5Lexer.ID,
                                   null,
                                   null,
                                   DroolsEditorType.IDENTIFIER_PATTERN );
            if ( state.failed ) return;

            if ( state.backtracking == 0 ) {
                behavior.type( bName,
                               subtype.getText() );
            }

            List<String> parameters = parameters();
            if ( state.failed ) return;
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.