use of org.eclipse.xtext.conversion.ValueConverterException in project applause by applause.
the class InternalApplauseDslParser method ruleSimpleType.
// $ANTLR end entryRuleSimpleType
// $ANTLR start ruleSimpleType
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1482:1: ruleSimpleType returns [EObject current=null] : ( 'type' ( (lv_name_1_0= RULE_ID ) ) 'mapsTo' ( (lv_platformType_3_0= RULE_STRING ) ) ) ;
public final EObject ruleSimpleType() throws RecognitionException {
EObject current = null;
Token lv_name_1_0 = null;
Token lv_platformType_3_0 = null;
EObject temp = null;
setCurrentLookahead();
resetLookahead();
try {
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1487:6: ( ( 'type' ( (lv_name_1_0= RULE_ID ) ) 'mapsTo' ( (lv_platformType_3_0= RULE_STRING ) ) ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1488:1: ( 'type' ( (lv_name_1_0= RULE_ID ) ) 'mapsTo' ( (lv_platformType_3_0= RULE_STRING ) ) )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1488:1: ( 'type' ( (lv_name_1_0= RULE_ID ) ) 'mapsTo' ( (lv_platformType_3_0= RULE_STRING ) ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1488:3: 'type' ( (lv_name_1_0= RULE_ID ) ) 'mapsTo' ( (lv_platformType_3_0= RULE_STRING ) )
{
match(input, 31, FOLLOW_31_in_ruleSimpleType2793);
createLeafNode(grammarAccess.getSimpleTypeAccess().getTypeKeyword_0(), null);
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1492:1: ( (lv_name_1_0= RULE_ID ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1493:1: (lv_name_1_0= RULE_ID )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1493:1: (lv_name_1_0= RULE_ID )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1494:3: lv_name_1_0= RULE_ID
{
lv_name_1_0 = (Token) input.LT(1);
match(input, RULE_ID, FOLLOW_RULE_ID_in_ruleSimpleType2810);
createLeafNode(grammarAccess.getSimpleTypeAccess().getNameIDTerminalRuleCall_1_0(), "name");
if (current == null) {
current = factory.create(grammarAccess.getSimpleTypeRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, current);
}
try {
set(current, "name", lv_name_1_0, "ID", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
}
match(input, 32, FOLLOW_32_in_ruleSimpleType2825);
createLeafNode(grammarAccess.getSimpleTypeAccess().getMapsToKeyword_2(), null);
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1520:1: ( (lv_platformType_3_0= RULE_STRING ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1521:1: (lv_platformType_3_0= RULE_STRING )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1521:1: (lv_platformType_3_0= RULE_STRING )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:1522:3: lv_platformType_3_0= RULE_STRING
{
lv_platformType_3_0 = (Token) input.LT(1);
match(input, RULE_STRING, FOLLOW_RULE_STRING_in_ruleSimpleType2842);
createLeafNode(grammarAccess.getSimpleTypeAccess().getPlatformTypeSTRINGTerminalRuleCall_3_0(), "platformType");
if (current == null) {
current = factory.create(grammarAccess.getSimpleTypeRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, current);
}
try {
set(current, "platformType", lv_platformType_3_0, "STRING", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
}
}
}
resetLookahead();
lastConsumedNode = currentNode;
} catch (RecognitionException re) {
recover(input, re);
appendSkippedTokens();
} finally {
}
return current;
}
use of org.eclipse.xtext.conversion.ValueConverterException in project applause by applause.
the class InternalApplauseDslParser method ruleViewHeader.
// $ANTLR end entryRuleViewHeader
// $ANTLR start ruleViewHeader
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2583:1: ruleViewHeader returns [EObject current=null] : ( () 'header' '{' ( 'title=' ( (lv_title_4_0= ruleScalarExpression ) ) )? ( 'subtitle=' ( (lv_subtitle_6_0= ruleScalarExpression ) ) )? ( 'details=' ( (lv_details_8_0= ruleScalarExpression ) ) )? ( 'image=' ( (lv_image_10_0= ruleScalarExpression ) ) )? '}' ) ;
public final EObject ruleViewHeader() throws RecognitionException {
EObject current = null;
EObject lv_title_4_0 = null;
EObject lv_subtitle_6_0 = null;
EObject lv_details_8_0 = null;
EObject lv_image_10_0 = null;
EObject temp = null;
setCurrentLookahead();
resetLookahead();
try {
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2588:6: ( ( () 'header' '{' ( 'title=' ( (lv_title_4_0= ruleScalarExpression ) ) )? ( 'subtitle=' ( (lv_subtitle_6_0= ruleScalarExpression ) ) )? ( 'details=' ( (lv_details_8_0= ruleScalarExpression ) ) )? ( 'image=' ( (lv_image_10_0= ruleScalarExpression ) ) )? '}' ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2589:1: ( () 'header' '{' ( 'title=' ( (lv_title_4_0= ruleScalarExpression ) ) )? ( 'subtitle=' ( (lv_subtitle_6_0= ruleScalarExpression ) ) )? ( 'details=' ( (lv_details_8_0= ruleScalarExpression ) ) )? ( 'image=' ( (lv_image_10_0= ruleScalarExpression ) ) )? '}' )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2589:1: ( () 'header' '{' ( 'title=' ( (lv_title_4_0= ruleScalarExpression ) ) )? ( 'subtitle=' ( (lv_subtitle_6_0= ruleScalarExpression ) ) )? ( 'details=' ( (lv_details_8_0= ruleScalarExpression ) ) )? ( 'image=' ( (lv_image_10_0= ruleScalarExpression ) ) )? '}' )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2589:2: () 'header' '{' ( 'title=' ( (lv_title_4_0= ruleScalarExpression ) ) )? ( 'subtitle=' ( (lv_subtitle_6_0= ruleScalarExpression ) ) )? ( 'details=' ( (lv_details_8_0= ruleScalarExpression ) ) )? ( 'image=' ( (lv_image_10_0= ruleScalarExpression ) ) )? '}'
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2589:2: ()
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2590:5:
{
temp = factory.create(grammarAccess.getViewHeaderAccess().getViewHeaderAction_0().getType().getClassifier());
current = temp;
temp = null;
CompositeNode newNode = createCompositeNode(grammarAccess.getViewHeaderAccess().getViewHeaderAction_0(), currentNode.getParent());
newNode.getChildren().add(currentNode);
moveLookaheadInfo(currentNode, newNode);
currentNode = newNode;
associateNodeWithAstElement(currentNode, current);
}
match(input, 47, FOLLOW_47_in_ruleViewHeader4646);
createLeafNode(grammarAccess.getViewHeaderAccess().getHeaderKeyword_1(), null);
match(input, 23, FOLLOW_23_in_ruleViewHeader4656);
createLeafNode(grammarAccess.getViewHeaderAccess().getLeftCurlyBracketKeyword_2(), null);
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2608:1: ( 'title=' ( (lv_title_4_0= ruleScalarExpression ) ) )?
int alt32 = 2;
int LA32_0 = input.LA(1);
if ((LA32_0 == 27)) {
alt32 = 1;
}
switch(alt32) {
case 1:
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2608:3: 'title=' ( (lv_title_4_0= ruleScalarExpression ) )
{
match(input, 27, FOLLOW_27_in_ruleViewHeader4667);
createLeafNode(grammarAccess.getViewHeaderAccess().getTitleKeyword_3_0(), null);
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2612:1: ( (lv_title_4_0= ruleScalarExpression ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2613:1: (lv_title_4_0= ruleScalarExpression )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2613:1: (lv_title_4_0= ruleScalarExpression )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2614:3: lv_title_4_0= ruleScalarExpression
{
currentNode = createCompositeNode(grammarAccess.getViewHeaderAccess().getTitleScalarExpressionParserRuleCall_3_1_0(), currentNode);
pushFollow(FOLLOW_ruleScalarExpression_in_ruleViewHeader4688);
lv_title_4_0 = ruleScalarExpression();
_fsp--;
if (current == null) {
current = factory.create(grammarAccess.getViewHeaderRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), current);
}
try {
set(current, "title", lv_title_4_0, "ScalarExpression", currentNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
currentNode = currentNode.getParent();
}
}
}
break;
}
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2636:4: ( 'subtitle=' ( (lv_subtitle_6_0= ruleScalarExpression ) ) )?
int alt33 = 2;
int LA33_0 = input.LA(1);
if ((LA33_0 == 48)) {
alt33 = 1;
}
switch(alt33) {
case 1:
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2636:6: 'subtitle=' ( (lv_subtitle_6_0= ruleScalarExpression ) )
{
match(input, 48, FOLLOW_48_in_ruleViewHeader4701);
createLeafNode(grammarAccess.getViewHeaderAccess().getSubtitleKeyword_4_0(), null);
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2640:1: ( (lv_subtitle_6_0= ruleScalarExpression ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2641:1: (lv_subtitle_6_0= ruleScalarExpression )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2641:1: (lv_subtitle_6_0= ruleScalarExpression )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2642:3: lv_subtitle_6_0= ruleScalarExpression
{
currentNode = createCompositeNode(grammarAccess.getViewHeaderAccess().getSubtitleScalarExpressionParserRuleCall_4_1_0(), currentNode);
pushFollow(FOLLOW_ruleScalarExpression_in_ruleViewHeader4722);
lv_subtitle_6_0 = ruleScalarExpression();
_fsp--;
if (current == null) {
current = factory.create(grammarAccess.getViewHeaderRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), current);
}
try {
set(current, "subtitle", lv_subtitle_6_0, "ScalarExpression", currentNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
currentNode = currentNode.getParent();
}
}
}
break;
}
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2664:4: ( 'details=' ( (lv_details_8_0= ruleScalarExpression ) ) )?
int alt34 = 2;
int LA34_0 = input.LA(1);
if ((LA34_0 == 49)) {
alt34 = 1;
}
switch(alt34) {
case 1:
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2664:6: 'details=' ( (lv_details_8_0= ruleScalarExpression ) )
{
match(input, 49, FOLLOW_49_in_ruleViewHeader4735);
createLeafNode(grammarAccess.getViewHeaderAccess().getDetailsKeyword_5_0(), null);
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2668:1: ( (lv_details_8_0= ruleScalarExpression ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2669:1: (lv_details_8_0= ruleScalarExpression )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2669:1: (lv_details_8_0= ruleScalarExpression )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2670:3: lv_details_8_0= ruleScalarExpression
{
currentNode = createCompositeNode(grammarAccess.getViewHeaderAccess().getDetailsScalarExpressionParserRuleCall_5_1_0(), currentNode);
pushFollow(FOLLOW_ruleScalarExpression_in_ruleViewHeader4756);
lv_details_8_0 = ruleScalarExpression();
_fsp--;
if (current == null) {
current = factory.create(grammarAccess.getViewHeaderRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), current);
}
try {
set(current, "details", lv_details_8_0, "ScalarExpression", currentNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
currentNode = currentNode.getParent();
}
}
}
break;
}
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2692:4: ( 'image=' ( (lv_image_10_0= ruleScalarExpression ) ) )?
int alt35 = 2;
int LA35_0 = input.LA(1);
if ((LA35_0 == 50)) {
alt35 = 1;
}
switch(alt35) {
case 1:
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2692:6: 'image=' ( (lv_image_10_0= ruleScalarExpression ) )
{
match(input, 50, FOLLOW_50_in_ruleViewHeader4769);
createLeafNode(grammarAccess.getViewHeaderAccess().getImageKeyword_6_0(), null);
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2696:1: ( (lv_image_10_0= ruleScalarExpression ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2697:1: (lv_image_10_0= ruleScalarExpression )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2697:1: (lv_image_10_0= ruleScalarExpression )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:2698:3: lv_image_10_0= ruleScalarExpression
{
currentNode = createCompositeNode(grammarAccess.getViewHeaderAccess().getImageScalarExpressionParserRuleCall_6_1_0(), currentNode);
pushFollow(FOLLOW_ruleScalarExpression_in_ruleViewHeader4790);
lv_image_10_0 = ruleScalarExpression();
_fsp--;
if (current == null) {
current = factory.create(grammarAccess.getViewHeaderRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), current);
}
try {
set(current, "image", lv_image_10_0, "ScalarExpression", currentNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
currentNode = currentNode.getParent();
}
}
}
break;
}
match(input, 25, FOLLOW_25_in_ruleViewHeader4802);
createLeafNode(grammarAccess.getViewHeaderAccess().getRightCurlyBracketKeyword_7(), null);
}
}
resetLookahead();
lastConsumedNode = currentNode;
} catch (RecognitionException re) {
recover(input, re);
appendSkippedTokens();
} finally {
}
return current;
}
use of org.eclipse.xtext.conversion.ValueConverterException in project applause by applause.
the class InternalApplauseDslParser method ruleTypeDescription.
// $ANTLR end entryRuleTypeDescription
// $ANTLR start ruleTypeDescription
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:254:1: ruleTypeDescription returns [EObject current=null] : ( ( ( RULE_ID ) ) ( (lv_many_1_0= '[]' ) )? ) ;
public final EObject ruleTypeDescription() throws RecognitionException {
EObject current = null;
Token lv_many_1_0 = null;
EObject temp = null;
setCurrentLookahead();
resetLookahead();
try {
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:259:6: ( ( ( ( RULE_ID ) ) ( (lv_many_1_0= '[]' ) )? ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:260:1: ( ( ( RULE_ID ) ) ( (lv_many_1_0= '[]' ) )? )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:260:1: ( ( ( RULE_ID ) ) ( (lv_many_1_0= '[]' ) )? )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:260:2: ( ( RULE_ID ) ) ( (lv_many_1_0= '[]' ) )?
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:260:2: ( ( RULE_ID ) )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:261:1: ( RULE_ID )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:261:1: ( RULE_ID )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:262:3: RULE_ID
{
if (current == null) {
current = factory.create(grammarAccess.getTypeDescriptionRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, current);
}
match(input, RULE_ID, FOLLOW_RULE_ID_in_ruleTypeDescription507);
createLeafNode(grammarAccess.getTypeDescriptionAccess().getTypeTypeCrossReference_0_0(), "type");
}
}
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:274:2: ( (lv_many_1_0= '[]' ) )?
int alt3 = 2;
int LA3_0 = input.LA(1);
if ((LA3_0 == 11)) {
alt3 = 1;
}
switch(alt3) {
case 1:
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:275:1: (lv_many_1_0= '[]' )
{
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:275:1: (lv_many_1_0= '[]' )
// ../org.applause.lang/src-gen/org/applause/lang/parser/antlr/internal/InternalApplauseDsl.g:276:3: lv_many_1_0= '[]'
{
lv_many_1_0 = (Token) input.LT(1);
match(input, 11, FOLLOW_11_in_ruleTypeDescription525);
createLeafNode(grammarAccess.getTypeDescriptionAccess().getManyLeftSquareBracketRightSquareBracketKeyword_1_0(), "many");
if (current == null) {
current = factory.create(grammarAccess.getTypeDescriptionRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, current);
}
try {
set(current, "many", true, "[]", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
}
break;
}
}
}
resetLookahead();
lastConsumedNode = currentNode;
} catch (RecognitionException re) {
recover(input, re);
appendSkippedTokens();
} finally {
}
return current;
}
use of org.eclipse.xtext.conversion.ValueConverterException in project xtext-xtend by eclipse.
the class Linker method afterCreateAndSetProxy.
@Override
protected void afterCreateAndSetProxy(EObject obj, INode node, EReference eRef, CrossReference xref, IDiagnosticProducer diagnosticProducer) {
AbstractElement terminal = xref.getTerminal();
if (!(terminal instanceof RuleCall)) {
throw new IllegalArgumentException(String.valueOf(xref));
}
AbstractRule rule = ((RuleCall) terminal).getRule();
try {
String tokenText = NodeModelUtils.getTokenText(node);
valueConverterService.toValue(tokenText, rule.getName(), node);
} catch (ValueConverterException e) {
diagnosticProducer.addDiagnostic(new DiagnosticMessage(e.getMessage(), Severity.ERROR, Diagnostic.SYNTAX_DIAGNOSTIC, Strings.EMPTY_ARRAY));
}
}
use of org.eclipse.xtext.conversion.ValueConverterException in project xtext-xtend by eclipse.
the class XtendRenameStrategy method validateNewName.
@Override
public RefactoringStatus validateNewName(String newName) {
if (grammarAccess.getFunctionIDRule().getName().equals(nameRuleName)) {
if (operatorMapping.getOperator(QualifiedName.create(newName)) != null) {
RefactoringStatus status = new RefactoringStatus();
if (nameRuleName != null) {
try {
String value = getNameAsValue(newName, grammarAccess.getValidIDRule().getName());
String text = getNameAsText(value, grammarAccess.getValidIDRule().getName());
if (!equal(text, newName)) {
status.addError("Illegal name: '" + newName + "'. Consider using '" + text + "' instead.");
}
} catch (ValueConverterException vce) {
status.addFatalError("Illegal name: " + notNull(vce.getMessage()));
}
}
return status;
}
}
return super.validateNewName(newName);
}
Aggregations