blob: 7abe17c16da778335f68c79f7800bf3fb758d1a7 [file] [log] [blame]
/*
* generated by Xtext
*/
grammar InternalATest;
options {
superClass=AbstractInternalAntlrParser;
}
@lexer::header {
package org.eclipse.amp.amf.testing.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.testing.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.testing.services.ATestGrammarAccess;
}
@parser::members {
private ATestGrammarAccess grammarAccess;
public InternalATestParser(TokenStream input, IAstFactory factory, ATestGrammarAccess 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/testing/parser/antlr/internal/InternalATest.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 { EObject temp=null; setCurrentLookahead(); resetLookahead();
}
@after { resetLookahead();
lastConsumedNode = currentNode;
}:
((
lv_name_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, "STRING", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
)?(
lv_description_1= RULE_PLAIN_STRING
{
createLeafNode(grammarAccess.getModelAccess().getDescriptionPLAIN_STRINGTerminalRuleCall_1_0(), "description");
}
{
if ($current==null) {
$current = factory.create(grammarAccess.getModelRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, $current);
}
try {
set($current, "description", lv_description_1, "PLAIN_STRING", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
)?(
{
currentNode=createCompositeNode(grammarAccess.getModelAccess().getTestsTestsParserRuleCall_2_0(), currentNode);
}
lv_tests_2=ruleTests
{
if ($current==null) {
$current = factory.create(grammarAccess.getModelRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), $current);
}
try {
set($current, "tests", lv_tests_2, "Tests", currentNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
currentNode = currentNode.getParent();
}
)?(
{
currentNode=createCompositeNode(grammarAccess.getModelAccess().getContraintsConstraintParserRuleCall_3_0(), currentNode);
}
lv_contraints_3=ruleConstraint
{
if ($current==null) {
$current = factory.create(grammarAccess.getModelRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), $current);
}
try {
add($current, "contraints", lv_contraints_3, "Constraint", currentNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
currentNode = currentNode.getParent();
}
)*);
// Entry rule entryRuleTests
entryRuleTests returns [EObject current=null] :
{ currentNode = createCompositeNode(grammarAccess.getTestsRule(), currentNode); }
iv_ruleTests=ruleTests
{ $current=$iv_ruleTests.current; }
EOF
;
// Rule Tests
ruleTests returns [EObject current=null]
@init { EObject temp=null; setCurrentLookahead(); resetLookahead();
}
@after { resetLookahead();
lastConsumedNode = currentNode;
}:
('TESTS'
{
createLeafNode(grammarAccess.getTestsAccess().getTESTSKeyword_0(), null);
}
(
lv_importURI_1= RULE_STRING
{
createLeafNode(grammarAccess.getTestsAccess().getImportURISTRINGTerminalRuleCall_1_0(), "importURI");
}
{
if ($current==null) {
$current = factory.create(grammarAccess.getTestsRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, $current);
}
try {
set($current, "importURI", lv_importURI_1, "STRING", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
));
// Entry rule entryRuleConstraint
entryRuleConstraint returns [EObject current=null] :
{ currentNode = createCompositeNode(grammarAccess.getConstraintRule(), currentNode); }
iv_ruleConstraint=ruleConstraint
{ $current=$iv_ruleConstraint.current; }
EOF
;
// Rule Constraint
ruleConstraint returns [EObject current=null]
@init { EObject temp=null; setCurrentLookahead(); resetLookahead();
}
@after { resetLookahead();
lastConsumedNode = currentNode;
}:
((
{
currentNode=createCompositeNode(grammarAccess.getConstraintAccess().getMeasureMeasureEnumRuleCall_0_0(), currentNode);
}
lv_measure_0=ruleMeasure
{
if ($current==null) {
$current = factory.create(grammarAccess.getConstraintRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), $current);
}
try {
set($current, "measure", lv_measure_0, "Measure", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
currentNode = currentNode.getParent();
}
)'('
{
createLeafNode(grammarAccess.getConstraintAccess().getLeftParenthesisKeyword_1(), null);
}
(
{
if ($current==null) {
$current = factory.create(grammarAccess.getConstraintRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, $current);
}
}
RULE_STRING
{
createLeafNode(grammarAccess.getConstraintAccess().getAgentSAgentCrossReference_2_0(), "agent");
}
// TODO assign feature to currentNode
)':'
{
createLeafNode(grammarAccess.getConstraintAccess().getColonKeyword_3(), null);
}
(
{
if ($current==null) {
$current = factory.create(grammarAccess.getConstraintRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, $current);
}
}
RULE_STRING
{
createLeafNode(grammarAccess.getConstraintAccess().getAttributeSAttributeCrossReference_4_0(), "attribute");
}
// TODO assign feature to currentNode
)(':'
{
createLeafNode(grammarAccess.getConstraintAccess().getColonKeyword_5_0(), null);
}
(
{
if ($current==null) {
$current = factory.create(grammarAccess.getConstraintRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, $current);
}
}
RULE_STRING
{
createLeafNode(grammarAccess.getConstraintAccess().getQualifierSStateValueCrossReference_5_1_0(), "qualifier");
}
// TODO assign feature to currentNode
))?')'
{
createLeafNode(grammarAccess.getConstraintAccess().getRightParenthesisKeyword_6(), null);
}
('='
{
createLeafNode(grammarAccess.getConstraintAccess().getEqualsSignKeyword_7_0(), null);
}
'['
{
createLeafNode(grammarAccess.getConstraintAccess().getLeftSquareBracketKeyword_7_1(), null);
}
(
lv_minValue_10=( {
currentNode=createCompositeNode(grammarAccess.getConstraintAccess().getMinValueIntValueParserRuleCall_7_2_0_0(), currentNode);
}
ruleIntValue {
currentNode = currentNode.getParent();
}
| {
currentNode=createCompositeNode(grammarAccess.getConstraintAccess().getMinValueRealValueParserRuleCall_7_2_0_1(), currentNode);
}
ruleRealValue {
currentNode = currentNode.getParent();
}
)
{
if ($current==null) {
$current = factory.create(grammarAccess.getConstraintRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, $current);
}
try {
set($current, "minValue", lv_minValue_10, null, lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
)','
{
createLeafNode(grammarAccess.getConstraintAccess().getCommaKeyword_7_3(), null);
}
(
lv_maxValue_12=( {
currentNode=createCompositeNode(grammarAccess.getConstraintAccess().getMaxValueIntValueParserRuleCall_7_4_0_0(), currentNode);
}
ruleIntValue {
currentNode = currentNode.getParent();
}
| {
currentNode=createCompositeNode(grammarAccess.getConstraintAccess().getMaxValueRealValueParserRuleCall_7_4_0_1(), currentNode);
}
ruleRealValue {
currentNode = currentNode.getParent();
}
)
{
if ($current==null) {
$current = factory.create(grammarAccess.getConstraintRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, $current);
}
try {
set($current, "maxValue", lv_maxValue_12, null, lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
)']'
{
createLeafNode(grammarAccess.getConstraintAccess().getRightSquareBracketKeyword_7_5(), null);
}
));
// 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 { EObject temp=null; setCurrentLookahead(); resetLookahead();
}
@after { resetLookahead();
lastConsumedNode = currentNode;
}:
(
lv_value_0= RULE_INT
{
createLeafNode(grammarAccess.getIntValueAccess().getValueINTTerminalRuleCall_0(), "value");
}
{
if ($current==null) {
$current = factory.create(grammarAccess.getIntValueRule().getType().getClassifier());
associateNodeWithAstElement(currentNode, $current);
}
try {
set($current, "value", lv_value_0, "INT", 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 { EObject temp=null; setCurrentLookahead(); resetLookahead();
}
@after { resetLookahead();
lastConsumedNode = currentNode;
}:
(
lv_value_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, "REAL", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
}
);
// Rule Measure
ruleMeasure returns [Enumerator current=null]
@init { setCurrentLookahead(); resetLookahead(); }
@after { resetLookahead();
lastConsumedNode = currentNode;
}:
(( 'Count'
{
$current = grammarAccess.getMeasureAccess().getCOUNTEnumLiteralDeclaration_0().getEnumLiteral().getInstance();
createLeafNode(grammarAccess.getMeasureAccess().getCOUNTEnumLiteralDeclaration_0(), null);
}
)
|( 'Average'
{
$current = grammarAccess.getMeasureAccess().getAVERAGEEnumLiteralDeclaration_1().getEnumLiteral().getInstance();
createLeafNode(grammarAccess.getMeasureAccess().getAVERAGEEnumLiteralDeclaration_1(), null);
}
)
|( 'Sum'
{
$current = grammarAccess.getMeasureAccess().getSUMEnumLiteralDeclaration_2().getEnumLiteral().getInstance();
createLeafNode(grammarAccess.getMeasureAccess().getSUMEnumLiteralDeclaration_2(), null);
}
)
|( 'Minimum'
{
$current = grammarAccess.getMeasureAccess().getMINIMUMEnumLiteralDeclaration_3().getEnumLiteral().getInstance();
createLeafNode(grammarAccess.getMeasureAccess().getMINIMUMEnumLiteralDeclaration_3(), null);
}
)
|( 'Maximum'
{
$current = grammarAccess.getMeasureAccess().getMAXIMUMEnumLiteralDeclaration_4().getEnumLiteral().getInstance();
createLeafNode(grammarAccess.getMeasureAccess().getMAXIMUMEnumLiteralDeclaration_4(), null);
}
));
RULE_REAL : '-'? RULE_INT ('.' RULE_INT)?;
RULE_PLAIN_STRING : '\u00AB' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'\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 : .;