Search in sources :

Example 31 with ValueConverterException

use of org.eclipse.xtext.conversion.ValueConverterException in project n4js by eclipse.

the class AbstractTemplateSegmentValueConverter method toValue.

@Override
public String toValue(String string, INode node) {
    if (string == null)
        return null;
    try {
        int len = string.length();
        int leftLen = getLeftDelimiter().length();
        if (len == leftLen) {
            throw newN4JSValueConverterException(node, "");
        }
        int lastIdx = len - getRightDelimiter().length();
        if (string.startsWith(getLeftDelimiter()) && string.endsWith(getRightDelimiter())) {
            int minLen = leftLen + getRightDelimiter().length();
            if (len > minLen) {
                if (string.charAt(lastIdx - 1) == '\\' && (len == minLen + 1 || string.charAt(lastIdx - 2) != '\\')) {
                    String value = convertFromJSString(string.substring(leftLen), node, false);
                    throw newN4JSValueConverterException(node, value);
                }
            }
            return convertFromJSString(string.substring(leftLen, lastIdx), node, true);
        } else {
            String value = convertFromJSString(string.substring(leftLen), node, false);
            throw newN4JSValueConverterException(node, value);
        }
    } catch (IllegalArgumentException e) {
        throw new ValueConverterException(e.getMessage(), node, e);
    }
}
Also used : ValueConverterException(org.eclipse.xtext.conversion.ValueConverterException)

Example 32 with ValueConverterException

use of org.eclipse.xtext.conversion.ValueConverterException in project n4js by eclipse.

the class N4JSStringValueConverter method toValue.

@Override
public String toValue(String string, INode node) {
    if (string == null)
        return null;
    try {
        if (string.length() == 1) {
            throw newN4JSValueConverterException(string.charAt(0), node, "");
        }
        char first = string.charAt(0);
        int lastIdx = string.length() - 1;
        if (string.charAt(lastIdx) == first) {
            if (string.length() >= 3) {
                if (string.charAt(lastIdx - 1) == '\\' && string.charAt(lastIdx - 2) != '\\') {
                    String value = convertFromJSString(string.substring(1), node, false);
                    throw newN4JSValueConverterException(first, node, value);
                }
            }
            return convertFromJSString(string.substring(1, lastIdx), node, true);
        } else {
            String value = convertFromJSString(string.substring(1), node, false);
            throw newN4JSValueConverterException(first, node, value);
        }
    } catch (IllegalArgumentException e) {
        throw new ValueConverterException(e.getMessage(), node, e);
    }
}
Also used : ValueConverterException(org.eclipse.xtext.conversion.ValueConverterException)

Example 33 with ValueConverterException

use of org.eclipse.xtext.conversion.ValueConverterException in project applause by applause.

the class InternalApplauseDslParser method ruleStringLiteral.

// $ANTLR end entryRuleStringLiteral
// $ANTLR start ruleStringLiteral
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:685:1: ruleStringLiteral returns [EObject current=null] : ( (lv_value_0_0= RULE_STRING ) ) ;
public final EObject ruleStringLiteral() throws RecognitionException {
    EObject current = null;
    Token lv_value_0_0 = null;
    EObject temp = null;
    setCurrentLookahead();
    resetLookahead();
    try {
        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:690:6: ( ( (lv_value_0_0= RULE_STRING ) ) )
        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:691:1: ( (lv_value_0_0= RULE_STRING ) )
        {
            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:691:1: ( (lv_value_0_0= RULE_STRING ) )
            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:692:1: (lv_value_0_0= RULE_STRING )
            {
                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:692:1: (lv_value_0_0= RULE_STRING )
                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:693:3: lv_value_0_0= RULE_STRING
                {
                    lv_value_0_0 = (Token) input.LT(1);
                    match(input, RULE_STRING, FOLLOW_RULE_STRING_in_ruleStringLiteral1464);
                    createLeafNode(grammarAccess.getStringLiteralAccess().getValueSTRINGTerminalRuleCall_0(), "value");
                    if (current == null) {
                        current = factory.create(grammarAccess.getStringLiteralRule().getType().getClassifier());
                        associateNodeWithAstElement(currentNode, current);
                    }
                    try {
                        set(current, "value", lv_value_0_0, "STRING", lastConsumedNode);
                    } catch (ValueConverterException vce) {
                        handleValueConverterException(vce);
                    }
                }
            }
        }
        resetLookahead();
        lastConsumedNode = currentNode;
    } catch (RecognitionException re) {
        recover(input, re);
        appendSkippedTokens();
    } finally {
    }
    return current;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) AntlrDatatypeRuleToken(org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken) ValueConverterException(org.eclipse.xtext.conversion.ValueConverterException)

Example 34 with ValueConverterException

use of org.eclipse.xtext.conversion.ValueConverterException in project applause by applause.

the class InternalApplauseDslParser method ruleProperty.

// $ANTLR end entryRuleProperty
// $ANTLR start ruleProperty
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1662:1: ruleProperty returns [EObject current=null] : ( ( (lv_derived_0_0= 'derived' ) )? ( (lv_description_1_0= ruleTypeDescription ) ) ( (lv_name_2_0= RULE_ID ) ) ) ;
public final EObject ruleProperty() throws RecognitionException {
    EObject current = null;
    Token lv_derived_0_0 = null;
    Token lv_name_2_0 = null;
    EObject lv_description_1_0 = null;
    EObject temp = null;
    setCurrentLookahead();
    resetLookahead();
    try {
        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1667:6: ( ( ( (lv_derived_0_0= 'derived' ) )? ( (lv_description_1_0= ruleTypeDescription ) ) ( (lv_name_2_0= RULE_ID ) ) ) )
        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1668:1: ( ( (lv_derived_0_0= 'derived' ) )? ( (lv_description_1_0= ruleTypeDescription ) ) ( (lv_name_2_0= RULE_ID ) ) )
        {
            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1668:1: ( ( (lv_derived_0_0= 'derived' ) )? ( (lv_description_1_0= ruleTypeDescription ) ) ( (lv_name_2_0= RULE_ID ) ) )
            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1668:2: ( (lv_derived_0_0= 'derived' ) )? ( (lv_description_1_0= ruleTypeDescription ) ) ( (lv_name_2_0= RULE_ID ) )
            {
                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1668:2: ( (lv_derived_0_0= 'derived' ) )?
                int alt18 = 2;
                int LA18_0 = input.LA(1);
                if ((LA18_0 == 35)) {
                    alt18 = 1;
                }
                switch(alt18) {
                    case 1:
                        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1669:1: (lv_derived_0_0= 'derived' )
                        {
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1669:1: (lv_derived_0_0= 'derived' )
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1670:3: lv_derived_0_0= 'derived'
                            {
                                lv_derived_0_0 = (Token) input.LT(1);
                                match(input, 35, FOLLOW_35_in_ruleProperty3112);
                                createLeafNode(grammarAccess.getPropertyAccess().getDerivedDerivedKeyword_0_0(), "derived");
                                if (current == null) {
                                    current = factory.create(grammarAccess.getPropertyRule().getType().getClassifier());
                                    associateNodeWithAstElement(currentNode, current);
                                }
                                try {
                                    set(current, "derived", true, "derived", lastConsumedNode);
                                } catch (ValueConverterException vce) {
                                    handleValueConverterException(vce);
                                }
                            }
                        }
                        break;
                }
                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1689:3: ( (lv_description_1_0= ruleTypeDescription ) )
                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1690:1: (lv_description_1_0= ruleTypeDescription )
                {
                    // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1690:1: (lv_description_1_0= ruleTypeDescription )
                    // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1691:3: lv_description_1_0= ruleTypeDescription
                    {
                        currentNode = createCompositeNode(grammarAccess.getPropertyAccess().getDescriptionTypeDescriptionParserRuleCall_1_0(), currentNode);
                        pushFollow(FOLLOW_ruleTypeDescription_in_ruleProperty3147);
                        lv_description_1_0 = ruleTypeDescription();
                        _fsp--;
                        if (current == null) {
                            current = factory.create(grammarAccess.getPropertyRule().getType().getClassifier());
                            associateNodeWithAstElement(currentNode.getParent(), current);
                        }
                        try {
                            set(current, "description", lv_description_1_0, "TypeDescription", currentNode);
                        } catch (ValueConverterException vce) {
                            handleValueConverterException(vce);
                        }
                        currentNode = currentNode.getParent();
                    }
                }
                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1713:2: ( (lv_name_2_0= RULE_ID ) )
                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1714:1: (lv_name_2_0= RULE_ID )
                {
                    // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1714:1: (lv_name_2_0= RULE_ID )
                    // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1715:3: lv_name_2_0= RULE_ID
                    {
                        lv_name_2_0 = (Token) input.LT(1);
                        match(input, RULE_ID, FOLLOW_RULE_ID_in_ruleProperty3164);
                        createLeafNode(grammarAccess.getPropertyAccess().getNameIDTerminalRuleCall_2_0(), "name");
                        if (current == null) {
                            current = factory.create(grammarAccess.getPropertyRule().getType().getClassifier());
                            associateNodeWithAstElement(currentNode, current);
                        }
                        try {
                            set(current, "name", lv_name_2_0, "ID", lastConsumedNode);
                        } catch (ValueConverterException vce) {
                            handleValueConverterException(vce);
                        }
                    }
                }
            }
        }
        resetLookahead();
        lastConsumedNode = currentNode;
    } catch (RecognitionException re) {
        recover(input, re);
        appendSkippedTokens();
    } finally {
    }
    return current;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) AntlrDatatypeRuleToken(org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken) ValueConverterException(org.eclipse.xtext.conversion.ValueConverterException)

Example 35 with ValueConverterException

use of org.eclipse.xtext.conversion.ValueConverterException in project applause by applause.

the class InternalApplauseDslParser method ruleStringFunction.

// $ANTLR end entryRuleStringFunction
// $ANTLR start ruleStringFunction
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:732:1: ruleStringFunction returns [EObject current=null] : ( ( () '(' ( (lv_values_2_0= ruleScalarExpression ) )+ ')' ) | ( () 'replace(' ( (lv_value_6_0= ruleScalarExpression ) ) ',' ( (lv_match_8_0= ruleScalarExpression ) ) ',' ( (lv_replacement_10_0= ruleScalarExpression ) ) ')' ) | ( () 'urlconform(' ( (lv_value_14_0= ruleScalarExpression ) ) ')' ) ) ;
public final EObject ruleStringFunction() throws RecognitionException {
    EObject current = null;
    EObject lv_values_2_0 = null;
    EObject lv_value_6_0 = null;
    EObject lv_match_8_0 = null;
    EObject lv_replacement_10_0 = null;
    EObject lv_value_14_0 = null;
    EObject temp = null;
    setCurrentLookahead();
    resetLookahead();
    try {
        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:737:6: ( ( ( () '(' ( (lv_values_2_0= ruleScalarExpression ) )+ ')' ) | ( () 'replace(' ( (lv_value_6_0= ruleScalarExpression ) ) ',' ( (lv_match_8_0= ruleScalarExpression ) ) ',' ( (lv_replacement_10_0= ruleScalarExpression ) ) ')' ) | ( () 'urlconform(' ( (lv_value_14_0= ruleScalarExpression ) ) ')' ) ) )
        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:738:1: ( ( () '(' ( (lv_values_2_0= ruleScalarExpression ) )+ ')' ) | ( () 'replace(' ( (lv_value_6_0= ruleScalarExpression ) ) ',' ( (lv_match_8_0= ruleScalarExpression ) ) ',' ( (lv_replacement_10_0= ruleScalarExpression ) ) ')' ) | ( () 'urlconform(' ( (lv_value_14_0= ruleScalarExpression ) ) ')' ) )
        {
            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:738:1: ( ( () '(' ( (lv_values_2_0= ruleScalarExpression ) )+ ')' ) | ( () 'replace(' ( (lv_value_6_0= ruleScalarExpression ) ) ',' ( (lv_match_8_0= ruleScalarExpression ) ) ',' ( (lv_replacement_10_0= ruleScalarExpression ) ) ')' ) | ( () 'urlconform(' ( (lv_value_14_0= ruleScalarExpression ) ) ')' ) )
            int alt10 = 3;
            switch(input.LA(1)) {
                case 13:
                    {
                        alt10 = 1;
                    }
                    break;
                case 15:
                    {
                        alt10 = 2;
                    }
                    break;
                case 17:
                    {
                        alt10 = 3;
                    }
                    break;
                default:
                    NoViableAltException nvae = new NoViableAltException("738:1: ( ( () '(' ( (lv_values_2_0= ruleScalarExpression ) )+ ')' ) | ( () 'replace(' ( (lv_value_6_0= ruleScalarExpression ) ) ',' ( (lv_match_8_0= ruleScalarExpression ) ) ',' ( (lv_replacement_10_0= ruleScalarExpression ) ) ')' ) | ( () 'urlconform(' ( (lv_value_14_0= ruleScalarExpression ) ) ')' ) )", 10, 0, input);
                    throw nvae;
            }
            switch(alt10) {
                case 1:
                    // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:738:2: ( () '(' ( (lv_values_2_0= ruleScalarExpression ) )+ ')' )
                    {
                        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:738:2: ( () '(' ( (lv_values_2_0= ruleScalarExpression ) )+ ')' )
                        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:738:3: () '(' ( (lv_values_2_0= ruleScalarExpression ) )+ ')'
                        {
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:738:3: ()
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:739:5:
                            {
                                temp = factory.create(grammarAccess.getStringFunctionAccess().getStringConcatAction_0_0().getType().getClassifier());
                                current = temp;
                                temp = null;
                                CompositeNode newNode = createCompositeNode(grammarAccess.getStringFunctionAccess().getStringConcatAction_0_0(), currentNode.getParent());
                                newNode.getChildren().add(currentNode);
                                moveLookaheadInfo(currentNode, newNode);
                                currentNode = newNode;
                                associateNodeWithAstElement(currentNode, current);
                            }
                            match(input, 13, FOLLOW_13_in_ruleStringFunction1559);
                            createLeafNode(grammarAccess.getStringFunctionAccess().getLeftParenthesisKeyword_0_1(), null);
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:753:1: ( (lv_values_2_0= ruleScalarExpression ) )+
                            int cnt9 = 0;
                            loop9: do {
                                int alt9 = 2;
                                int LA9_0 = input.LA(1);
                                if (((LA9_0 >= RULE_ID && LA9_0 <= RULE_STRING) || LA9_0 == 13 || LA9_0 == 15 || LA9_0 == 17)) {
                                    alt9 = 1;
                                }
                                switch(alt9) {
                                    case 1:
                                        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:754:1: (lv_values_2_0= ruleScalarExpression )
                                        {
                                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:754:1: (lv_values_2_0= ruleScalarExpression )
                                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:755:3: lv_values_2_0= ruleScalarExpression
                                            {
                                                currentNode = createCompositeNode(grammarAccess.getStringFunctionAccess().getValuesScalarExpressionParserRuleCall_0_2_0(), currentNode);
                                                pushFollow(FOLLOW_ruleScalarExpression_in_ruleStringFunction1580);
                                                lv_values_2_0 = ruleScalarExpression();
                                                _fsp--;
                                                if (current == null) {
                                                    current = factory.create(grammarAccess.getStringFunctionRule().getType().getClassifier());
                                                    associateNodeWithAstElement(currentNode.getParent(), current);
                                                }
                                                try {
                                                    add(current, "values", lv_values_2_0, "ScalarExpression", currentNode);
                                                } catch (ValueConverterException vce) {
                                                    handleValueConverterException(vce);
                                                }
                                                currentNode = currentNode.getParent();
                                            }
                                        }
                                        break;
                                    default:
                                        if (cnt9 >= 1)
                                            break loop9;
                                        EarlyExitException eee = new EarlyExitException(9, input);
                                        throw eee;
                                }
                                cnt9++;
                            } while (true);
                            match(input, 14, FOLLOW_14_in_ruleStringFunction1591);
                            createLeafNode(grammarAccess.getStringFunctionAccess().getRightParenthesisKeyword_0_3(), null);
                        }
                    }
                    break;
                case 2:
                    // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:782:6: ( () 'replace(' ( (lv_value_6_0= ruleScalarExpression ) ) ',' ( (lv_match_8_0= ruleScalarExpression ) ) ',' ( (lv_replacement_10_0= ruleScalarExpression ) ) ')' )
                    {
                        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:782:6: ( () 'replace(' ( (lv_value_6_0= ruleScalarExpression ) ) ',' ( (lv_match_8_0= ruleScalarExpression ) ) ',' ( (lv_replacement_10_0= ruleScalarExpression ) ) ')' )
                        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:782:7: () 'replace(' ( (lv_value_6_0= ruleScalarExpression ) ) ',' ( (lv_match_8_0= ruleScalarExpression ) ) ',' ( (lv_replacement_10_0= ruleScalarExpression ) ) ')'
                        {
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:782:7: ()
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:783:5:
                            {
                                temp = factory.create(grammarAccess.getStringFunctionAccess().getStringReplaceAction_1_0().getType().getClassifier());
                                current = temp;
                                temp = null;
                                CompositeNode newNode = createCompositeNode(grammarAccess.getStringFunctionAccess().getStringReplaceAction_1_0(), currentNode.getParent());
                                newNode.getChildren().add(currentNode);
                                moveLookaheadInfo(currentNode, newNode);
                                currentNode = newNode;
                                associateNodeWithAstElement(currentNode, current);
                            }
                            match(input, 15, FOLLOW_15_in_ruleStringFunction1618);
                            createLeafNode(grammarAccess.getStringFunctionAccess().getReplaceKeyword_1_1(), null);
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:797:1: ( (lv_value_6_0= ruleScalarExpression ) )
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:798:1: (lv_value_6_0= ruleScalarExpression )
                            {
                                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:798:1: (lv_value_6_0= ruleScalarExpression )
                                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:799:3: lv_value_6_0= ruleScalarExpression
                                {
                                    currentNode = createCompositeNode(grammarAccess.getStringFunctionAccess().getValueScalarExpressionParserRuleCall_1_2_0(), currentNode);
                                    pushFollow(FOLLOW_ruleScalarExpression_in_ruleStringFunction1639);
                                    lv_value_6_0 = ruleScalarExpression();
                                    _fsp--;
                                    if (current == null) {
                                        current = factory.create(grammarAccess.getStringFunctionRule().getType().getClassifier());
                                        associateNodeWithAstElement(currentNode.getParent(), current);
                                    }
                                    try {
                                        set(current, "value", lv_value_6_0, "ScalarExpression", currentNode);
                                    } catch (ValueConverterException vce) {
                                        handleValueConverterException(vce);
                                    }
                                    currentNode = currentNode.getParent();
                                }
                            }
                            match(input, 16, FOLLOW_16_in_ruleStringFunction1649);
                            createLeafNode(grammarAccess.getStringFunctionAccess().getCommaKeyword_1_3(), null);
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:825:1: ( (lv_match_8_0= ruleScalarExpression ) )
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:826:1: (lv_match_8_0= ruleScalarExpression )
                            {
                                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:826:1: (lv_match_8_0= ruleScalarExpression )
                                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:827:3: lv_match_8_0= ruleScalarExpression
                                {
                                    currentNode = createCompositeNode(grammarAccess.getStringFunctionAccess().getMatchScalarExpressionParserRuleCall_1_4_0(), currentNode);
                                    pushFollow(FOLLOW_ruleScalarExpression_in_ruleStringFunction1670);
                                    lv_match_8_0 = ruleScalarExpression();
                                    _fsp--;
                                    if (current == null) {
                                        current = factory.create(grammarAccess.getStringFunctionRule().getType().getClassifier());
                                        associateNodeWithAstElement(currentNode.getParent(), current);
                                    }
                                    try {
                                        set(current, "match", lv_match_8_0, "ScalarExpression", currentNode);
                                    } catch (ValueConverterException vce) {
                                        handleValueConverterException(vce);
                                    }
                                    currentNode = currentNode.getParent();
                                }
                            }
                            match(input, 16, FOLLOW_16_in_ruleStringFunction1680);
                            createLeafNode(grammarAccess.getStringFunctionAccess().getCommaKeyword_1_5(), null);
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:853:1: ( (lv_replacement_10_0= ruleScalarExpression ) )
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:854:1: (lv_replacement_10_0= ruleScalarExpression )
                            {
                                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:854:1: (lv_replacement_10_0= ruleScalarExpression )
                                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:855:3: lv_replacement_10_0= ruleScalarExpression
                                {
                                    currentNode = createCompositeNode(grammarAccess.getStringFunctionAccess().getReplacementScalarExpressionParserRuleCall_1_6_0(), currentNode);
                                    pushFollow(FOLLOW_ruleScalarExpression_in_ruleStringFunction1701);
                                    lv_replacement_10_0 = ruleScalarExpression();
                                    _fsp--;
                                    if (current == null) {
                                        current = factory.create(grammarAccess.getStringFunctionRule().getType().getClassifier());
                                        associateNodeWithAstElement(currentNode.getParent(), current);
                                    }
                                    try {
                                        set(current, "replacement", lv_replacement_10_0, "ScalarExpression", currentNode);
                                    } catch (ValueConverterException vce) {
                                        handleValueConverterException(vce);
                                    }
                                    currentNode = currentNode.getParent();
                                }
                            }
                            match(input, 14, FOLLOW_14_in_ruleStringFunction1711);
                            createLeafNode(grammarAccess.getStringFunctionAccess().getRightParenthesisKeyword_1_7(), null);
                        }
                    }
                    break;
                case 3:
                    // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:882:6: ( () 'urlconform(' ( (lv_value_14_0= ruleScalarExpression ) ) ')' )
                    {
                        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:882:6: ( () 'urlconform(' ( (lv_value_14_0= ruleScalarExpression ) ) ')' )
                        // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:882:7: () 'urlconform(' ( (lv_value_14_0= ruleScalarExpression ) ) ')'
                        {
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:882:7: ()
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:883:5:
                            {
                                temp = factory.create(grammarAccess.getStringFunctionAccess().getStringUrlConformAction_2_0().getType().getClassifier());
                                current = temp;
                                temp = null;
                                CompositeNode newNode = createCompositeNode(grammarAccess.getStringFunctionAccess().getStringUrlConformAction_2_0(), currentNode.getParent());
                                newNode.getChildren().add(currentNode);
                                moveLookaheadInfo(currentNode, newNode);
                                currentNode = newNode;
                                associateNodeWithAstElement(currentNode, current);
                            }
                            match(input, 17, FOLLOW_17_in_ruleStringFunction1738);
                            createLeafNode(grammarAccess.getStringFunctionAccess().getUrlconformKeyword_2_1(), null);
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:897:1: ( (lv_value_14_0= ruleScalarExpression ) )
                            // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:898:1: (lv_value_14_0= ruleScalarExpression )
                            {
                                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:898:1: (lv_value_14_0= ruleScalarExpression )
                                // ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:899:3: lv_value_14_0= ruleScalarExpression
                                {
                                    currentNode = createCompositeNode(grammarAccess.getStringFunctionAccess().getValueScalarExpressionParserRuleCall_2_2_0(), currentNode);
                                    pushFollow(FOLLOW_ruleScalarExpression_in_ruleStringFunction1759);
                                    lv_value_14_0 = ruleScalarExpression();
                                    _fsp--;
                                    if (current == null) {
                                        current = factory.create(grammarAccess.getStringFunctionRule().getType().getClassifier());
                                        associateNodeWithAstElement(currentNode.getParent(), current);
                                    }
                                    try {
                                        set(current, "value", lv_value_14_0, "ScalarExpression", currentNode);
                                    } catch (ValueConverterException vce) {
                                        handleValueConverterException(vce);
                                    }
                                    currentNode = currentNode.getParent();
                                }
                            }
                            match(input, 14, FOLLOW_14_in_ruleStringFunction1769);
                            createLeafNode(grammarAccess.getStringFunctionAccess().getRightParenthesisKeyword_2_3(), null);
                        }
                    }
                    break;
            }
        }
        resetLookahead();
        lastConsumedNode = currentNode;
    } catch (RecognitionException re) {
        recover(input, re);
        appendSkippedTokens();
    } finally {
    }
    return current;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) ValueConverterException(org.eclipse.xtext.conversion.ValueConverterException)

Aggregations

ValueConverterException (org.eclipse.xtext.conversion.ValueConverterException)54 EObject (org.eclipse.emf.ecore.EObject)37 AntlrDatatypeRuleToken (org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken)13 ValueConverterWithValueException (org.eclipse.xtext.conversion.ValueConverterWithValueException)4 Test (org.junit.Test)4 URI (org.eclipse.emf.common.util.URI)3 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)3 Resource (org.eclipse.emf.ecore.resource.Resource)3 ClasspathUriResolutionException (org.eclipse.xtext.resource.ClasspathUriResolutionException)3 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)3 XtextResource (org.eclipse.xtext.resource.XtextResource)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 FailedPredicateException (org.antlr.runtime.FailedPredicateException)2 MismatchedTokenException (org.antlr.runtime.MismatchedTokenException)2 MissingTokenException (org.antlr.runtime.MissingTokenException)2 RecognitionException (org.antlr.runtime.RecognitionException)2 UnwantedTokenException (org.antlr.runtime.UnwantedTokenException)2 WrappedException (org.eclipse.emf.common.util.WrappedException)2 EClass (org.eclipse.emf.ecore.EClass)2 EReference (org.eclipse.emf.ecore.EReference)2