Package org.antlr.runtime

Examples of org.antlr.runtime.Token


                        builder.toString());
            }

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

            while (input.LA(1) == DRL6Lexer.COMMA) {
                match(input,
                        DRL6Lexer.COMMA,
                        null,
                        null,
                        DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
                builder.append(", ");
                value = match(input,
                        DRL6Lexer.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) == DRL6Lexer.PLUS) {
                    Token sign = match(input,
                            DRL6Lexer.PLUS,
                            null,
                            null,
                            DroolsEditorType.NUMERIC_CONST);
                    if (state.failed)
                        return null;
                    value += sign.getText();
                } else if (input.LA(1) == DRL6Lexer.MINUS) {
                    Token sign = match(input,
                            DRL6Lexer.MINUS,
                            null,
                            null,
                            DroolsEditorType.NUMERIC_CONST);
                    if (state.failed)
                        return null;
                    value += sign.getText();
                }
                Token nbr = match(input,
                        DRL6Lexer.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,
                    DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;

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

            namedConsequence.name(label.getText());

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

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

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

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

            match(input,
                    DRL6Lexer.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() == DRL6Lexer.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 org.antlr.runtime.RecognitionException
     */
    String label( DroolsEditorType edType ) throws RecognitionException {
        Token label = match(input,
                DRL6Lexer.ID,
                null,
                null,
                edType);
        if (state.failed)
            return null;

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

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

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

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

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

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

            Token subtype = match(input,
                    DRL6Lexer.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

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

        Token id = match(input,
                DRL6Lexer.ID,
                null,
                null,
                DroolsEditorType.IDENTIFIER);
        if (state.failed)
            return;
        window = id.getText();

        if (state.backtracking == 0) {
            pattern.from().window(window);
            if (input.LA(1) != DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
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.