| /* |
| * generated by Xtext |
| */ |
| |
| package org.eclipse.ocl.tutorial.eclipsecon2011.services; |
| |
| import com.google.inject.Singleton; |
| import com.google.inject.Inject; |
| |
| import org.eclipse.xtext.*; |
| import org.eclipse.xtext.service.GrammarProvider; |
| import org.eclipse.xtext.service.AbstractElementFinder.*; |
| |
| import org.eclipse.xtext.common.services.TerminalsGrammarAccess; |
| |
| @Singleton |
| public class OCLStatesGrammarAccess extends AbstractGrammarElementFinder { |
| |
| |
| public class ModuleElements extends AbstractParserRuleElementFinder { |
| private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Module"); |
| private final Group cGroup = (Group)rule.eContents().get(1); |
| private final Keyword cModuleKeyword_0 = (Keyword)cGroup.eContents().get(0); |
| private final Assignment cNameAssignment_1 = (Assignment)cGroup.eContents().get(1); |
| private final RuleCall cNameSTRINGTerminalRuleCall_1_0 = (RuleCall)cNameAssignment_1.eContents().get(0); |
| private final Assignment cMachinesAssignment_2 = (Assignment)cGroup.eContents().get(2); |
| private final RuleCall cMachinesStatemachineParserRuleCall_2_0 = (RuleCall)cMachinesAssignment_2.eContents().get(0); |
| |
| //Module: |
| // "module" name=STRING machines+=Statemachine*; |
| public ParserRule getRule() { return rule; } |
| |
| //"module" name=STRING machines+=Statemachine* |
| public Group getGroup() { return cGroup; } |
| |
| //"module" |
| public Keyword getModuleKeyword_0() { return cModuleKeyword_0; } |
| |
| //name=STRING |
| public Assignment getNameAssignment_1() { return cNameAssignment_1; } |
| |
| //STRING |
| public RuleCall getNameSTRINGTerminalRuleCall_1_0() { return cNameSTRINGTerminalRuleCall_1_0; } |
| |
| //machines+=Statemachine* |
| public Assignment getMachinesAssignment_2() { return cMachinesAssignment_2; } |
| |
| //Statemachine |
| public RuleCall getMachinesStatemachineParserRuleCall_2_0() { return cMachinesStatemachineParserRuleCall_2_0; } |
| } |
| |
| public class StatemachineElements extends AbstractParserRuleElementFinder { |
| private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Statemachine"); |
| private final Group cGroup = (Group)rule.eContents().get(1); |
| private final Assignment cInitialAssignment_0 = (Assignment)cGroup.eContents().get(0); |
| private final Keyword cInitialInitialKeyword_0_0 = (Keyword)cInitialAssignment_0.eContents().get(0); |
| private final Keyword cStatemachineKeyword_1 = (Keyword)cGroup.eContents().get(1); |
| private final Assignment cNameAssignment_2 = (Assignment)cGroup.eContents().get(2); |
| private final RuleCall cNameIDTerminalRuleCall_2_0 = (RuleCall)cNameAssignment_2.eContents().get(0); |
| private final Group cGroup_3 = (Group)cGroup.eContents().get(3); |
| private final Keyword cValueKeyword_3_0 = (Keyword)cGroup_3.eContents().get(0); |
| private final Assignment cValueAssignment_3_1 = (Assignment)cGroup_3.eContents().get(1); |
| private final RuleCall cValueINTTerminalRuleCall_3_1_0 = (RuleCall)cValueAssignment_3_1.eContents().get(0); |
| private final Keyword cLeftCurlyBracketKeyword_4 = (Keyword)cGroup.eContents().get(4); |
| private final Keyword cEventsKeyword_5 = (Keyword)cGroup.eContents().get(5); |
| private final Assignment cEventsAssignment_6 = (Assignment)cGroup.eContents().get(6); |
| private final RuleCall cEventsEventParserRuleCall_6_0 = (RuleCall)cEventsAssignment_6.eContents().get(0); |
| private final Keyword cSemicolonKeyword_7 = (Keyword)cGroup.eContents().get(7); |
| private final Assignment cStatesAssignment_8 = (Assignment)cGroup.eContents().get(8); |
| private final RuleCall cStatesStateParserRuleCall_8_0 = (RuleCall)cStatesAssignment_8.eContents().get(0); |
| private final Keyword cRightCurlyBracketKeyword_9 = (Keyword)cGroup.eContents().get(9); |
| |
| //Statemachine: |
| // initial?="initial"? "statemachine" name=ID ("value" value=INT)? "{" "events" events+=Event* ";" states+=State* "}"; |
| public ParserRule getRule() { return rule; } |
| |
| //initial?="initial"? "statemachine" name=ID ("value" value=INT)? "{" "events" events+=Event* ";" states+=State* "}" |
| public Group getGroup() { return cGroup; } |
| |
| //initial?="initial"? |
| public Assignment getInitialAssignment_0() { return cInitialAssignment_0; } |
| |
| //"initial" |
| public Keyword getInitialInitialKeyword_0_0() { return cInitialInitialKeyword_0_0; } |
| |
| //"statemachine" |
| public Keyword getStatemachineKeyword_1() { return cStatemachineKeyword_1; } |
| |
| //name=ID |
| public Assignment getNameAssignment_2() { return cNameAssignment_2; } |
| |
| //ID |
| public RuleCall getNameIDTerminalRuleCall_2_0() { return cNameIDTerminalRuleCall_2_0; } |
| |
| //("value" value=INT)? |
| public Group getGroup_3() { return cGroup_3; } |
| |
| //"value" |
| public Keyword getValueKeyword_3_0() { return cValueKeyword_3_0; } |
| |
| //value=INT |
| public Assignment getValueAssignment_3_1() { return cValueAssignment_3_1; } |
| |
| //INT |
| public RuleCall getValueINTTerminalRuleCall_3_1_0() { return cValueINTTerminalRuleCall_3_1_0; } |
| |
| //"{" |
| public Keyword getLeftCurlyBracketKeyword_4() { return cLeftCurlyBracketKeyword_4; } |
| |
| //"events" |
| public Keyword getEventsKeyword_5() { return cEventsKeyword_5; } |
| |
| //events+=Event* |
| public Assignment getEventsAssignment_6() { return cEventsAssignment_6; } |
| |
| //Event |
| public RuleCall getEventsEventParserRuleCall_6_0() { return cEventsEventParserRuleCall_6_0; } |
| |
| //";" |
| public Keyword getSemicolonKeyword_7() { return cSemicolonKeyword_7; } |
| |
| //states+=State* |
| public Assignment getStatesAssignment_8() { return cStatesAssignment_8; } |
| |
| //State |
| public RuleCall getStatesStateParserRuleCall_8_0() { return cStatesStateParserRuleCall_8_0; } |
| |
| //"}" |
| public Keyword getRightCurlyBracketKeyword_9() { return cRightCurlyBracketKeyword_9; } |
| } |
| |
| public class EventElements extends AbstractParserRuleElementFinder { |
| private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Event"); |
| private final Assignment cNameAssignment = (Assignment)rule.eContents().get(1); |
| private final RuleCall cNameIDTerminalRuleCall_0 = (RuleCall)cNameAssignment.eContents().get(0); |
| |
| //Event: |
| // name=ID; |
| public ParserRule getRule() { return rule; } |
| |
| //name=ID |
| public Assignment getNameAssignment() { return cNameAssignment; } |
| |
| //ID |
| public RuleCall getNameIDTerminalRuleCall_0() { return cNameIDTerminalRuleCall_0; } |
| } |
| |
| public class StateElements extends AbstractParserRuleElementFinder { |
| private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "State"); |
| private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); |
| private final RuleCall cSimpleStateParserRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0); |
| private final RuleCall cCompoundStateParserRuleCall_1 = (RuleCall)cAlternatives.eContents().get(1); |
| |
| //State: |
| // SimpleState | CompoundState; |
| public ParserRule getRule() { return rule; } |
| |
| //SimpleState | CompoundState |
| public Alternatives getAlternatives() { return cAlternatives; } |
| |
| //SimpleState |
| public RuleCall getSimpleStateParserRuleCall_0() { return cSimpleStateParserRuleCall_0; } |
| |
| //CompoundState |
| public RuleCall getCompoundStateParserRuleCall_1() { return cCompoundStateParserRuleCall_1; } |
| } |
| |
| public class SimpleStateElements extends AbstractParserRuleElementFinder { |
| private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SimpleState"); |
| private final Group cGroup = (Group)rule.eContents().get(1); |
| private final Assignment cInitialAssignment_0 = (Assignment)cGroup.eContents().get(0); |
| private final Keyword cInitialInitialKeyword_0_0 = (Keyword)cInitialAssignment_0.eContents().get(0); |
| private final Keyword cStateKeyword_1 = (Keyword)cGroup.eContents().get(1); |
| private final Assignment cNameAssignment_2 = (Assignment)cGroup.eContents().get(2); |
| private final RuleCall cNameIDTerminalRuleCall_2_0 = (RuleCall)cNameAssignment_2.eContents().get(0); |
| private final Group cGroup_3 = (Group)cGroup.eContents().get(3); |
| private final Keyword cValueKeyword_3_0 = (Keyword)cGroup_3.eContents().get(0); |
| private final Assignment cValueAssignment_3_1 = (Assignment)cGroup_3.eContents().get(1); |
| private final RuleCall cValueINTTerminalRuleCall_3_1_0 = (RuleCall)cValueAssignment_3_1.eContents().get(0); |
| private final Keyword cLeftCurlyBracketKeyword_4 = (Keyword)cGroup.eContents().get(4); |
| private final Assignment cTransitionsAssignment_5 = (Assignment)cGroup.eContents().get(5); |
| private final RuleCall cTransitionsTransitionParserRuleCall_5_0 = (RuleCall)cTransitionsAssignment_5.eContents().get(0); |
| private final Keyword cRightCurlyBracketKeyword_6 = (Keyword)cGroup.eContents().get(6); |
| |
| //SimpleState: |
| // initial?="initial"? "state" name=ID ("value" value=INT)? "{" transitions+=Transition* "}"; |
| public ParserRule getRule() { return rule; } |
| |
| //initial?="initial"? "state" name=ID ("value" value=INT)? "{" transitions+=Transition* "}" |
| public Group getGroup() { return cGroup; } |
| |
| //initial?="initial"? |
| public Assignment getInitialAssignment_0() { return cInitialAssignment_0; } |
| |
| //"initial" |
| public Keyword getInitialInitialKeyword_0_0() { return cInitialInitialKeyword_0_0; } |
| |
| //"state" |
| public Keyword getStateKeyword_1() { return cStateKeyword_1; } |
| |
| //name=ID |
| public Assignment getNameAssignment_2() { return cNameAssignment_2; } |
| |
| //ID |
| public RuleCall getNameIDTerminalRuleCall_2_0() { return cNameIDTerminalRuleCall_2_0; } |
| |
| //("value" value=INT)? |
| public Group getGroup_3() { return cGroup_3; } |
| |
| //"value" |
| public Keyword getValueKeyword_3_0() { return cValueKeyword_3_0; } |
| |
| //value=INT |
| public Assignment getValueAssignment_3_1() { return cValueAssignment_3_1; } |
| |
| //INT |
| public RuleCall getValueINTTerminalRuleCall_3_1_0() { return cValueINTTerminalRuleCall_3_1_0; } |
| |
| //"{" |
| public Keyword getLeftCurlyBracketKeyword_4() { return cLeftCurlyBracketKeyword_4; } |
| |
| //transitions+=Transition* |
| public Assignment getTransitionsAssignment_5() { return cTransitionsAssignment_5; } |
| |
| //Transition |
| public RuleCall getTransitionsTransitionParserRuleCall_5_0() { return cTransitionsTransitionParserRuleCall_5_0; } |
| |
| //"}" |
| public Keyword getRightCurlyBracketKeyword_6() { return cRightCurlyBracketKeyword_6; } |
| } |
| |
| public class CompoundStateElements extends AbstractParserRuleElementFinder { |
| private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CompoundState"); |
| private final Group cGroup = (Group)rule.eContents().get(1); |
| private final Keyword cCompoundKeyword_0 = (Keyword)cGroup.eContents().get(0); |
| private final Assignment cInitialAssignment_1 = (Assignment)cGroup.eContents().get(1); |
| private final Keyword cInitialInitialKeyword_1_0 = (Keyword)cInitialAssignment_1.eContents().get(0); |
| private final Keyword cStateKeyword_2 = (Keyword)cGroup.eContents().get(2); |
| private final Assignment cNameAssignment_3 = (Assignment)cGroup.eContents().get(3); |
| private final RuleCall cNameIDTerminalRuleCall_3_0 = (RuleCall)cNameAssignment_3.eContents().get(0); |
| private final Keyword cMachineKeyword_4 = (Keyword)cGroup.eContents().get(4); |
| private final Assignment cMachineAssignment_5 = (Assignment)cGroup.eContents().get(5); |
| private final CrossReference cMachineStatemachineCrossReference_5_0 = (CrossReference)cMachineAssignment_5.eContents().get(0); |
| private final RuleCall cMachineStatemachineIDTerminalRuleCall_5_0_1 = (RuleCall)cMachineStatemachineCrossReference_5_0.eContents().get(1); |
| private final Keyword cLeftCurlyBracketKeyword_6 = (Keyword)cGroup.eContents().get(6); |
| private final Assignment cTransitionsAssignment_7 = (Assignment)cGroup.eContents().get(7); |
| private final RuleCall cTransitionsTransitionParserRuleCall_7_0 = (RuleCall)cTransitionsAssignment_7.eContents().get(0); |
| private final Keyword cRightCurlyBracketKeyword_8 = (Keyword)cGroup.eContents().get(8); |
| |
| //CompoundState: |
| // "compound" initial?="initial"? "state" name=ID "machine" machine=[Statemachine] "{" transitions+=Transition* "}"; |
| public ParserRule getRule() { return rule; } |
| |
| //"compound" initial?="initial"? "state" name=ID "machine" machine=[Statemachine] "{" transitions+=Transition* "}" |
| public Group getGroup() { return cGroup; } |
| |
| //"compound" |
| public Keyword getCompoundKeyword_0() { return cCompoundKeyword_0; } |
| |
| //initial?="initial"? |
| public Assignment getInitialAssignment_1() { return cInitialAssignment_1; } |
| |
| //"initial" |
| public Keyword getInitialInitialKeyword_1_0() { return cInitialInitialKeyword_1_0; } |
| |
| //"state" |
| public Keyword getStateKeyword_2() { return cStateKeyword_2; } |
| |
| //name=ID |
| public Assignment getNameAssignment_3() { return cNameAssignment_3; } |
| |
| //ID |
| public RuleCall getNameIDTerminalRuleCall_3_0() { return cNameIDTerminalRuleCall_3_0; } |
| |
| //"machine" |
| public Keyword getMachineKeyword_4() { return cMachineKeyword_4; } |
| |
| //machine=[Statemachine] |
| public Assignment getMachineAssignment_5() { return cMachineAssignment_5; } |
| |
| //[Statemachine] |
| public CrossReference getMachineStatemachineCrossReference_5_0() { return cMachineStatemachineCrossReference_5_0; } |
| |
| //ID |
| public RuleCall getMachineStatemachineIDTerminalRuleCall_5_0_1() { return cMachineStatemachineIDTerminalRuleCall_5_0_1; } |
| |
| //"{" |
| public Keyword getLeftCurlyBracketKeyword_6() { return cLeftCurlyBracketKeyword_6; } |
| |
| //transitions+=Transition* |
| public Assignment getTransitionsAssignment_7() { return cTransitionsAssignment_7; } |
| |
| //Transition |
| public RuleCall getTransitionsTransitionParserRuleCall_7_0() { return cTransitionsTransitionParserRuleCall_7_0; } |
| |
| //"}" |
| public Keyword getRightCurlyBracketKeyword_8() { return cRightCurlyBracketKeyword_8; } |
| } |
| |
| public class TransitionElements extends AbstractParserRuleElementFinder { |
| private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Transition"); |
| private final Group cGroup = (Group)rule.eContents().get(1); |
| private final Assignment cEventAssignment_0 = (Assignment)cGroup.eContents().get(0); |
| private final CrossReference cEventEventCrossReference_0_0 = (CrossReference)cEventAssignment_0.eContents().get(0); |
| private final RuleCall cEventEventIDTerminalRuleCall_0_0_1 = (RuleCall)cEventEventCrossReference_0_0.eContents().get(1); |
| private final Keyword cEqualsSignGreaterThanSignKeyword_1 = (Keyword)cGroup.eContents().get(1); |
| private final Assignment cStateAssignment_2 = (Assignment)cGroup.eContents().get(2); |
| private final CrossReference cStateStateCrossReference_2_0 = (CrossReference)cStateAssignment_2.eContents().get(0); |
| private final RuleCall cStateStateIDTerminalRuleCall_2_0_1 = (RuleCall)cStateStateCrossReference_2_0.eContents().get(1); |
| |
| //Transition: |
| // event=[Event] "=>" state=[State]; |
| public ParserRule getRule() { return rule; } |
| |
| //event=[Event] "=>" state=[State] |
| public Group getGroup() { return cGroup; } |
| |
| //event=[Event] |
| public Assignment getEventAssignment_0() { return cEventAssignment_0; } |
| |
| //[Event] |
| public CrossReference getEventEventCrossReference_0_0() { return cEventEventCrossReference_0_0; } |
| |
| //ID |
| public RuleCall getEventEventIDTerminalRuleCall_0_0_1() { return cEventEventIDTerminalRuleCall_0_0_1; } |
| |
| //"=>" |
| public Keyword getEqualsSignGreaterThanSignKeyword_1() { return cEqualsSignGreaterThanSignKeyword_1; } |
| |
| //state=[State] |
| public Assignment getStateAssignment_2() { return cStateAssignment_2; } |
| |
| //[State] |
| public CrossReference getStateStateCrossReference_2_0() { return cStateStateCrossReference_2_0; } |
| |
| //ID |
| public RuleCall getStateStateIDTerminalRuleCall_2_0_1() { return cStateStateIDTerminalRuleCall_2_0_1; } |
| } |
| |
| |
| private ModuleElements pModule; |
| private StatemachineElements pStatemachine; |
| private EventElements pEvent; |
| private StateElements pState; |
| private SimpleStateElements pSimpleState; |
| private CompoundStateElements pCompoundState; |
| private TransitionElements pTransition; |
| |
| private final GrammarProvider grammarProvider; |
| |
| private TerminalsGrammarAccess gaTerminals; |
| |
| @Inject |
| public OCLStatesGrammarAccess(GrammarProvider grammarProvider, |
| TerminalsGrammarAccess gaTerminals) { |
| this.grammarProvider = grammarProvider; |
| this.gaTerminals = gaTerminals; |
| } |
| |
| public Grammar getGrammar() { |
| return grammarProvider.getGrammar(this); |
| } |
| |
| |
| public TerminalsGrammarAccess getTerminalsGrammarAccess() { |
| return gaTerminals; |
| } |
| |
| |
| //Module: |
| // "module" name=STRING machines+=Statemachine*; |
| public ModuleElements getModuleAccess() { |
| return (pModule != null) ? pModule : (pModule = new ModuleElements()); |
| } |
| |
| public ParserRule getModuleRule() { |
| return getModuleAccess().getRule(); |
| } |
| |
| //Statemachine: |
| // initial?="initial"? "statemachine" name=ID ("value" value=INT)? "{" "events" events+=Event* ";" states+=State* "}"; |
| public StatemachineElements getStatemachineAccess() { |
| return (pStatemachine != null) ? pStatemachine : (pStatemachine = new StatemachineElements()); |
| } |
| |
| public ParserRule getStatemachineRule() { |
| return getStatemachineAccess().getRule(); |
| } |
| |
| //Event: |
| // name=ID; |
| public EventElements getEventAccess() { |
| return (pEvent != null) ? pEvent : (pEvent = new EventElements()); |
| } |
| |
| public ParserRule getEventRule() { |
| return getEventAccess().getRule(); |
| } |
| |
| //State: |
| // SimpleState | CompoundState; |
| public StateElements getStateAccess() { |
| return (pState != null) ? pState : (pState = new StateElements()); |
| } |
| |
| public ParserRule getStateRule() { |
| return getStateAccess().getRule(); |
| } |
| |
| //SimpleState: |
| // initial?="initial"? "state" name=ID ("value" value=INT)? "{" transitions+=Transition* "}"; |
| public SimpleStateElements getSimpleStateAccess() { |
| return (pSimpleState != null) ? pSimpleState : (pSimpleState = new SimpleStateElements()); |
| } |
| |
| public ParserRule getSimpleStateRule() { |
| return getSimpleStateAccess().getRule(); |
| } |
| |
| //CompoundState: |
| // "compound" initial?="initial"? "state" name=ID "machine" machine=[Statemachine] "{" transitions+=Transition* "}"; |
| public CompoundStateElements getCompoundStateAccess() { |
| return (pCompoundState != null) ? pCompoundState : (pCompoundState = new CompoundStateElements()); |
| } |
| |
| public ParserRule getCompoundStateRule() { |
| return getCompoundStateAccess().getRule(); |
| } |
| |
| //Transition: |
| // event=[Event] "=>" state=[State]; |
| public TransitionElements getTransitionAccess() { |
| return (pTransition != null) ? pTransition : (pTransition = new TransitionElements()); |
| } |
| |
| public ParserRule getTransitionRule() { |
| return getTransitionAccess().getRule(); |
| } |
| |
| //terminal ID: |
| // "^"? ("a".."z" | "A".."Z" | "_") ("a".."z" | "A".."Z" | "_" | "0".."9")*; |
| public TerminalRule getIDRule() { |
| return gaTerminals.getIDRule(); |
| } |
| |
| //terminal INT returns ecore::EInt: |
| // "0".."9"+; |
| public TerminalRule getINTRule() { |
| return gaTerminals.getINTRule(); |
| } |
| |
| //terminal STRING: |
| // "\"" ("\\" ("b" | "t" | "n" | "f" | "r" | "u" | "\"" | "\'" | "\\") | !("\\" | "\""))* "\"" | "\'" ("\\" ("b" | "t" | |
| // "n" | "f" | "r" | "u" | "\"" | "\'" | "\\") | !("\\" | "\'"))* "\'"; |
| public TerminalRule getSTRINGRule() { |
| return gaTerminals.getSTRINGRule(); |
| } |
| |
| //terminal ML_COMMENT: |
| // "/ *"->"* /"; |
| public TerminalRule getML_COMMENTRule() { |
| return gaTerminals.getML_COMMENTRule(); |
| } |
| |
| //terminal SL_COMMENT: |
| // "//" !("\n" | "\r")* ("\r"? "\n")?; |
| public TerminalRule getSL_COMMENTRule() { |
| return gaTerminals.getSL_COMMENTRule(); |
| } |
| |
| //terminal WS: |
| // (" " | "\t" | "\r" | "\n")+; |
| public TerminalRule getWSRule() { |
| return gaTerminals.getWSRule(); |
| } |
| |
| //terminal ANY_OTHER: |
| // .; |
| public TerminalRule getANY_OTHERRule() { |
| return gaTerminals.getANY_OTHERRule(); |
| } |
| } |