| /***************************************************************************** |
| * Copyright (c) 2017 CEA LIST. |
| * |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * |
| * Mauricio Alferez (mauricio.alferez@cea.fr) CEA LIST - Initial API and implementation |
| * |
| *****************************************************************************/ |
| /* |
| * generated by Xtext 2.11.0 |
| */ |
| grammar InternalBoilerplateText; |
| |
| options { |
| superClass=AbstractInternalAntlrParser; |
| } |
| |
| @lexer::header { |
| package org.eclipse.papyrus.requirements.sysml14.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.papyrus.requirements.sysml14.parser.antlr.internal; |
| |
| import org.eclipse.xtext.*; |
| import org.eclipse.xtext.parser.*; |
| import org.eclipse.xtext.parser.impl.*; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| import org.eclipse.emf.ecore.EObject; |
| 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.papyrus.requirements.sysml14.services.BoilerplateTextGrammarAccess; |
| |
| } |
| |
| @parser::members { |
| |
| private BoilerplateTextGrammarAccess grammarAccess; |
| |
| public InternalBoilerplateTextParser(TokenStream input, BoilerplateTextGrammarAccess grammarAccess) { |
| this(input); |
| this.grammarAccess = grammarAccess; |
| registerRules(grammarAccess.getGrammar()); |
| } |
| |
| @Override |
| protected String getFirstRuleName() { |
| return "Model"; |
| } |
| |
| @Override |
| protected BoilerplateTextGrammarAccess getGrammarAccess() { |
| return grammarAccess; |
| } |
| |
| } |
| |
| @rulecatch { |
| catch (RecognitionException re) { |
| recover(input,re); |
| appendSkippedTokens(); |
| } |
| } |
| |
| // Entry rule entryRuleModel |
| entryRuleModel returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getModelRule()); } |
| iv_ruleModel=ruleModel |
| { $current=$iv_ruleModel.current; } |
| EOF; |
| |
| // Rule Model |
| ruleModel returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| ( |
| { |
| newCompositeNode(grammarAccess.getModelAccess().getModelRequirementParserRuleCall_0()); |
| } |
| lv_model_0_0=ruleRequirement |
| { |
| if ($current==null) { |
| $current = createModelElementForParent(grammarAccess.getModelRule()); |
| } |
| set( |
| $current, |
| "model", |
| lv_model_0_0, |
| "org.eclipse.papyrus.requirements.sysml14.BoilerplateText.Requirement"); |
| afterParserOrEnumRuleCall(); |
| } |
| ) |
| ) |
| ; |
| |
| // Entry rule entryRuleRequirement |
| entryRuleRequirement returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getRequirementRule()); } |
| iv_ruleRequirement=ruleRequirement |
| { $current=$iv_ruleRequirement.current; } |
| EOF; |
| |
| // Rule Requirement |
| ruleRequirement returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| ( |
| ( |
| ( |
| { |
| newCompositeNode(grammarAccess.getRequirementAccess().getPrefixPrefixParserRuleCall_0_0_0()); |
| } |
| lv_prefix_0_0=rulePrefix |
| { |
| if ($current==null) { |
| $current = createModelElementForParent(grammarAccess.getRequirementRule()); |
| } |
| set( |
| $current, |
| "prefix", |
| lv_prefix_0_0, |
| "org.eclipse.papyrus.requirements.sysml14.BoilerplateText.Prefix"); |
| afterParserOrEnumRuleCall(); |
| } |
| ) |
| ) |
| otherlv_1=',' |
| { |
| newLeafNode(otherlv_1, grammarAccess.getRequirementAccess().getCommaKeyword_0_1()); |
| } |
| )? |
| ( |
| ( |
| { |
| newCompositeNode(grammarAccess.getRequirementAccess().getSystemSubjectParserRuleCall_1_0()); |
| } |
| lv_system_2_0=ruleSubject |
| { |
| if ($current==null) { |
| $current = createModelElementForParent(grammarAccess.getRequirementRule()); |
| } |
| set( |
| $current, |
| "system", |
| lv_system_2_0, |
| "org.eclipse.papyrus.requirements.sysml14.BoilerplateText.Subject"); |
| afterParserOrEnumRuleCall(); |
| } |
| ) |
| ) |
| ( |
| ( |
| { |
| newCompositeNode(grammarAccess.getRequirementAccess().getPredicatePredicateParserRuleCall_2_0()); |
| } |
| lv_predicate_3_0=rulePredicate |
| { |
| if ($current==null) { |
| $current = createModelElementForParent(grammarAccess.getRequirementRule()); |
| } |
| set( |
| $current, |
| "predicate", |
| lv_predicate_3_0, |
| "org.eclipse.papyrus.requirements.sysml14.BoilerplateText.Predicate"); |
| afterParserOrEnumRuleCall(); |
| } |
| ) |
| ) |
| ) |
| ; |
| |
| // Entry rule entryRuleSubject |
| entryRuleSubject returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getSubjectRule()); } |
| iv_ruleSubject=ruleSubject |
| { $current=$iv_ruleSubject.current; } |
| EOF; |
| |
| // Rule Subject |
| ruleSubject returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| ( |
| lv_system_0_0=RULE_STRING |
| { |
| newLeafNode(lv_system_0_0, grammarAccess.getSubjectAccess().getSystemSTRINGTerminalRuleCall_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getSubjectRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "system", |
| lv_system_0_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| ; |
| |
| // Entry rule entryRulePrefix |
| entryRulePrefix returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getPrefixRule()); } |
| iv_rulePrefix=rulePrefix |
| { $current=$iv_rulePrefix.current; } |
| EOF; |
| |
| // Rule Prefix |
| rulePrefix returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| { |
| newCompositeNode(grammarAccess.getPrefixAccess().getIfParserRuleCall_0()); |
| } |
| this_If_0=ruleIf |
| { |
| $current = $this_If_0.current; |
| afterParserOrEnumRuleCall(); |
| } |
| | |
| { |
| newCompositeNode(grammarAccess.getPrefixAccess().getWhileParserRuleCall_1()); |
| } |
| this_While_1=ruleWhile |
| { |
| $current = $this_While_1.current; |
| afterParserOrEnumRuleCall(); |
| } |
| ) |
| ; |
| |
| // Entry rule entryRuleIf |
| entryRuleIf returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getIfRule()); } |
| iv_ruleIf=ruleIf |
| { $current=$iv_ruleIf.current; } |
| EOF; |
| |
| // Rule If |
| ruleIf returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| otherlv_0='if' |
| { |
| newLeafNode(otherlv_0, grammarAccess.getIfAccess().getIfKeyword_0()); |
| } |
| ( |
| ( |
| lv_event_1_0=RULE_STRING |
| { |
| newLeafNode(lv_event_1_0, grammarAccess.getIfAccess().getEventSTRINGTerminalRuleCall_1_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getIfRule()); |
| } |
| addWithLastConsumed( |
| $current, |
| "event", |
| lv_event_1_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| ( |
| otherlv_2='and' |
| { |
| newLeafNode(otherlv_2, grammarAccess.getIfAccess().getAndKeyword_2_0()); |
| } |
| ( |
| ( |
| lv_event_3_0=RULE_STRING |
| { |
| newLeafNode(lv_event_3_0, grammarAccess.getIfAccess().getEventSTRINGTerminalRuleCall_2_1_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getIfRule()); |
| } |
| addWithLastConsumed( |
| $current, |
| "event", |
| lv_event_3_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| )* |
| ) |
| ; |
| |
| // Entry rule entryRuleWhile |
| entryRuleWhile returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getWhileRule()); } |
| iv_ruleWhile=ruleWhile |
| { $current=$iv_ruleWhile.current; } |
| EOF; |
| |
| // Rule While |
| ruleWhile returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| otherlv_0='while' |
| { |
| newLeafNode(otherlv_0, grammarAccess.getWhileAccess().getWhileKeyword_0()); |
| } |
| ( |
| ( |
| lv_state_1_0=RULE_STRING |
| { |
| newLeafNode(lv_state_1_0, grammarAccess.getWhileAccess().getStateSTRINGTerminalRuleCall_1_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getWhileRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "state", |
| lv_state_1_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| ) |
| ; |
| |
| // Entry rule entryRulePredicate |
| entryRulePredicate returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getPredicateRule()); } |
| iv_rulePredicate=rulePredicate |
| { $current=$iv_rulePredicate.current; } |
| EOF; |
| |
| // Rule Predicate |
| rulePredicate returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| { |
| newCompositeNode(grammarAccess.getPredicateAccess().getShallParserRuleCall_0()); |
| } |
| this_Shall_0=ruleShall |
| { |
| $current = $this_Shall_0.current; |
| afterParserOrEnumRuleCall(); |
| } |
| | |
| { |
| newCompositeNode(grammarAccess.getPredicateAccess().getShallNotParserRuleCall_1()); |
| } |
| this_ShallNot_1=ruleShallNot |
| { |
| $current = $this_ShallNot_1.current; |
| afterParserOrEnumRuleCall(); |
| } |
| | |
| { |
| newCompositeNode(grammarAccess.getPredicateAccess().getShallAllowParserRuleCall_2()); |
| } |
| this_ShallAllow_2=ruleShallAllow |
| { |
| $current = $this_ShallAllow_2.current; |
| afterParserOrEnumRuleCall(); |
| } |
| | |
| { |
| newCompositeNode(grammarAccess.getPredicateAccess().getShallNotAllowParserRuleCall_3()); |
| } |
| this_ShallNotAllow_3=ruleShallNotAllow |
| { |
| $current = $this_ShallNotAllow_3.current; |
| afterParserOrEnumRuleCall(); |
| } |
| ) |
| ; |
| |
| // Entry rule entryRuleShallNotAllow |
| entryRuleShallNotAllow returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getShallNotAllowRule()); } |
| iv_ruleShallNotAllow=ruleShallNotAllow |
| { $current=$iv_ruleShallNotAllow.current; } |
| EOF; |
| |
| // Rule ShallNotAllow |
| ruleShallNotAllow returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| otherlv_0='shall' |
| { |
| newLeafNode(otherlv_0, grammarAccess.getShallNotAllowAccess().getShallKeyword_0()); |
| } |
| ( |
| ('not')=> |
| otherlv_1='not' |
| { |
| newLeafNode(otherlv_1, grammarAccess.getShallNotAllowAccess().getNotKeyword_1()); |
| } |
| ) |
| ( |
| ('allow')=> |
| otherlv_2='allow' |
| { |
| newLeafNode(otherlv_2, grammarAccess.getShallNotAllowAccess().getAllowKeyword_2()); |
| } |
| ) |
| ( |
| ( |
| ( |
| lv_action_3_0=RULE_STRING |
| { |
| newLeafNode(lv_action_3_0, grammarAccess.getShallNotAllowAccess().getActionSTRINGTerminalRuleCall_3_0_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getShallNotAllowRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "action", |
| lv_action_3_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| | |
| ( |
| ( |
| ( |
| lv_entity_4_0=RULE_STRING |
| { |
| newLeafNode(lv_entity_4_0, grammarAccess.getShallNotAllowAccess().getEntitySTRINGTerminalRuleCall_3_1_0_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getShallNotAllowRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "entity", |
| lv_entity_4_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| otherlv_5='to' |
| { |
| newLeafNode(otherlv_5, grammarAccess.getShallNotAllowAccess().getToKeyword_3_1_1()); |
| } |
| ( |
| ( |
| lv_actionPerformedByEntity_6_0=RULE_STRING |
| { |
| newLeafNode(lv_actionPerformedByEntity_6_0, grammarAccess.getShallNotAllowAccess().getActionPerformedByEntitySTRINGTerminalRuleCall_3_1_2_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getShallNotAllowRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "actionPerformedByEntity", |
| lv_actionPerformedByEntity_6_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| ) |
| ) |
| ) |
| ; |
| |
| // Entry rule entryRuleShallAllow |
| entryRuleShallAllow returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getShallAllowRule()); } |
| iv_ruleShallAllow=ruleShallAllow |
| { $current=$iv_ruleShallAllow.current; } |
| EOF; |
| |
| // Rule ShallAllow |
| ruleShallAllow returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| otherlv_0='shall' |
| { |
| newLeafNode(otherlv_0, grammarAccess.getShallAllowAccess().getShallKeyword_0()); |
| } |
| ( |
| ('allow')=> |
| otherlv_1='allow' |
| { |
| newLeafNode(otherlv_1, grammarAccess.getShallAllowAccess().getAllowKeyword_1()); |
| } |
| ) |
| ( |
| ( |
| ( |
| lv_action_2_0=RULE_STRING |
| { |
| newLeafNode(lv_action_2_0, grammarAccess.getShallAllowAccess().getActionSTRINGTerminalRuleCall_2_0_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getShallAllowRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "action", |
| lv_action_2_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| | |
| ( |
| ( |
| ( |
| lv_entity_3_0=RULE_STRING |
| { |
| newLeafNode(lv_entity_3_0, grammarAccess.getShallAllowAccess().getEntitySTRINGTerminalRuleCall_2_1_0_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getShallAllowRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "entity", |
| lv_entity_3_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| otherlv_4='to' |
| { |
| newLeafNode(otherlv_4, grammarAccess.getShallAllowAccess().getToKeyword_2_1_1()); |
| } |
| ( |
| ( |
| lv_actionPerformedByEntity_5_0=RULE_STRING |
| { |
| newLeafNode(lv_actionPerformedByEntity_5_0, grammarAccess.getShallAllowAccess().getActionPerformedByEntitySTRINGTerminalRuleCall_2_1_2_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getShallAllowRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "actionPerformedByEntity", |
| lv_actionPerformedByEntity_5_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| ) |
| ) |
| ) |
| ; |
| |
| // Entry rule entryRuleShallNot |
| entryRuleShallNot returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getShallNotRule()); } |
| iv_ruleShallNot=ruleShallNot |
| { $current=$iv_ruleShallNot.current; } |
| EOF; |
| |
| // Rule ShallNot |
| ruleShallNot returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| otherlv_0='shall' |
| { |
| newLeafNode(otherlv_0, grammarAccess.getShallNotAccess().getShallKeyword_0()); |
| } |
| ( |
| ('not')=> |
| otherlv_1='not' |
| { |
| newLeafNode(otherlv_1, grammarAccess.getShallNotAccess().getNotKeyword_1()); |
| } |
| ) |
| ( |
| otherlv_2='be' |
| { |
| newLeafNode(otherlv_2, grammarAccess.getShallNotAccess().getBeKeyword_2_0()); |
| } |
| ( |
| ('able')=> |
| otherlv_3='able' |
| { |
| newLeafNode(otherlv_3, grammarAccess.getShallNotAccess().getAbleKeyword_2_1()); |
| } |
| ) |
| ( |
| ('to')=> |
| otherlv_4='to' |
| { |
| newLeafNode(otherlv_4, grammarAccess.getShallNotAccess().getToKeyword_2_2()); |
| } |
| ) |
| )? |
| ( |
| ( |
| lv_action_5_0=RULE_STRING |
| { |
| newLeafNode(lv_action_5_0, grammarAccess.getShallNotAccess().getActionSTRINGTerminalRuleCall_3_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getShallNotRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "action", |
| lv_action_5_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| ) |
| ; |
| |
| // Entry rule entryRuleShall |
| entryRuleShall returns [EObject current=null]: |
| { newCompositeNode(grammarAccess.getShallRule()); } |
| iv_ruleShall=ruleShall |
| { $current=$iv_ruleShall.current; } |
| EOF; |
| |
| // Rule Shall |
| ruleShall returns [EObject current=null] |
| @init { |
| enterRule(); |
| } |
| @after { |
| leaveRule(); |
| }: |
| ( |
| otherlv_0='shall' |
| { |
| newLeafNode(otherlv_0, grammarAccess.getShallAccess().getShallKeyword_0()); |
| } |
| ( |
| ('be')=> |
| ( |
| otherlv_1='be' |
| { |
| newLeafNode(otherlv_1, grammarAccess.getShallAccess().getBeKeyword_1_0_0()); |
| } |
| ( |
| ('able')=> |
| otherlv_2='able' |
| { |
| newLeafNode(otherlv_2, grammarAccess.getShallAccess().getAbleKeyword_1_0_1()); |
| } |
| ) |
| ( |
| ('to')=> |
| otherlv_3='to' |
| { |
| newLeafNode(otherlv_3, grammarAccess.getShallAccess().getToKeyword_1_0_2()); |
| } |
| ) |
| ) |
| )? |
| ( |
| ( |
| lv_action_4_0=RULE_STRING |
| { |
| newLeafNode(lv_action_4_0, grammarAccess.getShallAccess().getActionSTRINGTerminalRuleCall_2_0()); |
| } |
| { |
| if ($current==null) { |
| $current = createModelElement(grammarAccess.getShallRule()); |
| } |
| setWithLastConsumed( |
| $current, |
| "action", |
| lv_action_4_0, |
| "org.eclipse.xtext.common.Terminals.STRING"); |
| } |
| ) |
| ) |
| ) |
| ; |
| |
| RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; |
| |
| RULE_INT : ('0'..'9')+; |
| |
| RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\''); |
| |
| RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; |
| |
| RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?; |
| |
| RULE_WS : (' '|'\t'|'\r'|'\n')+; |
| |
| RULE_ANY_OTHER : .; |