blob: 4a6abde5cf0097d770c49bc49f031f6b5ef1130c [file] [log] [blame]
/*
* generated by Xtext 2.22.0
*/
grammar InternalDTML;
options {
superClass=AbstractInternalAntlrParser;
}
@lexer::header {
package org.eclipse.papyrus.robotics.xtext.datatypes.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.robotics.xtext.datatypes.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.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.papyrus.robotics.xtext.datatypes.services.DTMLGrammarAccess;
}
@parser::members {
private DTMLGrammarAccess grammarAccess;
public InternalDTMLParser(TokenStream input, DTMLGrammarAccess grammarAccess) {
this(input);
this.grammarAccess = grammarAccess;
registerRules(grammarAccess.getGrammar());
}
@Override
protected String getFirstRuleName() {
return "Model";
}
@Override
protected DTMLGrammarAccess 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().getDTModelParserRuleCall_0());
}
this_DTModel_0=ruleDTModel
{
$current = $this_DTModel_0.current;
afterParserOrEnumRuleCall();
}
|
{
newCompositeNode(grammarAccess.getModelAccess().getAssignmentParserRuleCall_1());
}
this_Assignment_1=ruleAssignment
{
$current = $this_Assignment_1.current;
afterParserOrEnumRuleCall();
}
)
;
// Entry rule entryRuleDTModel
entryRuleDTModel returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getDTModelRule()); }
iv_ruleDTModel=ruleDTModel
{ $current=$iv_ruleDTModel.current; }
EOF;
// Rule DTModel
ruleDTModel returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
{
newCompositeNode(grammarAccess.getDTModelAccess().getDTKeyParserRuleCall_0());
}
ruleDTKey
{
afterParserOrEnumRuleCall();
}
(
(
lv_name_1_0=RULE_ID
{
newLeafNode(lv_name_1_0, grammarAccess.getDTModelAccess().getNameIDTerminalRuleCall_1_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getDTModelRule());
}
setWithLastConsumed(
$current,
"name",
lv_name_1_0,
"org.eclipse.papyrus.uml.alf.Common.ID");
}
)
)
otherlv_2='{'
{
newLeafNode(otherlv_2, grammarAccess.getDTModelAccess().getLeftCurlyBracketKeyword_2());
}
(
(
{
newCompositeNode(grammarAccess.getDTModelAccess().getAttributesPropertyParserRuleCall_3_0());
}
lv_attributes_3_0=ruleProperty
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getDTModelRule());
}
add(
$current,
"attributes",
lv_attributes_3_0,
"org.eclipse.papyrus.robotics.xtext.datatypes.DTML.Property");
afterParserOrEnumRuleCall();
}
)
)*
otherlv_4='}'
{
newLeafNode(otherlv_4, grammarAccess.getDTModelAccess().getRightCurlyBracketKeyword_4());
}
)
;
// Entry rule entryRuleDTKey
entryRuleDTKey returns [String current=null]:
{ newCompositeNode(grammarAccess.getDTKeyRule()); }
iv_ruleDTKey=ruleDTKey
{ $current=$iv_ruleDTKey.current.getText(); }
EOF;
// Rule DTKey
ruleDTKey returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
kw='DataType'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getDTKeyAccess().getDataTypeKeyword_0());
}
|
kw='CommObject'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getDTKeyAccess().getCommObjectKeyword_1());
}
)
;
// Entry rule entryRuleProperty
entryRuleProperty returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getPropertyRule()); }
iv_ruleProperty=ruleProperty
{ $current=$iv_ruleProperty.current; }
EOF;
// Rule Property
ruleProperty returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
otherlv_0='attribute'
{
newLeafNode(otherlv_0, grammarAccess.getPropertyAccess().getAttributeKeyword_0());
}
(
(
lv_name_1_0=RULE_ID
{
newLeafNode(lv_name_1_0, grammarAccess.getPropertyAccess().getNameIDTerminalRuleCall_1_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getPropertyRule());
}
setWithLastConsumed(
$current,
"name",
lv_name_1_0,
"org.eclipse.papyrus.uml.alf.Common.ID");
}
)
)
(
otherlv_2=':'
{
newLeafNode(otherlv_2, grammarAccess.getPropertyAccess().getColonKeyword_2_0());
}
(
(
(
{
newCompositeNode(grammarAccess.getPropertyAccess().getTypeTypeRuleParserRuleCall_2_1_0_0());
}
lv_type_3_0=ruleTypeRule
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPropertyRule());
}
set(
$current,
"type",
lv_type_3_0,
"org.eclipse.papyrus.uml.textedit.common.xtext.UmlCommon.TypeRule");
afterParserOrEnumRuleCall();
}
)
)
|
(
(
lv_typeUndefined_4_0='<Undefined>'
{
newLeafNode(lv_typeUndefined_4_0, grammarAccess.getPropertyAccess().getTypeUndefinedUndefinedKeyword_2_1_1_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getPropertyRule());
}
setWithLastConsumed($current, "typeUndefined", lv_typeUndefined_4_0 != null, "<Undefined>");
}
)
)
)
)?
(
(
{
newCompositeNode(grammarAccess.getPropertyAccess().getMultiplicityMultiplicityRuleParserRuleCall_3_0());
}
lv_multiplicity_5_0=ruleMultiplicityRule
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPropertyRule());
}
set(
$current,
"multiplicity",
lv_multiplicity_5_0,
"org.eclipse.papyrus.uml.textedit.common.xtext.UmlCommon.MultiplicityRule");
afterParserOrEnumRuleCall();
}
)
)?
(
otherlv_6='='
{
newLeafNode(otherlv_6, grammarAccess.getPropertyAccess().getEqualsSignKeyword_4_0());
}
(
(
{
newCompositeNode(grammarAccess.getPropertyAccess().getValueValueParserRuleCall_4_1_0());
}
lv_value_7_0=ruleValue
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getPropertyRule());
}
set(
$current,
"value",
lv_value_7_0,
"org.eclipse.papyrus.robotics.xtext.datatypes.DTML.Value");
afterParserOrEnumRuleCall();
}
)
)
)?
(
(
lv_comment_8_0=RULE_VSL_COMMENT
{
newLeafNode(lv_comment_8_0, grammarAccess.getPropertyAccess().getCommentVSL_COMMENTTerminalRuleCall_5_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getPropertyRule());
}
setWithLastConsumed(
$current,
"comment",
lv_comment_8_0,
"org.eclipse.papyrus.robotics.xtext.datatypes.DTML.VSL_COMMENT");
}
)
)?
)
;
// Entry rule entryRuleAssignment
entryRuleAssignment returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getAssignmentRule()); }
iv_ruleAssignment=ruleAssignment
{ $current=$iv_ruleAssignment.current; }
EOF;
// Rule Assignment
ruleAssignment returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
lv_name_0_0=RULE_ID
{
newLeafNode(lv_name_0_0, grammarAccess.getAssignmentAccess().getNameIDTerminalRuleCall_0_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getAssignmentRule());
}
setWithLastConsumed(
$current,
"name",
lv_name_0_0,
"org.eclipse.papyrus.uml.alf.Common.ID");
}
)
)
otherlv_1='='
{
newLeafNode(otherlv_1, grammarAccess.getAssignmentAccess().getEqualsSignKeyword_1());
}
(
(
{
newCompositeNode(grammarAccess.getAssignmentAccess().getExpressionExpressionStringParserRuleCall_2_0());
}
lv_expression_2_0=ruleExpressionString
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getAssignmentRule());
}
set(
$current,
"expression",
lv_expression_2_0,
"org.eclipse.papyrus.robotics.xtext.datatypes.DTML.ExpressionString");
afterParserOrEnumRuleCall();
}
)
)
otherlv_3=';'
{
newLeafNode(otherlv_3, grammarAccess.getAssignmentAccess().getSemicolonKeyword_3());
}
)
;
// Entry rule entryRuleExpressionString
entryRuleExpressionString returns [String current=null]:
{ newCompositeNode(grammarAccess.getExpressionStringRule()); }
iv_ruleExpressionString=ruleExpressionString
{ $current=$iv_ruleExpressionString.current.getText(); }
EOF;
// Rule ExpressionString
ruleExpressionString returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
this_ID_0=RULE_ID
{
$current.merge(this_ID_0);
}
{
newLeafNode(this_ID_0, grammarAccess.getExpressionStringAccess().getIDTerminalRuleCall_0());
}
|
kw='['
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getExpressionStringAccess().getLeftSquareBracketKeyword_1());
}
|
kw=']'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getExpressionStringAccess().getRightSquareBracketKeyword_2());
}
|
kw='-'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getExpressionStringAccess().getHyphenMinusKeyword_3());
}
|
kw=','
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getExpressionStringAccess().getCommaKeyword_4());
}
|
this_INT_5=RULE_INT
{
$current.merge(this_INT_5);
}
{
newLeafNode(this_INT_5, grammarAccess.getExpressionStringAccess().getINTTerminalRuleCall_5());
}
|
this_DOUBLE_6=RULE_DOUBLE
{
$current.merge(this_DOUBLE_6);
}
{
newLeafNode(this_DOUBLE_6, grammarAccess.getExpressionStringAccess().getDOUBLETerminalRuleCall_6());
}
)*
;
// Entry rule entryRuleValue
entryRuleValue returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getValueRule()); }
iv_ruleValue=ruleValue
{ $current=$iv_ruleValue.current; }
EOF;
// Rule Value
ruleValue returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
lv_str_0_0=RULE_STRING
{
newLeafNode(lv_str_0_0, grammarAccess.getValueAccess().getStrSTRINGTerminalRuleCall_0_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getValueRule());
}
setWithLastConsumed(
$current,
"str",
lv_str_0_0,
"org.eclipse.papyrus.uml.alf.Common.STRING");
}
)
)
|
(
(
lv_ival_1_0=RULE_INT
{
newLeafNode(lv_ival_1_0, grammarAccess.getValueAccess().getIvalINTTerminalRuleCall_1_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getValueRule());
}
setWithLastConsumed(
$current,
"ival",
lv_ival_1_0,
"org.eclipse.papyrus.uml.alf.Common.INT");
}
)
)
|
(
(
lv_dval_2_0=RULE_DOUBLE
{
newLeafNode(lv_dval_2_0, grammarAccess.getValueAccess().getDvalDOUBLETerminalRuleCall_2_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getValueRule());
}
setWithLastConsumed(
$current,
"dval",
lv_dval_2_0,
"org.eclipse.papyrus.robotics.xtext.datatypes.DTML.DOUBLE");
}
)
)
)
;
// Entry rule entryRuleQualifiedName
entryRuleQualifiedName returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getQualifiedNameRule()); }
iv_ruleQualifiedName=ruleQualifiedName
{ $current=$iv_ruleQualifiedName.current; }
EOF;
// Rule QualifiedName
ruleQualifiedName returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getQualifiedNameRule());
}
}
otherlv_0=RULE_ID
{
newLeafNode(otherlv_0, grammarAccess.getQualifiedNameAccess().getPathNamespaceCrossReference_0_0());
}
)
)
otherlv_1='::'
{
newLeafNode(otherlv_1, grammarAccess.getQualifiedNameAccess().getColonColonKeyword_1());
}
(
(
{
newCompositeNode(grammarAccess.getQualifiedNameAccess().getRemainingQualifiedNameParserRuleCall_2_0());
}
lv_remaining_2_0=ruleQualifiedName
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getQualifiedNameRule());
}
set(
$current,
"remaining",
lv_remaining_2_0,
"org.eclipse.papyrus.uml.textedit.common.xtext.UmlCommon.QualifiedName");
afterParserOrEnumRuleCall();
}
)
)?
)
;
// Entry rule entryRuleTypeRule
entryRuleTypeRule returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getTypeRuleRule()); }
iv_ruleTypeRule=ruleTypeRule
{ $current=$iv_ruleTypeRule.current; }
EOF;
// Rule TypeRule
ruleTypeRule returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
(
{
newCompositeNode(grammarAccess.getTypeRuleAccess().getPathQualifiedNameParserRuleCall_0_0());
}
lv_path_0_0=ruleQualifiedName
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getTypeRuleRule());
}
set(
$current,
"path",
lv_path_0_0,
"org.eclipse.papyrus.uml.textedit.common.xtext.UmlCommon.QualifiedName");
afterParserOrEnumRuleCall();
}
)
)?
(
(
{
if ($current==null) {
$current = createModelElement(grammarAccess.getTypeRuleRule());
}
}
otherlv_1=RULE_ID
{
newLeafNode(otherlv_1, grammarAccess.getTypeRuleAccess().getTypeTypeCrossReference_1_0());
}
)
)
)
;
// Entry rule entryRuleMultiplicityRule
entryRuleMultiplicityRule returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getMultiplicityRuleRule()); }
iv_ruleMultiplicityRule=ruleMultiplicityRule
{ $current=$iv_ruleMultiplicityRule.current; }
EOF;
// Rule MultiplicityRule
ruleMultiplicityRule returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
otherlv_0='['
{
newLeafNode(otherlv_0, grammarAccess.getMultiplicityRuleAccess().getLeftSquareBracketKeyword_0());
}
(
(
{
newCompositeNode(grammarAccess.getMultiplicityRuleAccess().getBoundsBoundSpecificationParserRuleCall_1_0());
}
lv_bounds_1_0=ruleBoundSpecification
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getMultiplicityRuleRule());
}
add(
$current,
"bounds",
lv_bounds_1_0,
"org.eclipse.papyrus.uml.textedit.common.xtext.UmlCommon.BoundSpecification");
afterParserOrEnumRuleCall();
}
)
)
(
otherlv_2='..'
{
newLeafNode(otherlv_2, grammarAccess.getMultiplicityRuleAccess().getFullStopFullStopKeyword_2_0());
}
(
(
{
newCompositeNode(grammarAccess.getMultiplicityRuleAccess().getBoundsBoundSpecificationParserRuleCall_2_1_0());
}
lv_bounds_3_0=ruleBoundSpecification
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getMultiplicityRuleRule());
}
add(
$current,
"bounds",
lv_bounds_3_0,
"org.eclipse.papyrus.uml.textedit.common.xtext.UmlCommon.BoundSpecification");
afterParserOrEnumRuleCall();
}
)
)
)?
otherlv_4=']'
{
newLeafNode(otherlv_4, grammarAccess.getMultiplicityRuleAccess().getRightSquareBracketKeyword_3());
}
)
;
// Entry rule entryRuleBoundSpecification
entryRuleBoundSpecification returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getBoundSpecificationRule()); }
iv_ruleBoundSpecification=ruleBoundSpecification
{ $current=$iv_ruleBoundSpecification.current; }
EOF;
// Rule BoundSpecification
ruleBoundSpecification returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
{
newCompositeNode(grammarAccess.getBoundSpecificationAccess().getValueUnlimitedLiteralParserRuleCall_0());
}
lv_value_0_0=ruleUnlimitedLiteral
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getBoundSpecificationRule());
}
set(
$current,
"value",
lv_value_0_0,
"org.eclipse.papyrus.uml.textedit.common.xtext.UmlCommon.UnlimitedLiteral");
afterParserOrEnumRuleCall();
}
)
)
;
// Entry rule entryRuleUnlimitedLiteral
entryRuleUnlimitedLiteral returns [String current=null]:
{ newCompositeNode(grammarAccess.getUnlimitedLiteralRule()); }
iv_ruleUnlimitedLiteral=ruleUnlimitedLiteral
{ $current=$iv_ruleUnlimitedLiteral.current.getText(); }
EOF;
// Rule UnlimitedLiteral
ruleUnlimitedLiteral returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
this_INT_0=RULE_INT
{
$current.merge(this_INT_0);
}
{
newLeafNode(this_INT_0, grammarAccess.getUnlimitedLiteralAccess().getINTTerminalRuleCall_0());
}
|
kw='*'
{
$current.merge(kw);
newLeafNode(kw, grammarAccess.getUnlimitedLiteralAccess().getAsteriskKeyword_1());
}
)
;
RULE_VSL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?;
RULE_DOUBLE : ('0'..'9')+ '.' ('0'..'9')+;
RULE_ID : (('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*|'\'' ( options {greedy=false;} : . )*'\'');
RULE_STRING : '"' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'"')))* '"';
RULE_ML_COMMENT : '/*' ~('@') ( options {greedy=false;} : . )*'*/';
RULE_SL_COMMENT : '//' ~(('\n'|'\r'|'@'))* ('\r'? '\n')?;
RULE_INT : ('0'..'9')+;
RULE_INTEGER_VALUE : (('0'|'1'..'9' ('_'? '0'..'9')*)|('0b'|'0B') '0'..'1' ('_'? '0'..'1')*|('0x'|'0X') ('0'..'9'|'a'..'f'|'A'..'F') ('_'? ('0'..'9'|'a'..'f'|'A'..'F'))*|'0' '_'? '0'..'7' ('_'? '0'..'7')*);
RULE_WS : (' '|'\t'|'\r'|'\n')+;
RULE_ANY_OTHER : .;