| /* |
| * generated by Xtext |
| */ |
| grammar InternalAPar; |
| |
| options { |
| superClass=AbstractInternalAntlrParser; |
| |
| } |
| |
| @lexer::header { |
| package org.eclipse.amp.amf.parameters.parser.antlr.internal; |
| |
| // Hack: Use our own Lexer superclass by means of import. |
| // Currently there is no other way to specify the superclass for the lexer. |
| import org.eclipse.xtext.parser.antlr.Lexer; |
| } |
| |
| @parser::header { |
| package org.eclipse.amp.amf.parameters.parser.antlr.internal; |
| |
| import java.io.InputStream; |
| import org.eclipse.xtext.*; |
| import org.eclipse.xtext.parser.*; |
| import org.eclipse.xtext.parser.impl.*; |
| import org.eclipse.xtext.parsetree.*; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.common.util.Enumerator; |
| import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser; |
| import org.eclipse.xtext.parser.antlr.XtextTokenStream; |
| import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens; |
| import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken; |
| import org.eclipse.xtext.conversion.ValueConverterException; |
| import org.eclipse.amp.amf.parameters.services.AParGrammarAccess; |
| |
| } |
| |
| @parser::members { |
| |
| private AParGrammarAccess grammarAccess; |
| |
| public InternalAParParser(TokenStream input, IAstFactory factory, AParGrammarAccess grammarAccess) { |
| this(input); |
| this.factory = factory; |
| registerRules(grammarAccess.getGrammar()); |
| this.grammarAccess = grammarAccess; |
| } |
| |
| @Override |
| protected InputStream getTokenFile() { |
| ClassLoader classLoader = getClass().getClassLoader(); |
| return classLoader.getResourceAsStream("org/eclipse/amp/amf/parameters/parser/antlr/internal/InternalAPar.tokens"); |
| } |
| |
| @Override |
| protected String getFirstRuleName() { |
| return "Model"; |
| } |
| } |
| |
| @rulecatch { |
| catch (RecognitionException re) { |
| recover(input,re); |
| appendSkippedTokens(); |
| } |
| } |
| |
| |
| |
| |
| // Entry rule entryRuleModel |
| entryRuleModel returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getModelRule(), currentNode); } |
| iv_ruleModel=ruleModel |
| { $current=$iv_ruleModel.current; } |
| EOF |
| ; |
| |
| // Rule Model |
| ruleModel returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| (( |
| ( |
| lv_name_0_0=RULE_STRING |
| { |
| createLeafNode(grammarAccess.getModelAccess().getNameSTRINGTerminalRuleCall_0_0(), "name"); |
| } |
| { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getModelRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode, $current); |
| } |
| try { |
| set( |
| $current, |
| "name", |
| lv_name_0_0, |
| "STRING", |
| lastConsumedNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| } |
| |
| ) |
| )?( |
| ( |
| { |
| currentNode=createCompositeNode(grammarAccess.getModelAccess().getModelImportParserRuleCall_1_0(), currentNode); |
| } |
| lv_model_1_0=ruleImport { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getModelRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode.getParent(), $current); |
| } |
| try { |
| add( |
| $current, |
| "model", |
| lv_model_1_0, |
| "Import", |
| currentNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| currentNode = currentNode.getParent(); |
| } |
| |
| ) |
| )( |
| ( |
| { |
| currentNode=createCompositeNode(grammarAccess.getModelAccess().getIncorporatesIncorporatesParserRuleCall_2_0(), currentNode); |
| } |
| lv_incorporates_2_0=ruleIncorporates { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getModelRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode.getParent(), $current); |
| } |
| try { |
| add( |
| $current, |
| "incorporates", |
| lv_incorporates_2_0, |
| "Incorporates", |
| currentNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| currentNode = currentNode.getParent(); |
| } |
| |
| ) |
| )*( |
| ( |
| { |
| currentNode=createCompositeNode(grammarAccess.getModelAccess().getParametersParameterParserRuleCall_3_0(), currentNode); |
| } |
| lv_parameters_3_0=ruleParameter { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getModelRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode.getParent(), $current); |
| } |
| try { |
| add( |
| $current, |
| "parameters", |
| lv_parameters_3_0, |
| "Parameter", |
| currentNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| currentNode = currentNode.getParent(); |
| } |
| |
| ) |
| )*); |
| |
| |
| |
| |
| |
| // Entry rule entryRuleImport |
| entryRuleImport returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getImportRule(), currentNode); } |
| iv_ruleImport=ruleImport |
| { $current=$iv_ruleImport.current; } |
| EOF |
| ; |
| |
| // Rule Import |
| ruleImport returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| ('model' |
| { |
| createLeafNode(grammarAccess.getImportAccess().getModelKeyword_0(), null); |
| } |
| ( |
| ( |
| lv_importURI_1_0=RULE_STRING |
| { |
| createLeafNode(grammarAccess.getImportAccess().getImportURISTRINGTerminalRuleCall_1_0(), "importURI"); |
| } |
| { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getImportRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode, $current); |
| } |
| try { |
| set( |
| $current, |
| "importURI", |
| lv_importURI_1_0, |
| "STRING", |
| lastConsumedNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| } |
| |
| ) |
| )); |
| |
| |
| |
| |
| |
| // Entry rule entryRuleIncorporates |
| entryRuleIncorporates returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getIncorporatesRule(), currentNode); } |
| iv_ruleIncorporates=ruleIncorporates |
| { $current=$iv_ruleIncorporates.current; } |
| EOF |
| ; |
| |
| // Rule Incorporates |
| ruleIncorporates returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| ('incorporates' |
| { |
| createLeafNode(grammarAccess.getIncorporatesAccess().getIncorporatesKeyword_0(), null); |
| } |
| ( |
| ( |
| lv_importURI_1_0=RULE_STRING |
| { |
| createLeafNode(grammarAccess.getIncorporatesAccess().getImportURISTRINGTerminalRuleCall_1_0(), "importURI"); |
| } |
| { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getIncorporatesRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode, $current); |
| } |
| try { |
| set( |
| $current, |
| "importURI", |
| lv_importURI_1_0, |
| "STRING", |
| lastConsumedNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| } |
| |
| ) |
| )); |
| |
| |
| |
| |
| |
| // Entry rule entryRuleParameter |
| entryRuleParameter returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getParameterRule(), currentNode); } |
| iv_ruleParameter=ruleParameter |
| { $current=$iv_ruleParameter.current; } |
| EOF |
| ; |
| |
| // Rule Parameter |
| ruleParameter returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| (( |
| ( |
| { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getParameterRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode, $current); |
| } |
| } |
| RULE_STRING |
| { |
| createLeafNode(grammarAccess.getParameterAccess().getAttributeSAttributeCrossReference_0_0(), "attribute"); |
| } |
| |
| ) |
| )'=' |
| { |
| createLeafNode(grammarAccess.getParameterAccess().getEqualsSignKeyword_1(), null); |
| } |
| ( |
| ( |
| { |
| currentNode=createCompositeNode(grammarAccess.getParameterAccess().getValueValueParserRuleCall_2_0(), currentNode); |
| } |
| lv_value_2_0=ruleValue { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getParameterRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode.getParent(), $current); |
| } |
| try { |
| set( |
| $current, |
| "value", |
| lv_value_2_0, |
| "Value", |
| currentNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| currentNode = currentNode.getParent(); |
| } |
| |
| ) |
| )); |
| |
| |
| |
| |
| |
| // Entry rule entryRuleValue |
| entryRuleValue returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getValueRule(), currentNode); } |
| iv_ruleValue=ruleValue |
| { $current=$iv_ruleValue.current; } |
| EOF |
| ; |
| |
| // Rule Value |
| ruleValue returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| ( |
| { |
| currentNode=createCompositeNode(grammarAccess.getValueAccess().getIntValueParserRuleCall_0(), currentNode); |
| } |
| this_IntValue_0=ruleIntValue |
| { |
| $current = $this_IntValue_0.current; |
| currentNode = currentNode.getParent(); |
| } |
| |
| | |
| { |
| currentNode=createCompositeNode(grammarAccess.getValueAccess().getStringValueParserRuleCall_1(), currentNode); |
| } |
| this_StringValue_1=ruleStringValue |
| { |
| $current = $this_StringValue_1.current; |
| currentNode = currentNode.getParent(); |
| } |
| |
| | |
| { |
| currentNode=createCompositeNode(grammarAccess.getValueAccess().getRealValueParserRuleCall_2(), currentNode); |
| } |
| this_RealValue_2=ruleRealValue |
| { |
| $current = $this_RealValue_2.current; |
| currentNode = currentNode.getParent(); |
| } |
| |
| | |
| { |
| currentNode=createCompositeNode(grammarAccess.getValueAccess().getBooleanValueParserRuleCall_3(), currentNode); |
| } |
| this_BooleanValue_3=ruleBooleanValue |
| { |
| $current = $this_BooleanValue_3.current; |
| currentNode = currentNode.getParent(); |
| } |
| ); |
| |
| |
| |
| |
| |
| // Entry rule entryRuleIntValue |
| entryRuleIntValue returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getIntValueRule(), currentNode); } |
| iv_ruleIntValue=ruleIntValue |
| { $current=$iv_ruleIntValue.current; } |
| EOF |
| ; |
| |
| // Rule IntValue |
| ruleIntValue returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| ( |
| ( |
| lv_value_0_0=RULE_INTEGER |
| { |
| createLeafNode(grammarAccess.getIntValueAccess().getValueINTEGERTerminalRuleCall_0(), "value"); |
| } |
| { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getIntValueRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode, $current); |
| } |
| try { |
| set( |
| $current, |
| "value", |
| lv_value_0_0, |
| "INTEGER", |
| lastConsumedNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| } |
| |
| ) |
| ); |
| |
| |
| |
| |
| |
| // Entry rule entryRuleRealValue |
| entryRuleRealValue returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getRealValueRule(), currentNode); } |
| iv_ruleRealValue=ruleRealValue |
| { $current=$iv_ruleRealValue.current; } |
| EOF |
| ; |
| |
| // Rule RealValue |
| ruleRealValue returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| ( |
| ( |
| lv_value_0_0=RULE_REAL |
| { |
| createLeafNode(grammarAccess.getRealValueAccess().getValueREALTerminalRuleCall_0(), "value"); |
| } |
| { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getRealValueRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode, $current); |
| } |
| try { |
| set( |
| $current, |
| "value", |
| lv_value_0_0, |
| "REAL", |
| lastConsumedNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| } |
| |
| ) |
| ); |
| |
| |
| |
| |
| |
| // Entry rule entryRuleStringValue |
| entryRuleStringValue returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getStringValueRule(), currentNode); } |
| iv_ruleStringValue=ruleStringValue |
| { $current=$iv_ruleStringValue.current; } |
| EOF |
| ; |
| |
| // Rule StringValue |
| ruleStringValue returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| ( |
| ( |
| lv_value_0_0=RULE_STRING |
| { |
| createLeafNode(grammarAccess.getStringValueAccess().getValueSTRINGTerminalRuleCall_0(), "value"); |
| } |
| { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getStringValueRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode, $current); |
| } |
| try { |
| set( |
| $current, |
| "value", |
| lv_value_0_0, |
| "STRING", |
| lastConsumedNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| } |
| |
| ) |
| ); |
| |
| |
| |
| |
| |
| // Entry rule entryRuleBooleanValue |
| entryRuleBooleanValue returns [EObject current=null] : |
| { currentNode = createCompositeNode(grammarAccess.getBooleanValueRule(), currentNode); } |
| iv_ruleBooleanValue=ruleBooleanValue |
| { $current=$iv_ruleBooleanValue.current; } |
| EOF |
| ; |
| |
| // Rule BooleanValue |
| ruleBooleanValue returns [EObject current=null] |
| @init { @SuppressWarnings("unused") EObject temp=null; setCurrentLookahead(); resetLookahead(); |
| } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| ( |
| ( |
| { |
| currentNode=createCompositeNode(grammarAccess.getBooleanValueAccess().getValueBOOLEANEnumRuleCall_0(), currentNode); |
| } |
| lv_value_0_0=ruleBOOLEAN { |
| if ($current==null) { |
| $current = factory.create(grammarAccess.getBooleanValueRule().getType().getClassifier()); |
| associateNodeWithAstElement(currentNode.getParent(), $current); |
| } |
| try { |
| set( |
| $current, |
| "value", |
| lv_value_0_0, |
| "BOOLEAN", |
| currentNode); |
| } catch (ValueConverterException vce) { |
| handleValueConverterException(vce); |
| } |
| currentNode = currentNode.getParent(); |
| } |
| |
| ) |
| ); |
| |
| |
| |
| |
| |
| // Rule BOOLEAN |
| ruleBOOLEAN returns [Enumerator current=null] |
| @init { setCurrentLookahead(); resetLookahead(); } |
| @after { resetLookahead(); |
| lastConsumedNode = currentNode; |
| }: |
| (( 'true' |
| { |
| $current = grammarAccess.getBOOLEANAccess().getTRUEEnumLiteralDeclaration_0().getEnumLiteral().getInstance(); |
| createLeafNode(grammarAccess.getBOOLEANAccess().getTRUEEnumLiteralDeclaration_0(), null); |
| } |
| ) |
| |( 'false' |
| { |
| $current = grammarAccess.getBOOLEANAccess().getFALSEEnumLiteralDeclaration_1().getEnumLiteral().getInstance(); |
| createLeafNode(grammarAccess.getBOOLEANAccess().getFALSEEnumLiteralDeclaration_1(), null); |
| } |
| )); |
| |
| |
| |
| RULE_INTEGER : '-'? ('0'..'9')+; |
| |
| RULE_REAL : '-'? ('0'..'9')* '.' ('0'..'9')*; |
| |
| RULE_DESC_STRING : '\u00AB' ('\\' ('b'|'t'|'n'|'f'|'r'|'\u00AB'|'\u00BB'|'\\')|~(('\\'|'\u00AB'|'\u00BB')))* '\u00BB'; |
| |
| RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; |
| |
| RULE_INT : ('0'..'9')+; |
| |
| RULE_STRING : ('"' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'"')))* '"'|'\'' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'\'')))* '\''); |
| |
| RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; |
| |
| RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?; |
| |
| RULE_WS : (' '|'\t'|'\r'|'\n')+; |
| |
| RULE_ANY_OTHER : .; |
| |
| |