From baba88758a0ea5f671ab4a2aeacec374bed938c4 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Fri, 25 Jun 2021 17:12:45 +0200 Subject: Add initial prototype --- .../org.eclipse.viatra.solver.language/.classpath | 58 + .../org.eclipse.viatra.solver.language/.gitignore | 1 + ...roblem (problem) Language Infrastructure.launch | 14 + .../org.eclipse.viatra.solver.language/.project | 29 + .../.settings/org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 10 + .../build.gradle | 42 + .../viatra/solver/language/GenerateProblem.mwe2 | 54 + .../eclipse/viatra/solver/language/Problem.xtext | 88 + .../solver/language/ProblemRuntimeModule.java | 86 + .../solver/language/ProblemStandaloneSetup.java | 26 + .../conversion/ProblemValueConverterService.java | 17 + .../conversion/UpperBoundValueConverter.java | 35 + .../language/generator/ProblemGenerator.xtend | 25 + .../naming/ProblemQualifiedNameConverter.java | 13 + .../naming/ProblemQualifiedNameProvider.java | 15 + .../resource/ProblemDerivedStateComputer.java | 218 ++ .../resource/ProblemLocationInFileProvider.java | 130 + .../ProblemResourceDescriptionStrategy.java | 39 + .../scoping/ProblemGlobalScopeProvider.java | 19 + .../language/scoping/ProblemScopeProvider.java | 74 + .../language/validation/ProblemValidator.java | 25 + .../eclipse/viatra/solver/language/library.problem | 4 + .../language/AbstractProblemRuntimeModule.java | 201 + .../viatra/solver/language/Problem.xtextbin | Bin 0 -> 5210 bytes .../language/ProblemStandaloneSetupGenerated.java | 37 + .../antlr/ProblemAntlrTokenFileProvider.java | 16 + .../language/parser/antlr/ProblemParser.java | 40 + .../parser/antlr/internal/InternalProblem.g | 1522 ++++++++ .../parser/antlr/internal/InternalProblem.tokens | 65 + .../antlr/internal/InternalProblemLexer.java | 1699 ++++++++ .../antlr/internal/InternalProblemParser.java | 4056 ++++++++++++++++++++ .../scoping/AbstractProblemScopeProvider.java | 9 + .../serializer/ProblemSemanticSequencer.java | 296 ++ .../serializer/ProblemSyntacticSequencer.java | 77 + .../language/services/ProblemGrammarAccess.java | 1411 +++++++ .../validation/AbstractProblemValidator.java | 19 + .../ProblemConfigurableIssueCodesProvider.java | 22 + .../solver/language/tests/ProblemParsingTest.xtend | 30 + .../language/tests/ProblemInjectorProvider.java | 69 + 40 files changed, 10593 insertions(+) create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.classpath create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.gitignore create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.launch/Generate Problem (problem) Language Infrastructure.launch create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.project create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.settings/org.eclipse.core.resources.prefs create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/build.gradle create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/GenerateProblem.mwe2 create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/ProblemRuntimeModule.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/ProblemStandaloneSetup.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/conversion/ProblemValueConverterService.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/conversion/UpperBoundValueConverter.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/generator/ProblemGenerator.xtend create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/naming/ProblemQualifiedNameConverter.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/naming/ProblemQualifiedNameProvider.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemDerivedStateComputer.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemLocationInFileProvider.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemResourceDescriptionStrategy.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/scoping/ProblemGlobalScopeProvider.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/scoping/ProblemScopeProvider.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/validation/ProblemValidator.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/resources/org/eclipse/viatra/solver/language/library.problem create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/AbstractProblemRuntimeModule.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/Problem.xtextbin create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/ProblemStandaloneSetupGenerated.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/ProblemAntlrTokenFileProvider.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/ProblemParser.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.g create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.tokens create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblemLexer.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblemParser.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/scoping/AbstractProblemScopeProvider.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/serializer/ProblemSemanticSequencer.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/serializer/ProblemSyntacticSequencer.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/services/ProblemGrammarAccess.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/validation/AbstractProblemValidator.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/validation/ProblemConfigurableIssueCodesProvider.java create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/test/java/org/eclipse/viatra/solver/language/tests/ProblemParsingTest.xtend create mode 100644 org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/test/xtext-gen/org/eclipse/viatra/solver/language/tests/ProblemInjectorProvider.java (limited to 'org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language') diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.classpath b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.classpath new file mode 100644 index 00000000..01bce195 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.classpath @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.gitignore b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.gitignore new file mode 100644 index 00000000..84c048a7 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.launch/Generate Problem (problem) Language Infrastructure.launch b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.launch/Generate Problem (problem) Language Infrastructure.launch new file mode 100644 index 00000000..042ecc17 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.launch/Generate Problem (problem) Language Infrastructure.launch @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.project b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.project new file mode 100644 index 00000000..bbe16f36 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.project @@ -0,0 +1,29 @@ + + + org.eclipse.viatra.solver.language + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + org.eclipse.xtext.ui.shared.xtextNature + org.eclipse.jdt.core.javanature + + diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.settings/org.eclipse.core.resources.prefs b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..99f26c02 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..7adc0fb9 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/build.gradle b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/build.gradle new file mode 100644 index 00000000..558f08bb --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/build.gradle @@ -0,0 +1,42 @@ +dependencies { + testCompile 'org.junit.jupiter:junit-jupiter-api' + testRuntime 'org.junit.jupiter:junit-jupiter-engine' + testCompile "org.eclipse.xtext:org.eclipse.xtext.testing:${xtextVersion}" + testCompile "org.eclipse.xtext:org.eclipse.xtext.xbase.testing:${xtextVersion}" + compile "org.eclipse.xtext:org.eclipse.xtext:${xtextVersion}" + compile "org.eclipse.xtext:org.eclipse.xtext.xbase:${xtextVersion}" + compile 'org.eclipse.emf:org.eclipse.emf.ecore' + compile project(':org.eclipse.viatra.solver.language.model') +} + +configurations { + mwe2 { + extendsFrom compile + } +} + +dependencies { + mwe2 'org.eclipse.emf:org.eclipse.emf.mwe2.launch' + mwe2 "org.eclipse.xtext:org.eclipse.xtext.common.types:${xtextVersion}" + mwe2 "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}" + mwe2 'org.eclipse.xtext:xtext-antlr-generator' +} + +task generateXtextLanguage(type: JavaExec) { + main = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher' + classpath = configurations.mwe2 + inputs.file "src/main/java/org/eclipse/viatra/solver/language/GenerateProblem.mwe2" + inputs.file "src/main/java/org/eclipse/viatra/solver/language/Problem.xtext" + outputs.dir "src/main/xtext-gen" + args += "src/main/java/org/eclipse/viatra/solver/language/GenerateProblem.mwe2" + args += "-p" + args += "rootPath=/${projectDir}/.." +} + +test { + useJUnitPlatform() +} + +generateXtext.dependsOn(generateXtextLanguage) +clean.dependsOn(cleanGenerateXtextLanguage) +eclipse.classpath.plusConfigurations += [configurations.mwe2] diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/GenerateProblem.mwe2 b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/GenerateProblem.mwe2 new file mode 100644 index 00000000..46812355 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/GenerateProblem.mwe2 @@ -0,0 +1,54 @@ +module org.eclipse.viatra.solver.language.GenerateProblem + +import org.eclipse.xtext.xtext.generator.* +import org.eclipse.xtext.xtext.generator.model.project.* + +var rootPath = ".." + +Workflow { + component = XtextGenerator { + configuration = { + project = StandardProjectConfig { + baseName = "org.eclipse.viatra.solver.language" + rootPath = rootPath + runtimeTest = { + enabled = true + } + web = { + enabled = true + } + mavenLayout = true + } + code = { + encoding = "UTF-8" + lineDelimiter = "\n" + fileHeader = "/*\n * generated by Xtext \${version}\n */" + preferXtendStubs = false + } + } + + language = StandardLanguage { + name = "org.eclipse.viatra.solver.language.Problem" + fileExtensions = "problem" + referencedResource = "platform:/resource/org.eclipse.viatra.solver.language.model/model/problem.genmodel" + + serializer = { + generateStub = false + } + validator = { + // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" + // Generates checks for @Deprecated grammar annotations, an IssueProvider and a corresponding PropertyPage + generateDeprecationValidation = true + } + generator = { + generateXtendStub = true + } + junitSupport = { + junitVersion = "5" + } + webSupport = { + framework = "CodeMirror" + } + } + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext new file mode 100644 index 00000000..81c18d0d --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/Problem.xtext @@ -0,0 +1,88 @@ +grammar org.eclipse.viatra.solver.language.Problem with org.eclipse.xtext.common.Terminals + +import "http://www.eclipse.org/emf/2002/Ecore" as ecore +import "http://www.eclipse.org/viatra/solver/language/model/Problem" + +Problem: + statements+=Statement*; + +Statement: + ClassDeclaration | PredicateDefinition | Assertion | ScopeDeclaration; + +ClassDeclaration: + abstract?="abstract"? "class" + name=ID + ("extends" (superTypes+=[ClassDeclaration] | + "[" (superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? "]") | + referenceDeclarations+=ReferenceDeclaration)? + ("," referenceDeclarations+=ReferenceDeclaration)* + "."; + +ReferenceDeclaration: + (containment?="contains" | "refers") + referenceType=[ClassDeclaration] + "[" multiplicity=Multiplicity "]" + name=ID + ("opposite" opposite=[ReferenceDeclaration|QualifiedName])?; + +PredicateDefinition: + (error?="error" "pred"? | "pred") + name=ID + "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" + (":=" bodies+=Conjunction (";" bodies+=Conjunction)*)? + "."; + +Parameter: + parameterType=[ClassDeclaration] name=ID; + +Conjunction: + literals+=Literal ("," literals+=Literal)*; + +Literal: + Atom | NegativeLiteral; + +NegativeLiteral: + "!" atom=Atom; + +Atom: + relation=[Relation|QualifiedName] + transitiveClosure?="+"? + "(" (arguments+=[Variable] ("," arguments+=[Variable])*)? ")"; + +Assertion: + (relation=[Relation|QualifiedName] + "(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")" + ":" value=LogicValue | + value=ShortLogicValue? + relation=[Relation|QualifiedName] + "(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")") + "."; + +enum LogicValue: + TRUE="true" | FALSE="false" | UNKNOWN="unknown"; + +enum ShortLogicValue returns LogicValue: + FALSE="!" | UNKNOWN="?"; + +ScopeDeclaration: + "scope" typeScopes+=TypeScope ("," typeScopes+=TypeScope)* "."; + +TypeScope: + targetType=[ClassDeclaration] + (increment?="+=" | "=") + multiplicity=Multiplicity; + +Multiplicity: + RangeMultiplicity | ExactMultiplicity; + +RangeMultiplicity: + lowerBound=INT ".." upperBound=UpperBound; + +ExactMultiplicity: + exactValue=INT; + +UpperBound returns ecore::EInt: + INT | "*"; + +QualifiedName: + ID ("::" ID)*; diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/ProblemRuntimeModule.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/ProblemRuntimeModule.java new file mode 100644 index 00000000..b2a3218c --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/ProblemRuntimeModule.java @@ -0,0 +1,86 @@ +/* + * generated by Xtext 2.25.0 + */ +package org.eclipse.viatra.solver.language; + +import org.eclipse.viatra.solver.language.conversion.ProblemValueConverterService; +import org.eclipse.viatra.solver.language.naming.ProblemQualifiedNameConverter; +import org.eclipse.viatra.solver.language.naming.ProblemQualifiedNameProvider; +import org.eclipse.viatra.solver.language.resource.ProblemDerivedStateComputer; +import org.eclipse.viatra.solver.language.resource.ProblemLocationInFileProvider; +import org.eclipse.viatra.solver.language.resource.ProblemResourceDescriptionStrategy; +import org.eclipse.viatra.solver.language.scoping.ProblemGlobalScopeProvider; +import org.eclipse.xtext.conversion.IValueConverterService; +import org.eclipse.xtext.naming.IQualifiedNameConverter; +import org.eclipse.xtext.naming.IQualifiedNameProvider; +import org.eclipse.xtext.resource.DerivedStateAwareResource; +import org.eclipse.xtext.resource.DerivedStateAwareResourceDescriptionManager; +import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy; +import org.eclipse.xtext.resource.IDerivedStateComputer; +import org.eclipse.xtext.resource.ILocationInFileProvider; +import org.eclipse.xtext.resource.IResourceDescription; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.scoping.IGlobalScopeProvider; +import org.eclipse.xtext.scoping.IScopeProvider; +import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; +import org.eclipse.xtext.scoping.impl.SimpleLocalScopeProvider; +import org.eclipse.xtext.validation.IResourceValidator; +import org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator; + +import com.google.inject.Binder; +import com.google.inject.name.Names; + +/** + * Use this class to register components to be used at runtime / without the + * Equinox extension registry. + */ +public class ProblemRuntimeModule extends AbstractProblemRuntimeModule { + public Class bindIQualifiedNameConverter() { + return ProblemQualifiedNameConverter.class; + } + + public Class bindIQualifiedNameProvider() { + return ProblemQualifiedNameProvider.class; + } + + public Class bindIDefaultResourceDescriptionStrategy() { + return ProblemResourceDescriptionStrategy.class; + } + + @Override + public Class bindIValueConverterService() { + return ProblemValueConverterService.class; + } + + @Override + public void configureIScopeProviderDelegate(Binder binder) { + binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)) + .to(SimpleLocalScopeProvider.class); + } + + @Override + public Class bindIGlobalScopeProvider() { + return ProblemGlobalScopeProvider.class; + } + + @Override + public Class bindXtextResource() { + return DerivedStateAwareResource.class; + } + + public Class bindIResourceDescription$Manager() { + return DerivedStateAwareResourceDescriptionManager.class; + } + + public Class bindIResourceValidator() { + return DerivedStateAwareResourceValidator.class; + } + + public Class bindIDerivedStateComputer() { + return ProblemDerivedStateComputer.class; + } + + public Class bindILocationInFileProvider() { + return ProblemLocationInFileProvider.class; + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/ProblemStandaloneSetup.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/ProblemStandaloneSetup.java new file mode 100644 index 00000000..5652f859 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/ProblemStandaloneSetup.java @@ -0,0 +1,26 @@ +/* + * generated by Xtext 2.25.0 + */ +package org.eclipse.viatra.solver.language; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.viatra.solver.language.model.problem.ProblemPackage; + +import com.google.inject.Injector; + +/** + * Initialization support for running Xtext languages without Equinox extension registry. + */ +public class ProblemStandaloneSetup extends ProblemStandaloneSetupGenerated { + + public static void doSetup() { + new ProblemStandaloneSetup().createInjectorAndDoEMFRegistration(); + } + + @Override + public Injector createInjectorAndDoEMFRegistration() { + if (!EPackage.Registry.INSTANCE.containsKey(ProblemPackage.eNS_URI)) + EPackage.Registry.INSTANCE.put(ProblemPackage.eNS_URI, ProblemPackage.eINSTANCE); + return super.createInjectorAndDoEMFRegistration(); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/conversion/ProblemValueConverterService.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/conversion/ProblemValueConverterService.java new file mode 100644 index 00000000..4f5fd069 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/conversion/ProblemValueConverterService.java @@ -0,0 +1,17 @@ +package org.eclipse.viatra.solver.language.conversion; + +import org.eclipse.xtext.common.services.DefaultTerminalConverters; +import org.eclipse.xtext.conversion.IValueConverter; +import org.eclipse.xtext.conversion.ValueConverter; + +import com.google.inject.Inject; + +public class ProblemValueConverterService extends DefaultTerminalConverters { + @Inject + private UpperBoundValueConverter upperBoundValueConverter; + + @ValueConverter(rule = "UpperBound") + public IValueConverter UpperBound() { + return upperBoundValueConverter; + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/conversion/UpperBoundValueConverter.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/conversion/UpperBoundValueConverter.java new file mode 100644 index 00000000..3111b69b --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/conversion/UpperBoundValueConverter.java @@ -0,0 +1,35 @@ +package org.eclipse.viatra.solver.language.conversion; + +import org.eclipse.xtext.conversion.ValueConverterException; +import org.eclipse.xtext.conversion.impl.AbstractValueConverter; +import org.eclipse.xtext.conversion.impl.INTValueConverter; +import org.eclipse.xtext.nodemodel.INode; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +@Singleton +public class UpperBoundValueConverter extends AbstractValueConverter { + public static final String INFINITY = "*"; + + @Inject + private INTValueConverter intValueConverter; + + @Override + public Integer toValue(String string, INode node) throws ValueConverterException { + if (INFINITY.equals(string)) { + return -1; + } else { + return intValueConverter.toValue(string, node); + } + } + + @Override + public String toString(Integer value) throws ValueConverterException { + if (value < 0) { + return INFINITY; + } else { + return intValueConverter.toString(value); + } + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/generator/ProblemGenerator.xtend b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/generator/ProblemGenerator.xtend new file mode 100644 index 00000000..0930f244 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/generator/ProblemGenerator.xtend @@ -0,0 +1,25 @@ +/* + * generated by Xtext 2.25.0 + */ +package org.eclipse.viatra.solver.language.generator + +import org.eclipse.emf.ecore.resource.Resource +import org.eclipse.xtext.generator.AbstractGenerator +import org.eclipse.xtext.generator.IFileSystemAccess2 +import org.eclipse.xtext.generator.IGeneratorContext + +/** + * Generates code from your model files on save. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation + */ +class ProblemGenerator extends AbstractGenerator { + + override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) { +// fsa.generateFile('greetings.txt', 'People to greet: ' + +// resource.allContents +// .filter(Greeting) +// .map[name] +// .join(', ')) + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/naming/ProblemQualifiedNameConverter.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/naming/ProblemQualifiedNameConverter.java new file mode 100644 index 00000000..ebb7e7b4 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/naming/ProblemQualifiedNameConverter.java @@ -0,0 +1,13 @@ +package org.eclipse.viatra.solver.language.naming; + +import org.eclipse.xtext.naming.IQualifiedNameConverter; + +import com.google.inject.Singleton; + +@Singleton +public class ProblemQualifiedNameConverter extends IQualifiedNameConverter.DefaultImpl { + @Override + public String getDelimiter() { + return "::"; + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/naming/ProblemQualifiedNameProvider.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/naming/ProblemQualifiedNameProvider.java new file mode 100644 index 00000000..81365724 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/naming/ProblemQualifiedNameProvider.java @@ -0,0 +1,15 @@ +package org.eclipse.viatra.solver.language.naming; + +import org.eclipse.viatra.solver.language.model.problem.Node; +import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider; +import org.eclipse.xtext.naming.QualifiedName; + +public class ProblemQualifiedNameProvider extends DefaultDeclarativeQualifiedNameProvider { + public QualifiedName qualifiedName(Node node) { + String name = node.getName(); + if (name == null || name.isEmpty()) { + return null; + } + return getConverter().toQualifiedName(name); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemDerivedStateComputer.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemDerivedStateComputer.java new file mode 100644 index 00000000..571b5745 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemDerivedStateComputer.java @@ -0,0 +1,218 @@ +package org.eclipse.viatra.solver.language.resource; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.viatra.solver.language.model.problem.Assertion; +import org.eclipse.viatra.solver.language.model.problem.Atom; +import org.eclipse.viatra.solver.language.model.problem.ClassDeclaration; +import org.eclipse.viatra.solver.language.model.problem.Conjunction; +import org.eclipse.viatra.solver.language.model.problem.ExistentialQuantifier; +import org.eclipse.viatra.solver.language.model.problem.ImplicitVariable; +import org.eclipse.viatra.solver.language.model.problem.Literal; +import org.eclipse.viatra.solver.language.model.problem.NegativeLiteral; +import org.eclipse.viatra.solver.language.model.problem.Node; +import org.eclipse.viatra.solver.language.model.problem.Parameter; +import org.eclipse.viatra.solver.language.model.problem.PredicateDefinition; +import org.eclipse.viatra.solver.language.model.problem.Problem; +import org.eclipse.viatra.solver.language.model.problem.ProblemFactory; +import org.eclipse.viatra.solver.language.model.problem.ProblemPackage; +import org.eclipse.viatra.solver.language.model.problem.Statement; +import org.eclipse.xtext.linking.impl.LinkingHelper; +import org.eclipse.xtext.naming.IQualifiedNameConverter; +import org.eclipse.xtext.naming.QualifiedName; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.nodemodel.util.NodeModelUtils; +import org.eclipse.xtext.resource.DerivedStateAwareResource; +import org.eclipse.xtext.resource.IDerivedStateComputer; +import org.eclipse.xtext.scoping.IGlobalScopeProvider; +import org.eclipse.xtext.scoping.IScope; + +import com.google.common.base.Predicates; +import com.google.inject.Inject; +import com.google.inject.Singleton; + +@Singleton +public class ProblemDerivedStateComputer implements IDerivedStateComputer { + public static final String NEW_NODE = "new"; + + private static final String ID_REGEX_STRING = "[_a-zA-Z][_0-9a-zA-Z]*"; + + private static final Pattern ID_REGEX = Pattern.compile(ID_REGEX_STRING); + + private static final Pattern QUALIFIED_NAME_REGEX = Pattern + .compile(ID_REGEX_STRING + "(::" + ID_REGEX_STRING + ")*"); + + @Inject + private LinkingHelper linkingHelper; + + @Inject + private IQualifiedNameConverter qualifiedNameConverter; + + @Inject + private IGlobalScopeProvider scopeProvider; + + @Override + public void installDerivedState(DerivedStateAwareResource resource, boolean preLinkingPhase) { + for (EObject object : resource.getContents()) { + if (object instanceof Problem) { + installDerivedProblemState((Problem) object, preLinkingPhase); + } + } + } + + protected void installDerivedProblemState(Problem problem, boolean preLinkingPhase) { + Set nodeNames = new HashSet<>(); + if (!preLinkingPhase) { + installDerivedNodes(problem); + } + for (Statement statement : problem.getStatements()) { + if (statement instanceof PredicateDefinition) { + PredicateDefinition definition = (PredicateDefinition) statement; + installDerivedPredicateDefinitionState(definition); + } + } + List grapNodes = problem.getNodes(); + for (String nodeName : nodeNames) { + Node graphNode = ProblemFactory.eINSTANCE.createNode(); + graphNode.setName(nodeName); + grapNodes.add(graphNode); + } + } + + protected void installDerivedNodes(Problem problem) { + IScope nodeScope = scopeProvider.getScope(problem.eResource(), ProblemPackage.Literals.ASSERTION__ARGUMENTS, + Predicates.alwaysTrue()); + Set nodeNames = new HashSet<>(); + for (Statement statement : problem.getStatements()) { + if (statement instanceof ClassDeclaration) { + ClassDeclaration declaration = (ClassDeclaration) statement; + if (!declaration.isAbstract()) { + String className = declaration.getName(); + if (validId(className)) { + QualifiedName qualifiedName = QualifiedName.create(className, NEW_NODE); + String nodeName = qualifiedNameConverter.toString(qualifiedName); + nodeNames.add(nodeName); + } + } + } + } + for (Statement statement : problem.getStatements()) { + if (statement instanceof Assertion) { + Assertion assertion = (Assertion) statement; + List nodes = NodeModelUtils.findNodesForFeature(assertion, + ProblemPackage.Literals.ASSERTION__ARGUMENTS); + for (INode node : nodes) { + String nodeName = linkingHelper.getCrossRefNodeAsString(node, true); + if (validQualifiedName(nodeName)) { + QualifiedName qualifiedName = qualifiedNameConverter.toQualifiedName(nodeName); + if (nodeScope.getSingleElement(qualifiedName) == null) { + nodeNames.add(nodeName); + } + } + } + } + } + List grapNodes = problem.getNodes(); + for (String nodeName : nodeNames) { + Node graphNode = ProblemFactory.eINSTANCE.createNode(); + graphNode.setName(nodeName); + grapNodes.add(graphNode); + } + } + + protected void installDerivedPredicateDefinitionState(PredicateDefinition definition) { + Set parameterNames = new HashSet<>(); + for (Parameter parameter : definition.getParameters()) { + String name = parameter.getName(); + if (name != null) { + parameterNames.add(name); + } + } + for (Conjunction body : definition.getBodies()) { + installDeriveConjunctionState(body, parameterNames); + } + } + + protected void installDeriveConjunctionState(Conjunction conjunction, Set knownVariables) { + Set newVariables = new HashSet<>(); + for (Literal literal : conjunction.getLiterals()) { + if (literal instanceof Atom) { + Atom atom = (Atom) literal; + collectVariables(atom, knownVariables, newVariables); + } + } + createVariables(conjunction, newVariables); + newVariables.addAll(knownVariables); + for (Literal literal : conjunction.getLiterals()) { + if (literal instanceof NegativeLiteral) { + NegativeLiteral negativeLiteral = (NegativeLiteral) literal; + installDeriveNegativeLiteralState(negativeLiteral, newVariables); + } + } + } + + protected void installDeriveNegativeLiteralState(NegativeLiteral negativeLiteral, Set knownVariables) { + Set newVariables = new HashSet<>(); + collectVariables(negativeLiteral.getAtom(), knownVariables, newVariables); + createVariables(negativeLiteral, newVariables); + } + + protected void collectVariables(Atom atom, Set knownVariables, Set newVariables) { + List nodes = NodeModelUtils.findNodesForFeature(atom, ProblemPackage.Literals.ATOM__ARGUMENTS); + for (INode node : nodes) { + String variableName = linkingHelper.getCrossRefNodeAsString(node, true); + if (!knownVariables.contains(variableName)) { + newVariables.add(variableName); + } + } + } + + protected void createVariables(ExistentialQuantifier quantifier, Set newVariables) { + for (String variableName : newVariables) { + if (validId(variableName)) { + ImplicitVariable variable = ProblemFactory.eINSTANCE.createImplicitVariable(); + variable.setName(variableName); + quantifier.getImplicitVariables().add(variable); + } + } + } + + @Override + public void discardDerivedState(DerivedStateAwareResource resource) { + for (EObject object : resource.getContents()) { + if (object instanceof Problem) { + discardDerivedProblemState((Problem) object); + } + } + } + + protected void discardDerivedProblemState(Problem problem) { + problem.getNodes().clear(); + for (Statement statement : problem.getStatements()) { + if (statement instanceof PredicateDefinition) { + PredicateDefinition definition = (PredicateDefinition) statement; + for (Conjunction body : definition.getBodies()) { + body.getImplicitVariables().clear(); + for (Literal literal : body.getLiterals()) { + if (literal instanceof NegativeLiteral) { + NegativeLiteral negativeLiteral = (NegativeLiteral) literal; + negativeLiteral.getImplicitVariables().clear(); + } + } + } + } + } + } + + protected static boolean validId(String name) { + return name != null && ID_REGEX.matcher(name).matches(); + } + + protected static boolean validQualifiedName(String name) { + return name != null && QUALIFIED_NAME_REGEX.matcher(name).matches(); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemLocationInFileProvider.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemLocationInFileProvider.java new file mode 100644 index 00000000..dfffc7ef --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemLocationInFileProvider.java @@ -0,0 +1,130 @@ +package org.eclipse.viatra.solver.language.resource; + +import java.util.Iterator; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.viatra.solver.language.model.problem.Assertion; +import org.eclipse.viatra.solver.language.model.problem.Atom; +import org.eclipse.viatra.solver.language.model.problem.Conjunction; +import org.eclipse.viatra.solver.language.model.problem.ImplicitVariable; +import org.eclipse.viatra.solver.language.model.problem.Literal; +import org.eclipse.viatra.solver.language.model.problem.NegativeLiteral; +import org.eclipse.viatra.solver.language.model.problem.Node; +import org.eclipse.viatra.solver.language.model.problem.Problem; +import org.eclipse.viatra.solver.language.model.problem.ProblemPackage; +import org.eclipse.viatra.solver.language.model.problem.Statement; +import org.eclipse.xtext.EcoreUtil2; +import org.eclipse.xtext.naming.IQualifiedNameProvider; +import org.eclipse.xtext.naming.QualifiedName; +import org.eclipse.xtext.resource.DefaultLocationInFileProvider; +import org.eclipse.xtext.resource.IEObjectDescription; +import org.eclipse.xtext.scoping.IScope; +import org.eclipse.xtext.scoping.IScopeProvider; +import org.eclipse.xtext.util.ITextRegion; + +import com.google.inject.Inject; + +public class ProblemLocationInFileProvider extends DefaultLocationInFileProvider { + @Inject + private IQualifiedNameProvider qualifiedNameProvider; + + @Inject + private IScopeProvider scopeProvider; + + @Override + protected ITextRegion doGetTextRegion(EObject obj, RegionDescription query) { + if (obj instanceof Node) { + return getNodeTextRegion((Node) obj, query); + } + if (obj instanceof ImplicitVariable) { + return getVariableTextRegion((ImplicitVariable) obj, query); + } + return super.doGetTextRegion(obj, query); + } + + protected ITextRegion getNodeTextRegion(Node node, RegionDescription query) { + ITextRegion newNodeRegion = getNewNodeTextRegion(node, query); + if (newNodeRegion != null) { + return newNodeRegion; + } + return getNodeFirstReferenceTextRegion(node, query); + } + + protected ITextRegion getNewNodeTextRegion(Node node, RegionDescription query) { + QualifiedName nodeName = qualifiedNameProvider.getFullyQualifiedName(node); + if (nodeName == null || nodeName.getSegmentCount() <= 1) { + return null; + } + if (ProblemDerivedStateComputer.NEW_NODE.equals(nodeName.getLastSegment())) { + QualifiedName className = nodeName.skipLast(1); + IScope classScope = scopeProvider.getScope(node, ProblemPackage.Literals.ASSERTION__RELATION); + IEObjectDescription description = classScope.getSingleElement(className); + if (description == null) { + return null; + } + EObject classDeclaration = description.getEObjectOrProxy(); + if (!classDeclaration.eIsProxy()) { + return doGetTextRegion(classDeclaration, query); + } + } + return null; + } + + protected ITextRegion getNodeFirstReferenceTextRegion(Node node, RegionDescription query) { + Problem problem = EcoreUtil2.getContainerOfType(node, Problem.class); + if (problem == null) { + return ITextRegion.EMPTY_REGION; + } + for (Statement statement : problem.getStatements()) { + if (statement instanceof Assertion) { + Assertion assertion = (Assertion) statement; + int index = assertion.getArguments().indexOf(node); + if (index >= 0) { + return doGetLocationOfFeature(assertion, ProblemPackage.Literals.ASSERTION__ARGUMENTS, index, + query); + } + } + } + return ITextRegion.EMPTY_REGION; + } + + protected ITextRegion getVariableTextRegion(ImplicitVariable variable, RegionDescription query) { + EObject container = variable.eContainer(); + if (container instanceof Conjunction) { + return getFirstReferenceToVariableInConjunction(variable, (Conjunction) container, query); + } + if (container instanceof NegativeLiteral) { + return getFirstReferenceToVariableInNegativeLiteral(variable, (NegativeLiteral) container, query); + } + return ITextRegion.EMPTY_REGION; + } + + protected ITextRegion getFirstReferenceToVariableInConjunction(ImplicitVariable variable, Conjunction conjunction, + RegionDescription query) { + Iterator iterator = conjunction.getLiterals().iterator(); + ITextRegion found = ITextRegion.EMPTY_REGION; + while (found == ITextRegion.EMPTY_REGION && iterator.hasNext()) { + Literal literal = iterator.next(); + if (literal instanceof Atom) { + found = getFirstReferenceToVariableInAtom(variable, (Atom) literal, query); + } else if (literal instanceof NegativeLiteral) { + found = getFirstReferenceToVariableInNegativeLiteral(variable, (NegativeLiteral) literal, query); + } + } + return found; + } + + protected ITextRegion getFirstReferenceToVariableInNegativeLiteral(ImplicitVariable variable, + NegativeLiteral literal, RegionDescription query) { + return getFirstReferenceToVariableInAtom(variable, literal.getAtom(), query); + } + + protected ITextRegion getFirstReferenceToVariableInAtom(ImplicitVariable variable, Atom atom, + RegionDescription query) { + int index = atom.getArguments().indexOf(variable); + if (index >= 0) { + return doGetLocationOfFeature(atom, ProblemPackage.Literals.ATOM__ARGUMENTS, index, query); + } + return ITextRegion.EMPTY_REGION; + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemResourceDescriptionStrategy.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemResourceDescriptionStrategy.java new file mode 100644 index 00000000..7b37ffd6 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/resource/ProblemResourceDescriptionStrategy.java @@ -0,0 +1,39 @@ +package org.eclipse.viatra.solver.language.resource; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.viatra.solver.language.model.problem.ReferenceDeclaration; +import org.eclipse.viatra.solver.language.model.problem.Variable; +import org.eclipse.xtext.naming.QualifiedName; +import org.eclipse.xtext.resource.IEObjectDescription; +import org.eclipse.xtext.resource.impl.AliasedEObjectDescription; +import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy; +import org.eclipse.xtext.util.IAcceptor; + +import com.google.inject.Singleton; + +@Singleton +public class ProblemResourceDescriptionStrategy extends DefaultResourceDescriptionStrategy { + @Override + public boolean createEObjectDescriptions(EObject eObject, IAcceptor acceptor) { + IAcceptor wrappedAcceptor; + if (eObject instanceof Variable) { + return false; + } + if (eObject instanceof ReferenceDeclaration) { + wrappedAcceptor = new IAcceptor() { + public void accept(IEObjectDescription description) { + acceptor.accept(description); + QualifiedName qualifiedName = description.getQualifiedName(); + if (qualifiedName.getSegmentCount() >= 2) { + QualifiedName simpleName = QualifiedName.create(qualifiedName.getLastSegment()); + IEObjectDescription aliasedDescription = new AliasedEObjectDescription(simpleName, description); + acceptor.accept(aliasedDescription); + } + }; + }; + } else { + wrappedAcceptor = acceptor; + } + return super.createEObjectDescriptions(eObject, wrappedAcceptor); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/scoping/ProblemGlobalScopeProvider.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/scoping/ProblemGlobalScopeProvider.java new file mode 100644 index 00000000..cf01999a --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/scoping/ProblemGlobalScopeProvider.java @@ -0,0 +1,19 @@ +package org.eclipse.viatra.solver.language.scoping; + +import java.util.LinkedHashSet; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider; + +public class ProblemGlobalScopeProvider extends ImportUriGlobalScopeProvider { + public static final URI LIBRARY_URI = URI.createURI(ProblemGlobalScopeProvider.class.getClassLoader() + .getResource("org/eclipse/viatra/solver/language/library.problem").toString()); + + @Override + protected LinkedHashSet getImportedUris(Resource resource) { + LinkedHashSet importedUris = super.getImportedUris(resource); + importedUris.add(LIBRARY_URI); + return importedUris; + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/scoping/ProblemScopeProvider.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/scoping/ProblemScopeProvider.java new file mode 100644 index 00000000..254284a8 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/scoping/ProblemScopeProvider.java @@ -0,0 +1,74 @@ +/* + * generated by Xtext 2.25.0 + */ +package org.eclipse.viatra.solver.language.scoping; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.viatra.solver.language.model.problem.ClassDeclaration; +import org.eclipse.viatra.solver.language.model.problem.ExistentialQuantifier; +import org.eclipse.viatra.solver.language.model.problem.PredicateDefinition; +import org.eclipse.viatra.solver.language.model.problem.Problem; +import org.eclipse.viatra.solver.language.model.problem.ProblemPackage; +import org.eclipse.viatra.solver.language.model.problem.ReferenceDeclaration; +import org.eclipse.viatra.solver.language.model.problem.Statement; +import org.eclipse.viatra.solver.language.model.problem.Variable; +import org.eclipse.xtext.EcoreUtil2; +import org.eclipse.xtext.naming.QualifiedName; +import org.eclipse.xtext.scoping.IScope; +import org.eclipse.xtext.scoping.Scopes; + +import com.google.common.collect.ImmutableList; + +/** + * This class contains custom scoping description. + * + * See + * https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping + * on how and when to use it. + */ +public class ProblemScopeProvider extends AbstractProblemScopeProvider { + + @Override + public IScope getScope(EObject context, EReference reference) { + IScope scope = super.getScope(context, reference); + if (reference == ProblemPackage.Literals.ATOM__ARGUMENTS) { + return getVariableScope(context, scope); + } else if (EcoreUtil2.isAssignableFrom(reference.getEReferenceType(), + ProblemPackage.Literals.REFERENCE_DECLARATION)) { + Problem problem = EcoreUtil2.getContainerOfType(context, Problem.class); + if (problem == null) { + return scope; + } + ImmutableList.Builder builder = ImmutableList.builder(); + for (Statement statement : problem.getStatements()) { + if (statement instanceof ClassDeclaration) { + ClassDeclaration classDeclaration = (ClassDeclaration) statement; + builder.addAll(classDeclaration.getReferenceDeclarations()); + } + } + return Scopes.scopeFor(builder.build(), scope); + } + return scope; + } + + protected IScope getVariableScope(EObject context, IScope delegateScope) { + List variables = new ArrayList<>(); + EObject currentContext = context; + while (currentContext != null && !(currentContext instanceof PredicateDefinition)) { + if (currentContext instanceof ExistentialQuantifier) { + ExistentialQuantifier quantifier = (ExistentialQuantifier) currentContext; + variables.addAll(quantifier.getImplicitVariables()); + } + currentContext = currentContext.eContainer(); + } + if (currentContext instanceof PredicateDefinition) { + PredicateDefinition definition = (PredicateDefinition) currentContext; + variables.addAll(definition.getParameters()); + } + return Scopes.scopeFor(variables); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/validation/ProblemValidator.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/validation/ProblemValidator.java new file mode 100644 index 00000000..2b17e222 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/java/org/eclipse/viatra/solver/language/validation/ProblemValidator.java @@ -0,0 +1,25 @@ +/* + * generated by Xtext 2.25.0 + */ +package org.eclipse.viatra.solver.language.validation; + + +/** + * This class contains custom validation rules. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation + */ +public class ProblemValidator extends AbstractProblemValidator { + +// public static final String INVALID_NAME = "invalidName"; +// +// @Check +// public void checkGreetingStartsWithCapital(Greeting greeting) { +// if (!Character.isUpperCase(greeting.getName().charAt(0))) { +// warning("Name should start with a capital", +// ProblemPackage.Literals.GREETING__NAME, +// INVALID_NAME); +// } +// } + +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/resources/org/eclipse/viatra/solver/language/library.problem b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/resources/org/eclipse/viatra/solver/language/library.problem new file mode 100644 index 00000000..77f26b70 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/resources/org/eclipse/viatra/solver/language/library.problem @@ -0,0 +1,4 @@ +abstract class node + refers node[0..*] equals opposite equals. + +predicate exists(node node). \ No newline at end of file diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/AbstractProblemRuntimeModule.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/AbstractProblemRuntimeModule.java new file mode 100644 index 00000000..642b465b --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/AbstractProblemRuntimeModule.java @@ -0,0 +1,201 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language; + +import com.google.inject.Binder; +import com.google.inject.Provider; +import com.google.inject.name.Names; +import java.util.Properties; +import org.eclipse.viatra.solver.language.generator.ProblemGenerator; +import org.eclipse.viatra.solver.language.parser.antlr.ProblemAntlrTokenFileProvider; +import org.eclipse.viatra.solver.language.parser.antlr.ProblemParser; +import org.eclipse.viatra.solver.language.parser.antlr.internal.InternalProblemLexer; +import org.eclipse.viatra.solver.language.scoping.ProblemScopeProvider; +import org.eclipse.viatra.solver.language.serializer.ProblemSemanticSequencer; +import org.eclipse.viatra.solver.language.serializer.ProblemSyntacticSequencer; +import org.eclipse.viatra.solver.language.services.ProblemGrammarAccess; +import org.eclipse.viatra.solver.language.validation.ProblemConfigurableIssueCodesProvider; +import org.eclipse.viatra.solver.language.validation.ProblemValidator; +import org.eclipse.xtext.Constants; +import org.eclipse.xtext.IGrammarAccess; +import org.eclipse.xtext.generator.IGenerator2; +import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider; +import org.eclipse.xtext.naming.IQualifiedNameProvider; +import org.eclipse.xtext.parser.IParser; +import org.eclipse.xtext.parser.ITokenToStringConverter; +import org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider; +import org.eclipse.xtext.parser.antlr.AntlrTokenToStringConverter; +import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; +import org.eclipse.xtext.parser.antlr.ITokenDefProvider; +import org.eclipse.xtext.parser.antlr.Lexer; +import org.eclipse.xtext.parser.antlr.LexerBindings; +import org.eclipse.xtext.parser.antlr.LexerProvider; +import org.eclipse.xtext.resource.IContainer; +import org.eclipse.xtext.resource.IResourceDescriptions; +import org.eclipse.xtext.resource.containers.IAllContainersState; +import org.eclipse.xtext.resource.containers.ResourceSetBasedAllContainersStateProvider; +import org.eclipse.xtext.resource.containers.StateBasedContainerManager; +import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; +import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions; +import org.eclipse.xtext.scoping.IGlobalScopeProvider; +import org.eclipse.xtext.scoping.IScopeProvider; +import org.eclipse.xtext.scoping.IgnoreCaseLinking; +import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; +import org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider; +import org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider; +import org.eclipse.xtext.serializer.ISerializer; +import org.eclipse.xtext.serializer.impl.Serializer; +import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; +import org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer; +import org.eclipse.xtext.service.DefaultRuntimeModule; +import org.eclipse.xtext.service.SingletonBinding; +import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider; + +/** + * Manual modifications go to {@link ProblemRuntimeModule}. + */ +@SuppressWarnings("all") +public abstract class AbstractProblemRuntimeModule extends DefaultRuntimeModule { + + protected Properties properties = null; + + @Override + public void configure(Binder binder) { + properties = tryBindProperties(binder, "org/eclipse/viatra/solver/language/Problem.properties"); + super.configure(binder); + } + + public void configureLanguageName(Binder binder) { + binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.viatra.solver.language.Problem"); + } + + public void configureFileExtensions(Binder binder) { + if (properties == null || properties.getProperty(Constants.FILE_EXTENSIONS) == null) + binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("problem"); + } + + // contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2 + public ClassLoader bindClassLoaderToInstance() { + return getClass().getClassLoader(); + } + + // contributed by org.eclipse.xtext.xtext.generator.grammarAccess.GrammarAccessFragment2 + public Class bindIGrammarAccess() { + return ProblemGrammarAccess.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISemanticSequencer() { + return ProblemSemanticSequencer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISyntacticSequencer() { + return ProblemSyntacticSequencer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2 + public Class bindISerializer() { + return Serializer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIParser() { + return ProblemParser.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindITokenToStringConverter() { + return AntlrTokenToStringConverter.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIAntlrTokenFileProvider() { + return ProblemAntlrTokenFileProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindLexer() { + return InternalProblemLexer.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindITokenDefProvider() { + return AntlrTokenDefProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Provider provideInternalProblemLexer() { + return LexerProvider.create(InternalProblemLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureRuntimeLexer(Binder binder) { + binder.bind(Lexer.class) + .annotatedWith(Names.named(LexerBindings.RUNTIME)) + .to(InternalProblemLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2 + @SingletonBinding(eager=true) + public Class bindProblemValidator() { + return ProblemValidator.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.validation.ValidatorFragment2 + public Class bindConfigurableIssueCodesProvider() { + return ProblemConfigurableIssueCodesProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public Class bindIScopeProvider() { + return ProblemScopeProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public void configureIScopeProviderDelegate(Binder binder) { + binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public Class bindIGlobalScopeProvider() { + return DefaultGlobalScopeProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.scoping.ImportNamespacesScopingFragment2 + public void configureIgnoreCaseLinking(Binder binder) { + binder.bindConstant().annotatedWith(IgnoreCaseLinking.class).to(false); + } + + // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2 + public Class bindIQualifiedNameProvider() { + return DefaultDeclarativeQualifiedNameProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindIContainer$Manager() { + return StateBasedContainerManager.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public Class bindIAllContainersState$Provider() { + return ResourceSetBasedAllContainersStateProvider.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public void configureIResourceDescriptions(Binder binder) { + binder.bind(IResourceDescriptions.class).to(ResourceSetBasedResourceDescriptions.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.builder.BuilderIntegrationFragment2 + public void configureIResourceDescriptionsPersisted(Binder binder) { + binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to(ResourceSetBasedResourceDescriptions.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.generator.GeneratorFragment2 + public Class bindIGenerator2() { + return ProblemGenerator.class; + } + +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/Problem.xtextbin b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/Problem.xtextbin new file mode 100644 index 00000000..d16365d7 Binary files /dev/null and b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/Problem.xtextbin differ diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/ProblemStandaloneSetupGenerated.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/ProblemStandaloneSetupGenerated.java new file mode 100644 index 00000000..0366f9cd --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/ProblemStandaloneSetupGenerated.java @@ -0,0 +1,37 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.ISetup; +import org.eclipse.xtext.common.TerminalsStandaloneSetup; +import org.eclipse.xtext.resource.IResourceFactory; +import org.eclipse.xtext.resource.IResourceServiceProvider; + +@SuppressWarnings("all") +public class ProblemStandaloneSetupGenerated implements ISetup { + + @Override + public Injector createInjectorAndDoEMFRegistration() { + TerminalsStandaloneSetup.doSetup(); + + Injector injector = createInjector(); + register(injector); + return injector; + } + + public Injector createInjector() { + return Guice.createInjector(new ProblemRuntimeModule()); + } + + public void register(Injector injector) { + IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class); + IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class); + + Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("problem", resourceFactory); + IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("problem", serviceProvider); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/ProblemAntlrTokenFileProvider.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/ProblemAntlrTokenFileProvider.java new file mode 100644 index 00000000..b7ecf3f6 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/ProblemAntlrTokenFileProvider.java @@ -0,0 +1,16 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.parser.antlr; + +import java.io.InputStream; +import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; + +public class ProblemAntlrTokenFileProvider implements IAntlrTokenFileProvider { + + @Override + public InputStream getAntlrTokenFile() { + ClassLoader classLoader = getClass().getClassLoader(); + return classLoader.getResourceAsStream("org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.tokens"); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/ProblemParser.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/ProblemParser.java new file mode 100644 index 00000000..3af86cab --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/ProblemParser.java @@ -0,0 +1,40 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.parser.antlr; + +import com.google.inject.Inject; +import org.eclipse.viatra.solver.language.parser.antlr.internal.InternalProblemParser; +import org.eclipse.viatra.solver.language.services.ProblemGrammarAccess; +import org.eclipse.xtext.parser.antlr.AbstractAntlrParser; +import org.eclipse.xtext.parser.antlr.XtextTokenStream; + +public class ProblemParser extends AbstractAntlrParser { + + @Inject + private ProblemGrammarAccess grammarAccess; + + @Override + protected void setInitialHiddenTokens(XtextTokenStream tokenStream) { + tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT"); + } + + + @Override + protected InternalProblemParser createParser(XtextTokenStream stream) { + return new InternalProblemParser(stream, getGrammarAccess()); + } + + @Override + protected String getDefaultRuleName() { + return "Problem"; + } + + public ProblemGrammarAccess getGrammarAccess() { + return this.grammarAccess; + } + + public void setGrammarAccess(ProblemGrammarAccess grammarAccess) { + this.grammarAccess = grammarAccess; + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.g b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.g new file mode 100644 index 00000000..61b76835 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.g @@ -0,0 +1,1522 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +grammar InternalProblem; + +options { + superClass=AbstractInternalAntlrParser; +} + +@lexer::header { +package org.eclipse.viatra.solver.language.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.viatra.solver.language.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.viatra.solver.language.services.ProblemGrammarAccess; + +} + +@parser::members { + + private ProblemGrammarAccess grammarAccess; + + public InternalProblemParser(TokenStream input, ProblemGrammarAccess grammarAccess) { + this(input); + this.grammarAccess = grammarAccess; + registerRules(grammarAccess.getGrammar()); + } + + @Override + protected String getFirstRuleName() { + return "Problem"; + } + + @Override + protected ProblemGrammarAccess getGrammarAccess() { + return grammarAccess; + } + +} + +@rulecatch { + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } +} + +// Entry rule entryRuleProblem +entryRuleProblem returns [EObject current=null]: + { newCompositeNode(grammarAccess.getProblemRule()); } + iv_ruleProblem=ruleProblem + { $current=$iv_ruleProblem.current; } + EOF; + +// Rule Problem +ruleProblem returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + { + newCompositeNode(grammarAccess.getProblemAccess().getStatementsStatementParserRuleCall_0()); + } + lv_statements_0_0=ruleStatement + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getProblemRule()); + } + add( + $current, + "statements", + lv_statements_0_0, + "org.eclipse.viatra.solver.language.Problem.Statement"); + afterParserOrEnumRuleCall(); + } + ) + )* +; + +// Entry rule entryRuleStatement +entryRuleStatement returns [EObject current=null]: + { newCompositeNode(grammarAccess.getStatementRule()); } + iv_ruleStatement=ruleStatement + { $current=$iv_ruleStatement.current; } + EOF; + +// Rule Statement +ruleStatement returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + { + newCompositeNode(grammarAccess.getStatementAccess().getClassDeclarationParserRuleCall_0()); + } + this_ClassDeclaration_0=ruleClassDeclaration + { + $current = $this_ClassDeclaration_0.current; + afterParserOrEnumRuleCall(); + } + | + { + newCompositeNode(grammarAccess.getStatementAccess().getPredicateDefinitionParserRuleCall_1()); + } + this_PredicateDefinition_1=rulePredicateDefinition + { + $current = $this_PredicateDefinition_1.current; + afterParserOrEnumRuleCall(); + } + | + { + newCompositeNode(grammarAccess.getStatementAccess().getAssertionParserRuleCall_2()); + } + this_Assertion_2=ruleAssertion + { + $current = $this_Assertion_2.current; + afterParserOrEnumRuleCall(); + } + | + { + newCompositeNode(grammarAccess.getStatementAccess().getScopeDeclarationParserRuleCall_3()); + } + this_ScopeDeclaration_3=ruleScopeDeclaration + { + $current = $this_ScopeDeclaration_3.current; + afterParserOrEnumRuleCall(); + } + ) +; + +// Entry rule entryRuleClassDeclaration +entryRuleClassDeclaration returns [EObject current=null]: + { newCompositeNode(grammarAccess.getClassDeclarationRule()); } + iv_ruleClassDeclaration=ruleClassDeclaration + { $current=$iv_ruleClassDeclaration.current; } + EOF; + +// Rule ClassDeclaration +ruleClassDeclaration returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + lv_abstract_0_0='abstract' + { + newLeafNode(lv_abstract_0_0, grammarAccess.getClassDeclarationAccess().getAbstractAbstractKeyword_0_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + setWithLastConsumed($current, "abstract", lv_abstract_0_0 != null, "abstract"); + } + ) + )? + otherlv_1='class' + { + newLeafNode(otherlv_1, grammarAccess.getClassDeclarationAccess().getClassKeyword_1()); + } + ( + ( + lv_name_2_0=RULE_ID + { + newLeafNode(lv_name_2_0, grammarAccess.getClassDeclarationAccess().getNameIDTerminalRuleCall_2_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + setWithLastConsumed( + $current, + "name", + lv_name_2_0, + "org.eclipse.xtext.common.Terminals.ID"); + } + ) + ) + ( + ( + otherlv_3='extends' + { + newLeafNode(otherlv_3, grammarAccess.getClassDeclarationAccess().getExtendsKeyword_3_0_0()); + } + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + } + otherlv_4=RULE_ID + { + newLeafNode(otherlv_4, grammarAccess.getClassDeclarationAccess().getSuperTypesClassDeclarationCrossReference_3_0_1_0_0()); + } + ) + ) + | + ( + otherlv_5='[' + { + newLeafNode(otherlv_5, grammarAccess.getClassDeclarationAccess().getLeftSquareBracketKeyword_3_0_1_1_0()); + } + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + } + otherlv_6=RULE_ID + { + newLeafNode(otherlv_6, grammarAccess.getClassDeclarationAccess().getSuperTypesClassDeclarationCrossReference_3_0_1_1_1_0_0()); + } + ) + ) + ( + otherlv_7=',' + { + newLeafNode(otherlv_7, grammarAccess.getClassDeclarationAccess().getCommaKeyword_3_0_1_1_1_1_0()); + } + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + } + otherlv_8=RULE_ID + { + newLeafNode(otherlv_8, grammarAccess.getClassDeclarationAccess().getSuperTypesClassDeclarationCrossReference_3_0_1_1_1_1_1_0()); + } + ) + ) + )* + )? + otherlv_9=']' + { + newLeafNode(otherlv_9, grammarAccess.getClassDeclarationAccess().getRightSquareBracketKeyword_3_0_1_1_2()); + } + ) + ) + ) + | + ( + ( + { + newCompositeNode(grammarAccess.getClassDeclarationAccess().getReferenceDeclarationsReferenceDeclarationParserRuleCall_3_1_0()); + } + lv_referenceDeclarations_10_0=ruleReferenceDeclaration + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getClassDeclarationRule()); + } + add( + $current, + "referenceDeclarations", + lv_referenceDeclarations_10_0, + "org.eclipse.viatra.solver.language.Problem.ReferenceDeclaration"); + afterParserOrEnumRuleCall(); + } + ) + ) + )? + ( + otherlv_11=',' + { + newLeafNode(otherlv_11, grammarAccess.getClassDeclarationAccess().getCommaKeyword_4_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getClassDeclarationAccess().getReferenceDeclarationsReferenceDeclarationParserRuleCall_4_1_0()); + } + lv_referenceDeclarations_12_0=ruleReferenceDeclaration + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getClassDeclarationRule()); + } + add( + $current, + "referenceDeclarations", + lv_referenceDeclarations_12_0, + "org.eclipse.viatra.solver.language.Problem.ReferenceDeclaration"); + afterParserOrEnumRuleCall(); + } + ) + ) + )* + otherlv_13='.' + { + newLeafNode(otherlv_13, grammarAccess.getClassDeclarationAccess().getFullStopKeyword_5()); + } + ) +; + +// Entry rule entryRuleReferenceDeclaration +entryRuleReferenceDeclaration returns [EObject current=null]: + { newCompositeNode(grammarAccess.getReferenceDeclarationRule()); } + iv_ruleReferenceDeclaration=ruleReferenceDeclaration + { $current=$iv_ruleReferenceDeclaration.current; } + EOF; + +// Rule ReferenceDeclaration +ruleReferenceDeclaration returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + ( + lv_containment_0_0='contains' + { + newLeafNode(lv_containment_0_0, grammarAccess.getReferenceDeclarationAccess().getContainmentContainsKeyword_0_0_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getReferenceDeclarationRule()); + } + setWithLastConsumed($current, "containment", lv_containment_0_0 != null, "contains"); + } + ) + ) + | + otherlv_1='refers' + { + newLeafNode(otherlv_1, grammarAccess.getReferenceDeclarationAccess().getRefersKeyword_0_1()); + } + ) + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getReferenceDeclarationRule()); + } + } + otherlv_2=RULE_ID + { + newLeafNode(otherlv_2, grammarAccess.getReferenceDeclarationAccess().getReferenceTypeClassDeclarationCrossReference_1_0()); + } + ) + ) + otherlv_3='[' + { + newLeafNode(otherlv_3, grammarAccess.getReferenceDeclarationAccess().getLeftSquareBracketKeyword_2()); + } + ( + ( + { + newCompositeNode(grammarAccess.getReferenceDeclarationAccess().getMultiplicityMultiplicityParserRuleCall_3_0()); + } + lv_multiplicity_4_0=ruleMultiplicity + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getReferenceDeclarationRule()); + } + set( + $current, + "multiplicity", + lv_multiplicity_4_0, + "org.eclipse.viatra.solver.language.Problem.Multiplicity"); + afterParserOrEnumRuleCall(); + } + ) + ) + otherlv_5=']' + { + newLeafNode(otherlv_5, grammarAccess.getReferenceDeclarationAccess().getRightSquareBracketKeyword_4()); + } + ( + ( + lv_name_6_0=RULE_ID + { + newLeafNode(lv_name_6_0, grammarAccess.getReferenceDeclarationAccess().getNameIDTerminalRuleCall_5_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getReferenceDeclarationRule()); + } + setWithLastConsumed( + $current, + "name", + lv_name_6_0, + "org.eclipse.xtext.common.Terminals.ID"); + } + ) + ) + ( + otherlv_7='opposite' + { + newLeafNode(otherlv_7, grammarAccess.getReferenceDeclarationAccess().getOppositeKeyword_6_0()); + } + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getReferenceDeclarationRule()); + } + } + { + newCompositeNode(grammarAccess.getReferenceDeclarationAccess().getOppositeReferenceDeclarationCrossReference_6_1_0()); + } + ruleQualifiedName + { + afterParserOrEnumRuleCall(); + } + ) + ) + )? + ) +; + +// Entry rule entryRulePredicateDefinition +entryRulePredicateDefinition returns [EObject current=null]: + { newCompositeNode(grammarAccess.getPredicateDefinitionRule()); } + iv_rulePredicateDefinition=rulePredicateDefinition + { $current=$iv_rulePredicateDefinition.current; } + EOF; + +// Rule PredicateDefinition +rulePredicateDefinition returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + ( + ( + lv_error_0_0='error' + { + newLeafNode(lv_error_0_0, grammarAccess.getPredicateDefinitionAccess().getErrorErrorKeyword_0_0_0_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getPredicateDefinitionRule()); + } + setWithLastConsumed($current, "error", lv_error_0_0 != null, "error"); + } + ) + ) + ( + otherlv_1='pred' + { + newLeafNode(otherlv_1, grammarAccess.getPredicateDefinitionAccess().getPredKeyword_0_0_1()); + } + )? + ) + | + otherlv_2='pred' + { + newLeafNode(otherlv_2, grammarAccess.getPredicateDefinitionAccess().getPredKeyword_0_1()); + } + ) + ( + ( + lv_name_3_0=RULE_ID + { + newLeafNode(lv_name_3_0, grammarAccess.getPredicateDefinitionAccess().getNameIDTerminalRuleCall_1_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getPredicateDefinitionRule()); + } + setWithLastConsumed( + $current, + "name", + lv_name_3_0, + "org.eclipse.xtext.common.Terminals.ID"); + } + ) + ) + otherlv_4='(' + { + newLeafNode(otherlv_4, grammarAccess.getPredicateDefinitionAccess().getLeftParenthesisKeyword_2()); + } + ( + ( + ( + { + newCompositeNode(grammarAccess.getPredicateDefinitionAccess().getParametersParameterParserRuleCall_3_0_0()); + } + lv_parameters_5_0=ruleParameter + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getPredicateDefinitionRule()); + } + add( + $current, + "parameters", + lv_parameters_5_0, + "org.eclipse.viatra.solver.language.Problem.Parameter"); + afterParserOrEnumRuleCall(); + } + ) + ) + ( + otherlv_6=',' + { + newLeafNode(otherlv_6, grammarAccess.getPredicateDefinitionAccess().getCommaKeyword_3_1_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getPredicateDefinitionAccess().getParametersParameterParserRuleCall_3_1_1_0()); + } + lv_parameters_7_0=ruleParameter + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getPredicateDefinitionRule()); + } + add( + $current, + "parameters", + lv_parameters_7_0, + "org.eclipse.viatra.solver.language.Problem.Parameter"); + afterParserOrEnumRuleCall(); + } + ) + ) + )* + )? + otherlv_8=')' + { + newLeafNode(otherlv_8, grammarAccess.getPredicateDefinitionAccess().getRightParenthesisKeyword_4()); + } + ( + otherlv_9=':=' + { + newLeafNode(otherlv_9, grammarAccess.getPredicateDefinitionAccess().getColonEqualsSignKeyword_5_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getPredicateDefinitionAccess().getBodiesConjunctionParserRuleCall_5_1_0()); + } + lv_bodies_10_0=ruleConjunction + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getPredicateDefinitionRule()); + } + add( + $current, + "bodies", + lv_bodies_10_0, + "org.eclipse.viatra.solver.language.Problem.Conjunction"); + afterParserOrEnumRuleCall(); + } + ) + ) + ( + otherlv_11=';' + { + newLeafNode(otherlv_11, grammarAccess.getPredicateDefinitionAccess().getSemicolonKeyword_5_2_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getPredicateDefinitionAccess().getBodiesConjunctionParserRuleCall_5_2_1_0()); + } + lv_bodies_12_0=ruleConjunction + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getPredicateDefinitionRule()); + } + add( + $current, + "bodies", + lv_bodies_12_0, + "org.eclipse.viatra.solver.language.Problem.Conjunction"); + afterParserOrEnumRuleCall(); + } + ) + ) + )* + )? + otherlv_13='.' + { + newLeafNode(otherlv_13, grammarAccess.getPredicateDefinitionAccess().getFullStopKeyword_6()); + } + ) +; + +// Entry rule entryRuleParameter +entryRuleParameter returns [EObject current=null]: + { newCompositeNode(grammarAccess.getParameterRule()); } + iv_ruleParameter=ruleParameter + { $current=$iv_ruleParameter.current; } + EOF; + +// Rule Parameter +ruleParameter returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getParameterRule()); + } + } + otherlv_0=RULE_ID + { + newLeafNode(otherlv_0, grammarAccess.getParameterAccess().getParameterTypeClassDeclarationCrossReference_0_0()); + } + ) + ) + ( + ( + lv_name_1_0=RULE_ID + { + newLeafNode(lv_name_1_0, grammarAccess.getParameterAccess().getNameIDTerminalRuleCall_1_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getParameterRule()); + } + setWithLastConsumed( + $current, + "name", + lv_name_1_0, + "org.eclipse.xtext.common.Terminals.ID"); + } + ) + ) + ) +; + +// Entry rule entryRuleConjunction +entryRuleConjunction returns [EObject current=null]: + { newCompositeNode(grammarAccess.getConjunctionRule()); } + iv_ruleConjunction=ruleConjunction + { $current=$iv_ruleConjunction.current; } + EOF; + +// Rule Conjunction +ruleConjunction returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + { + newCompositeNode(grammarAccess.getConjunctionAccess().getLiteralsLiteralParserRuleCall_0_0()); + } + lv_literals_0_0=ruleLiteral + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getConjunctionRule()); + } + add( + $current, + "literals", + lv_literals_0_0, + "org.eclipse.viatra.solver.language.Problem.Literal"); + afterParserOrEnumRuleCall(); + } + ) + ) + ( + otherlv_1=',' + { + newLeafNode(otherlv_1, grammarAccess.getConjunctionAccess().getCommaKeyword_1_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getConjunctionAccess().getLiteralsLiteralParserRuleCall_1_1_0()); + } + lv_literals_2_0=ruleLiteral + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getConjunctionRule()); + } + add( + $current, + "literals", + lv_literals_2_0, + "org.eclipse.viatra.solver.language.Problem.Literal"); + afterParserOrEnumRuleCall(); + } + ) + ) + )* + ) +; + +// Entry rule entryRuleLiteral +entryRuleLiteral returns [EObject current=null]: + { newCompositeNode(grammarAccess.getLiteralRule()); } + iv_ruleLiteral=ruleLiteral + { $current=$iv_ruleLiteral.current; } + EOF; + +// Rule Literal +ruleLiteral returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + { + newCompositeNode(grammarAccess.getLiteralAccess().getAtomParserRuleCall_0()); + } + this_Atom_0=ruleAtom + { + $current = $this_Atom_0.current; + afterParserOrEnumRuleCall(); + } + | + { + newCompositeNode(grammarAccess.getLiteralAccess().getNegativeLiteralParserRuleCall_1()); + } + this_NegativeLiteral_1=ruleNegativeLiteral + { + $current = $this_NegativeLiteral_1.current; + afterParserOrEnumRuleCall(); + } + ) +; + +// Entry rule entryRuleNegativeLiteral +entryRuleNegativeLiteral returns [EObject current=null]: + { newCompositeNode(grammarAccess.getNegativeLiteralRule()); } + iv_ruleNegativeLiteral=ruleNegativeLiteral + { $current=$iv_ruleNegativeLiteral.current; } + EOF; + +// Rule NegativeLiteral +ruleNegativeLiteral returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + otherlv_0='!' + { + newLeafNode(otherlv_0, grammarAccess.getNegativeLiteralAccess().getExclamationMarkKeyword_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getNegativeLiteralAccess().getAtomAtomParserRuleCall_1_0()); + } + lv_atom_1_0=ruleAtom + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getNegativeLiteralRule()); + } + set( + $current, + "atom", + lv_atom_1_0, + "org.eclipse.viatra.solver.language.Problem.Atom"); + afterParserOrEnumRuleCall(); + } + ) + ) + ) +; + +// Entry rule entryRuleAtom +entryRuleAtom returns [EObject current=null]: + { newCompositeNode(grammarAccess.getAtomRule()); } + iv_ruleAtom=ruleAtom + { $current=$iv_ruleAtom.current; } + EOF; + +// Rule Atom +ruleAtom returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAtomRule()); + } + } + { + newCompositeNode(grammarAccess.getAtomAccess().getRelationRelationCrossReference_0_0()); + } + ruleQualifiedName + { + afterParserOrEnumRuleCall(); + } + ) + ) + ( + ( + lv_transitiveClosure_1_0='+' + { + newLeafNode(lv_transitiveClosure_1_0, grammarAccess.getAtomAccess().getTransitiveClosurePlusSignKeyword_1_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAtomRule()); + } + setWithLastConsumed($current, "transitiveClosure", lv_transitiveClosure_1_0 != null, "+"); + } + ) + )? + otherlv_2='(' + { + newLeafNode(otherlv_2, grammarAccess.getAtomAccess().getLeftParenthesisKeyword_2()); + } + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAtomRule()); + } + } + otherlv_3=RULE_ID + { + newLeafNode(otherlv_3, grammarAccess.getAtomAccess().getArgumentsVariableCrossReference_3_0_0()); + } + ) + ) + ( + otherlv_4=',' + { + newLeafNode(otherlv_4, grammarAccess.getAtomAccess().getCommaKeyword_3_1_0()); + } + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAtomRule()); + } + } + otherlv_5=RULE_ID + { + newLeafNode(otherlv_5, grammarAccess.getAtomAccess().getArgumentsVariableCrossReference_3_1_1_0()); + } + ) + ) + )* + )? + otherlv_6=')' + { + newLeafNode(otherlv_6, grammarAccess.getAtomAccess().getRightParenthesisKeyword_4()); + } + ) +; + +// Entry rule entryRuleAssertion +entryRuleAssertion returns [EObject current=null]: + { newCompositeNode(grammarAccess.getAssertionRule()); } + iv_ruleAssertion=ruleAssertion + { $current=$iv_ruleAssertion.current; } + EOF; + +// Rule Assertion +ruleAssertion returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAssertionRule()); + } + } + { + newCompositeNode(grammarAccess.getAssertionAccess().getRelationRelationCrossReference_0_0_0_0()); + } + ruleQualifiedName + { + afterParserOrEnumRuleCall(); + } + ) + ) + otherlv_1='(' + { + newLeafNode(otherlv_1, grammarAccess.getAssertionAccess().getLeftParenthesisKeyword_0_0_1()); + } + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAssertionRule()); + } + } + { + newCompositeNode(grammarAccess.getAssertionAccess().getArgumentsNodeCrossReference_0_0_2_0_0()); + } + ruleQualifiedName + { + afterParserOrEnumRuleCall(); + } + ) + ) + ( + otherlv_3=',' + { + newLeafNode(otherlv_3, grammarAccess.getAssertionAccess().getCommaKeyword_0_0_2_1_0()); + } + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAssertionRule()); + } + } + { + newCompositeNode(grammarAccess.getAssertionAccess().getArgumentsNodeCrossReference_0_0_2_1_1_0()); + } + ruleQualifiedName + { + afterParserOrEnumRuleCall(); + } + ) + ) + )* + )? + otherlv_5=')' + { + newLeafNode(otherlv_5, grammarAccess.getAssertionAccess().getRightParenthesisKeyword_0_0_3()); + } + otherlv_6=':' + { + newLeafNode(otherlv_6, grammarAccess.getAssertionAccess().getColonKeyword_0_0_4()); + } + ( + ( + { + newCompositeNode(grammarAccess.getAssertionAccess().getValueLogicValueEnumRuleCall_0_0_5_0()); + } + lv_value_7_0=ruleLogicValue + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getAssertionRule()); + } + set( + $current, + "value", + lv_value_7_0, + "org.eclipse.viatra.solver.language.Problem.LogicValue"); + afterParserOrEnumRuleCall(); + } + ) + ) + ) + | + ( + ( + ( + { + newCompositeNode(grammarAccess.getAssertionAccess().getValueShortLogicValueEnumRuleCall_0_1_0_0()); + } + lv_value_8_0=ruleShortLogicValue + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getAssertionRule()); + } + set( + $current, + "value", + lv_value_8_0, + "org.eclipse.viatra.solver.language.Problem.ShortLogicValue"); + afterParserOrEnumRuleCall(); + } + ) + )? + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAssertionRule()); + } + } + { + newCompositeNode(grammarAccess.getAssertionAccess().getRelationRelationCrossReference_0_1_1_0()); + } + ruleQualifiedName + { + afterParserOrEnumRuleCall(); + } + ) + ) + otherlv_10='(' + { + newLeafNode(otherlv_10, grammarAccess.getAssertionAccess().getLeftParenthesisKeyword_0_1_2()); + } + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAssertionRule()); + } + } + { + newCompositeNode(grammarAccess.getAssertionAccess().getArgumentsNodeCrossReference_0_1_3_0_0()); + } + ruleQualifiedName + { + afterParserOrEnumRuleCall(); + } + ) + ) + ( + otherlv_12=',' + { + newLeafNode(otherlv_12, grammarAccess.getAssertionAccess().getCommaKeyword_0_1_3_1_0()); + } + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getAssertionRule()); + } + } + { + newCompositeNode(grammarAccess.getAssertionAccess().getArgumentsNodeCrossReference_0_1_3_1_1_0()); + } + ruleQualifiedName + { + afterParserOrEnumRuleCall(); + } + ) + ) + )* + )? + otherlv_14=')' + { + newLeafNode(otherlv_14, grammarAccess.getAssertionAccess().getRightParenthesisKeyword_0_1_4()); + } + ) + ) + otherlv_15='.' + { + newLeafNode(otherlv_15, grammarAccess.getAssertionAccess().getFullStopKeyword_1()); + } + ) +; + +// Entry rule entryRuleScopeDeclaration +entryRuleScopeDeclaration returns [EObject current=null]: + { newCompositeNode(grammarAccess.getScopeDeclarationRule()); } + iv_ruleScopeDeclaration=ruleScopeDeclaration + { $current=$iv_ruleScopeDeclaration.current; } + EOF; + +// Rule ScopeDeclaration +ruleScopeDeclaration returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + otherlv_0='scope' + { + newLeafNode(otherlv_0, grammarAccess.getScopeDeclarationAccess().getScopeKeyword_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getScopeDeclarationAccess().getTypeScopesTypeScopeParserRuleCall_1_0()); + } + lv_typeScopes_1_0=ruleTypeScope + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getScopeDeclarationRule()); + } + add( + $current, + "typeScopes", + lv_typeScopes_1_0, + "org.eclipse.viatra.solver.language.Problem.TypeScope"); + afterParserOrEnumRuleCall(); + } + ) + ) + ( + otherlv_2=',' + { + newLeafNode(otherlv_2, grammarAccess.getScopeDeclarationAccess().getCommaKeyword_2_0()); + } + ( + ( + { + newCompositeNode(grammarAccess.getScopeDeclarationAccess().getTypeScopesTypeScopeParserRuleCall_2_1_0()); + } + lv_typeScopes_3_0=ruleTypeScope + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getScopeDeclarationRule()); + } + add( + $current, + "typeScopes", + lv_typeScopes_3_0, + "org.eclipse.viatra.solver.language.Problem.TypeScope"); + afterParserOrEnumRuleCall(); + } + ) + ) + )* + otherlv_4='.' + { + newLeafNode(otherlv_4, grammarAccess.getScopeDeclarationAccess().getFullStopKeyword_3()); + } + ) +; + +// Entry rule entryRuleTypeScope +entryRuleTypeScope returns [EObject current=null]: + { newCompositeNode(grammarAccess.getTypeScopeRule()); } + iv_ruleTypeScope=ruleTypeScope + { $current=$iv_ruleTypeScope.current; } + EOF; + +// Rule TypeScope +ruleTypeScope returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + { + if ($current==null) { + $current = createModelElement(grammarAccess.getTypeScopeRule()); + } + } + otherlv_0=RULE_ID + { + newLeafNode(otherlv_0, grammarAccess.getTypeScopeAccess().getTargetTypeClassDeclarationCrossReference_0_0()); + } + ) + ) + ( + ( + ( + lv_increment_1_0='+=' + { + newLeafNode(lv_increment_1_0, grammarAccess.getTypeScopeAccess().getIncrementPlusSignEqualsSignKeyword_1_0_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getTypeScopeRule()); + } + setWithLastConsumed($current, "increment", lv_increment_1_0 != null, "+="); + } + ) + ) + | + otherlv_2='=' + { + newLeafNode(otherlv_2, grammarAccess.getTypeScopeAccess().getEqualsSignKeyword_1_1()); + } + ) + ( + ( + { + newCompositeNode(grammarAccess.getTypeScopeAccess().getMultiplicityMultiplicityParserRuleCall_2_0()); + } + lv_multiplicity_3_0=ruleMultiplicity + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getTypeScopeRule()); + } + set( + $current, + "multiplicity", + lv_multiplicity_3_0, + "org.eclipse.viatra.solver.language.Problem.Multiplicity"); + afterParserOrEnumRuleCall(); + } + ) + ) + ) +; + +// Entry rule entryRuleMultiplicity +entryRuleMultiplicity returns [EObject current=null]: + { newCompositeNode(grammarAccess.getMultiplicityRule()); } + iv_ruleMultiplicity=ruleMultiplicity + { $current=$iv_ruleMultiplicity.current; } + EOF; + +// Rule Multiplicity +ruleMultiplicity returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + { + newCompositeNode(grammarAccess.getMultiplicityAccess().getRangeMultiplicityParserRuleCall_0()); + } + this_RangeMultiplicity_0=ruleRangeMultiplicity + { + $current = $this_RangeMultiplicity_0.current; + afterParserOrEnumRuleCall(); + } + | + { + newCompositeNode(grammarAccess.getMultiplicityAccess().getExactMultiplicityParserRuleCall_1()); + } + this_ExactMultiplicity_1=ruleExactMultiplicity + { + $current = $this_ExactMultiplicity_1.current; + afterParserOrEnumRuleCall(); + } + ) +; + +// Entry rule entryRuleRangeMultiplicity +entryRuleRangeMultiplicity returns [EObject current=null]: + { newCompositeNode(grammarAccess.getRangeMultiplicityRule()); } + iv_ruleRangeMultiplicity=ruleRangeMultiplicity + { $current=$iv_ruleRangeMultiplicity.current; } + EOF; + +// Rule RangeMultiplicity +ruleRangeMultiplicity returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + ( + lv_lowerBound_0_0=RULE_INT + { + newLeafNode(lv_lowerBound_0_0, grammarAccess.getRangeMultiplicityAccess().getLowerBoundINTTerminalRuleCall_0_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getRangeMultiplicityRule()); + } + setWithLastConsumed( + $current, + "lowerBound", + lv_lowerBound_0_0, + "org.eclipse.xtext.common.Terminals.INT"); + } + ) + ) + otherlv_1='..' + { + newLeafNode(otherlv_1, grammarAccess.getRangeMultiplicityAccess().getFullStopFullStopKeyword_1()); + } + ( + ( + { + newCompositeNode(grammarAccess.getRangeMultiplicityAccess().getUpperBoundUpperBoundParserRuleCall_2_0()); + } + lv_upperBound_2_0=ruleUpperBound + { + if ($current==null) { + $current = createModelElementForParent(grammarAccess.getRangeMultiplicityRule()); + } + set( + $current, + "upperBound", + lv_upperBound_2_0, + "org.eclipse.viatra.solver.language.Problem.UpperBound"); + afterParserOrEnumRuleCall(); + } + ) + ) + ) +; + +// Entry rule entryRuleExactMultiplicity +entryRuleExactMultiplicity returns [EObject current=null]: + { newCompositeNode(grammarAccess.getExactMultiplicityRule()); } + iv_ruleExactMultiplicity=ruleExactMultiplicity + { $current=$iv_ruleExactMultiplicity.current; } + EOF; + +// Rule ExactMultiplicity +ruleExactMultiplicity returns [EObject current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + lv_exactValue_0_0=RULE_INT + { + newLeafNode(lv_exactValue_0_0, grammarAccess.getExactMultiplicityAccess().getExactValueINTTerminalRuleCall_0()); + } + { + if ($current==null) { + $current = createModelElement(grammarAccess.getExactMultiplicityRule()); + } + setWithLastConsumed( + $current, + "exactValue", + lv_exactValue_0_0, + "org.eclipse.xtext.common.Terminals.INT"); + } + ) + ) +; + +// Entry rule entryRuleUpperBound +entryRuleUpperBound returns [String current=null]: + { newCompositeNode(grammarAccess.getUpperBoundRule()); } + iv_ruleUpperBound=ruleUpperBound + { $current=$iv_ruleUpperBound.current.getText(); } + EOF; + +// Rule UpperBound +ruleUpperBound returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + this_INT_0=RULE_INT + { + $current.merge(this_INT_0); + } + { + newLeafNode(this_INT_0, grammarAccess.getUpperBoundAccess().getINTTerminalRuleCall_0()); + } + | + kw='*' + { + $current.merge(kw); + newLeafNode(kw, grammarAccess.getUpperBoundAccess().getAsteriskKeyword_1()); + } + ) +; + +// Entry rule entryRuleQualifiedName +entryRuleQualifiedName returns [String current=null]: + { newCompositeNode(grammarAccess.getQualifiedNameRule()); } + iv_ruleQualifiedName=ruleQualifiedName + { $current=$iv_ruleQualifiedName.current.getText(); } + EOF; + +// Rule QualifiedName +ruleQualifiedName returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + this_ID_0=RULE_ID + { + $current.merge(this_ID_0); + } + { + newLeafNode(this_ID_0, grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_0()); + } + ( + kw='::' + { + $current.merge(kw); + newLeafNode(kw, grammarAccess.getQualifiedNameAccess().getColonColonKeyword_1_0()); + } + this_ID_2=RULE_ID + { + $current.merge(this_ID_2); + } + { + newLeafNode(this_ID_2, grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_1_1()); + } + )* + ) +; + +// Rule LogicValue +ruleLogicValue returns [Enumerator current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + enumLiteral_0='true' + { + $current = grammarAccess.getLogicValueAccess().getTRUEEnumLiteralDeclaration_0().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_0, grammarAccess.getLogicValueAccess().getTRUEEnumLiteralDeclaration_0()); + } + ) + | + ( + enumLiteral_1='false' + { + $current = grammarAccess.getLogicValueAccess().getFALSEEnumLiteralDeclaration_1().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_1, grammarAccess.getLogicValueAccess().getFALSEEnumLiteralDeclaration_1()); + } + ) + | + ( + enumLiteral_2='unknown' + { + $current = grammarAccess.getLogicValueAccess().getUNKNOWNEnumLiteralDeclaration_2().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_2, grammarAccess.getLogicValueAccess().getUNKNOWNEnumLiteralDeclaration_2()); + } + ) + ) +; + +// Rule ShortLogicValue +ruleShortLogicValue returns [Enumerator current=null] +@init { + enterRule(); +} +@after { + leaveRule(); +}: + ( + ( + enumLiteral_0='!' + { + $current = grammarAccess.getShortLogicValueAccess().getFALSEEnumLiteralDeclaration_0().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_0, grammarAccess.getShortLogicValueAccess().getFALSEEnumLiteralDeclaration_0()); + } + ) + | + ( + enumLiteral_1='?' + { + $current = grammarAccess.getShortLogicValueAccess().getUNKNOWNEnumLiteralDeclaration_1().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_1, grammarAccess.getShortLogicValueAccess().getUNKNOWNEnumLiteralDeclaration_1()); + } + ) + ) +; + +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 : .; diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.tokens b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.tokens new file mode 100644 index 00000000..22ef662c --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblem.tokens @@ -0,0 +1,65 @@ +'!'=27 +'('=23 +')'=24 +'*'=34 +'+'=28 +'+='=31 +','=15 +'.'=17 +'..'=33 +':'=29 +'::'=35 +':='=25 +';'=26 +'='=32 +'?'=39 +'['=14 +']'=16 +'abstract'=11 +'class'=12 +'contains'=18 +'error'=21 +'extends'=13 +'false'=37 +'opposite'=20 +'pred'=22 +'refers'=19 +'scope'=30 +'true'=36 +'unknown'=38 +RULE_ANY_OTHER=10 +RULE_ID=4 +RULE_INT=5 +RULE_ML_COMMENT=7 +RULE_SL_COMMENT=8 +RULE_STRING=6 +RULE_WS=9 +T__11=11 +T__12=12 +T__13=13 +T__14=14 +T__15=15 +T__16=16 +T__17=17 +T__18=18 +T__19=19 +T__20=20 +T__21=21 +T__22=22 +T__23=23 +T__24=24 +T__25=25 +T__26=26 +T__27=27 +T__28=28 +T__29=29 +T__30=30 +T__31=31 +T__32=32 +T__33=33 +T__34=34 +T__35=35 +T__36=36 +T__37=37 +T__38=38 +T__39=39 diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblemLexer.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblemLexer.java new file mode 100644 index 00000000..a0b530c8 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblemLexer.java @@ -0,0 +1,1699 @@ +package org.eclipse.viatra.solver.language.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; + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalProblemLexer extends Lexer { + public static final int RULE_STRING=6; + public static final int RULE_SL_COMMENT=8; + public static final int T__19=19; + public static final int T__15=15; + public static final int T__37=37; + public static final int T__16=16; + public static final int T__38=38; + public static final int T__17=17; + public static final int T__39=39; + public static final int T__18=18; + public static final int T__11=11; + public static final int T__33=33; + public static final int T__12=12; + public static final int T__34=34; + public static final int T__13=13; + public static final int T__35=35; + public static final int T__14=14; + public static final int T__36=36; + public static final int EOF=-1; + public static final int T__30=30; + public static final int T__31=31; + public static final int T__32=32; + public static final int RULE_ID=4; + public static final int RULE_WS=9; + public static final int RULE_ANY_OTHER=10; + public static final int T__26=26; + public static final int T__27=27; + public static final int T__28=28; + public static final int RULE_INT=5; + public static final int T__29=29; + public static final int T__22=22; + public static final int RULE_ML_COMMENT=7; + public static final int T__23=23; + public static final int T__24=24; + public static final int T__25=25; + public static final int T__20=20; + public static final int T__21=21; + + // delegates + // delegators + + public InternalProblemLexer() {;} + public InternalProblemLexer(CharStream input) { + this(input, new RecognizerSharedState()); + } + public InternalProblemLexer(CharStream input, RecognizerSharedState state) { + super(input,state); + + } + public String getGrammarFileName() { return "InternalProblem.g"; } + + // $ANTLR start "T__11" + public final void mT__11() throws RecognitionException { + try { + int _type = T__11; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:11:7: ( 'abstract' ) + // InternalProblem.g:11:9: 'abstract' + { + match("abstract"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__11" + + // $ANTLR start "T__12" + public final void mT__12() throws RecognitionException { + try { + int _type = T__12; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:12:7: ( 'class' ) + // InternalProblem.g:12:9: 'class' + { + match("class"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__12" + + // $ANTLR start "T__13" + public final void mT__13() throws RecognitionException { + try { + int _type = T__13; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:13:7: ( 'extends' ) + // InternalProblem.g:13:9: 'extends' + { + match("extends"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__13" + + // $ANTLR start "T__14" + public final void mT__14() throws RecognitionException { + try { + int _type = T__14; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:14:7: ( '[' ) + // InternalProblem.g:14:9: '[' + { + match('['); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__14" + + // $ANTLR start "T__15" + public final void mT__15() throws RecognitionException { + try { + int _type = T__15; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:15:7: ( ',' ) + // InternalProblem.g:15:9: ',' + { + match(','); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__15" + + // $ANTLR start "T__16" + public final void mT__16() throws RecognitionException { + try { + int _type = T__16; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:16:7: ( ']' ) + // InternalProblem.g:16:9: ']' + { + match(']'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__16" + + // $ANTLR start "T__17" + public final void mT__17() throws RecognitionException { + try { + int _type = T__17; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:17:7: ( '.' ) + // InternalProblem.g:17:9: '.' + { + match('.'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__17" + + // $ANTLR start "T__18" + public final void mT__18() throws RecognitionException { + try { + int _type = T__18; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:18:7: ( 'contains' ) + // InternalProblem.g:18:9: 'contains' + { + match("contains"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__18" + + // $ANTLR start "T__19" + public final void mT__19() throws RecognitionException { + try { + int _type = T__19; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:19:7: ( 'refers' ) + // InternalProblem.g:19:9: 'refers' + { + match("refers"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__19" + + // $ANTLR start "T__20" + public final void mT__20() throws RecognitionException { + try { + int _type = T__20; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:20:7: ( 'opposite' ) + // InternalProblem.g:20:9: 'opposite' + { + match("opposite"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__20" + + // $ANTLR start "T__21" + public final void mT__21() throws RecognitionException { + try { + int _type = T__21; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:21:7: ( 'error' ) + // InternalProblem.g:21:9: 'error' + { + match("error"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__21" + + // $ANTLR start "T__22" + public final void mT__22() throws RecognitionException { + try { + int _type = T__22; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:22:7: ( 'pred' ) + // InternalProblem.g:22:9: 'pred' + { + match("pred"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__22" + + // $ANTLR start "T__23" + public final void mT__23() throws RecognitionException { + try { + int _type = T__23; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:23:7: ( '(' ) + // InternalProblem.g:23:9: '(' + { + match('('); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__23" + + // $ANTLR start "T__24" + public final void mT__24() throws RecognitionException { + try { + int _type = T__24; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:24:7: ( ')' ) + // InternalProblem.g:24:9: ')' + { + match(')'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__24" + + // $ANTLR start "T__25" + public final void mT__25() throws RecognitionException { + try { + int _type = T__25; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:25:7: ( ':=' ) + // InternalProblem.g:25:9: ':=' + { + match(":="); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__25" + + // $ANTLR start "T__26" + public final void mT__26() throws RecognitionException { + try { + int _type = T__26; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:26:7: ( ';' ) + // InternalProblem.g:26:9: ';' + { + match(';'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__26" + + // $ANTLR start "T__27" + public final void mT__27() throws RecognitionException { + try { + int _type = T__27; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:27:7: ( '!' ) + // InternalProblem.g:27:9: '!' + { + match('!'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__27" + + // $ANTLR start "T__28" + public final void mT__28() throws RecognitionException { + try { + int _type = T__28; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:28:7: ( '+' ) + // InternalProblem.g:28:9: '+' + { + match('+'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__28" + + // $ANTLR start "T__29" + public final void mT__29() throws RecognitionException { + try { + int _type = T__29; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:29:7: ( ':' ) + // InternalProblem.g:29:9: ':' + { + match(':'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__29" + + // $ANTLR start "T__30" + public final void mT__30() throws RecognitionException { + try { + int _type = T__30; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:30:7: ( 'scope' ) + // InternalProblem.g:30:9: 'scope' + { + match("scope"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__30" + + // $ANTLR start "T__31" + public final void mT__31() throws RecognitionException { + try { + int _type = T__31; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:31:7: ( '+=' ) + // InternalProblem.g:31:9: '+=' + { + match("+="); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__31" + + // $ANTLR start "T__32" + public final void mT__32() throws RecognitionException { + try { + int _type = T__32; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:32:7: ( '=' ) + // InternalProblem.g:32:9: '=' + { + match('='); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__32" + + // $ANTLR start "T__33" + public final void mT__33() throws RecognitionException { + try { + int _type = T__33; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:33:7: ( '..' ) + // InternalProblem.g:33:9: '..' + { + match(".."); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__33" + + // $ANTLR start "T__34" + public final void mT__34() throws RecognitionException { + try { + int _type = T__34; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:34:7: ( '*' ) + // InternalProblem.g:34:9: '*' + { + match('*'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__34" + + // $ANTLR start "T__35" + public final void mT__35() throws RecognitionException { + try { + int _type = T__35; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:35:7: ( '::' ) + // InternalProblem.g:35:9: '::' + { + match("::"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__35" + + // $ANTLR start "T__36" + public final void mT__36() throws RecognitionException { + try { + int _type = T__36; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:36:7: ( 'true' ) + // InternalProblem.g:36:9: 'true' + { + match("true"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__36" + + // $ANTLR start "T__37" + public final void mT__37() throws RecognitionException { + try { + int _type = T__37; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:37:7: ( 'false' ) + // InternalProblem.g:37:9: 'false' + { + match("false"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__37" + + // $ANTLR start "T__38" + public final void mT__38() throws RecognitionException { + try { + int _type = T__38; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:38:7: ( 'unknown' ) + // InternalProblem.g:38:9: 'unknown' + { + match("unknown"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__38" + + // $ANTLR start "T__39" + public final void mT__39() throws RecognitionException { + try { + int _type = T__39; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:39:7: ( '?' ) + // InternalProblem.g:39:9: '?' + { + match('?'); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "T__39" + + // $ANTLR start "RULE_ID" + public final void mRULE_ID() throws RecognitionException { + try { + int _type = RULE_ID; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:1510:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // InternalProblem.g:1510:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + { + // InternalProblem.g:1510:11: ( '^' )? + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0=='^') ) { + alt1=1; + } + switch (alt1) { + case 1 : + // InternalProblem.g:1510:11: '^' + { + match('^'); + + } + break; + + } + + if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + // InternalProblem.g:1510:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + loop2: + do { + int alt2=2; + int LA2_0 = input.LA(1); + + if ( ((LA2_0>='0' && LA2_0<='9')||(LA2_0>='A' && LA2_0<='Z')||LA2_0=='_'||(LA2_0>='a' && LA2_0<='z')) ) { + alt2=1; + } + + + switch (alt2) { + case 1 : + // InternalProblem.g: + { + if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop2; + } + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ID" + + // $ANTLR start "RULE_INT" + public final void mRULE_INT() throws RecognitionException { + try { + int _type = RULE_INT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:1512:10: ( ( '0' .. '9' )+ ) + // InternalProblem.g:1512:12: ( '0' .. '9' )+ + { + // InternalProblem.g:1512:12: ( '0' .. '9' )+ + int cnt3=0; + loop3: + do { + int alt3=2; + int LA3_0 = input.LA(1); + + if ( ((LA3_0>='0' && LA3_0<='9')) ) { + alt3=1; + } + + + switch (alt3) { + case 1 : + // InternalProblem.g:1512:13: '0' .. '9' + { + matchRange('0','9'); + + } + break; + + default : + if ( cnt3 >= 1 ) break loop3; + EarlyExitException eee = + new EarlyExitException(3, input); + throw eee; + } + cnt3++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_INT" + + // $ANTLR start "RULE_STRING" + public final void mRULE_STRING() throws RecognitionException { + try { + int _type = RULE_STRING; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:1514:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) ) + // InternalProblem.g:1514:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + { + // InternalProblem.g:1514:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) + int alt6=2; + int LA6_0 = input.LA(1); + + if ( (LA6_0=='\"') ) { + alt6=1; + } + else if ( (LA6_0=='\'') ) { + alt6=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 6, 0, input); + + throw nvae; + } + switch (alt6) { + case 1 : + // InternalProblem.g:1514:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' + { + match('\"'); + // InternalProblem.g:1514:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* + loop4: + do { + int alt4=3; + int LA4_0 = input.LA(1); + + if ( (LA4_0=='\\') ) { + alt4=1; + } + else if ( ((LA4_0>='\u0000' && LA4_0<='!')||(LA4_0>='#' && LA4_0<='[')||(LA4_0>=']' && LA4_0<='\uFFFF')) ) { + alt4=2; + } + + + switch (alt4) { + case 1 : + // InternalProblem.g:1514:21: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalProblem.g:1514:28: ~ ( ( '\\\\' | '\"' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop4; + } + } while (true); + + match('\"'); + + } + break; + case 2 : + // InternalProblem.g:1514:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' + { + match('\''); + // InternalProblem.g:1514:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* + loop5: + do { + int alt5=3; + int LA5_0 = input.LA(1); + + if ( (LA5_0=='\\') ) { + alt5=1; + } + else if ( ((LA5_0>='\u0000' && LA5_0<='&')||(LA5_0>='(' && LA5_0<='[')||(LA5_0>=']' && LA5_0<='\uFFFF')) ) { + alt5=2; + } + + + switch (alt5) { + case 1 : + // InternalProblem.g:1514:54: '\\\\' . + { + match('\\'); + matchAny(); + + } + break; + case 2 : + // InternalProblem.g:1514:61: ~ ( ( '\\\\' | '\\'' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop5; + } + } while (true); + + match('\''); + + } + break; + + } + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_STRING" + + // $ANTLR start "RULE_ML_COMMENT" + public final void mRULE_ML_COMMENT() throws RecognitionException { + try { + int _type = RULE_ML_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:1516:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // InternalProblem.g:1516:19: '/*' ( options {greedy=false; } : . )* '*/' + { + match("/*"); + + // InternalProblem.g:1516:24: ( options {greedy=false; } : . )* + loop7: + do { + int alt7=2; + int LA7_0 = input.LA(1); + + if ( (LA7_0=='*') ) { + int LA7_1 = input.LA(2); + + if ( (LA7_1=='/') ) { + alt7=2; + } + else if ( ((LA7_1>='\u0000' && LA7_1<='.')||(LA7_1>='0' && LA7_1<='\uFFFF')) ) { + alt7=1; + } + + + } + else if ( ((LA7_0>='\u0000' && LA7_0<=')')||(LA7_0>='+' && LA7_0<='\uFFFF')) ) { + alt7=1; + } + + + switch (alt7) { + case 1 : + // InternalProblem.g:1516:52: . + { + matchAny(); + + } + break; + + default : + break loop7; + } + } while (true); + + match("*/"); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ML_COMMENT" + + // $ANTLR start "RULE_SL_COMMENT" + public final void mRULE_SL_COMMENT() throws RecognitionException { + try { + int _type = RULE_SL_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:1518:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? ) + // InternalProblem.g:1518:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? + { + match("//"); + + // InternalProblem.g:1518:24: (~ ( ( '\\n' | '\\r' ) ) )* + loop8: + do { + int alt8=2; + int LA8_0 = input.LA(1); + + if ( ((LA8_0>='\u0000' && LA8_0<='\t')||(LA8_0>='\u000B' && LA8_0<='\f')||(LA8_0>='\u000E' && LA8_0<='\uFFFF')) ) { + alt8=1; + } + + + switch (alt8) { + case 1 : + // InternalProblem.g:1518:24: ~ ( ( '\\n' | '\\r' ) ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop8; + } + } while (true); + + // InternalProblem.g:1518:40: ( ( '\\r' )? '\\n' )? + int alt10=2; + int LA10_0 = input.LA(1); + + if ( (LA10_0=='\n'||LA10_0=='\r') ) { + alt10=1; + } + switch (alt10) { + case 1 : + // InternalProblem.g:1518:41: ( '\\r' )? '\\n' + { + // InternalProblem.g:1518:41: ( '\\r' )? + int alt9=2; + int LA9_0 = input.LA(1); + + if ( (LA9_0=='\r') ) { + alt9=1; + } + switch (alt9) { + case 1 : + // InternalProblem.g:1518:41: '\\r' + { + match('\r'); + + } + break; + + } + + match('\n'); + + } + break; + + } + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_SL_COMMENT" + + // $ANTLR start "RULE_WS" + public final void mRULE_WS() throws RecognitionException { + try { + int _type = RULE_WS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:1520:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // InternalProblem.g:1520:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + { + // InternalProblem.g:1520:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + int cnt11=0; + loop11: + do { + int alt11=2; + int LA11_0 = input.LA(1); + + if ( ((LA11_0>='\t' && LA11_0<='\n')||LA11_0=='\r'||LA11_0==' ') ) { + alt11=1; + } + + + switch (alt11) { + case 1 : + // InternalProblem.g: + { + if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) { + input.consume(); + + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + if ( cnt11 >= 1 ) break loop11; + EarlyExitException eee = + new EarlyExitException(11, input); + throw eee; + } + cnt11++; + } while (true); + + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_WS" + + // $ANTLR start "RULE_ANY_OTHER" + public final void mRULE_ANY_OTHER() throws RecognitionException { + try { + int _type = RULE_ANY_OTHER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // InternalProblem.g:1522:16: ( . ) + // InternalProblem.g:1522:18: . + { + matchAny(); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "RULE_ANY_OTHER" + + public void mTokens() throws RecognitionException { + // InternalProblem.g:1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER ) + int alt12=36; + alt12 = dfa12.predict(input); + switch (alt12) { + case 1 : + // InternalProblem.g:1:10: T__11 + { + mT__11(); + + } + break; + case 2 : + // InternalProblem.g:1:16: T__12 + { + mT__12(); + + } + break; + case 3 : + // InternalProblem.g:1:22: T__13 + { + mT__13(); + + } + break; + case 4 : + // InternalProblem.g:1:28: T__14 + { + mT__14(); + + } + break; + case 5 : + // InternalProblem.g:1:34: T__15 + { + mT__15(); + + } + break; + case 6 : + // InternalProblem.g:1:40: T__16 + { + mT__16(); + + } + break; + case 7 : + // InternalProblem.g:1:46: T__17 + { + mT__17(); + + } + break; + case 8 : + // InternalProblem.g:1:52: T__18 + { + mT__18(); + + } + break; + case 9 : + // InternalProblem.g:1:58: T__19 + { + mT__19(); + + } + break; + case 10 : + // InternalProblem.g:1:64: T__20 + { + mT__20(); + + } + break; + case 11 : + // InternalProblem.g:1:70: T__21 + { + mT__21(); + + } + break; + case 12 : + // InternalProblem.g:1:76: T__22 + { + mT__22(); + + } + break; + case 13 : + // InternalProblem.g:1:82: T__23 + { + mT__23(); + + } + break; + case 14 : + // InternalProblem.g:1:88: T__24 + { + mT__24(); + + } + break; + case 15 : + // InternalProblem.g:1:94: T__25 + { + mT__25(); + + } + break; + case 16 : + // InternalProblem.g:1:100: T__26 + { + mT__26(); + + } + break; + case 17 : + // InternalProblem.g:1:106: T__27 + { + mT__27(); + + } + break; + case 18 : + // InternalProblem.g:1:112: T__28 + { + mT__28(); + + } + break; + case 19 : + // InternalProblem.g:1:118: T__29 + { + mT__29(); + + } + break; + case 20 : + // InternalProblem.g:1:124: T__30 + { + mT__30(); + + } + break; + case 21 : + // InternalProblem.g:1:130: T__31 + { + mT__31(); + + } + break; + case 22 : + // InternalProblem.g:1:136: T__32 + { + mT__32(); + + } + break; + case 23 : + // InternalProblem.g:1:142: T__33 + { + mT__33(); + + } + break; + case 24 : + // InternalProblem.g:1:148: T__34 + { + mT__34(); + + } + break; + case 25 : + // InternalProblem.g:1:154: T__35 + { + mT__35(); + + } + break; + case 26 : + // InternalProblem.g:1:160: T__36 + { + mT__36(); + + } + break; + case 27 : + // InternalProblem.g:1:166: T__37 + { + mT__37(); + + } + break; + case 28 : + // InternalProblem.g:1:172: T__38 + { + mT__38(); + + } + break; + case 29 : + // InternalProblem.g:1:178: T__39 + { + mT__39(); + + } + break; + case 30 : + // InternalProblem.g:1:184: RULE_ID + { + mRULE_ID(); + + } + break; + case 31 : + // InternalProblem.g:1:192: RULE_INT + { + mRULE_INT(); + + } + break; + case 32 : + // InternalProblem.g:1:201: RULE_STRING + { + mRULE_STRING(); + + } + break; + case 33 : + // InternalProblem.g:1:213: RULE_ML_COMMENT + { + mRULE_ML_COMMENT(); + + } + break; + case 34 : + // InternalProblem.g:1:229: RULE_SL_COMMENT + { + mRULE_SL_COMMENT(); + + } + break; + case 35 : + // InternalProblem.g:1:245: RULE_WS + { + mRULE_WS(); + + } + break; + case 36 : + // InternalProblem.g:1:253: RULE_ANY_OTHER + { + mRULE_ANY_OTHER(); + + } + break; + + } + + } + + + protected DFA12 dfa12 = new DFA12(this); + static final String DFA12_eotS = + "\1\uffff\3\41\3\uffff\1\52\3\41\2\uffff\1\62\2\uffff\1\66\1\41\2\uffff\3\41\1\uffff\1\37\2\uffff\3\37\2\uffff\1\41\1\uffff\4\41\5\uffff\3\41\11\uffff\1\41\2\uffff\3\41\6\uffff\23\41\1\142\1\41\1\144\3\41\1\150\2\41\1\153\2\41\1\uffff\1\156\1\uffff\1\157\2\41\1\uffff\2\41\1\uffff\1\164\1\41\2\uffff\3\41\1\171\1\uffff\1\41\1\173\1\174\1\175\1\uffff\1\176\4\uffff"; + static final String DFA12_eofS = + "\177\uffff"; + static final String DFA12_minS = + "\1\0\1\142\1\154\1\162\3\uffff\1\56\1\145\1\160\1\162\2\uffff\1\72\2\uffff\1\75\1\143\2\uffff\1\162\1\141\1\156\1\uffff\1\101\2\uffff\2\0\1\52\2\uffff\1\163\1\uffff\1\141\1\156\1\164\1\162\5\uffff\1\146\1\160\1\145\11\uffff\1\157\2\uffff\1\165\1\154\1\153\6\uffff\1\164\1\163\1\164\1\145\1\157\1\145\1\157\1\144\1\160\1\145\1\163\1\156\1\162\1\163\1\141\1\156\2\162\1\163\1\60\1\145\1\60\1\145\1\157\1\141\1\60\1\151\1\144\1\60\1\163\1\151\1\uffff\1\60\1\uffff\1\60\1\167\1\143\1\uffff\1\156\1\163\1\uffff\1\60\1\164\2\uffff\1\156\1\164\1\163\1\60\1\uffff\1\145\3\60\1\uffff\1\60\4\uffff"; + static final String DFA12_maxS = + "\1\uffff\1\142\1\157\1\170\3\uffff\1\56\1\145\1\160\1\162\2\uffff\1\75\2\uffff\1\75\1\143\2\uffff\1\162\1\141\1\156\1\uffff\1\172\2\uffff\2\uffff\1\57\2\uffff\1\163\1\uffff\1\141\1\156\1\164\1\162\5\uffff\1\146\1\160\1\145\11\uffff\1\157\2\uffff\1\165\1\154\1\153\6\uffff\1\164\1\163\1\164\1\145\1\157\1\145\1\157\1\144\1\160\1\145\1\163\1\156\1\162\1\163\1\141\1\156\2\162\1\163\1\172\1\145\1\172\1\145\1\157\1\141\1\172\1\151\1\144\1\172\1\163\1\151\1\uffff\1\172\1\uffff\1\172\1\167\1\143\1\uffff\1\156\1\163\1\uffff\1\172\1\164\2\uffff\1\156\1\164\1\163\1\172\1\uffff\1\145\3\172\1\uffff\1\172\4\uffff"; + static final String DFA12_acceptS = + "\4\uffff\1\4\1\5\1\6\4\uffff\1\15\1\16\1\uffff\1\20\1\21\2\uffff\1\26\1\30\3\uffff\1\35\1\uffff\1\36\1\37\3\uffff\1\43\1\44\1\uffff\1\36\4\uffff\1\4\1\5\1\6\1\27\1\7\3\uffff\1\15\1\16\1\17\1\31\1\23\1\20\1\21\1\25\1\22\1\uffff\1\26\1\30\3\uffff\1\35\1\37\1\40\1\41\1\42\1\43\37\uffff\1\14\1\uffff\1\32\3\uffff\1\2\2\uffff\1\13\2\uffff\1\24\1\33\4\uffff\1\11\4\uffff\1\3\1\uffff\1\34\1\1\1\10\1\12"; + static final String DFA12_specialS = + "\1\1\32\uffff\1\2\1\0\142\uffff}>"; + static final String[] DFA12_transitionS = { + "\11\37\2\36\2\37\1\36\22\37\1\36\1\17\1\33\4\37\1\34\1\13\1\14\1\23\1\20\1\5\1\37\1\7\1\35\12\32\1\15\1\16\1\37\1\22\1\37\1\27\1\37\32\31\1\4\1\37\1\6\1\30\1\31\1\37\1\1\1\31\1\2\1\31\1\3\1\25\10\31\1\11\1\12\1\31\1\10\1\21\1\24\1\26\5\31\uff85\37", + "\1\40", + "\1\42\2\uffff\1\43", + "\1\45\5\uffff\1\44", + "", + "", + "", + "\1\51", + "\1\53", + "\1\54", + "\1\55", + "", + "", + "\1\61\2\uffff\1\60", + "", + "", + "\1\65", + "\1\67", + "", + "", + "\1\72", + "\1\73", + "\1\74", + "", + "\32\41\4\uffff\1\41\1\uffff\32\41", + "", + "", + "\0\77", + "\0\77", + "\1\100\4\uffff\1\101", + "", + "", + "\1\103", + "", + "\1\104", + "\1\105", + "\1\106", + "\1\107", + "", + "", + "", + "", + "", + "\1\110", + "\1\111", + "\1\112", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\1\113", + "", + "", + "\1\114", + "\1\115", + "\1\116", + "", + "", + "", + "", + "", + "", + "\1\117", + "\1\120", + "\1\121", + "\1\122", + "\1\123", + "\1\124", + "\1\125", + "\1\126", + "\1\127", + "\1\130", + "\1\131", + "\1\132", + "\1\133", + "\1\134", + "\1\135", + "\1\136", + "\1\137", + "\1\140", + "\1\141", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "\1\143", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "\1\145", + "\1\146", + "\1\147", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "\1\151", + "\1\152", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "\1\154", + "\1\155", + "", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "\1\160", + "\1\161", + "", + "\1\162", + "\1\163", + "", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "\1\165", + "", + "", + "\1\166", + "\1\167", + "\1\170", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "", + "\1\172", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "", + "\12\41\7\uffff\32\41\4\uffff\1\41\1\uffff\32\41", + "", + "", + "", + "" + }; + + static final short[] DFA12_eot = DFA.unpackEncodedString(DFA12_eotS); + static final short[] DFA12_eof = DFA.unpackEncodedString(DFA12_eofS); + static final char[] DFA12_min = DFA.unpackEncodedStringToUnsignedChars(DFA12_minS); + static final char[] DFA12_max = DFA.unpackEncodedStringToUnsignedChars(DFA12_maxS); + static final short[] DFA12_accept = DFA.unpackEncodedString(DFA12_acceptS); + static final short[] DFA12_special = DFA.unpackEncodedString(DFA12_specialS); + static final short[][] DFA12_transition; + + static { + int numStates = DFA12_transitionS.length; + DFA12_transition = new short[numStates][]; + for (int i=0; i='\u0000' && LA12_28<='\uFFFF')) ) {s = 63;} + + else s = 31; + + if ( s>=0 ) return s; + break; + case 1 : + int LA12_0 = input.LA(1); + + s = -1; + if ( (LA12_0=='a') ) {s = 1;} + + else if ( (LA12_0=='c') ) {s = 2;} + + else if ( (LA12_0=='e') ) {s = 3;} + + else if ( (LA12_0=='[') ) {s = 4;} + + else if ( (LA12_0==',') ) {s = 5;} + + else if ( (LA12_0==']') ) {s = 6;} + + else if ( (LA12_0=='.') ) {s = 7;} + + else if ( (LA12_0=='r') ) {s = 8;} + + else if ( (LA12_0=='o') ) {s = 9;} + + else if ( (LA12_0=='p') ) {s = 10;} + + else if ( (LA12_0=='(') ) {s = 11;} + + else if ( (LA12_0==')') ) {s = 12;} + + else if ( (LA12_0==':') ) {s = 13;} + + else if ( (LA12_0==';') ) {s = 14;} + + else if ( (LA12_0=='!') ) {s = 15;} + + else if ( (LA12_0=='+') ) {s = 16;} + + else if ( (LA12_0=='s') ) {s = 17;} + + else if ( (LA12_0=='=') ) {s = 18;} + + else if ( (LA12_0=='*') ) {s = 19;} + + else if ( (LA12_0=='t') ) {s = 20;} + + else if ( (LA12_0=='f') ) {s = 21;} + + else if ( (LA12_0=='u') ) {s = 22;} + + else if ( (LA12_0=='?') ) {s = 23;} + + else if ( (LA12_0=='^') ) {s = 24;} + + else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||LA12_0=='b'||LA12_0=='d'||(LA12_0>='g' && LA12_0<='n')||LA12_0=='q'||(LA12_0>='v' && LA12_0<='z')) ) {s = 25;} + + else if ( ((LA12_0>='0' && LA12_0<='9')) ) {s = 26;} + + else if ( (LA12_0=='\"') ) {s = 27;} + + else if ( (LA12_0=='\'') ) {s = 28;} + + else if ( (LA12_0=='/') ) {s = 29;} + + else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {s = 30;} + + else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||(LA12_0>='#' && LA12_0<='&')||LA12_0=='-'||LA12_0=='<'||LA12_0=='>'||LA12_0=='@'||LA12_0=='\\'||LA12_0=='`'||(LA12_0>='{' && LA12_0<='\uFFFF')) ) {s = 31;} + + if ( s>=0 ) return s; + break; + case 2 : + int LA12_27 = input.LA(1); + + s = -1; + if ( ((LA12_27>='\u0000' && LA12_27<='\uFFFF')) ) {s = 63;} + + else s = 31; + + if ( s>=0 ) return s; + break; + } + NoViableAltException nvae = + new NoViableAltException(getDescription(), 12, _s, input); + error(nvae); + throw nvae; + } + } + + +} \ No newline at end of file diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblemParser.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblemParser.java new file mode 100644 index 00000000..9bfeb079 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/parser/antlr/internal/InternalProblemParser.java @@ -0,0 +1,4056 @@ +package org.eclipse.viatra.solver.language.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.viatra.solver.language.services.ProblemGrammarAccess; + + + +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; +import java.util.ArrayList; + +@SuppressWarnings("all") +public class InternalProblemParser extends AbstractInternalAntlrParser { + public static final String[] tokenNames = new String[] { + "", "", "", "", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'abstract'", "'class'", "'extends'", "'['", "','", "']'", "'.'", "'contains'", "'refers'", "'opposite'", "'error'", "'pred'", "'('", "')'", "':='", "';'", "'!'", "'+'", "':'", "'scope'", "'+='", "'='", "'..'", "'*'", "'::'", "'true'", "'false'", "'unknown'", "'?'" + }; + public static final int RULE_STRING=6; + public static final int RULE_SL_COMMENT=8; + public static final int T__19=19; + public static final int T__15=15; + public static final int T__37=37; + public static final int T__16=16; + public static final int T__38=38; + public static final int T__17=17; + public static final int T__39=39; + public static final int T__18=18; + public static final int T__11=11; + public static final int T__33=33; + public static final int T__12=12; + public static final int T__34=34; + public static final int T__13=13; + public static final int T__35=35; + public static final int T__14=14; + public static final int T__36=36; + public static final int EOF=-1; + public static final int T__30=30; + public static final int T__31=31; + public static final int T__32=32; + public static final int RULE_ID=4; + public static final int RULE_WS=9; + public static final int RULE_ANY_OTHER=10; + public static final int T__26=26; + public static final int T__27=27; + public static final int T__28=28; + public static final int RULE_INT=5; + public static final int T__29=29; + public static final int T__22=22; + public static final int RULE_ML_COMMENT=7; + public static final int T__23=23; + public static final int T__24=24; + public static final int T__25=25; + public static final int T__20=20; + public static final int T__21=21; + + // delegates + // delegators + + + public InternalProblemParser(TokenStream input) { + this(input, new RecognizerSharedState()); + } + public InternalProblemParser(TokenStream input, RecognizerSharedState state) { + super(input, state); + + } + + + public String[] getTokenNames() { return InternalProblemParser.tokenNames; } + public String getGrammarFileName() { return "InternalProblem.g"; } + + + + private ProblemGrammarAccess grammarAccess; + + public InternalProblemParser(TokenStream input, ProblemGrammarAccess grammarAccess) { + this(input); + this.grammarAccess = grammarAccess; + registerRules(grammarAccess.getGrammar()); + } + + @Override + protected String getFirstRuleName() { + return "Problem"; + } + + @Override + protected ProblemGrammarAccess getGrammarAccess() { + return grammarAccess; + } + + + + + // $ANTLR start "entryRuleProblem" + // InternalProblem.g:65:1: entryRuleProblem returns [EObject current=null] : iv_ruleProblem= ruleProblem EOF ; + public final EObject entryRuleProblem() throws RecognitionException { + EObject current = null; + + EObject iv_ruleProblem = null; + + + try { + // InternalProblem.g:65:48: (iv_ruleProblem= ruleProblem EOF ) + // InternalProblem.g:66:2: iv_ruleProblem= ruleProblem EOF + { + newCompositeNode(grammarAccess.getProblemRule()); + pushFollow(FOLLOW_1); + iv_ruleProblem=ruleProblem(); + + state._fsp--; + + current =iv_ruleProblem; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleProblem" + + + // $ANTLR start "ruleProblem" + // InternalProblem.g:72:1: ruleProblem returns [EObject current=null] : ( (lv_statements_0_0= ruleStatement ) )* ; + public final EObject ruleProblem() throws RecognitionException { + EObject current = null; + + EObject lv_statements_0_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:78:2: ( ( (lv_statements_0_0= ruleStatement ) )* ) + // InternalProblem.g:79:2: ( (lv_statements_0_0= ruleStatement ) )* + { + // InternalProblem.g:79:2: ( (lv_statements_0_0= ruleStatement ) )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0==RULE_ID||(LA1_0>=11 && LA1_0<=12)||(LA1_0>=21 && LA1_0<=22)||LA1_0==27||LA1_0==30||LA1_0==39) ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // InternalProblem.g:80:3: (lv_statements_0_0= ruleStatement ) + { + // InternalProblem.g:80:3: (lv_statements_0_0= ruleStatement ) + // InternalProblem.g:81:4: lv_statements_0_0= ruleStatement + { + + newCompositeNode(grammarAccess.getProblemAccess().getStatementsStatementParserRuleCall_0()); + + pushFollow(FOLLOW_3); + lv_statements_0_0=ruleStatement(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getProblemRule()); + } + add( + current, + "statements", + lv_statements_0_0, + "org.eclipse.viatra.solver.language.Problem.Statement"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + default : + break loop1; + } + } while (true); + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleProblem" + + + // $ANTLR start "entryRuleStatement" + // InternalProblem.g:101:1: entryRuleStatement returns [EObject current=null] : iv_ruleStatement= ruleStatement EOF ; + public final EObject entryRuleStatement() throws RecognitionException { + EObject current = null; + + EObject iv_ruleStatement = null; + + + try { + // InternalProblem.g:101:50: (iv_ruleStatement= ruleStatement EOF ) + // InternalProblem.g:102:2: iv_ruleStatement= ruleStatement EOF + { + newCompositeNode(grammarAccess.getStatementRule()); + pushFollow(FOLLOW_1); + iv_ruleStatement=ruleStatement(); + + state._fsp--; + + current =iv_ruleStatement; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleStatement" + + + // $ANTLR start "ruleStatement" + // InternalProblem.g:108:1: ruleStatement returns [EObject current=null] : (this_ClassDeclaration_0= ruleClassDeclaration | this_PredicateDefinition_1= rulePredicateDefinition | this_Assertion_2= ruleAssertion | this_ScopeDeclaration_3= ruleScopeDeclaration ) ; + public final EObject ruleStatement() throws RecognitionException { + EObject current = null; + + EObject this_ClassDeclaration_0 = null; + + EObject this_PredicateDefinition_1 = null; + + EObject this_Assertion_2 = null; + + EObject this_ScopeDeclaration_3 = null; + + + + enterRule(); + + try { + // InternalProblem.g:114:2: ( (this_ClassDeclaration_0= ruleClassDeclaration | this_PredicateDefinition_1= rulePredicateDefinition | this_Assertion_2= ruleAssertion | this_ScopeDeclaration_3= ruleScopeDeclaration ) ) + // InternalProblem.g:115:2: (this_ClassDeclaration_0= ruleClassDeclaration | this_PredicateDefinition_1= rulePredicateDefinition | this_Assertion_2= ruleAssertion | this_ScopeDeclaration_3= ruleScopeDeclaration ) + { + // InternalProblem.g:115:2: (this_ClassDeclaration_0= ruleClassDeclaration | this_PredicateDefinition_1= rulePredicateDefinition | this_Assertion_2= ruleAssertion | this_ScopeDeclaration_3= ruleScopeDeclaration ) + int alt2=4; + switch ( input.LA(1) ) { + case 11: + case 12: + { + alt2=1; + } + break; + case 21: + case 22: + { + alt2=2; + } + break; + case RULE_ID: + case 27: + case 39: + { + alt2=3; + } + break; + case 30: + { + alt2=4; + } + break; + default: + NoViableAltException nvae = + new NoViableAltException("", 2, 0, input); + + throw nvae; + } + + switch (alt2) { + case 1 : + // InternalProblem.g:116:3: this_ClassDeclaration_0= ruleClassDeclaration + { + + newCompositeNode(grammarAccess.getStatementAccess().getClassDeclarationParserRuleCall_0()); + + pushFollow(FOLLOW_2); + this_ClassDeclaration_0=ruleClassDeclaration(); + + state._fsp--; + + + current = this_ClassDeclaration_0; + afterParserOrEnumRuleCall(); + + + } + break; + case 2 : + // InternalProblem.g:125:3: this_PredicateDefinition_1= rulePredicateDefinition + { + + newCompositeNode(grammarAccess.getStatementAccess().getPredicateDefinitionParserRuleCall_1()); + + pushFollow(FOLLOW_2); + this_PredicateDefinition_1=rulePredicateDefinition(); + + state._fsp--; + + + current = this_PredicateDefinition_1; + afterParserOrEnumRuleCall(); + + + } + break; + case 3 : + // InternalProblem.g:134:3: this_Assertion_2= ruleAssertion + { + + newCompositeNode(grammarAccess.getStatementAccess().getAssertionParserRuleCall_2()); + + pushFollow(FOLLOW_2); + this_Assertion_2=ruleAssertion(); + + state._fsp--; + + + current = this_Assertion_2; + afterParserOrEnumRuleCall(); + + + } + break; + case 4 : + // InternalProblem.g:143:3: this_ScopeDeclaration_3= ruleScopeDeclaration + { + + newCompositeNode(grammarAccess.getStatementAccess().getScopeDeclarationParserRuleCall_3()); + + pushFollow(FOLLOW_2); + this_ScopeDeclaration_3=ruleScopeDeclaration(); + + state._fsp--; + + + current = this_ScopeDeclaration_3; + afterParserOrEnumRuleCall(); + + + } + break; + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleStatement" + + + // $ANTLR start "entryRuleClassDeclaration" + // InternalProblem.g:155:1: entryRuleClassDeclaration returns [EObject current=null] : iv_ruleClassDeclaration= ruleClassDeclaration EOF ; + public final EObject entryRuleClassDeclaration() throws RecognitionException { + EObject current = null; + + EObject iv_ruleClassDeclaration = null; + + + try { + // InternalProblem.g:155:57: (iv_ruleClassDeclaration= ruleClassDeclaration EOF ) + // InternalProblem.g:156:2: iv_ruleClassDeclaration= ruleClassDeclaration EOF + { + newCompositeNode(grammarAccess.getClassDeclarationRule()); + pushFollow(FOLLOW_1); + iv_ruleClassDeclaration=ruleClassDeclaration(); + + state._fsp--; + + current =iv_ruleClassDeclaration; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleClassDeclaration" + + + // $ANTLR start "ruleClassDeclaration" + // InternalProblem.g:162:1: ruleClassDeclaration returns [EObject current=null] : ( ( (lv_abstract_0_0= 'abstract' ) )? otherlv_1= 'class' ( (lv_name_2_0= RULE_ID ) ) ( (otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) ) | ( (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) ) )? (otherlv_11= ',' ( (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) ) )* otherlv_13= '.' ) ; + public final EObject ruleClassDeclaration() throws RecognitionException { + EObject current = null; + + Token lv_abstract_0_0=null; + Token otherlv_1=null; + Token lv_name_2_0=null; + Token otherlv_3=null; + Token otherlv_4=null; + Token otherlv_5=null; + Token otherlv_6=null; + Token otherlv_7=null; + Token otherlv_8=null; + Token otherlv_9=null; + Token otherlv_11=null; + Token otherlv_13=null; + EObject lv_referenceDeclarations_10_0 = null; + + EObject lv_referenceDeclarations_12_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:168:2: ( ( ( (lv_abstract_0_0= 'abstract' ) )? otherlv_1= 'class' ( (lv_name_2_0= RULE_ID ) ) ( (otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) ) | ( (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) ) )? (otherlv_11= ',' ( (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) ) )* otherlv_13= '.' ) ) + // InternalProblem.g:169:2: ( ( (lv_abstract_0_0= 'abstract' ) )? otherlv_1= 'class' ( (lv_name_2_0= RULE_ID ) ) ( (otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) ) | ( (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) ) )? (otherlv_11= ',' ( (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) ) )* otherlv_13= '.' ) + { + // InternalProblem.g:169:2: ( ( (lv_abstract_0_0= 'abstract' ) )? otherlv_1= 'class' ( (lv_name_2_0= RULE_ID ) ) ( (otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) ) | ( (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) ) )? (otherlv_11= ',' ( (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) ) )* otherlv_13= '.' ) + // InternalProblem.g:170:3: ( (lv_abstract_0_0= 'abstract' ) )? otherlv_1= 'class' ( (lv_name_2_0= RULE_ID ) ) ( (otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) ) | ( (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) ) )? (otherlv_11= ',' ( (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) ) )* otherlv_13= '.' + { + // InternalProblem.g:170:3: ( (lv_abstract_0_0= 'abstract' ) )? + int alt3=2; + int LA3_0 = input.LA(1); + + if ( (LA3_0==11) ) { + alt3=1; + } + switch (alt3) { + case 1 : + // InternalProblem.g:171:4: (lv_abstract_0_0= 'abstract' ) + { + // InternalProblem.g:171:4: (lv_abstract_0_0= 'abstract' ) + // InternalProblem.g:172:5: lv_abstract_0_0= 'abstract' + { + lv_abstract_0_0=(Token)match(input,11,FOLLOW_4); + + newLeafNode(lv_abstract_0_0, grammarAccess.getClassDeclarationAccess().getAbstractAbstractKeyword_0_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + setWithLastConsumed(current, "abstract", lv_abstract_0_0 != null, "abstract"); + + + } + + + } + break; + + } + + otherlv_1=(Token)match(input,12,FOLLOW_5); + + newLeafNode(otherlv_1, grammarAccess.getClassDeclarationAccess().getClassKeyword_1()); + + // InternalProblem.g:188:3: ( (lv_name_2_0= RULE_ID ) ) + // InternalProblem.g:189:4: (lv_name_2_0= RULE_ID ) + { + // InternalProblem.g:189:4: (lv_name_2_0= RULE_ID ) + // InternalProblem.g:190:5: lv_name_2_0= RULE_ID + { + lv_name_2_0=(Token)match(input,RULE_ID,FOLLOW_6); + + newLeafNode(lv_name_2_0, grammarAccess.getClassDeclarationAccess().getNameIDTerminalRuleCall_2_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + setWithLastConsumed( + current, + "name", + lv_name_2_0, + "org.eclipse.xtext.common.Terminals.ID"); + + + } + + + } + + // InternalProblem.g:206:3: ( (otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) ) | ( (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) ) )? + int alt7=3; + int LA7_0 = input.LA(1); + + if ( (LA7_0==13) ) { + alt7=1; + } + else if ( ((LA7_0>=18 && LA7_0<=19)) ) { + alt7=2; + } + switch (alt7) { + case 1 : + // InternalProblem.g:207:4: (otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) ) + { + // InternalProblem.g:207:4: (otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) ) + // InternalProblem.g:208:5: otherlv_3= 'extends' ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) + { + otherlv_3=(Token)match(input,13,FOLLOW_7); + + newLeafNode(otherlv_3, grammarAccess.getClassDeclarationAccess().getExtendsKeyword_3_0_0()); + + // InternalProblem.g:212:5: ( ( (otherlv_4= RULE_ID ) ) | (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) ) + int alt6=2; + int LA6_0 = input.LA(1); + + if ( (LA6_0==RULE_ID) ) { + alt6=1; + } + else if ( (LA6_0==14) ) { + alt6=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 6, 0, input); + + throw nvae; + } + switch (alt6) { + case 1 : + // InternalProblem.g:213:6: ( (otherlv_4= RULE_ID ) ) + { + // InternalProblem.g:213:6: ( (otherlv_4= RULE_ID ) ) + // InternalProblem.g:214:7: (otherlv_4= RULE_ID ) + { + // InternalProblem.g:214:7: (otherlv_4= RULE_ID ) + // InternalProblem.g:215:8: otherlv_4= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + + otherlv_4=(Token)match(input,RULE_ID,FOLLOW_8); + + newLeafNode(otherlv_4, grammarAccess.getClassDeclarationAccess().getSuperTypesClassDeclarationCrossReference_3_0_1_0_0()); + + + } + + + } + + + } + break; + case 2 : + // InternalProblem.g:227:6: (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) + { + // InternalProblem.g:227:6: (otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' ) + // InternalProblem.g:228:7: otherlv_5= '[' ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? otherlv_9= ']' + { + otherlv_5=(Token)match(input,14,FOLLOW_9); + + newLeafNode(otherlv_5, grammarAccess.getClassDeclarationAccess().getLeftSquareBracketKeyword_3_0_1_1_0()); + + // InternalProblem.g:232:7: ( ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* )? + int alt5=2; + int LA5_0 = input.LA(1); + + if ( (LA5_0==RULE_ID) ) { + alt5=1; + } + switch (alt5) { + case 1 : + // InternalProblem.g:233:8: ( (otherlv_6= RULE_ID ) ) (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* + { + // InternalProblem.g:233:8: ( (otherlv_6= RULE_ID ) ) + // InternalProblem.g:234:9: (otherlv_6= RULE_ID ) + { + // InternalProblem.g:234:9: (otherlv_6= RULE_ID ) + // InternalProblem.g:235:10: otherlv_6= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + + otherlv_6=(Token)match(input,RULE_ID,FOLLOW_10); + + newLeafNode(otherlv_6, grammarAccess.getClassDeclarationAccess().getSuperTypesClassDeclarationCrossReference_3_0_1_1_1_0_0()); + + + } + + + } + + // InternalProblem.g:246:8: (otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) )* + loop4: + do { + int alt4=2; + int LA4_0 = input.LA(1); + + if ( (LA4_0==15) ) { + alt4=1; + } + + + switch (alt4) { + case 1 : + // InternalProblem.g:247:9: otherlv_7= ',' ( (otherlv_8= RULE_ID ) ) + { + otherlv_7=(Token)match(input,15,FOLLOW_5); + + newLeafNode(otherlv_7, grammarAccess.getClassDeclarationAccess().getCommaKeyword_3_0_1_1_1_1_0()); + + // InternalProblem.g:251:9: ( (otherlv_8= RULE_ID ) ) + // InternalProblem.g:252:10: (otherlv_8= RULE_ID ) + { + // InternalProblem.g:252:10: (otherlv_8= RULE_ID ) + // InternalProblem.g:253:11: otherlv_8= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getClassDeclarationRule()); + } + + otherlv_8=(Token)match(input,RULE_ID,FOLLOW_10); + + newLeafNode(otherlv_8, grammarAccess.getClassDeclarationAccess().getSuperTypesClassDeclarationCrossReference_3_0_1_1_1_1_1_0()); + + + } + + + } + + + } + break; + + default : + break loop4; + } + } while (true); + + + } + break; + + } + + otherlv_9=(Token)match(input,16,FOLLOW_8); + + newLeafNode(otherlv_9, grammarAccess.getClassDeclarationAccess().getRightSquareBracketKeyword_3_0_1_1_2()); + + + } + + + } + break; + + } + + + } + + + } + break; + case 2 : + // InternalProblem.g:274:4: ( (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) ) + { + // InternalProblem.g:274:4: ( (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) ) + // InternalProblem.g:275:5: (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) + { + // InternalProblem.g:275:5: (lv_referenceDeclarations_10_0= ruleReferenceDeclaration ) + // InternalProblem.g:276:6: lv_referenceDeclarations_10_0= ruleReferenceDeclaration + { + + newCompositeNode(grammarAccess.getClassDeclarationAccess().getReferenceDeclarationsReferenceDeclarationParserRuleCall_3_1_0()); + + pushFollow(FOLLOW_8); + lv_referenceDeclarations_10_0=ruleReferenceDeclaration(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getClassDeclarationRule()); + } + add( + current, + "referenceDeclarations", + lv_referenceDeclarations_10_0, + "org.eclipse.viatra.solver.language.Problem.ReferenceDeclaration"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + } + + // InternalProblem.g:294:3: (otherlv_11= ',' ( (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) ) )* + loop8: + do { + int alt8=2; + int LA8_0 = input.LA(1); + + if ( (LA8_0==15) ) { + alt8=1; + } + + + switch (alt8) { + case 1 : + // InternalProblem.g:295:4: otherlv_11= ',' ( (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) ) + { + otherlv_11=(Token)match(input,15,FOLLOW_11); + + newLeafNode(otherlv_11, grammarAccess.getClassDeclarationAccess().getCommaKeyword_4_0()); + + // InternalProblem.g:299:4: ( (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) ) + // InternalProblem.g:300:5: (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) + { + // InternalProblem.g:300:5: (lv_referenceDeclarations_12_0= ruleReferenceDeclaration ) + // InternalProblem.g:301:6: lv_referenceDeclarations_12_0= ruleReferenceDeclaration + { + + newCompositeNode(grammarAccess.getClassDeclarationAccess().getReferenceDeclarationsReferenceDeclarationParserRuleCall_4_1_0()); + + pushFollow(FOLLOW_8); + lv_referenceDeclarations_12_0=ruleReferenceDeclaration(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getClassDeclarationRule()); + } + add( + current, + "referenceDeclarations", + lv_referenceDeclarations_12_0, + "org.eclipse.viatra.solver.language.Problem.ReferenceDeclaration"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + default : + break loop8; + } + } while (true); + + otherlv_13=(Token)match(input,17,FOLLOW_2); + + newLeafNode(otherlv_13, grammarAccess.getClassDeclarationAccess().getFullStopKeyword_5()); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleClassDeclaration" + + + // $ANTLR start "entryRuleReferenceDeclaration" + // InternalProblem.g:327:1: entryRuleReferenceDeclaration returns [EObject current=null] : iv_ruleReferenceDeclaration= ruleReferenceDeclaration EOF ; + public final EObject entryRuleReferenceDeclaration() throws RecognitionException { + EObject current = null; + + EObject iv_ruleReferenceDeclaration = null; + + + try { + // InternalProblem.g:327:61: (iv_ruleReferenceDeclaration= ruleReferenceDeclaration EOF ) + // InternalProblem.g:328:2: iv_ruleReferenceDeclaration= ruleReferenceDeclaration EOF + { + newCompositeNode(grammarAccess.getReferenceDeclarationRule()); + pushFollow(FOLLOW_1); + iv_ruleReferenceDeclaration=ruleReferenceDeclaration(); + + state._fsp--; + + current =iv_ruleReferenceDeclaration; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleReferenceDeclaration" + + + // $ANTLR start "ruleReferenceDeclaration" + // InternalProblem.g:334:1: ruleReferenceDeclaration returns [EObject current=null] : ( ( ( (lv_containment_0_0= 'contains' ) ) | otherlv_1= 'refers' ) ( (otherlv_2= RULE_ID ) ) otherlv_3= '[' ( (lv_multiplicity_4_0= ruleMultiplicity ) ) otherlv_5= ']' ( (lv_name_6_0= RULE_ID ) ) (otherlv_7= 'opposite' ( ( ruleQualifiedName ) ) )? ) ; + public final EObject ruleReferenceDeclaration() throws RecognitionException { + EObject current = null; + + Token lv_containment_0_0=null; + Token otherlv_1=null; + Token otherlv_2=null; + Token otherlv_3=null; + Token otherlv_5=null; + Token lv_name_6_0=null; + Token otherlv_7=null; + EObject lv_multiplicity_4_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:340:2: ( ( ( ( (lv_containment_0_0= 'contains' ) ) | otherlv_1= 'refers' ) ( (otherlv_2= RULE_ID ) ) otherlv_3= '[' ( (lv_multiplicity_4_0= ruleMultiplicity ) ) otherlv_5= ']' ( (lv_name_6_0= RULE_ID ) ) (otherlv_7= 'opposite' ( ( ruleQualifiedName ) ) )? ) ) + // InternalProblem.g:341:2: ( ( ( (lv_containment_0_0= 'contains' ) ) | otherlv_1= 'refers' ) ( (otherlv_2= RULE_ID ) ) otherlv_3= '[' ( (lv_multiplicity_4_0= ruleMultiplicity ) ) otherlv_5= ']' ( (lv_name_6_0= RULE_ID ) ) (otherlv_7= 'opposite' ( ( ruleQualifiedName ) ) )? ) + { + // InternalProblem.g:341:2: ( ( ( (lv_containment_0_0= 'contains' ) ) | otherlv_1= 'refers' ) ( (otherlv_2= RULE_ID ) ) otherlv_3= '[' ( (lv_multiplicity_4_0= ruleMultiplicity ) ) otherlv_5= ']' ( (lv_name_6_0= RULE_ID ) ) (otherlv_7= 'opposite' ( ( ruleQualifiedName ) ) )? ) + // InternalProblem.g:342:3: ( ( (lv_containment_0_0= 'contains' ) ) | otherlv_1= 'refers' ) ( (otherlv_2= RULE_ID ) ) otherlv_3= '[' ( (lv_multiplicity_4_0= ruleMultiplicity ) ) otherlv_5= ']' ( (lv_name_6_0= RULE_ID ) ) (otherlv_7= 'opposite' ( ( ruleQualifiedName ) ) )? + { + // InternalProblem.g:342:3: ( ( (lv_containment_0_0= 'contains' ) ) | otherlv_1= 'refers' ) + int alt9=2; + int LA9_0 = input.LA(1); + + if ( (LA9_0==18) ) { + alt9=1; + } + else if ( (LA9_0==19) ) { + alt9=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 9, 0, input); + + throw nvae; + } + switch (alt9) { + case 1 : + // InternalProblem.g:343:4: ( (lv_containment_0_0= 'contains' ) ) + { + // InternalProblem.g:343:4: ( (lv_containment_0_0= 'contains' ) ) + // InternalProblem.g:344:5: (lv_containment_0_0= 'contains' ) + { + // InternalProblem.g:344:5: (lv_containment_0_0= 'contains' ) + // InternalProblem.g:345:6: lv_containment_0_0= 'contains' + { + lv_containment_0_0=(Token)match(input,18,FOLLOW_5); + + newLeafNode(lv_containment_0_0, grammarAccess.getReferenceDeclarationAccess().getContainmentContainsKeyword_0_0_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getReferenceDeclarationRule()); + } + setWithLastConsumed(current, "containment", lv_containment_0_0 != null, "contains"); + + + } + + + } + + + } + break; + case 2 : + // InternalProblem.g:358:4: otherlv_1= 'refers' + { + otherlv_1=(Token)match(input,19,FOLLOW_5); + + newLeafNode(otherlv_1, grammarAccess.getReferenceDeclarationAccess().getRefersKeyword_0_1()); + + + } + break; + + } + + // InternalProblem.g:363:3: ( (otherlv_2= RULE_ID ) ) + // InternalProblem.g:364:4: (otherlv_2= RULE_ID ) + { + // InternalProblem.g:364:4: (otherlv_2= RULE_ID ) + // InternalProblem.g:365:5: otherlv_2= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getReferenceDeclarationRule()); + } + + otherlv_2=(Token)match(input,RULE_ID,FOLLOW_12); + + newLeafNode(otherlv_2, grammarAccess.getReferenceDeclarationAccess().getReferenceTypeClassDeclarationCrossReference_1_0()); + + + } + + + } + + otherlv_3=(Token)match(input,14,FOLLOW_13); + + newLeafNode(otherlv_3, grammarAccess.getReferenceDeclarationAccess().getLeftSquareBracketKeyword_2()); + + // InternalProblem.g:380:3: ( (lv_multiplicity_4_0= ruleMultiplicity ) ) + // InternalProblem.g:381:4: (lv_multiplicity_4_0= ruleMultiplicity ) + { + // InternalProblem.g:381:4: (lv_multiplicity_4_0= ruleMultiplicity ) + // InternalProblem.g:382:5: lv_multiplicity_4_0= ruleMultiplicity + { + + newCompositeNode(grammarAccess.getReferenceDeclarationAccess().getMultiplicityMultiplicityParserRuleCall_3_0()); + + pushFollow(FOLLOW_14); + lv_multiplicity_4_0=ruleMultiplicity(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getReferenceDeclarationRule()); + } + set( + current, + "multiplicity", + lv_multiplicity_4_0, + "org.eclipse.viatra.solver.language.Problem.Multiplicity"); + afterParserOrEnumRuleCall(); + + + } + + + } + + otherlv_5=(Token)match(input,16,FOLLOW_5); + + newLeafNode(otherlv_5, grammarAccess.getReferenceDeclarationAccess().getRightSquareBracketKeyword_4()); + + // InternalProblem.g:403:3: ( (lv_name_6_0= RULE_ID ) ) + // InternalProblem.g:404:4: (lv_name_6_0= RULE_ID ) + { + // InternalProblem.g:404:4: (lv_name_6_0= RULE_ID ) + // InternalProblem.g:405:5: lv_name_6_0= RULE_ID + { + lv_name_6_0=(Token)match(input,RULE_ID,FOLLOW_15); + + newLeafNode(lv_name_6_0, grammarAccess.getReferenceDeclarationAccess().getNameIDTerminalRuleCall_5_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getReferenceDeclarationRule()); + } + setWithLastConsumed( + current, + "name", + lv_name_6_0, + "org.eclipse.xtext.common.Terminals.ID"); + + + } + + + } + + // InternalProblem.g:421:3: (otherlv_7= 'opposite' ( ( ruleQualifiedName ) ) )? + int alt10=2; + int LA10_0 = input.LA(1); + + if ( (LA10_0==20) ) { + alt10=1; + } + switch (alt10) { + case 1 : + // InternalProblem.g:422:4: otherlv_7= 'opposite' ( ( ruleQualifiedName ) ) + { + otherlv_7=(Token)match(input,20,FOLLOW_5); + + newLeafNode(otherlv_7, grammarAccess.getReferenceDeclarationAccess().getOppositeKeyword_6_0()); + + // InternalProblem.g:426:4: ( ( ruleQualifiedName ) ) + // InternalProblem.g:427:5: ( ruleQualifiedName ) + { + // InternalProblem.g:427:5: ( ruleQualifiedName ) + // InternalProblem.g:428:6: ruleQualifiedName + { + + if (current==null) { + current = createModelElement(grammarAccess.getReferenceDeclarationRule()); + } + + + newCompositeNode(grammarAccess.getReferenceDeclarationAccess().getOppositeReferenceDeclarationCrossReference_6_1_0()); + + pushFollow(FOLLOW_2); + ruleQualifiedName(); + + state._fsp--; + + + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleReferenceDeclaration" + + + // $ANTLR start "entryRulePredicateDefinition" + // InternalProblem.g:447:1: entryRulePredicateDefinition returns [EObject current=null] : iv_rulePredicateDefinition= rulePredicateDefinition EOF ; + public final EObject entryRulePredicateDefinition() throws RecognitionException { + EObject current = null; + + EObject iv_rulePredicateDefinition = null; + + + try { + // InternalProblem.g:447:60: (iv_rulePredicateDefinition= rulePredicateDefinition EOF ) + // InternalProblem.g:448:2: iv_rulePredicateDefinition= rulePredicateDefinition EOF + { + newCompositeNode(grammarAccess.getPredicateDefinitionRule()); + pushFollow(FOLLOW_1); + iv_rulePredicateDefinition=rulePredicateDefinition(); + + state._fsp--; + + current =iv_rulePredicateDefinition; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRulePredicateDefinition" + + + // $ANTLR start "rulePredicateDefinition" + // InternalProblem.g:454:1: rulePredicateDefinition returns [EObject current=null] : ( ( ( ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? ) | otherlv_2= 'pred' ) ( (lv_name_3_0= RULE_ID ) ) otherlv_4= '(' ( ( (lv_parameters_5_0= ruleParameter ) ) (otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) )* )? otherlv_8= ')' (otherlv_9= ':=' ( (lv_bodies_10_0= ruleConjunction ) ) (otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) )* )? otherlv_13= '.' ) ; + public final EObject rulePredicateDefinition() throws RecognitionException { + EObject current = null; + + Token lv_error_0_0=null; + Token otherlv_1=null; + Token otherlv_2=null; + Token lv_name_3_0=null; + Token otherlv_4=null; + Token otherlv_6=null; + Token otherlv_8=null; + Token otherlv_9=null; + Token otherlv_11=null; + Token otherlv_13=null; + EObject lv_parameters_5_0 = null; + + EObject lv_parameters_7_0 = null; + + EObject lv_bodies_10_0 = null; + + EObject lv_bodies_12_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:460:2: ( ( ( ( ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? ) | otherlv_2= 'pred' ) ( (lv_name_3_0= RULE_ID ) ) otherlv_4= '(' ( ( (lv_parameters_5_0= ruleParameter ) ) (otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) )* )? otherlv_8= ')' (otherlv_9= ':=' ( (lv_bodies_10_0= ruleConjunction ) ) (otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) )* )? otherlv_13= '.' ) ) + // InternalProblem.g:461:2: ( ( ( ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? ) | otherlv_2= 'pred' ) ( (lv_name_3_0= RULE_ID ) ) otherlv_4= '(' ( ( (lv_parameters_5_0= ruleParameter ) ) (otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) )* )? otherlv_8= ')' (otherlv_9= ':=' ( (lv_bodies_10_0= ruleConjunction ) ) (otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) )* )? otherlv_13= '.' ) + { + // InternalProblem.g:461:2: ( ( ( ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? ) | otherlv_2= 'pred' ) ( (lv_name_3_0= RULE_ID ) ) otherlv_4= '(' ( ( (lv_parameters_5_0= ruleParameter ) ) (otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) )* )? otherlv_8= ')' (otherlv_9= ':=' ( (lv_bodies_10_0= ruleConjunction ) ) (otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) )* )? otherlv_13= '.' ) + // InternalProblem.g:462:3: ( ( ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? ) | otherlv_2= 'pred' ) ( (lv_name_3_0= RULE_ID ) ) otherlv_4= '(' ( ( (lv_parameters_5_0= ruleParameter ) ) (otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) )* )? otherlv_8= ')' (otherlv_9= ':=' ( (lv_bodies_10_0= ruleConjunction ) ) (otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) )* )? otherlv_13= '.' + { + // InternalProblem.g:462:3: ( ( ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? ) | otherlv_2= 'pred' ) + int alt12=2; + int LA12_0 = input.LA(1); + + if ( (LA12_0==21) ) { + alt12=1; + } + else if ( (LA12_0==22) ) { + alt12=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 12, 0, input); + + throw nvae; + } + switch (alt12) { + case 1 : + // InternalProblem.g:463:4: ( ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? ) + { + // InternalProblem.g:463:4: ( ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? ) + // InternalProblem.g:464:5: ( (lv_error_0_0= 'error' ) ) (otherlv_1= 'pred' )? + { + // InternalProblem.g:464:5: ( (lv_error_0_0= 'error' ) ) + // InternalProblem.g:465:6: (lv_error_0_0= 'error' ) + { + // InternalProblem.g:465:6: (lv_error_0_0= 'error' ) + // InternalProblem.g:466:7: lv_error_0_0= 'error' + { + lv_error_0_0=(Token)match(input,21,FOLLOW_16); + + newLeafNode(lv_error_0_0, grammarAccess.getPredicateDefinitionAccess().getErrorErrorKeyword_0_0_0_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getPredicateDefinitionRule()); + } + setWithLastConsumed(current, "error", lv_error_0_0 != null, "error"); + + + } + + + } + + // InternalProblem.g:478:5: (otherlv_1= 'pred' )? + int alt11=2; + int LA11_0 = input.LA(1); + + if ( (LA11_0==22) ) { + alt11=1; + } + switch (alt11) { + case 1 : + // InternalProblem.g:479:6: otherlv_1= 'pred' + { + otherlv_1=(Token)match(input,22,FOLLOW_5); + + newLeafNode(otherlv_1, grammarAccess.getPredicateDefinitionAccess().getPredKeyword_0_0_1()); + + + } + break; + + } + + + } + + + } + break; + case 2 : + // InternalProblem.g:486:4: otherlv_2= 'pred' + { + otherlv_2=(Token)match(input,22,FOLLOW_5); + + newLeafNode(otherlv_2, grammarAccess.getPredicateDefinitionAccess().getPredKeyword_0_1()); + + + } + break; + + } + + // InternalProblem.g:491:3: ( (lv_name_3_0= RULE_ID ) ) + // InternalProblem.g:492:4: (lv_name_3_0= RULE_ID ) + { + // InternalProblem.g:492:4: (lv_name_3_0= RULE_ID ) + // InternalProblem.g:493:5: lv_name_3_0= RULE_ID + { + lv_name_3_0=(Token)match(input,RULE_ID,FOLLOW_17); + + newLeafNode(lv_name_3_0, grammarAccess.getPredicateDefinitionAccess().getNameIDTerminalRuleCall_1_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getPredicateDefinitionRule()); + } + setWithLastConsumed( + current, + "name", + lv_name_3_0, + "org.eclipse.xtext.common.Terminals.ID"); + + + } + + + } + + otherlv_4=(Token)match(input,23,FOLLOW_18); + + newLeafNode(otherlv_4, grammarAccess.getPredicateDefinitionAccess().getLeftParenthesisKeyword_2()); + + // InternalProblem.g:513:3: ( ( (lv_parameters_5_0= ruleParameter ) ) (otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) )* )? + int alt14=2; + int LA14_0 = input.LA(1); + + if ( (LA14_0==RULE_ID) ) { + alt14=1; + } + switch (alt14) { + case 1 : + // InternalProblem.g:514:4: ( (lv_parameters_5_0= ruleParameter ) ) (otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) )* + { + // InternalProblem.g:514:4: ( (lv_parameters_5_0= ruleParameter ) ) + // InternalProblem.g:515:5: (lv_parameters_5_0= ruleParameter ) + { + // InternalProblem.g:515:5: (lv_parameters_5_0= ruleParameter ) + // InternalProblem.g:516:6: lv_parameters_5_0= ruleParameter + { + + newCompositeNode(grammarAccess.getPredicateDefinitionAccess().getParametersParameterParserRuleCall_3_0_0()); + + pushFollow(FOLLOW_19); + lv_parameters_5_0=ruleParameter(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getPredicateDefinitionRule()); + } + add( + current, + "parameters", + lv_parameters_5_0, + "org.eclipse.viatra.solver.language.Problem.Parameter"); + afterParserOrEnumRuleCall(); + + + } + + + } + + // InternalProblem.g:533:4: (otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) )* + loop13: + do { + int alt13=2; + int LA13_0 = input.LA(1); + + if ( (LA13_0==15) ) { + alt13=1; + } + + + switch (alt13) { + case 1 : + // InternalProblem.g:534:5: otherlv_6= ',' ( (lv_parameters_7_0= ruleParameter ) ) + { + otherlv_6=(Token)match(input,15,FOLLOW_5); + + newLeafNode(otherlv_6, grammarAccess.getPredicateDefinitionAccess().getCommaKeyword_3_1_0()); + + // InternalProblem.g:538:5: ( (lv_parameters_7_0= ruleParameter ) ) + // InternalProblem.g:539:6: (lv_parameters_7_0= ruleParameter ) + { + // InternalProblem.g:539:6: (lv_parameters_7_0= ruleParameter ) + // InternalProblem.g:540:7: lv_parameters_7_0= ruleParameter + { + + newCompositeNode(grammarAccess.getPredicateDefinitionAccess().getParametersParameterParserRuleCall_3_1_1_0()); + + pushFollow(FOLLOW_19); + lv_parameters_7_0=ruleParameter(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getPredicateDefinitionRule()); + } + add( + current, + "parameters", + lv_parameters_7_0, + "org.eclipse.viatra.solver.language.Problem.Parameter"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + default : + break loop13; + } + } while (true); + + + } + break; + + } + + otherlv_8=(Token)match(input,24,FOLLOW_20); + + newLeafNode(otherlv_8, grammarAccess.getPredicateDefinitionAccess().getRightParenthesisKeyword_4()); + + // InternalProblem.g:563:3: (otherlv_9= ':=' ( (lv_bodies_10_0= ruleConjunction ) ) (otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) )* )? + int alt16=2; + int LA16_0 = input.LA(1); + + if ( (LA16_0==25) ) { + alt16=1; + } + switch (alt16) { + case 1 : + // InternalProblem.g:564:4: otherlv_9= ':=' ( (lv_bodies_10_0= ruleConjunction ) ) (otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) )* + { + otherlv_9=(Token)match(input,25,FOLLOW_21); + + newLeafNode(otherlv_9, grammarAccess.getPredicateDefinitionAccess().getColonEqualsSignKeyword_5_0()); + + // InternalProblem.g:568:4: ( (lv_bodies_10_0= ruleConjunction ) ) + // InternalProblem.g:569:5: (lv_bodies_10_0= ruleConjunction ) + { + // InternalProblem.g:569:5: (lv_bodies_10_0= ruleConjunction ) + // InternalProblem.g:570:6: lv_bodies_10_0= ruleConjunction + { + + newCompositeNode(grammarAccess.getPredicateDefinitionAccess().getBodiesConjunctionParserRuleCall_5_1_0()); + + pushFollow(FOLLOW_22); + lv_bodies_10_0=ruleConjunction(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getPredicateDefinitionRule()); + } + add( + current, + "bodies", + lv_bodies_10_0, + "org.eclipse.viatra.solver.language.Problem.Conjunction"); + afterParserOrEnumRuleCall(); + + + } + + + } + + // InternalProblem.g:587:4: (otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) )* + loop15: + do { + int alt15=2; + int LA15_0 = input.LA(1); + + if ( (LA15_0==26) ) { + alt15=1; + } + + + switch (alt15) { + case 1 : + // InternalProblem.g:588:5: otherlv_11= ';' ( (lv_bodies_12_0= ruleConjunction ) ) + { + otherlv_11=(Token)match(input,26,FOLLOW_21); + + newLeafNode(otherlv_11, grammarAccess.getPredicateDefinitionAccess().getSemicolonKeyword_5_2_0()); + + // InternalProblem.g:592:5: ( (lv_bodies_12_0= ruleConjunction ) ) + // InternalProblem.g:593:6: (lv_bodies_12_0= ruleConjunction ) + { + // InternalProblem.g:593:6: (lv_bodies_12_0= ruleConjunction ) + // InternalProblem.g:594:7: lv_bodies_12_0= ruleConjunction + { + + newCompositeNode(grammarAccess.getPredicateDefinitionAccess().getBodiesConjunctionParserRuleCall_5_2_1_0()); + + pushFollow(FOLLOW_22); + lv_bodies_12_0=ruleConjunction(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getPredicateDefinitionRule()); + } + add( + current, + "bodies", + lv_bodies_12_0, + "org.eclipse.viatra.solver.language.Problem.Conjunction"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + default : + break loop15; + } + } while (true); + + + } + break; + + } + + otherlv_13=(Token)match(input,17,FOLLOW_2); + + newLeafNode(otherlv_13, grammarAccess.getPredicateDefinitionAccess().getFullStopKeyword_6()); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "rulePredicateDefinition" + + + // $ANTLR start "entryRuleParameter" + // InternalProblem.g:621:1: entryRuleParameter returns [EObject current=null] : iv_ruleParameter= ruleParameter EOF ; + public final EObject entryRuleParameter() throws RecognitionException { + EObject current = null; + + EObject iv_ruleParameter = null; + + + try { + // InternalProblem.g:621:50: (iv_ruleParameter= ruleParameter EOF ) + // InternalProblem.g:622:2: iv_ruleParameter= ruleParameter EOF + { + newCompositeNode(grammarAccess.getParameterRule()); + pushFollow(FOLLOW_1); + iv_ruleParameter=ruleParameter(); + + state._fsp--; + + current =iv_ruleParameter; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleParameter" + + + // $ANTLR start "ruleParameter" + // InternalProblem.g:628:1: ruleParameter returns [EObject current=null] : ( ( (otherlv_0= RULE_ID ) ) ( (lv_name_1_0= RULE_ID ) ) ) ; + public final EObject ruleParameter() throws RecognitionException { + EObject current = null; + + Token otherlv_0=null; + Token lv_name_1_0=null; + + + enterRule(); + + try { + // InternalProblem.g:634:2: ( ( ( (otherlv_0= RULE_ID ) ) ( (lv_name_1_0= RULE_ID ) ) ) ) + // InternalProblem.g:635:2: ( ( (otherlv_0= RULE_ID ) ) ( (lv_name_1_0= RULE_ID ) ) ) + { + // InternalProblem.g:635:2: ( ( (otherlv_0= RULE_ID ) ) ( (lv_name_1_0= RULE_ID ) ) ) + // InternalProblem.g:636:3: ( (otherlv_0= RULE_ID ) ) ( (lv_name_1_0= RULE_ID ) ) + { + // InternalProblem.g:636:3: ( (otherlv_0= RULE_ID ) ) + // InternalProblem.g:637:4: (otherlv_0= RULE_ID ) + { + // InternalProblem.g:637:4: (otherlv_0= RULE_ID ) + // InternalProblem.g:638:5: otherlv_0= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getParameterRule()); + } + + otherlv_0=(Token)match(input,RULE_ID,FOLLOW_5); + + newLeafNode(otherlv_0, grammarAccess.getParameterAccess().getParameterTypeClassDeclarationCrossReference_0_0()); + + + } + + + } + + // InternalProblem.g:649:3: ( (lv_name_1_0= RULE_ID ) ) + // InternalProblem.g:650:4: (lv_name_1_0= RULE_ID ) + { + // InternalProblem.g:650:4: (lv_name_1_0= RULE_ID ) + // InternalProblem.g:651:5: lv_name_1_0= RULE_ID + { + lv_name_1_0=(Token)match(input,RULE_ID,FOLLOW_2); + + newLeafNode(lv_name_1_0, grammarAccess.getParameterAccess().getNameIDTerminalRuleCall_1_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getParameterRule()); + } + setWithLastConsumed( + current, + "name", + lv_name_1_0, + "org.eclipse.xtext.common.Terminals.ID"); + + + } + + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleParameter" + + + // $ANTLR start "entryRuleConjunction" + // InternalProblem.g:671:1: entryRuleConjunction returns [EObject current=null] : iv_ruleConjunction= ruleConjunction EOF ; + public final EObject entryRuleConjunction() throws RecognitionException { + EObject current = null; + + EObject iv_ruleConjunction = null; + + + try { + // InternalProblem.g:671:52: (iv_ruleConjunction= ruleConjunction EOF ) + // InternalProblem.g:672:2: iv_ruleConjunction= ruleConjunction EOF + { + newCompositeNode(grammarAccess.getConjunctionRule()); + pushFollow(FOLLOW_1); + iv_ruleConjunction=ruleConjunction(); + + state._fsp--; + + current =iv_ruleConjunction; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleConjunction" + + + // $ANTLR start "ruleConjunction" + // InternalProblem.g:678:1: ruleConjunction returns [EObject current=null] : ( ( (lv_literals_0_0= ruleLiteral ) ) (otherlv_1= ',' ( (lv_literals_2_0= ruleLiteral ) ) )* ) ; + public final EObject ruleConjunction() throws RecognitionException { + EObject current = null; + + Token otherlv_1=null; + EObject lv_literals_0_0 = null; + + EObject lv_literals_2_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:684:2: ( ( ( (lv_literals_0_0= ruleLiteral ) ) (otherlv_1= ',' ( (lv_literals_2_0= ruleLiteral ) ) )* ) ) + // InternalProblem.g:685:2: ( ( (lv_literals_0_0= ruleLiteral ) ) (otherlv_1= ',' ( (lv_literals_2_0= ruleLiteral ) ) )* ) + { + // InternalProblem.g:685:2: ( ( (lv_literals_0_0= ruleLiteral ) ) (otherlv_1= ',' ( (lv_literals_2_0= ruleLiteral ) ) )* ) + // InternalProblem.g:686:3: ( (lv_literals_0_0= ruleLiteral ) ) (otherlv_1= ',' ( (lv_literals_2_0= ruleLiteral ) ) )* + { + // InternalProblem.g:686:3: ( (lv_literals_0_0= ruleLiteral ) ) + // InternalProblem.g:687:4: (lv_literals_0_0= ruleLiteral ) + { + // InternalProblem.g:687:4: (lv_literals_0_0= ruleLiteral ) + // InternalProblem.g:688:5: lv_literals_0_0= ruleLiteral + { + + newCompositeNode(grammarAccess.getConjunctionAccess().getLiteralsLiteralParserRuleCall_0_0()); + + pushFollow(FOLLOW_23); + lv_literals_0_0=ruleLiteral(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getConjunctionRule()); + } + add( + current, + "literals", + lv_literals_0_0, + "org.eclipse.viatra.solver.language.Problem.Literal"); + afterParserOrEnumRuleCall(); + + + } + + + } + + // InternalProblem.g:705:3: (otherlv_1= ',' ( (lv_literals_2_0= ruleLiteral ) ) )* + loop17: + do { + int alt17=2; + int LA17_0 = input.LA(1); + + if ( (LA17_0==15) ) { + alt17=1; + } + + + switch (alt17) { + case 1 : + // InternalProblem.g:706:4: otherlv_1= ',' ( (lv_literals_2_0= ruleLiteral ) ) + { + otherlv_1=(Token)match(input,15,FOLLOW_21); + + newLeafNode(otherlv_1, grammarAccess.getConjunctionAccess().getCommaKeyword_1_0()); + + // InternalProblem.g:710:4: ( (lv_literals_2_0= ruleLiteral ) ) + // InternalProblem.g:711:5: (lv_literals_2_0= ruleLiteral ) + { + // InternalProblem.g:711:5: (lv_literals_2_0= ruleLiteral ) + // InternalProblem.g:712:6: lv_literals_2_0= ruleLiteral + { + + newCompositeNode(grammarAccess.getConjunctionAccess().getLiteralsLiteralParserRuleCall_1_1_0()); + + pushFollow(FOLLOW_23); + lv_literals_2_0=ruleLiteral(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getConjunctionRule()); + } + add( + current, + "literals", + lv_literals_2_0, + "org.eclipse.viatra.solver.language.Problem.Literal"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + default : + break loop17; + } + } while (true); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleConjunction" + + + // $ANTLR start "entryRuleLiteral" + // InternalProblem.g:734:1: entryRuleLiteral returns [EObject current=null] : iv_ruleLiteral= ruleLiteral EOF ; + public final EObject entryRuleLiteral() throws RecognitionException { + EObject current = null; + + EObject iv_ruleLiteral = null; + + + try { + // InternalProblem.g:734:48: (iv_ruleLiteral= ruleLiteral EOF ) + // InternalProblem.g:735:2: iv_ruleLiteral= ruleLiteral EOF + { + newCompositeNode(grammarAccess.getLiteralRule()); + pushFollow(FOLLOW_1); + iv_ruleLiteral=ruleLiteral(); + + state._fsp--; + + current =iv_ruleLiteral; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleLiteral" + + + // $ANTLR start "ruleLiteral" + // InternalProblem.g:741:1: ruleLiteral returns [EObject current=null] : (this_Atom_0= ruleAtom | this_NegativeLiteral_1= ruleNegativeLiteral ) ; + public final EObject ruleLiteral() throws RecognitionException { + EObject current = null; + + EObject this_Atom_0 = null; + + EObject this_NegativeLiteral_1 = null; + + + + enterRule(); + + try { + // InternalProblem.g:747:2: ( (this_Atom_0= ruleAtom | this_NegativeLiteral_1= ruleNegativeLiteral ) ) + // InternalProblem.g:748:2: (this_Atom_0= ruleAtom | this_NegativeLiteral_1= ruleNegativeLiteral ) + { + // InternalProblem.g:748:2: (this_Atom_0= ruleAtom | this_NegativeLiteral_1= ruleNegativeLiteral ) + int alt18=2; + int LA18_0 = input.LA(1); + + if ( (LA18_0==RULE_ID) ) { + alt18=1; + } + else if ( (LA18_0==27) ) { + alt18=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 18, 0, input); + + throw nvae; + } + switch (alt18) { + case 1 : + // InternalProblem.g:749:3: this_Atom_0= ruleAtom + { + + newCompositeNode(grammarAccess.getLiteralAccess().getAtomParserRuleCall_0()); + + pushFollow(FOLLOW_2); + this_Atom_0=ruleAtom(); + + state._fsp--; + + + current = this_Atom_0; + afterParserOrEnumRuleCall(); + + + } + break; + case 2 : + // InternalProblem.g:758:3: this_NegativeLiteral_1= ruleNegativeLiteral + { + + newCompositeNode(grammarAccess.getLiteralAccess().getNegativeLiteralParserRuleCall_1()); + + pushFollow(FOLLOW_2); + this_NegativeLiteral_1=ruleNegativeLiteral(); + + state._fsp--; + + + current = this_NegativeLiteral_1; + afterParserOrEnumRuleCall(); + + + } + break; + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleLiteral" + + + // $ANTLR start "entryRuleNegativeLiteral" + // InternalProblem.g:770:1: entryRuleNegativeLiteral returns [EObject current=null] : iv_ruleNegativeLiteral= ruleNegativeLiteral EOF ; + public final EObject entryRuleNegativeLiteral() throws RecognitionException { + EObject current = null; + + EObject iv_ruleNegativeLiteral = null; + + + try { + // InternalProblem.g:770:56: (iv_ruleNegativeLiteral= ruleNegativeLiteral EOF ) + // InternalProblem.g:771:2: iv_ruleNegativeLiteral= ruleNegativeLiteral EOF + { + newCompositeNode(grammarAccess.getNegativeLiteralRule()); + pushFollow(FOLLOW_1); + iv_ruleNegativeLiteral=ruleNegativeLiteral(); + + state._fsp--; + + current =iv_ruleNegativeLiteral; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleNegativeLiteral" + + + // $ANTLR start "ruleNegativeLiteral" + // InternalProblem.g:777:1: ruleNegativeLiteral returns [EObject current=null] : (otherlv_0= '!' ( (lv_atom_1_0= ruleAtom ) ) ) ; + public final EObject ruleNegativeLiteral() throws RecognitionException { + EObject current = null; + + Token otherlv_0=null; + EObject lv_atom_1_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:783:2: ( (otherlv_0= '!' ( (lv_atom_1_0= ruleAtom ) ) ) ) + // InternalProblem.g:784:2: (otherlv_0= '!' ( (lv_atom_1_0= ruleAtom ) ) ) + { + // InternalProblem.g:784:2: (otherlv_0= '!' ( (lv_atom_1_0= ruleAtom ) ) ) + // InternalProblem.g:785:3: otherlv_0= '!' ( (lv_atom_1_0= ruleAtom ) ) + { + otherlv_0=(Token)match(input,27,FOLLOW_5); + + newLeafNode(otherlv_0, grammarAccess.getNegativeLiteralAccess().getExclamationMarkKeyword_0()); + + // InternalProblem.g:789:3: ( (lv_atom_1_0= ruleAtom ) ) + // InternalProblem.g:790:4: (lv_atom_1_0= ruleAtom ) + { + // InternalProblem.g:790:4: (lv_atom_1_0= ruleAtom ) + // InternalProblem.g:791:5: lv_atom_1_0= ruleAtom + { + + newCompositeNode(grammarAccess.getNegativeLiteralAccess().getAtomAtomParserRuleCall_1_0()); + + pushFollow(FOLLOW_2); + lv_atom_1_0=ruleAtom(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getNegativeLiteralRule()); + } + set( + current, + "atom", + lv_atom_1_0, + "org.eclipse.viatra.solver.language.Problem.Atom"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleNegativeLiteral" + + + // $ANTLR start "entryRuleAtom" + // InternalProblem.g:812:1: entryRuleAtom returns [EObject current=null] : iv_ruleAtom= ruleAtom EOF ; + public final EObject entryRuleAtom() throws RecognitionException { + EObject current = null; + + EObject iv_ruleAtom = null; + + + try { + // InternalProblem.g:812:45: (iv_ruleAtom= ruleAtom EOF ) + // InternalProblem.g:813:2: iv_ruleAtom= ruleAtom EOF + { + newCompositeNode(grammarAccess.getAtomRule()); + pushFollow(FOLLOW_1); + iv_ruleAtom=ruleAtom(); + + state._fsp--; + + current =iv_ruleAtom; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleAtom" + + + // $ANTLR start "ruleAtom" + // InternalProblem.g:819:1: ruleAtom returns [EObject current=null] : ( ( ( ruleQualifiedName ) ) ( (lv_transitiveClosure_1_0= '+' ) )? otherlv_2= '(' ( ( (otherlv_3= RULE_ID ) ) (otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) )* )? otherlv_6= ')' ) ; + public final EObject ruleAtom() throws RecognitionException { + EObject current = null; + + Token lv_transitiveClosure_1_0=null; + Token otherlv_2=null; + Token otherlv_3=null; + Token otherlv_4=null; + Token otherlv_5=null; + Token otherlv_6=null; + + + enterRule(); + + try { + // InternalProblem.g:825:2: ( ( ( ( ruleQualifiedName ) ) ( (lv_transitiveClosure_1_0= '+' ) )? otherlv_2= '(' ( ( (otherlv_3= RULE_ID ) ) (otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) )* )? otherlv_6= ')' ) ) + // InternalProblem.g:826:2: ( ( ( ruleQualifiedName ) ) ( (lv_transitiveClosure_1_0= '+' ) )? otherlv_2= '(' ( ( (otherlv_3= RULE_ID ) ) (otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) )* )? otherlv_6= ')' ) + { + // InternalProblem.g:826:2: ( ( ( ruleQualifiedName ) ) ( (lv_transitiveClosure_1_0= '+' ) )? otherlv_2= '(' ( ( (otherlv_3= RULE_ID ) ) (otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) )* )? otherlv_6= ')' ) + // InternalProblem.g:827:3: ( ( ruleQualifiedName ) ) ( (lv_transitiveClosure_1_0= '+' ) )? otherlv_2= '(' ( ( (otherlv_3= RULE_ID ) ) (otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) )* )? otherlv_6= ')' + { + // InternalProblem.g:827:3: ( ( ruleQualifiedName ) ) + // InternalProblem.g:828:4: ( ruleQualifiedName ) + { + // InternalProblem.g:828:4: ( ruleQualifiedName ) + // InternalProblem.g:829:5: ruleQualifiedName + { + + if (current==null) { + current = createModelElement(grammarAccess.getAtomRule()); + } + + + newCompositeNode(grammarAccess.getAtomAccess().getRelationRelationCrossReference_0_0()); + + pushFollow(FOLLOW_24); + ruleQualifiedName(); + + state._fsp--; + + + afterParserOrEnumRuleCall(); + + + } + + + } + + // InternalProblem.g:843:3: ( (lv_transitiveClosure_1_0= '+' ) )? + int alt19=2; + int LA19_0 = input.LA(1); + + if ( (LA19_0==28) ) { + alt19=1; + } + switch (alt19) { + case 1 : + // InternalProblem.g:844:4: (lv_transitiveClosure_1_0= '+' ) + { + // InternalProblem.g:844:4: (lv_transitiveClosure_1_0= '+' ) + // InternalProblem.g:845:5: lv_transitiveClosure_1_0= '+' + { + lv_transitiveClosure_1_0=(Token)match(input,28,FOLLOW_17); + + newLeafNode(lv_transitiveClosure_1_0, grammarAccess.getAtomAccess().getTransitiveClosurePlusSignKeyword_1_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getAtomRule()); + } + setWithLastConsumed(current, "transitiveClosure", lv_transitiveClosure_1_0 != null, "+"); + + + } + + + } + break; + + } + + otherlv_2=(Token)match(input,23,FOLLOW_18); + + newLeafNode(otherlv_2, grammarAccess.getAtomAccess().getLeftParenthesisKeyword_2()); + + // InternalProblem.g:861:3: ( ( (otherlv_3= RULE_ID ) ) (otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) )* )? + int alt21=2; + int LA21_0 = input.LA(1); + + if ( (LA21_0==RULE_ID) ) { + alt21=1; + } + switch (alt21) { + case 1 : + // InternalProblem.g:862:4: ( (otherlv_3= RULE_ID ) ) (otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) )* + { + // InternalProblem.g:862:4: ( (otherlv_3= RULE_ID ) ) + // InternalProblem.g:863:5: (otherlv_3= RULE_ID ) + { + // InternalProblem.g:863:5: (otherlv_3= RULE_ID ) + // InternalProblem.g:864:6: otherlv_3= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getAtomRule()); + } + + otherlv_3=(Token)match(input,RULE_ID,FOLLOW_19); + + newLeafNode(otherlv_3, grammarAccess.getAtomAccess().getArgumentsVariableCrossReference_3_0_0()); + + + } + + + } + + // InternalProblem.g:875:4: (otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) )* + loop20: + do { + int alt20=2; + int LA20_0 = input.LA(1); + + if ( (LA20_0==15) ) { + alt20=1; + } + + + switch (alt20) { + case 1 : + // InternalProblem.g:876:5: otherlv_4= ',' ( (otherlv_5= RULE_ID ) ) + { + otherlv_4=(Token)match(input,15,FOLLOW_5); + + newLeafNode(otherlv_4, grammarAccess.getAtomAccess().getCommaKeyword_3_1_0()); + + // InternalProblem.g:880:5: ( (otherlv_5= RULE_ID ) ) + // InternalProblem.g:881:6: (otherlv_5= RULE_ID ) + { + // InternalProblem.g:881:6: (otherlv_5= RULE_ID ) + // InternalProblem.g:882:7: otherlv_5= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getAtomRule()); + } + + otherlv_5=(Token)match(input,RULE_ID,FOLLOW_19); + + newLeafNode(otherlv_5, grammarAccess.getAtomAccess().getArgumentsVariableCrossReference_3_1_1_0()); + + + } + + + } + + + } + break; + + default : + break loop20; + } + } while (true); + + + } + break; + + } + + otherlv_6=(Token)match(input,24,FOLLOW_2); + + newLeafNode(otherlv_6, grammarAccess.getAtomAccess().getRightParenthesisKeyword_4()); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleAtom" + + + // $ANTLR start "entryRuleAssertion" + // InternalProblem.g:903:1: entryRuleAssertion returns [EObject current=null] : iv_ruleAssertion= ruleAssertion EOF ; + public final EObject entryRuleAssertion() throws RecognitionException { + EObject current = null; + + EObject iv_ruleAssertion = null; + + + try { + // InternalProblem.g:903:50: (iv_ruleAssertion= ruleAssertion EOF ) + // InternalProblem.g:904:2: iv_ruleAssertion= ruleAssertion EOF + { + newCompositeNode(grammarAccess.getAssertionRule()); + pushFollow(FOLLOW_1); + iv_ruleAssertion=ruleAssertion(); + + state._fsp--; + + current =iv_ruleAssertion; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleAssertion" + + + // $ANTLR start "ruleAssertion" + // InternalProblem.g:910:1: ruleAssertion returns [EObject current=null] : ( ( ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) | ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) ) otherlv_15= '.' ) ; + public final EObject ruleAssertion() throws RecognitionException { + EObject current = null; + + Token otherlv_1=null; + Token otherlv_3=null; + Token otherlv_5=null; + Token otherlv_6=null; + Token otherlv_10=null; + Token otherlv_12=null; + Token otherlv_14=null; + Token otherlv_15=null; + Enumerator lv_value_7_0 = null; + + Enumerator lv_value_8_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:916:2: ( ( ( ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) | ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) ) otherlv_15= '.' ) ) + // InternalProblem.g:917:2: ( ( ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) | ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) ) otherlv_15= '.' ) + { + // InternalProblem.g:917:2: ( ( ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) | ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) ) otherlv_15= '.' ) + // InternalProblem.g:918:3: ( ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) | ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) ) otherlv_15= '.' + { + // InternalProblem.g:918:3: ( ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) | ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) ) + int alt27=2; + alt27 = dfa27.predict(input); + switch (alt27) { + case 1 : + // InternalProblem.g:919:4: ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) + { + // InternalProblem.g:919:4: ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) + // InternalProblem.g:920:5: ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) + { + // InternalProblem.g:920:5: ( ( ruleQualifiedName ) ) + // InternalProblem.g:921:6: ( ruleQualifiedName ) + { + // InternalProblem.g:921:6: ( ruleQualifiedName ) + // InternalProblem.g:922:7: ruleQualifiedName + { + + if (current==null) { + current = createModelElement(grammarAccess.getAssertionRule()); + } + + + newCompositeNode(grammarAccess.getAssertionAccess().getRelationRelationCrossReference_0_0_0_0()); + + pushFollow(FOLLOW_17); + ruleQualifiedName(); + + state._fsp--; + + + afterParserOrEnumRuleCall(); + + + } + + + } + + otherlv_1=(Token)match(input,23,FOLLOW_18); + + newLeafNode(otherlv_1, grammarAccess.getAssertionAccess().getLeftParenthesisKeyword_0_0_1()); + + // InternalProblem.g:940:5: ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? + int alt23=2; + int LA23_0 = input.LA(1); + + if ( (LA23_0==RULE_ID) ) { + alt23=1; + } + switch (alt23) { + case 1 : + // InternalProblem.g:941:6: ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* + { + // InternalProblem.g:941:6: ( ( ruleQualifiedName ) ) + // InternalProblem.g:942:7: ( ruleQualifiedName ) + { + // InternalProblem.g:942:7: ( ruleQualifiedName ) + // InternalProblem.g:943:8: ruleQualifiedName + { + + if (current==null) { + current = createModelElement(grammarAccess.getAssertionRule()); + } + + + newCompositeNode(grammarAccess.getAssertionAccess().getArgumentsNodeCrossReference_0_0_2_0_0()); + + pushFollow(FOLLOW_19); + ruleQualifiedName(); + + state._fsp--; + + + afterParserOrEnumRuleCall(); + + + } + + + } + + // InternalProblem.g:957:6: (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* + loop22: + do { + int alt22=2; + int LA22_0 = input.LA(1); + + if ( (LA22_0==15) ) { + alt22=1; + } + + + switch (alt22) { + case 1 : + // InternalProblem.g:958:7: otherlv_3= ',' ( ( ruleQualifiedName ) ) + { + otherlv_3=(Token)match(input,15,FOLLOW_5); + + newLeafNode(otherlv_3, grammarAccess.getAssertionAccess().getCommaKeyword_0_0_2_1_0()); + + // InternalProblem.g:962:7: ( ( ruleQualifiedName ) ) + // InternalProblem.g:963:8: ( ruleQualifiedName ) + { + // InternalProblem.g:963:8: ( ruleQualifiedName ) + // InternalProblem.g:964:9: ruleQualifiedName + { + + if (current==null) { + current = createModelElement(grammarAccess.getAssertionRule()); + } + + + newCompositeNode(grammarAccess.getAssertionAccess().getArgumentsNodeCrossReference_0_0_2_1_1_0()); + + pushFollow(FOLLOW_19); + ruleQualifiedName(); + + state._fsp--; + + + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + default : + break loop22; + } + } while (true); + + + } + break; + + } + + otherlv_5=(Token)match(input,24,FOLLOW_25); + + newLeafNode(otherlv_5, grammarAccess.getAssertionAccess().getRightParenthesisKeyword_0_0_3()); + + otherlv_6=(Token)match(input,29,FOLLOW_26); + + newLeafNode(otherlv_6, grammarAccess.getAssertionAccess().getColonKeyword_0_0_4()); + + // InternalProblem.g:988:5: ( (lv_value_7_0= ruleLogicValue ) ) + // InternalProblem.g:989:6: (lv_value_7_0= ruleLogicValue ) + { + // InternalProblem.g:989:6: (lv_value_7_0= ruleLogicValue ) + // InternalProblem.g:990:7: lv_value_7_0= ruleLogicValue + { + + newCompositeNode(grammarAccess.getAssertionAccess().getValueLogicValueEnumRuleCall_0_0_5_0()); + + pushFollow(FOLLOW_27); + lv_value_7_0=ruleLogicValue(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getAssertionRule()); + } + set( + current, + "value", + lv_value_7_0, + "org.eclipse.viatra.solver.language.Problem.LogicValue"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + + + } + break; + case 2 : + // InternalProblem.g:1009:4: ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) + { + // InternalProblem.g:1009:4: ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) + // InternalProblem.g:1010:5: ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' + { + // InternalProblem.g:1010:5: ( (lv_value_8_0= ruleShortLogicValue ) )? + int alt24=2; + int LA24_0 = input.LA(1); + + if ( (LA24_0==27||LA24_0==39) ) { + alt24=1; + } + switch (alt24) { + case 1 : + // InternalProblem.g:1011:6: (lv_value_8_0= ruleShortLogicValue ) + { + // InternalProblem.g:1011:6: (lv_value_8_0= ruleShortLogicValue ) + // InternalProblem.g:1012:7: lv_value_8_0= ruleShortLogicValue + { + + newCompositeNode(grammarAccess.getAssertionAccess().getValueShortLogicValueEnumRuleCall_0_1_0_0()); + + pushFollow(FOLLOW_5); + lv_value_8_0=ruleShortLogicValue(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getAssertionRule()); + } + set( + current, + "value", + lv_value_8_0, + "org.eclipse.viatra.solver.language.Problem.ShortLogicValue"); + afterParserOrEnumRuleCall(); + + + } + + + } + break; + + } + + // InternalProblem.g:1029:5: ( ( ruleQualifiedName ) ) + // InternalProblem.g:1030:6: ( ruleQualifiedName ) + { + // InternalProblem.g:1030:6: ( ruleQualifiedName ) + // InternalProblem.g:1031:7: ruleQualifiedName + { + + if (current==null) { + current = createModelElement(grammarAccess.getAssertionRule()); + } + + + newCompositeNode(grammarAccess.getAssertionAccess().getRelationRelationCrossReference_0_1_1_0()); + + pushFollow(FOLLOW_17); + ruleQualifiedName(); + + state._fsp--; + + + afterParserOrEnumRuleCall(); + + + } + + + } + + otherlv_10=(Token)match(input,23,FOLLOW_18); + + newLeafNode(otherlv_10, grammarAccess.getAssertionAccess().getLeftParenthesisKeyword_0_1_2()); + + // InternalProblem.g:1049:5: ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? + int alt26=2; + int LA26_0 = input.LA(1); + + if ( (LA26_0==RULE_ID) ) { + alt26=1; + } + switch (alt26) { + case 1 : + // InternalProblem.g:1050:6: ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* + { + // InternalProblem.g:1050:6: ( ( ruleQualifiedName ) ) + // InternalProblem.g:1051:7: ( ruleQualifiedName ) + { + // InternalProblem.g:1051:7: ( ruleQualifiedName ) + // InternalProblem.g:1052:8: ruleQualifiedName + { + + if (current==null) { + current = createModelElement(grammarAccess.getAssertionRule()); + } + + + newCompositeNode(grammarAccess.getAssertionAccess().getArgumentsNodeCrossReference_0_1_3_0_0()); + + pushFollow(FOLLOW_19); + ruleQualifiedName(); + + state._fsp--; + + + afterParserOrEnumRuleCall(); + + + } + + + } + + // InternalProblem.g:1066:6: (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* + loop25: + do { + int alt25=2; + int LA25_0 = input.LA(1); + + if ( (LA25_0==15) ) { + alt25=1; + } + + + switch (alt25) { + case 1 : + // InternalProblem.g:1067:7: otherlv_12= ',' ( ( ruleQualifiedName ) ) + { + otherlv_12=(Token)match(input,15,FOLLOW_5); + + newLeafNode(otherlv_12, grammarAccess.getAssertionAccess().getCommaKeyword_0_1_3_1_0()); + + // InternalProblem.g:1071:7: ( ( ruleQualifiedName ) ) + // InternalProblem.g:1072:8: ( ruleQualifiedName ) + { + // InternalProblem.g:1072:8: ( ruleQualifiedName ) + // InternalProblem.g:1073:9: ruleQualifiedName + { + + if (current==null) { + current = createModelElement(grammarAccess.getAssertionRule()); + } + + + newCompositeNode(grammarAccess.getAssertionAccess().getArgumentsNodeCrossReference_0_1_3_1_1_0()); + + pushFollow(FOLLOW_19); + ruleQualifiedName(); + + state._fsp--; + + + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + default : + break loop25; + } + } while (true); + + + } + break; + + } + + otherlv_14=(Token)match(input,24,FOLLOW_27); + + newLeafNode(otherlv_14, grammarAccess.getAssertionAccess().getRightParenthesisKeyword_0_1_4()); + + + } + + + } + break; + + } + + otherlv_15=(Token)match(input,17,FOLLOW_2); + + newLeafNode(otherlv_15, grammarAccess.getAssertionAccess().getFullStopKeyword_1()); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleAssertion" + + + // $ANTLR start "entryRuleScopeDeclaration" + // InternalProblem.g:1103:1: entryRuleScopeDeclaration returns [EObject current=null] : iv_ruleScopeDeclaration= ruleScopeDeclaration EOF ; + public final EObject entryRuleScopeDeclaration() throws RecognitionException { + EObject current = null; + + EObject iv_ruleScopeDeclaration = null; + + + try { + // InternalProblem.g:1103:57: (iv_ruleScopeDeclaration= ruleScopeDeclaration EOF ) + // InternalProblem.g:1104:2: iv_ruleScopeDeclaration= ruleScopeDeclaration EOF + { + newCompositeNode(grammarAccess.getScopeDeclarationRule()); + pushFollow(FOLLOW_1); + iv_ruleScopeDeclaration=ruleScopeDeclaration(); + + state._fsp--; + + current =iv_ruleScopeDeclaration; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleScopeDeclaration" + + + // $ANTLR start "ruleScopeDeclaration" + // InternalProblem.g:1110:1: ruleScopeDeclaration returns [EObject current=null] : (otherlv_0= 'scope' ( (lv_typeScopes_1_0= ruleTypeScope ) ) (otherlv_2= ',' ( (lv_typeScopes_3_0= ruleTypeScope ) ) )* otherlv_4= '.' ) ; + public final EObject ruleScopeDeclaration() throws RecognitionException { + EObject current = null; + + Token otherlv_0=null; + Token otherlv_2=null; + Token otherlv_4=null; + EObject lv_typeScopes_1_0 = null; + + EObject lv_typeScopes_3_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:1116:2: ( (otherlv_0= 'scope' ( (lv_typeScopes_1_0= ruleTypeScope ) ) (otherlv_2= ',' ( (lv_typeScopes_3_0= ruleTypeScope ) ) )* otherlv_4= '.' ) ) + // InternalProblem.g:1117:2: (otherlv_0= 'scope' ( (lv_typeScopes_1_0= ruleTypeScope ) ) (otherlv_2= ',' ( (lv_typeScopes_3_0= ruleTypeScope ) ) )* otherlv_4= '.' ) + { + // InternalProblem.g:1117:2: (otherlv_0= 'scope' ( (lv_typeScopes_1_0= ruleTypeScope ) ) (otherlv_2= ',' ( (lv_typeScopes_3_0= ruleTypeScope ) ) )* otherlv_4= '.' ) + // InternalProblem.g:1118:3: otherlv_0= 'scope' ( (lv_typeScopes_1_0= ruleTypeScope ) ) (otherlv_2= ',' ( (lv_typeScopes_3_0= ruleTypeScope ) ) )* otherlv_4= '.' + { + otherlv_0=(Token)match(input,30,FOLLOW_5); + + newLeafNode(otherlv_0, grammarAccess.getScopeDeclarationAccess().getScopeKeyword_0()); + + // InternalProblem.g:1122:3: ( (lv_typeScopes_1_0= ruleTypeScope ) ) + // InternalProblem.g:1123:4: (lv_typeScopes_1_0= ruleTypeScope ) + { + // InternalProblem.g:1123:4: (lv_typeScopes_1_0= ruleTypeScope ) + // InternalProblem.g:1124:5: lv_typeScopes_1_0= ruleTypeScope + { + + newCompositeNode(grammarAccess.getScopeDeclarationAccess().getTypeScopesTypeScopeParserRuleCall_1_0()); + + pushFollow(FOLLOW_8); + lv_typeScopes_1_0=ruleTypeScope(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getScopeDeclarationRule()); + } + add( + current, + "typeScopes", + lv_typeScopes_1_0, + "org.eclipse.viatra.solver.language.Problem.TypeScope"); + afterParserOrEnumRuleCall(); + + + } + + + } + + // InternalProblem.g:1141:3: (otherlv_2= ',' ( (lv_typeScopes_3_0= ruleTypeScope ) ) )* + loop28: + do { + int alt28=2; + int LA28_0 = input.LA(1); + + if ( (LA28_0==15) ) { + alt28=1; + } + + + switch (alt28) { + case 1 : + // InternalProblem.g:1142:4: otherlv_2= ',' ( (lv_typeScopes_3_0= ruleTypeScope ) ) + { + otherlv_2=(Token)match(input,15,FOLLOW_5); + + newLeafNode(otherlv_2, grammarAccess.getScopeDeclarationAccess().getCommaKeyword_2_0()); + + // InternalProblem.g:1146:4: ( (lv_typeScopes_3_0= ruleTypeScope ) ) + // InternalProblem.g:1147:5: (lv_typeScopes_3_0= ruleTypeScope ) + { + // InternalProblem.g:1147:5: (lv_typeScopes_3_0= ruleTypeScope ) + // InternalProblem.g:1148:6: lv_typeScopes_3_0= ruleTypeScope + { + + newCompositeNode(grammarAccess.getScopeDeclarationAccess().getTypeScopesTypeScopeParserRuleCall_2_1_0()); + + pushFollow(FOLLOW_8); + lv_typeScopes_3_0=ruleTypeScope(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getScopeDeclarationRule()); + } + add( + current, + "typeScopes", + lv_typeScopes_3_0, + "org.eclipse.viatra.solver.language.Problem.TypeScope"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + break; + + default : + break loop28; + } + } while (true); + + otherlv_4=(Token)match(input,17,FOLLOW_2); + + newLeafNode(otherlv_4, grammarAccess.getScopeDeclarationAccess().getFullStopKeyword_3()); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleScopeDeclaration" + + + // $ANTLR start "entryRuleTypeScope" + // InternalProblem.g:1174:1: entryRuleTypeScope returns [EObject current=null] : iv_ruleTypeScope= ruleTypeScope EOF ; + public final EObject entryRuleTypeScope() throws RecognitionException { + EObject current = null; + + EObject iv_ruleTypeScope = null; + + + try { + // InternalProblem.g:1174:50: (iv_ruleTypeScope= ruleTypeScope EOF ) + // InternalProblem.g:1175:2: iv_ruleTypeScope= ruleTypeScope EOF + { + newCompositeNode(grammarAccess.getTypeScopeRule()); + pushFollow(FOLLOW_1); + iv_ruleTypeScope=ruleTypeScope(); + + state._fsp--; + + current =iv_ruleTypeScope; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleTypeScope" + + + // $ANTLR start "ruleTypeScope" + // InternalProblem.g:1181:1: ruleTypeScope returns [EObject current=null] : ( ( (otherlv_0= RULE_ID ) ) ( ( (lv_increment_1_0= '+=' ) ) | otherlv_2= '=' ) ( (lv_multiplicity_3_0= ruleMultiplicity ) ) ) ; + public final EObject ruleTypeScope() throws RecognitionException { + EObject current = null; + + Token otherlv_0=null; + Token lv_increment_1_0=null; + Token otherlv_2=null; + EObject lv_multiplicity_3_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:1187:2: ( ( ( (otherlv_0= RULE_ID ) ) ( ( (lv_increment_1_0= '+=' ) ) | otherlv_2= '=' ) ( (lv_multiplicity_3_0= ruleMultiplicity ) ) ) ) + // InternalProblem.g:1188:2: ( ( (otherlv_0= RULE_ID ) ) ( ( (lv_increment_1_0= '+=' ) ) | otherlv_2= '=' ) ( (lv_multiplicity_3_0= ruleMultiplicity ) ) ) + { + // InternalProblem.g:1188:2: ( ( (otherlv_0= RULE_ID ) ) ( ( (lv_increment_1_0= '+=' ) ) | otherlv_2= '=' ) ( (lv_multiplicity_3_0= ruleMultiplicity ) ) ) + // InternalProblem.g:1189:3: ( (otherlv_0= RULE_ID ) ) ( ( (lv_increment_1_0= '+=' ) ) | otherlv_2= '=' ) ( (lv_multiplicity_3_0= ruleMultiplicity ) ) + { + // InternalProblem.g:1189:3: ( (otherlv_0= RULE_ID ) ) + // InternalProblem.g:1190:4: (otherlv_0= RULE_ID ) + { + // InternalProblem.g:1190:4: (otherlv_0= RULE_ID ) + // InternalProblem.g:1191:5: otherlv_0= RULE_ID + { + + if (current==null) { + current = createModelElement(grammarAccess.getTypeScopeRule()); + } + + otherlv_0=(Token)match(input,RULE_ID,FOLLOW_28); + + newLeafNode(otherlv_0, grammarAccess.getTypeScopeAccess().getTargetTypeClassDeclarationCrossReference_0_0()); + + + } + + + } + + // InternalProblem.g:1202:3: ( ( (lv_increment_1_0= '+=' ) ) | otherlv_2= '=' ) + int alt29=2; + int LA29_0 = input.LA(1); + + if ( (LA29_0==31) ) { + alt29=1; + } + else if ( (LA29_0==32) ) { + alt29=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 29, 0, input); + + throw nvae; + } + switch (alt29) { + case 1 : + // InternalProblem.g:1203:4: ( (lv_increment_1_0= '+=' ) ) + { + // InternalProblem.g:1203:4: ( (lv_increment_1_0= '+=' ) ) + // InternalProblem.g:1204:5: (lv_increment_1_0= '+=' ) + { + // InternalProblem.g:1204:5: (lv_increment_1_0= '+=' ) + // InternalProblem.g:1205:6: lv_increment_1_0= '+=' + { + lv_increment_1_0=(Token)match(input,31,FOLLOW_13); + + newLeafNode(lv_increment_1_0, grammarAccess.getTypeScopeAccess().getIncrementPlusSignEqualsSignKeyword_1_0_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getTypeScopeRule()); + } + setWithLastConsumed(current, "increment", lv_increment_1_0 != null, "+="); + + + } + + + } + + + } + break; + case 2 : + // InternalProblem.g:1218:4: otherlv_2= '=' + { + otherlv_2=(Token)match(input,32,FOLLOW_13); + + newLeafNode(otherlv_2, grammarAccess.getTypeScopeAccess().getEqualsSignKeyword_1_1()); + + + } + break; + + } + + // InternalProblem.g:1223:3: ( (lv_multiplicity_3_0= ruleMultiplicity ) ) + // InternalProblem.g:1224:4: (lv_multiplicity_3_0= ruleMultiplicity ) + { + // InternalProblem.g:1224:4: (lv_multiplicity_3_0= ruleMultiplicity ) + // InternalProblem.g:1225:5: lv_multiplicity_3_0= ruleMultiplicity + { + + newCompositeNode(grammarAccess.getTypeScopeAccess().getMultiplicityMultiplicityParserRuleCall_2_0()); + + pushFollow(FOLLOW_2); + lv_multiplicity_3_0=ruleMultiplicity(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getTypeScopeRule()); + } + set( + current, + "multiplicity", + lv_multiplicity_3_0, + "org.eclipse.viatra.solver.language.Problem.Multiplicity"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleTypeScope" + + + // $ANTLR start "entryRuleMultiplicity" + // InternalProblem.g:1246:1: entryRuleMultiplicity returns [EObject current=null] : iv_ruleMultiplicity= ruleMultiplicity EOF ; + public final EObject entryRuleMultiplicity() throws RecognitionException { + EObject current = null; + + EObject iv_ruleMultiplicity = null; + + + try { + // InternalProblem.g:1246:53: (iv_ruleMultiplicity= ruleMultiplicity EOF ) + // InternalProblem.g:1247:2: iv_ruleMultiplicity= ruleMultiplicity EOF + { + newCompositeNode(grammarAccess.getMultiplicityRule()); + pushFollow(FOLLOW_1); + iv_ruleMultiplicity=ruleMultiplicity(); + + state._fsp--; + + current =iv_ruleMultiplicity; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleMultiplicity" + + + // $ANTLR start "ruleMultiplicity" + // InternalProblem.g:1253:1: ruleMultiplicity returns [EObject current=null] : (this_RangeMultiplicity_0= ruleRangeMultiplicity | this_ExactMultiplicity_1= ruleExactMultiplicity ) ; + public final EObject ruleMultiplicity() throws RecognitionException { + EObject current = null; + + EObject this_RangeMultiplicity_0 = null; + + EObject this_ExactMultiplicity_1 = null; + + + + enterRule(); + + try { + // InternalProblem.g:1259:2: ( (this_RangeMultiplicity_0= ruleRangeMultiplicity | this_ExactMultiplicity_1= ruleExactMultiplicity ) ) + // InternalProblem.g:1260:2: (this_RangeMultiplicity_0= ruleRangeMultiplicity | this_ExactMultiplicity_1= ruleExactMultiplicity ) + { + // InternalProblem.g:1260:2: (this_RangeMultiplicity_0= ruleRangeMultiplicity | this_ExactMultiplicity_1= ruleExactMultiplicity ) + int alt30=2; + int LA30_0 = input.LA(1); + + if ( (LA30_0==RULE_INT) ) { + int LA30_1 = input.LA(2); + + if ( (LA30_1==33) ) { + alt30=1; + } + else if ( (LA30_1==EOF||(LA30_1>=15 && LA30_1<=17)) ) { + alt30=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 30, 1, input); + + throw nvae; + } + } + else { + NoViableAltException nvae = + new NoViableAltException("", 30, 0, input); + + throw nvae; + } + switch (alt30) { + case 1 : + // InternalProblem.g:1261:3: this_RangeMultiplicity_0= ruleRangeMultiplicity + { + + newCompositeNode(grammarAccess.getMultiplicityAccess().getRangeMultiplicityParserRuleCall_0()); + + pushFollow(FOLLOW_2); + this_RangeMultiplicity_0=ruleRangeMultiplicity(); + + state._fsp--; + + + current = this_RangeMultiplicity_0; + afterParserOrEnumRuleCall(); + + + } + break; + case 2 : + // InternalProblem.g:1270:3: this_ExactMultiplicity_1= ruleExactMultiplicity + { + + newCompositeNode(grammarAccess.getMultiplicityAccess().getExactMultiplicityParserRuleCall_1()); + + pushFollow(FOLLOW_2); + this_ExactMultiplicity_1=ruleExactMultiplicity(); + + state._fsp--; + + + current = this_ExactMultiplicity_1; + afterParserOrEnumRuleCall(); + + + } + break; + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleMultiplicity" + + + // $ANTLR start "entryRuleRangeMultiplicity" + // InternalProblem.g:1282:1: entryRuleRangeMultiplicity returns [EObject current=null] : iv_ruleRangeMultiplicity= ruleRangeMultiplicity EOF ; + public final EObject entryRuleRangeMultiplicity() throws RecognitionException { + EObject current = null; + + EObject iv_ruleRangeMultiplicity = null; + + + try { + // InternalProblem.g:1282:58: (iv_ruleRangeMultiplicity= ruleRangeMultiplicity EOF ) + // InternalProblem.g:1283:2: iv_ruleRangeMultiplicity= ruleRangeMultiplicity EOF + { + newCompositeNode(grammarAccess.getRangeMultiplicityRule()); + pushFollow(FOLLOW_1); + iv_ruleRangeMultiplicity=ruleRangeMultiplicity(); + + state._fsp--; + + current =iv_ruleRangeMultiplicity; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleRangeMultiplicity" + + + // $ANTLR start "ruleRangeMultiplicity" + // InternalProblem.g:1289:1: ruleRangeMultiplicity returns [EObject current=null] : ( ( (lv_lowerBound_0_0= RULE_INT ) ) otherlv_1= '..' ( (lv_upperBound_2_0= ruleUpperBound ) ) ) ; + public final EObject ruleRangeMultiplicity() throws RecognitionException { + EObject current = null; + + Token lv_lowerBound_0_0=null; + Token otherlv_1=null; + AntlrDatatypeRuleToken lv_upperBound_2_0 = null; + + + + enterRule(); + + try { + // InternalProblem.g:1295:2: ( ( ( (lv_lowerBound_0_0= RULE_INT ) ) otherlv_1= '..' ( (lv_upperBound_2_0= ruleUpperBound ) ) ) ) + // InternalProblem.g:1296:2: ( ( (lv_lowerBound_0_0= RULE_INT ) ) otherlv_1= '..' ( (lv_upperBound_2_0= ruleUpperBound ) ) ) + { + // InternalProblem.g:1296:2: ( ( (lv_lowerBound_0_0= RULE_INT ) ) otherlv_1= '..' ( (lv_upperBound_2_0= ruleUpperBound ) ) ) + // InternalProblem.g:1297:3: ( (lv_lowerBound_0_0= RULE_INT ) ) otherlv_1= '..' ( (lv_upperBound_2_0= ruleUpperBound ) ) + { + // InternalProblem.g:1297:3: ( (lv_lowerBound_0_0= RULE_INT ) ) + // InternalProblem.g:1298:4: (lv_lowerBound_0_0= RULE_INT ) + { + // InternalProblem.g:1298:4: (lv_lowerBound_0_0= RULE_INT ) + // InternalProblem.g:1299:5: lv_lowerBound_0_0= RULE_INT + { + lv_lowerBound_0_0=(Token)match(input,RULE_INT,FOLLOW_29); + + newLeafNode(lv_lowerBound_0_0, grammarAccess.getRangeMultiplicityAccess().getLowerBoundINTTerminalRuleCall_0_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getRangeMultiplicityRule()); + } + setWithLastConsumed( + current, + "lowerBound", + lv_lowerBound_0_0, + "org.eclipse.xtext.common.Terminals.INT"); + + + } + + + } + + otherlv_1=(Token)match(input,33,FOLLOW_30); + + newLeafNode(otherlv_1, grammarAccess.getRangeMultiplicityAccess().getFullStopFullStopKeyword_1()); + + // InternalProblem.g:1319:3: ( (lv_upperBound_2_0= ruleUpperBound ) ) + // InternalProblem.g:1320:4: (lv_upperBound_2_0= ruleUpperBound ) + { + // InternalProblem.g:1320:4: (lv_upperBound_2_0= ruleUpperBound ) + // InternalProblem.g:1321:5: lv_upperBound_2_0= ruleUpperBound + { + + newCompositeNode(grammarAccess.getRangeMultiplicityAccess().getUpperBoundUpperBoundParserRuleCall_2_0()); + + pushFollow(FOLLOW_2); + lv_upperBound_2_0=ruleUpperBound(); + + state._fsp--; + + + if (current==null) { + current = createModelElementForParent(grammarAccess.getRangeMultiplicityRule()); + } + set( + current, + "upperBound", + lv_upperBound_2_0, + "org.eclipse.viatra.solver.language.Problem.UpperBound"); + afterParserOrEnumRuleCall(); + + + } + + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleRangeMultiplicity" + + + // $ANTLR start "entryRuleExactMultiplicity" + // InternalProblem.g:1342:1: entryRuleExactMultiplicity returns [EObject current=null] : iv_ruleExactMultiplicity= ruleExactMultiplicity EOF ; + public final EObject entryRuleExactMultiplicity() throws RecognitionException { + EObject current = null; + + EObject iv_ruleExactMultiplicity = null; + + + try { + // InternalProblem.g:1342:58: (iv_ruleExactMultiplicity= ruleExactMultiplicity EOF ) + // InternalProblem.g:1343:2: iv_ruleExactMultiplicity= ruleExactMultiplicity EOF + { + newCompositeNode(grammarAccess.getExactMultiplicityRule()); + pushFollow(FOLLOW_1); + iv_ruleExactMultiplicity=ruleExactMultiplicity(); + + state._fsp--; + + current =iv_ruleExactMultiplicity; + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleExactMultiplicity" + + + // $ANTLR start "ruleExactMultiplicity" + // InternalProblem.g:1349:1: ruleExactMultiplicity returns [EObject current=null] : ( (lv_exactValue_0_0= RULE_INT ) ) ; + public final EObject ruleExactMultiplicity() throws RecognitionException { + EObject current = null; + + Token lv_exactValue_0_0=null; + + + enterRule(); + + try { + // InternalProblem.g:1355:2: ( ( (lv_exactValue_0_0= RULE_INT ) ) ) + // InternalProblem.g:1356:2: ( (lv_exactValue_0_0= RULE_INT ) ) + { + // InternalProblem.g:1356:2: ( (lv_exactValue_0_0= RULE_INT ) ) + // InternalProblem.g:1357:3: (lv_exactValue_0_0= RULE_INT ) + { + // InternalProblem.g:1357:3: (lv_exactValue_0_0= RULE_INT ) + // InternalProblem.g:1358:4: lv_exactValue_0_0= RULE_INT + { + lv_exactValue_0_0=(Token)match(input,RULE_INT,FOLLOW_2); + + newLeafNode(lv_exactValue_0_0, grammarAccess.getExactMultiplicityAccess().getExactValueINTTerminalRuleCall_0()); + + + if (current==null) { + current = createModelElement(grammarAccess.getExactMultiplicityRule()); + } + setWithLastConsumed( + current, + "exactValue", + lv_exactValue_0_0, + "org.eclipse.xtext.common.Terminals.INT"); + + + } + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleExactMultiplicity" + + + // $ANTLR start "entryRuleUpperBound" + // InternalProblem.g:1377:1: entryRuleUpperBound returns [String current=null] : iv_ruleUpperBound= ruleUpperBound EOF ; + public final String entryRuleUpperBound() throws RecognitionException { + String current = null; + + AntlrDatatypeRuleToken iv_ruleUpperBound = null; + + + try { + // InternalProblem.g:1377:50: (iv_ruleUpperBound= ruleUpperBound EOF ) + // InternalProblem.g:1378:2: iv_ruleUpperBound= ruleUpperBound EOF + { + newCompositeNode(grammarAccess.getUpperBoundRule()); + pushFollow(FOLLOW_1); + iv_ruleUpperBound=ruleUpperBound(); + + state._fsp--; + + current =iv_ruleUpperBound.getText(); + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleUpperBound" + + + // $ANTLR start "ruleUpperBound" + // InternalProblem.g:1384:1: ruleUpperBound returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (this_INT_0= RULE_INT | kw= '*' ) ; + public final AntlrDatatypeRuleToken ruleUpperBound() throws RecognitionException { + AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken(); + + Token this_INT_0=null; + Token kw=null; + + + enterRule(); + + try { + // InternalProblem.g:1390:2: ( (this_INT_0= RULE_INT | kw= '*' ) ) + // InternalProblem.g:1391:2: (this_INT_0= RULE_INT | kw= '*' ) + { + // InternalProblem.g:1391:2: (this_INT_0= RULE_INT | kw= '*' ) + int alt31=2; + int LA31_0 = input.LA(1); + + if ( (LA31_0==RULE_INT) ) { + alt31=1; + } + else if ( (LA31_0==34) ) { + alt31=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 31, 0, input); + + throw nvae; + } + switch (alt31) { + case 1 : + // InternalProblem.g:1392:3: this_INT_0= RULE_INT + { + this_INT_0=(Token)match(input,RULE_INT,FOLLOW_2); + + current.merge(this_INT_0); + + + newLeafNode(this_INT_0, grammarAccess.getUpperBoundAccess().getINTTerminalRuleCall_0()); + + + } + break; + case 2 : + // InternalProblem.g:1400:3: kw= '*' + { + kw=(Token)match(input,34,FOLLOW_2); + + current.merge(kw); + newLeafNode(kw, grammarAccess.getUpperBoundAccess().getAsteriskKeyword_1()); + + + } + break; + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleUpperBound" + + + // $ANTLR start "entryRuleQualifiedName" + // InternalProblem.g:1409:1: entryRuleQualifiedName returns [String current=null] : iv_ruleQualifiedName= ruleQualifiedName EOF ; + public final String entryRuleQualifiedName() throws RecognitionException { + String current = null; + + AntlrDatatypeRuleToken iv_ruleQualifiedName = null; + + + try { + // InternalProblem.g:1409:53: (iv_ruleQualifiedName= ruleQualifiedName EOF ) + // InternalProblem.g:1410:2: iv_ruleQualifiedName= ruleQualifiedName EOF + { + newCompositeNode(grammarAccess.getQualifiedNameRule()); + pushFollow(FOLLOW_1); + iv_ruleQualifiedName=ruleQualifiedName(); + + state._fsp--; + + current =iv_ruleQualifiedName.getText(); + match(input,EOF,FOLLOW_2); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "entryRuleQualifiedName" + + + // $ANTLR start "ruleQualifiedName" + // InternalProblem.g:1416:1: ruleQualifiedName returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (this_ID_0= RULE_ID (kw= '::' this_ID_2= RULE_ID )* ) ; + public final AntlrDatatypeRuleToken ruleQualifiedName() throws RecognitionException { + AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken(); + + Token this_ID_0=null; + Token kw=null; + Token this_ID_2=null; + + + enterRule(); + + try { + // InternalProblem.g:1422:2: ( (this_ID_0= RULE_ID (kw= '::' this_ID_2= RULE_ID )* ) ) + // InternalProblem.g:1423:2: (this_ID_0= RULE_ID (kw= '::' this_ID_2= RULE_ID )* ) + { + // InternalProblem.g:1423:2: (this_ID_0= RULE_ID (kw= '::' this_ID_2= RULE_ID )* ) + // InternalProblem.g:1424:3: this_ID_0= RULE_ID (kw= '::' this_ID_2= RULE_ID )* + { + this_ID_0=(Token)match(input,RULE_ID,FOLLOW_31); + + current.merge(this_ID_0); + + + newLeafNode(this_ID_0, grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_0()); + + // InternalProblem.g:1431:3: (kw= '::' this_ID_2= RULE_ID )* + loop32: + do { + int alt32=2; + int LA32_0 = input.LA(1); + + if ( (LA32_0==35) ) { + alt32=1; + } + + + switch (alt32) { + case 1 : + // InternalProblem.g:1432:4: kw= '::' this_ID_2= RULE_ID + { + kw=(Token)match(input,35,FOLLOW_5); + + current.merge(kw); + newLeafNode(kw, grammarAccess.getQualifiedNameAccess().getColonColonKeyword_1_0()); + + this_ID_2=(Token)match(input,RULE_ID,FOLLOW_31); + + current.merge(this_ID_2); + + + newLeafNode(this_ID_2, grammarAccess.getQualifiedNameAccess().getIDTerminalRuleCall_1_1()); + + + } + break; + + default : + break loop32; + } + } while (true); + + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleQualifiedName" + + + // $ANTLR start "ruleLogicValue" + // InternalProblem.g:1449:1: ruleLogicValue returns [Enumerator current=null] : ( (enumLiteral_0= 'true' ) | (enumLiteral_1= 'false' ) | (enumLiteral_2= 'unknown' ) ) ; + public final Enumerator ruleLogicValue() throws RecognitionException { + Enumerator current = null; + + Token enumLiteral_0=null; + Token enumLiteral_1=null; + Token enumLiteral_2=null; + + + enterRule(); + + try { + // InternalProblem.g:1455:2: ( ( (enumLiteral_0= 'true' ) | (enumLiteral_1= 'false' ) | (enumLiteral_2= 'unknown' ) ) ) + // InternalProblem.g:1456:2: ( (enumLiteral_0= 'true' ) | (enumLiteral_1= 'false' ) | (enumLiteral_2= 'unknown' ) ) + { + // InternalProblem.g:1456:2: ( (enumLiteral_0= 'true' ) | (enumLiteral_1= 'false' ) | (enumLiteral_2= 'unknown' ) ) + int alt33=3; + switch ( input.LA(1) ) { + case 36: + { + alt33=1; + } + break; + case 37: + { + alt33=2; + } + break; + case 38: + { + alt33=3; + } + break; + default: + NoViableAltException nvae = + new NoViableAltException("", 33, 0, input); + + throw nvae; + } + + switch (alt33) { + case 1 : + // InternalProblem.g:1457:3: (enumLiteral_0= 'true' ) + { + // InternalProblem.g:1457:3: (enumLiteral_0= 'true' ) + // InternalProblem.g:1458:4: enumLiteral_0= 'true' + { + enumLiteral_0=(Token)match(input,36,FOLLOW_2); + + current = grammarAccess.getLogicValueAccess().getTRUEEnumLiteralDeclaration_0().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_0, grammarAccess.getLogicValueAccess().getTRUEEnumLiteralDeclaration_0()); + + + } + + + } + break; + case 2 : + // InternalProblem.g:1465:3: (enumLiteral_1= 'false' ) + { + // InternalProblem.g:1465:3: (enumLiteral_1= 'false' ) + // InternalProblem.g:1466:4: enumLiteral_1= 'false' + { + enumLiteral_1=(Token)match(input,37,FOLLOW_2); + + current = grammarAccess.getLogicValueAccess().getFALSEEnumLiteralDeclaration_1().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_1, grammarAccess.getLogicValueAccess().getFALSEEnumLiteralDeclaration_1()); + + + } + + + } + break; + case 3 : + // InternalProblem.g:1473:3: (enumLiteral_2= 'unknown' ) + { + // InternalProblem.g:1473:3: (enumLiteral_2= 'unknown' ) + // InternalProblem.g:1474:4: enumLiteral_2= 'unknown' + { + enumLiteral_2=(Token)match(input,38,FOLLOW_2); + + current = grammarAccess.getLogicValueAccess().getUNKNOWNEnumLiteralDeclaration_2().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_2, grammarAccess.getLogicValueAccess().getUNKNOWNEnumLiteralDeclaration_2()); + + + } + + + } + break; + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleLogicValue" + + + // $ANTLR start "ruleShortLogicValue" + // InternalProblem.g:1484:1: ruleShortLogicValue returns [Enumerator current=null] : ( (enumLiteral_0= '!' ) | (enumLiteral_1= '?' ) ) ; + public final Enumerator ruleShortLogicValue() throws RecognitionException { + Enumerator current = null; + + Token enumLiteral_0=null; + Token enumLiteral_1=null; + + + enterRule(); + + try { + // InternalProblem.g:1490:2: ( ( (enumLiteral_0= '!' ) | (enumLiteral_1= '?' ) ) ) + // InternalProblem.g:1491:2: ( (enumLiteral_0= '!' ) | (enumLiteral_1= '?' ) ) + { + // InternalProblem.g:1491:2: ( (enumLiteral_0= '!' ) | (enumLiteral_1= '?' ) ) + int alt34=2; + int LA34_0 = input.LA(1); + + if ( (LA34_0==27) ) { + alt34=1; + } + else if ( (LA34_0==39) ) { + alt34=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 34, 0, input); + + throw nvae; + } + switch (alt34) { + case 1 : + // InternalProblem.g:1492:3: (enumLiteral_0= '!' ) + { + // InternalProblem.g:1492:3: (enumLiteral_0= '!' ) + // InternalProblem.g:1493:4: enumLiteral_0= '!' + { + enumLiteral_0=(Token)match(input,27,FOLLOW_2); + + current = grammarAccess.getShortLogicValueAccess().getFALSEEnumLiteralDeclaration_0().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_0, grammarAccess.getShortLogicValueAccess().getFALSEEnumLiteralDeclaration_0()); + + + } + + + } + break; + case 2 : + // InternalProblem.g:1500:3: (enumLiteral_1= '?' ) + { + // InternalProblem.g:1500:3: (enumLiteral_1= '?' ) + // InternalProblem.g:1501:4: enumLiteral_1= '?' + { + enumLiteral_1=(Token)match(input,39,FOLLOW_2); + + current = grammarAccess.getShortLogicValueAccess().getUNKNOWNEnumLiteralDeclaration_1().getEnumLiteral().getInstance(); + newLeafNode(enumLiteral_1, grammarAccess.getShortLogicValueAccess().getUNKNOWNEnumLiteralDeclaration_1()); + + + } + + + } + break; + + } + + + } + + + leaveRule(); + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end "ruleShortLogicValue" + + // Delegated rules + + + protected DFA27 dfa27 = new DFA27(this); + static final String dfa_1s = "\17\uffff"; + static final String dfa_2s = "\1\4\1\27\1\uffff\2\4\1\27\1\17\1\21\2\4\1\uffff\2\17\1\4\1\17"; + static final String dfa_3s = "\1\47\1\43\1\uffff\1\4\1\30\2\43\1\35\2\4\1\uffff\2\43\1\4\1\43"; + static final String dfa_4s = "\2\uffff\1\2\7\uffff\1\1\4\uffff"; + static final String dfa_5s = "\17\uffff}>"; + static final String[] dfa_6s = { + "\1\1\26\uffff\1\2\13\uffff\1\2", + "\1\4\13\uffff\1\3", + "", + "\1\5", + "\1\6\23\uffff\1\7", + "\1\4\13\uffff\1\3", + "\1\11\10\uffff\1\7\12\uffff\1\10", + "\1\2\13\uffff\1\12", + "\1\13", + "\1\14", + "", + "\1\11\10\uffff\1\7\12\uffff\1\10", + "\1\11\10\uffff\1\7\12\uffff\1\15", + "\1\16", + "\1\11\10\uffff\1\7\12\uffff\1\15" + }; + + static final short[] dfa_1 = DFA.unpackEncodedString(dfa_1s); + static final char[] dfa_2 = DFA.unpackEncodedStringToUnsignedChars(dfa_2s); + static final char[] dfa_3 = DFA.unpackEncodedStringToUnsignedChars(dfa_3s); + static final short[] dfa_4 = DFA.unpackEncodedString(dfa_4s); + static final short[] dfa_5 = DFA.unpackEncodedString(dfa_5s); + static final short[][] dfa_6 = unpackEncodedStringArray(dfa_6s); + + class DFA27 extends DFA { + + public DFA27(BaseRecognizer recognizer) { + this.recognizer = recognizer; + this.decisionNumber = 27; + this.eot = dfa_1; + this.eof = dfa_1; + this.min = dfa_2; + this.max = dfa_3; + this.accept = dfa_4; + this.special = dfa_5; + this.transition = dfa_6; + } + public String getDescription() { + return "918:3: ( ( ( ( ruleQualifiedName ) ) otherlv_1= '(' ( ( ( ruleQualifiedName ) ) (otherlv_3= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_5= ')' otherlv_6= ':' ( (lv_value_7_0= ruleLogicValue ) ) ) | ( ( (lv_value_8_0= ruleShortLogicValue ) )? ( ( ruleQualifiedName ) ) otherlv_10= '(' ( ( ( ruleQualifiedName ) ) (otherlv_12= ',' ( ( ruleQualifiedName ) ) )* )? otherlv_14= ')' ) )"; + } + } + + + public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000008048601812L}); + public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000001000L}); + public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000000010L}); + public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x00000000000EA000L}); + public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x0000000000004010L}); + public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000028000L}); + public static final BitSet FOLLOW_9 = new BitSet(new long[]{0x0000000000010010L}); + public static final BitSet FOLLOW_10 = new BitSet(new long[]{0x0000000000018000L}); + public static final BitSet FOLLOW_11 = new BitSet(new long[]{0x00000000000C0000L}); + public static final BitSet FOLLOW_12 = new BitSet(new long[]{0x0000000000004000L}); + public static final BitSet FOLLOW_13 = new BitSet(new long[]{0x0000000000000020L}); + public static final BitSet FOLLOW_14 = new BitSet(new long[]{0x0000000000010000L}); + public static final BitSet FOLLOW_15 = new BitSet(new long[]{0x0000000000100002L}); + public static final BitSet FOLLOW_16 = new BitSet(new long[]{0x0000000000400010L}); + public static final BitSet FOLLOW_17 = new BitSet(new long[]{0x0000000000800000L}); + public static final BitSet FOLLOW_18 = new BitSet(new long[]{0x0000000001000010L}); + public static final BitSet FOLLOW_19 = new BitSet(new long[]{0x0000000001008000L}); + public static final BitSet FOLLOW_20 = new BitSet(new long[]{0x0000000002020000L}); + public static final BitSet FOLLOW_21 = new BitSet(new long[]{0x0000000008000010L}); + public static final BitSet FOLLOW_22 = new BitSet(new long[]{0x0000000004020000L}); + public static final BitSet FOLLOW_23 = new BitSet(new long[]{0x0000000000008002L}); + public static final BitSet FOLLOW_24 = new BitSet(new long[]{0x0000000010800000L}); + public static final BitSet FOLLOW_25 = new BitSet(new long[]{0x0000000020000000L}); + public static final BitSet FOLLOW_26 = new BitSet(new long[]{0x0000007000000000L}); + public static final BitSet FOLLOW_27 = new BitSet(new long[]{0x0000000000020000L}); + public static final BitSet FOLLOW_28 = new BitSet(new long[]{0x0000000180000000L}); + public static final BitSet FOLLOW_29 = new BitSet(new long[]{0x0000000200000000L}); + public static final BitSet FOLLOW_30 = new BitSet(new long[]{0x0000000400000020L}); + public static final BitSet FOLLOW_31 = new BitSet(new long[]{0x0000000800000002L}); + +} \ No newline at end of file diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/scoping/AbstractProblemScopeProvider.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/scoping/AbstractProblemScopeProvider.java new file mode 100644 index 00000000..5b024d47 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/scoping/AbstractProblemScopeProvider.java @@ -0,0 +1,9 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.scoping; + +import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider; + +public abstract class AbstractProblemScopeProvider extends DelegatingScopeProvider { +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/serializer/ProblemSemanticSequencer.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/serializer/ProblemSemanticSequencer.java new file mode 100644 index 00000000..a857b997 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/serializer/ProblemSemanticSequencer.java @@ -0,0 +1,296 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.serializer; + +import com.google.inject.Inject; +import java.util.Set; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.viatra.solver.language.model.problem.Assertion; +import org.eclipse.viatra.solver.language.model.problem.Atom; +import org.eclipse.viatra.solver.language.model.problem.ClassDeclaration; +import org.eclipse.viatra.solver.language.model.problem.Conjunction; +import org.eclipse.viatra.solver.language.model.problem.ExactMultiplicity; +import org.eclipse.viatra.solver.language.model.problem.NegativeLiteral; +import org.eclipse.viatra.solver.language.model.problem.PredicateDefinition; +import org.eclipse.viatra.solver.language.model.problem.Problem; +import org.eclipse.viatra.solver.language.model.problem.ProblemPackage; +import org.eclipse.viatra.solver.language.model.problem.RangeMultiplicity; +import org.eclipse.viatra.solver.language.model.problem.ReferenceDeclaration; +import org.eclipse.viatra.solver.language.model.problem.ScopeDeclaration; +import org.eclipse.viatra.solver.language.model.problem.TypeScope; +import org.eclipse.viatra.solver.language.services.ProblemGrammarAccess; +import org.eclipse.xtext.Action; +import org.eclipse.xtext.Parameter; +import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.serializer.ISerializationContext; +import org.eclipse.xtext.serializer.acceptor.SequenceFeeder; +import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer; +import org.eclipse.xtext.serializer.sequencer.ITransientValueService.ValueTransient; + +@SuppressWarnings("all") +public class ProblemSemanticSequencer extends AbstractDelegatingSemanticSequencer { + + @Inject + private ProblemGrammarAccess grammarAccess; + + @Override + public void sequence(ISerializationContext context, EObject semanticObject) { + EPackage epackage = semanticObject.eClass().getEPackage(); + ParserRule rule = context.getParserRule(); + Action action = context.getAssignedAction(); + Set parameters = context.getEnabledBooleanParameters(); + if (epackage == ProblemPackage.eINSTANCE) + switch (semanticObject.eClass().getClassifierID()) { + case ProblemPackage.ASSERTION: + sequence_Assertion(context, (Assertion) semanticObject); + return; + case ProblemPackage.ATOM: + sequence_Atom(context, (Atom) semanticObject); + return; + case ProblemPackage.CLASS_DECLARATION: + sequence_ClassDeclaration(context, (ClassDeclaration) semanticObject); + return; + case ProblemPackage.CONJUNCTION: + sequence_Conjunction(context, (Conjunction) semanticObject); + return; + case ProblemPackage.EXACT_MULTIPLICITY: + sequence_ExactMultiplicity(context, (ExactMultiplicity) semanticObject); + return; + case ProblemPackage.NEGATIVE_LITERAL: + sequence_NegativeLiteral(context, (NegativeLiteral) semanticObject); + return; + case ProblemPackage.PARAMETER: + sequence_Parameter(context, (org.eclipse.viatra.solver.language.model.problem.Parameter) semanticObject); + return; + case ProblemPackage.PREDICATE_DEFINITION: + sequence_PredicateDefinition(context, (PredicateDefinition) semanticObject); + return; + case ProblemPackage.PROBLEM: + sequence_Problem(context, (Problem) semanticObject); + return; + case ProblemPackage.RANGE_MULTIPLICITY: + sequence_RangeMultiplicity(context, (RangeMultiplicity) semanticObject); + return; + case ProblemPackage.REFERENCE_DECLARATION: + sequence_ReferenceDeclaration(context, (ReferenceDeclaration) semanticObject); + return; + case ProblemPackage.SCOPE_DECLARATION: + sequence_ScopeDeclaration(context, (ScopeDeclaration) semanticObject); + return; + case ProblemPackage.TYPE_SCOPE: + sequence_TypeScope(context, (TypeScope) semanticObject); + return; + } + if (errorAcceptor != null) + errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context)); + } + + /** + * Contexts: + * Statement returns Assertion + * Assertion returns Assertion + * + * Constraint: + * ( + * (relation=[Relation|QualifiedName] (arguments+=[Node|QualifiedName] arguments+=[Node|QualifiedName]*)? value=LogicValue) | + * (value=ShortLogicValue? relation=[Relation|QualifiedName] (arguments+=[Node|QualifiedName] arguments+=[Node|QualifiedName]*)?) + * ) + */ + protected void sequence_Assertion(ISerializationContext context, Assertion semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * Literal returns Atom + * Atom returns Atom + * + * Constraint: + * (relation=[Relation|QualifiedName] transitiveClosure?='+'? (arguments+=[Variable|ID] arguments+=[Variable|ID]*)?) + */ + protected void sequence_Atom(ISerializationContext context, Atom semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * Statement returns ClassDeclaration + * ClassDeclaration returns ClassDeclaration + * + * Constraint: + * ( + * abstract?='abstract'? + * name=ID + * ( + * superTypes+=[ClassDeclaration|ID] | + * (superTypes+=[ClassDeclaration|ID] superTypes+=[ClassDeclaration|ID]*) | + * referenceDeclarations+=ReferenceDeclaration + * )? + * referenceDeclarations+=ReferenceDeclaration* + * ) + */ + protected void sequence_ClassDeclaration(ISerializationContext context, ClassDeclaration semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * Conjunction returns Conjunction + * + * Constraint: + * (literals+=Literal literals+=Literal*) + */ + protected void sequence_Conjunction(ISerializationContext context, Conjunction semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * Multiplicity returns ExactMultiplicity + * ExactMultiplicity returns ExactMultiplicity + * + * Constraint: + * exactValue=INT + */ + protected void sequence_ExactMultiplicity(ISerializationContext context, ExactMultiplicity semanticObject) { + if (errorAcceptor != null) { + if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.EXACT_MULTIPLICITY__EXACT_VALUE) == ValueTransient.YES) + errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.EXACT_MULTIPLICITY__EXACT_VALUE)); + } + SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); + feeder.accept(grammarAccess.getExactMultiplicityAccess().getExactValueINTTerminalRuleCall_0(), semanticObject.getExactValue()); + feeder.finish(); + } + + + /** + * Contexts: + * Literal returns NegativeLiteral + * NegativeLiteral returns NegativeLiteral + * + * Constraint: + * atom=Atom + */ + protected void sequence_NegativeLiteral(ISerializationContext context, NegativeLiteral semanticObject) { + if (errorAcceptor != null) { + if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.NEGATIVE_LITERAL__ATOM) == ValueTransient.YES) + errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.NEGATIVE_LITERAL__ATOM)); + } + SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); + feeder.accept(grammarAccess.getNegativeLiteralAccess().getAtomAtomParserRuleCall_1_0(), semanticObject.getAtom()); + feeder.finish(); + } + + + /** + * Contexts: + * Parameter returns Parameter + * + * Constraint: + * (parameterType=[ClassDeclaration|ID] name=ID) + */ + protected void sequence_Parameter(ISerializationContext context, org.eclipse.viatra.solver.language.model.problem.Parameter semanticObject) { + if (errorAcceptor != null) { + if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.PARAMETER__PARAMETER_TYPE) == ValueTransient.YES) + errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.PARAMETER__PARAMETER_TYPE)); + if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.NAMED_ELEMENT__NAME) == ValueTransient.YES) + errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.NAMED_ELEMENT__NAME)); + } + SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); + feeder.accept(grammarAccess.getParameterAccess().getParameterTypeClassDeclarationIDTerminalRuleCall_0_0_1(), semanticObject.eGet(ProblemPackage.Literals.PARAMETER__PARAMETER_TYPE, false)); + feeder.accept(grammarAccess.getParameterAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName()); + feeder.finish(); + } + + + /** + * Contexts: + * Statement returns PredicateDefinition + * PredicateDefinition returns PredicateDefinition + * + * Constraint: + * (error?='error'? name=ID (parameters+=Parameter parameters+=Parameter*)? (bodies+=Conjunction bodies+=Conjunction*)?) + */ + protected void sequence_PredicateDefinition(ISerializationContext context, PredicateDefinition semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * Problem returns Problem + * + * Constraint: + * statements+=Statement+ + */ + protected void sequence_Problem(ISerializationContext context, Problem semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * Multiplicity returns RangeMultiplicity + * RangeMultiplicity returns RangeMultiplicity + * + * Constraint: + * (lowerBound=INT upperBound=UpperBound) + */ + protected void sequence_RangeMultiplicity(ISerializationContext context, RangeMultiplicity semanticObject) { + if (errorAcceptor != null) { + if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.RANGE_MULTIPLICITY__LOWER_BOUND) == ValueTransient.YES) + errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.RANGE_MULTIPLICITY__LOWER_BOUND)); + if (transientValues.isValueTransient(semanticObject, ProblemPackage.Literals.RANGE_MULTIPLICITY__UPPER_BOUND) == ValueTransient.YES) + errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ProblemPackage.Literals.RANGE_MULTIPLICITY__UPPER_BOUND)); + } + SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); + feeder.accept(grammarAccess.getRangeMultiplicityAccess().getLowerBoundINTTerminalRuleCall_0_0(), semanticObject.getLowerBound()); + feeder.accept(grammarAccess.getRangeMultiplicityAccess().getUpperBoundUpperBoundParserRuleCall_2_0(), semanticObject.getUpperBound()); + feeder.finish(); + } + + + /** + * Contexts: + * ReferenceDeclaration returns ReferenceDeclaration + * + * Constraint: + * (containment?='contains'? referenceType=[ClassDeclaration|ID] multiplicity=Multiplicity name=ID opposite=[ReferenceDeclaration|QualifiedName]?) + */ + protected void sequence_ReferenceDeclaration(ISerializationContext context, ReferenceDeclaration semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * Statement returns ScopeDeclaration + * ScopeDeclaration returns ScopeDeclaration + * + * Constraint: + * (typeScopes+=TypeScope typeScopes+=TypeScope*) + */ + protected void sequence_ScopeDeclaration(ISerializationContext context, ScopeDeclaration semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + + /** + * Contexts: + * TypeScope returns TypeScope + * + * Constraint: + * (targetType=[ClassDeclaration|ID] increment?='+='? multiplicity=Multiplicity) + */ + protected void sequence_TypeScope(ISerializationContext context, TypeScope semanticObject) { + genericSequencer.createSequence(context, semanticObject); + } + + +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/serializer/ProblemSyntacticSequencer.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/serializer/ProblemSyntacticSequencer.java new file mode 100644 index 00000000..3ffb6315 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/serializer/ProblemSyntacticSequencer.java @@ -0,0 +1,77 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.serializer; + +import com.google.inject.Inject; +import java.util.List; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.viatra.solver.language.services.ProblemGrammarAccess; +import org.eclipse.xtext.IGrammarAccess; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias; +import org.eclipse.xtext.serializer.analysis.GrammarAlias.GroupAlias; +import org.eclipse.xtext.serializer.analysis.GrammarAlias.TokenAlias; +import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable; +import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition; +import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer; + +@SuppressWarnings("all") +public class ProblemSyntacticSequencer extends AbstractSyntacticSequencer { + + protected ProblemGrammarAccess grammarAccess; + protected AbstractElementAlias match_ClassDeclaration___ExtendsKeyword_3_0_0_LeftSquareBracketKeyword_3_0_1_1_0_RightSquareBracketKeyword_3_0_1_1_2__q; + protected AbstractElementAlias match_PredicateDefinition_PredKeyword_0_0_1_q; + + @Inject + protected void init(IGrammarAccess access) { + grammarAccess = (ProblemGrammarAccess) access; + match_ClassDeclaration___ExtendsKeyword_3_0_0_LeftSquareBracketKeyword_3_0_1_1_0_RightSquareBracketKeyword_3_0_1_1_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getClassDeclarationAccess().getExtendsKeyword_3_0_0()), new TokenAlias(false, false, grammarAccess.getClassDeclarationAccess().getLeftSquareBracketKeyword_3_0_1_1_0()), new TokenAlias(false, false, grammarAccess.getClassDeclarationAccess().getRightSquareBracketKeyword_3_0_1_1_2())); + match_PredicateDefinition_PredKeyword_0_0_1_q = new TokenAlias(false, true, grammarAccess.getPredicateDefinitionAccess().getPredKeyword_0_0_1()); + } + + @Override + protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { + return ""; + } + + + @Override + protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { + if (transition.getAmbiguousSyntaxes().isEmpty()) return; + List transitionNodes = collectNodes(fromNode, toNode); + for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { + List syntaxNodes = getNodesFor(transitionNodes, syntax); + if (match_ClassDeclaration___ExtendsKeyword_3_0_0_LeftSquareBracketKeyword_3_0_1_1_0_RightSquareBracketKeyword_3_0_1_1_2__q.equals(syntax)) + emit_ClassDeclaration___ExtendsKeyword_3_0_0_LeftSquareBracketKeyword_3_0_1_1_0_RightSquareBracketKeyword_3_0_1_1_2__q(semanticObject, getLastNavigableState(), syntaxNodes); + else if (match_PredicateDefinition_PredKeyword_0_0_1_q.equals(syntax)) + emit_PredicateDefinition_PredKeyword_0_0_1_q(semanticObject, getLastNavigableState(), syntaxNodes); + else acceptNodes(getLastNavigableState(), syntaxNodes); + } + } + + /** + * Ambiguous syntax: + * ('extends' '[' ']')? + * + * This ambiguous syntax occurs at: + * name=ID (ambiguity) ',' referenceDeclarations+=ReferenceDeclaration + * name=ID (ambiguity) '.' (rule end) + */ + protected void emit_ClassDeclaration___ExtendsKeyword_3_0_0_LeftSquareBracketKeyword_3_0_1_1_0_RightSquareBracketKeyword_3_0_1_1_2__q(EObject semanticObject, ISynNavigable transition, List nodes) { + acceptNodes(transition, nodes); + } + + /** + * Ambiguous syntax: + * 'pred'? + * + * This ambiguous syntax occurs at: + * error?='error' (ambiguity) name=ID + */ + protected void emit_PredicateDefinition_PredKeyword_0_0_1_q(EObject semanticObject, ISynNavigable transition, List nodes) { + acceptNodes(transition, nodes); + } + +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/services/ProblemGrammarAccess.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/services/ProblemGrammarAccess.java new file mode 100644 index 00000000..7d6b7013 --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/services/ProblemGrammarAccess.java @@ -0,0 +1,1411 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.services; + +import com.google.inject.Inject; +import com.google.inject.Singleton; +import java.util.List; +import org.eclipse.xtext.Alternatives; +import org.eclipse.xtext.Assignment; +import org.eclipse.xtext.CrossReference; +import org.eclipse.xtext.EnumLiteralDeclaration; +import org.eclipse.xtext.EnumRule; +import org.eclipse.xtext.Grammar; +import org.eclipse.xtext.GrammarUtil; +import org.eclipse.xtext.Group; +import org.eclipse.xtext.Keyword; +import org.eclipse.xtext.ParserRule; +import org.eclipse.xtext.RuleCall; +import org.eclipse.xtext.TerminalRule; +import org.eclipse.xtext.common.services.TerminalsGrammarAccess; +import org.eclipse.xtext.service.AbstractElementFinder; +import org.eclipse.xtext.service.GrammarProvider; + +@Singleton +public class ProblemGrammarAccess extends AbstractElementFinder.AbstractGrammarElementFinder { + + public class ProblemElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.Problem"); + private final Assignment cStatementsAssignment = (Assignment)rule.eContents().get(1); + private final RuleCall cStatementsStatementParserRuleCall_0 = (RuleCall)cStatementsAssignment.eContents().get(0); + + //Problem: + // statements+=Statement*; + @Override public ParserRule getRule() { return rule; } + + //statements+=Statement* + public Assignment getStatementsAssignment() { return cStatementsAssignment; } + + //Statement + public RuleCall getStatementsStatementParserRuleCall_0() { return cStatementsStatementParserRuleCall_0; } + } + public class StatementElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.Statement"); + private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); + private final RuleCall cClassDeclarationParserRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0); + private final RuleCall cPredicateDefinitionParserRuleCall_1 = (RuleCall)cAlternatives.eContents().get(1); + private final RuleCall cAssertionParserRuleCall_2 = (RuleCall)cAlternatives.eContents().get(2); + private final RuleCall cScopeDeclarationParserRuleCall_3 = (RuleCall)cAlternatives.eContents().get(3); + + //Statement: + // ClassDeclaration | PredicateDefinition | Assertion | ScopeDeclaration; + @Override public ParserRule getRule() { return rule; } + + //ClassDeclaration | PredicateDefinition | Assertion | ScopeDeclaration + public Alternatives getAlternatives() { return cAlternatives; } + + //ClassDeclaration + public RuleCall getClassDeclarationParserRuleCall_0() { return cClassDeclarationParserRuleCall_0; } + + //PredicateDefinition + public RuleCall getPredicateDefinitionParserRuleCall_1() { return cPredicateDefinitionParserRuleCall_1; } + + //Assertion + public RuleCall getAssertionParserRuleCall_2() { return cAssertionParserRuleCall_2; } + + //ScopeDeclaration + public RuleCall getScopeDeclarationParserRuleCall_3() { return cScopeDeclarationParserRuleCall_3; } + } + public class ClassDeclarationElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.ClassDeclaration"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cAbstractAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final Keyword cAbstractAbstractKeyword_0_0 = (Keyword)cAbstractAssignment_0.eContents().get(0); + private final Keyword cClassKeyword_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 Alternatives cAlternatives_3 = (Alternatives)cGroup.eContents().get(3); + private final Group cGroup_3_0 = (Group)cAlternatives_3.eContents().get(0); + private final Keyword cExtendsKeyword_3_0_0 = (Keyword)cGroup_3_0.eContents().get(0); + private final Alternatives cAlternatives_3_0_1 = (Alternatives)cGroup_3_0.eContents().get(1); + private final Assignment cSuperTypesAssignment_3_0_1_0 = (Assignment)cAlternatives_3_0_1.eContents().get(0); + private final CrossReference cSuperTypesClassDeclarationCrossReference_3_0_1_0_0 = (CrossReference)cSuperTypesAssignment_3_0_1_0.eContents().get(0); + private final RuleCall cSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_0_0_1 = (RuleCall)cSuperTypesClassDeclarationCrossReference_3_0_1_0_0.eContents().get(1); + private final Group cGroup_3_0_1_1 = (Group)cAlternatives_3_0_1.eContents().get(1); + private final Keyword cLeftSquareBracketKeyword_3_0_1_1_0 = (Keyword)cGroup_3_0_1_1.eContents().get(0); + private final Group cGroup_3_0_1_1_1 = (Group)cGroup_3_0_1_1.eContents().get(1); + private final Assignment cSuperTypesAssignment_3_0_1_1_1_0 = (Assignment)cGroup_3_0_1_1_1.eContents().get(0); + private final CrossReference cSuperTypesClassDeclarationCrossReference_3_0_1_1_1_0_0 = (CrossReference)cSuperTypesAssignment_3_0_1_1_1_0.eContents().get(0); + private final RuleCall cSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_1_1_0_0_1 = (RuleCall)cSuperTypesClassDeclarationCrossReference_3_0_1_1_1_0_0.eContents().get(1); + private final Group cGroup_3_0_1_1_1_1 = (Group)cGroup_3_0_1_1_1.eContents().get(1); + private final Keyword cCommaKeyword_3_0_1_1_1_1_0 = (Keyword)cGroup_3_0_1_1_1_1.eContents().get(0); + private final Assignment cSuperTypesAssignment_3_0_1_1_1_1_1 = (Assignment)cGroup_3_0_1_1_1_1.eContents().get(1); + private final CrossReference cSuperTypesClassDeclarationCrossReference_3_0_1_1_1_1_1_0 = (CrossReference)cSuperTypesAssignment_3_0_1_1_1_1_1.eContents().get(0); + private final RuleCall cSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_1_1_1_1_0_1 = (RuleCall)cSuperTypesClassDeclarationCrossReference_3_0_1_1_1_1_1_0.eContents().get(1); + private final Keyword cRightSquareBracketKeyword_3_0_1_1_2 = (Keyword)cGroup_3_0_1_1.eContents().get(2); + private final Assignment cReferenceDeclarationsAssignment_3_1 = (Assignment)cAlternatives_3.eContents().get(1); + private final RuleCall cReferenceDeclarationsReferenceDeclarationParserRuleCall_3_1_0 = (RuleCall)cReferenceDeclarationsAssignment_3_1.eContents().get(0); + private final Group cGroup_4 = (Group)cGroup.eContents().get(4); + private final Keyword cCommaKeyword_4_0 = (Keyword)cGroup_4.eContents().get(0); + private final Assignment cReferenceDeclarationsAssignment_4_1 = (Assignment)cGroup_4.eContents().get(1); + private final RuleCall cReferenceDeclarationsReferenceDeclarationParserRuleCall_4_1_0 = (RuleCall)cReferenceDeclarationsAssignment_4_1.eContents().get(0); + private final Keyword cFullStopKeyword_5 = (Keyword)cGroup.eContents().get(5); + + //ClassDeclaration: + // abstract?="abstract"? "class" + // name=ID + // ("extends" (superTypes+=[ClassDeclaration] | + // "[" (superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? "]") | + // referenceDeclarations+=ReferenceDeclaration)? + // ("," referenceDeclarations+=ReferenceDeclaration)* + // "."; + @Override public ParserRule getRule() { return rule; } + + //abstract?="abstract"? "class" + //name=ID + //("extends" (superTypes+=[ClassDeclaration] | + //"[" (superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? "]") | + //referenceDeclarations+=ReferenceDeclaration)? + //("," referenceDeclarations+=ReferenceDeclaration)* + //"." + public Group getGroup() { return cGroup; } + + //abstract?="abstract"? + public Assignment getAbstractAssignment_0() { return cAbstractAssignment_0; } + + //"abstract" + public Keyword getAbstractAbstractKeyword_0_0() { return cAbstractAbstractKeyword_0_0; } + + //"class" + public Keyword getClassKeyword_1() { return cClassKeyword_1; } + + //name=ID + public Assignment getNameAssignment_2() { return cNameAssignment_2; } + + //ID + public RuleCall getNameIDTerminalRuleCall_2_0() { return cNameIDTerminalRuleCall_2_0; } + + //("extends" (superTypes+=[ClassDeclaration] | + //"[" (superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? "]") | + //referenceDeclarations+=ReferenceDeclaration)? + public Alternatives getAlternatives_3() { return cAlternatives_3; } + + //"extends" (superTypes+=[ClassDeclaration] | + // "[" (superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? "]") + public Group getGroup_3_0() { return cGroup_3_0; } + + //"extends" + public Keyword getExtendsKeyword_3_0_0() { return cExtendsKeyword_3_0_0; } + + //(superTypes+=[ClassDeclaration] | + // "[" (superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? "]") + public Alternatives getAlternatives_3_0_1() { return cAlternatives_3_0_1; } + + //superTypes+=[ClassDeclaration] + public Assignment getSuperTypesAssignment_3_0_1_0() { return cSuperTypesAssignment_3_0_1_0; } + + //[ClassDeclaration] + public CrossReference getSuperTypesClassDeclarationCrossReference_3_0_1_0_0() { return cSuperTypesClassDeclarationCrossReference_3_0_1_0_0; } + + //ID + public RuleCall getSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_0_0_1() { return cSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_0_0_1; } + + //"[" (superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? "]" + public Group getGroup_3_0_1_1() { return cGroup_3_0_1_1; } + + //"[" + public Keyword getLeftSquareBracketKeyword_3_0_1_1_0() { return cLeftSquareBracketKeyword_3_0_1_1_0; } + + //(superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? + public Group getGroup_3_0_1_1_1() { return cGroup_3_0_1_1_1; } + + //superTypes+=[ClassDeclaration] + public Assignment getSuperTypesAssignment_3_0_1_1_1_0() { return cSuperTypesAssignment_3_0_1_1_1_0; } + + //[ClassDeclaration] + public CrossReference getSuperTypesClassDeclarationCrossReference_3_0_1_1_1_0_0() { return cSuperTypesClassDeclarationCrossReference_3_0_1_1_1_0_0; } + + //ID + public RuleCall getSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_1_1_0_0_1() { return cSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_1_1_0_0_1; } + + //("," superTypes+=[ClassDeclaration])* + public Group getGroup_3_0_1_1_1_1() { return cGroup_3_0_1_1_1_1; } + + //"," + public Keyword getCommaKeyword_3_0_1_1_1_1_0() { return cCommaKeyword_3_0_1_1_1_1_0; } + + //superTypes+=[ClassDeclaration] + public Assignment getSuperTypesAssignment_3_0_1_1_1_1_1() { return cSuperTypesAssignment_3_0_1_1_1_1_1; } + + //[ClassDeclaration] + public CrossReference getSuperTypesClassDeclarationCrossReference_3_0_1_1_1_1_1_0() { return cSuperTypesClassDeclarationCrossReference_3_0_1_1_1_1_1_0; } + + //ID + public RuleCall getSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_1_1_1_1_0_1() { return cSuperTypesClassDeclarationIDTerminalRuleCall_3_0_1_1_1_1_1_0_1; } + + //"]" + public Keyword getRightSquareBracketKeyword_3_0_1_1_2() { return cRightSquareBracketKeyword_3_0_1_1_2; } + + //referenceDeclarations+=ReferenceDeclaration + public Assignment getReferenceDeclarationsAssignment_3_1() { return cReferenceDeclarationsAssignment_3_1; } + + //ReferenceDeclaration + public RuleCall getReferenceDeclarationsReferenceDeclarationParserRuleCall_3_1_0() { return cReferenceDeclarationsReferenceDeclarationParserRuleCall_3_1_0; } + + //("," referenceDeclarations+=ReferenceDeclaration)* + public Group getGroup_4() { return cGroup_4; } + + //"," + public Keyword getCommaKeyword_4_0() { return cCommaKeyword_4_0; } + + //referenceDeclarations+=ReferenceDeclaration + public Assignment getReferenceDeclarationsAssignment_4_1() { return cReferenceDeclarationsAssignment_4_1; } + + //ReferenceDeclaration + public RuleCall getReferenceDeclarationsReferenceDeclarationParserRuleCall_4_1_0() { return cReferenceDeclarationsReferenceDeclarationParserRuleCall_4_1_0; } + + //"." + public Keyword getFullStopKeyword_5() { return cFullStopKeyword_5; } + } + public class ReferenceDeclarationElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.ReferenceDeclaration"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Alternatives cAlternatives_0 = (Alternatives)cGroup.eContents().get(0); + private final Assignment cContainmentAssignment_0_0 = (Assignment)cAlternatives_0.eContents().get(0); + private final Keyword cContainmentContainsKeyword_0_0_0 = (Keyword)cContainmentAssignment_0_0.eContents().get(0); + private final Keyword cRefersKeyword_0_1 = (Keyword)cAlternatives_0.eContents().get(1); + private final Assignment cReferenceTypeAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final CrossReference cReferenceTypeClassDeclarationCrossReference_1_0 = (CrossReference)cReferenceTypeAssignment_1.eContents().get(0); + private final RuleCall cReferenceTypeClassDeclarationIDTerminalRuleCall_1_0_1 = (RuleCall)cReferenceTypeClassDeclarationCrossReference_1_0.eContents().get(1); + private final Keyword cLeftSquareBracketKeyword_2 = (Keyword)cGroup.eContents().get(2); + private final Assignment cMultiplicityAssignment_3 = (Assignment)cGroup.eContents().get(3); + private final RuleCall cMultiplicityMultiplicityParserRuleCall_3_0 = (RuleCall)cMultiplicityAssignment_3.eContents().get(0); + private final Keyword cRightSquareBracketKeyword_4 = (Keyword)cGroup.eContents().get(4); + private final Assignment cNameAssignment_5 = (Assignment)cGroup.eContents().get(5); + private final RuleCall cNameIDTerminalRuleCall_5_0 = (RuleCall)cNameAssignment_5.eContents().get(0); + private final Group cGroup_6 = (Group)cGroup.eContents().get(6); + private final Keyword cOppositeKeyword_6_0 = (Keyword)cGroup_6.eContents().get(0); + private final Assignment cOppositeAssignment_6_1 = (Assignment)cGroup_6.eContents().get(1); + private final CrossReference cOppositeReferenceDeclarationCrossReference_6_1_0 = (CrossReference)cOppositeAssignment_6_1.eContents().get(0); + private final RuleCall cOppositeReferenceDeclarationQualifiedNameParserRuleCall_6_1_0_1 = (RuleCall)cOppositeReferenceDeclarationCrossReference_6_1_0.eContents().get(1); + + //ReferenceDeclaration: + // (containment?="contains" | "refers") + // referenceType=[ClassDeclaration] + // "[" multiplicity=Multiplicity "]" + // name=ID + // ("opposite" opposite=[ReferenceDeclaration|QualifiedName])?; + @Override public ParserRule getRule() { return rule; } + + //(containment?="contains" | "refers") + //referenceType=[ClassDeclaration] + //"[" multiplicity=Multiplicity "]" + //name=ID + //("opposite" opposite=[ReferenceDeclaration|QualifiedName])? + public Group getGroup() { return cGroup; } + + //(containment?="contains" | "refers") + public Alternatives getAlternatives_0() { return cAlternatives_0; } + + //containment?="contains" + public Assignment getContainmentAssignment_0_0() { return cContainmentAssignment_0_0; } + + //"contains" + public Keyword getContainmentContainsKeyword_0_0_0() { return cContainmentContainsKeyword_0_0_0; } + + //"refers" + public Keyword getRefersKeyword_0_1() { return cRefersKeyword_0_1; } + + //referenceType=[ClassDeclaration] + public Assignment getReferenceTypeAssignment_1() { return cReferenceTypeAssignment_1; } + + //[ClassDeclaration] + public CrossReference getReferenceTypeClassDeclarationCrossReference_1_0() { return cReferenceTypeClassDeclarationCrossReference_1_0; } + + //ID + public RuleCall getReferenceTypeClassDeclarationIDTerminalRuleCall_1_0_1() { return cReferenceTypeClassDeclarationIDTerminalRuleCall_1_0_1; } + + //"[" + public Keyword getLeftSquareBracketKeyword_2() { return cLeftSquareBracketKeyword_2; } + + //multiplicity=Multiplicity + public Assignment getMultiplicityAssignment_3() { return cMultiplicityAssignment_3; } + + //Multiplicity + public RuleCall getMultiplicityMultiplicityParserRuleCall_3_0() { return cMultiplicityMultiplicityParserRuleCall_3_0; } + + //"]" + public Keyword getRightSquareBracketKeyword_4() { return cRightSquareBracketKeyword_4; } + + //name=ID + public Assignment getNameAssignment_5() { return cNameAssignment_5; } + + //ID + public RuleCall getNameIDTerminalRuleCall_5_0() { return cNameIDTerminalRuleCall_5_0; } + + //("opposite" opposite=[ReferenceDeclaration|QualifiedName])? + public Group getGroup_6() { return cGroup_6; } + + //"opposite" + public Keyword getOppositeKeyword_6_0() { return cOppositeKeyword_6_0; } + + //opposite=[ReferenceDeclaration|QualifiedName] + public Assignment getOppositeAssignment_6_1() { return cOppositeAssignment_6_1; } + + //[ReferenceDeclaration|QualifiedName] + public CrossReference getOppositeReferenceDeclarationCrossReference_6_1_0() { return cOppositeReferenceDeclarationCrossReference_6_1_0; } + + //QualifiedName + public RuleCall getOppositeReferenceDeclarationQualifiedNameParserRuleCall_6_1_0_1() { return cOppositeReferenceDeclarationQualifiedNameParserRuleCall_6_1_0_1; } + } + public class PredicateDefinitionElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.PredicateDefinition"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Alternatives cAlternatives_0 = (Alternatives)cGroup.eContents().get(0); + private final Group cGroup_0_0 = (Group)cAlternatives_0.eContents().get(0); + private final Assignment cErrorAssignment_0_0_0 = (Assignment)cGroup_0_0.eContents().get(0); + private final Keyword cErrorErrorKeyword_0_0_0_0 = (Keyword)cErrorAssignment_0_0_0.eContents().get(0); + private final Keyword cPredKeyword_0_0_1 = (Keyword)cGroup_0_0.eContents().get(1); + private final Keyword cPredKeyword_0_1 = (Keyword)cAlternatives_0.eContents().get(1); + private final Assignment cNameAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final RuleCall cNameIDTerminalRuleCall_1_0 = (RuleCall)cNameAssignment_1.eContents().get(0); + private final Keyword cLeftParenthesisKeyword_2 = (Keyword)cGroup.eContents().get(2); + private final Group cGroup_3 = (Group)cGroup.eContents().get(3); + private final Assignment cParametersAssignment_3_0 = (Assignment)cGroup_3.eContents().get(0); + private final RuleCall cParametersParameterParserRuleCall_3_0_0 = (RuleCall)cParametersAssignment_3_0.eContents().get(0); + private final Group cGroup_3_1 = (Group)cGroup_3.eContents().get(1); + private final Keyword cCommaKeyword_3_1_0 = (Keyword)cGroup_3_1.eContents().get(0); + private final Assignment cParametersAssignment_3_1_1 = (Assignment)cGroup_3_1.eContents().get(1); + private final RuleCall cParametersParameterParserRuleCall_3_1_1_0 = (RuleCall)cParametersAssignment_3_1_1.eContents().get(0); + private final Keyword cRightParenthesisKeyword_4 = (Keyword)cGroup.eContents().get(4); + private final Group cGroup_5 = (Group)cGroup.eContents().get(5); + private final Keyword cColonEqualsSignKeyword_5_0 = (Keyword)cGroup_5.eContents().get(0); + private final Assignment cBodiesAssignment_5_1 = (Assignment)cGroup_5.eContents().get(1); + private final RuleCall cBodiesConjunctionParserRuleCall_5_1_0 = (RuleCall)cBodiesAssignment_5_1.eContents().get(0); + private final Group cGroup_5_2 = (Group)cGroup_5.eContents().get(2); + private final Keyword cSemicolonKeyword_5_2_0 = (Keyword)cGroup_5_2.eContents().get(0); + private final Assignment cBodiesAssignment_5_2_1 = (Assignment)cGroup_5_2.eContents().get(1); + private final RuleCall cBodiesConjunctionParserRuleCall_5_2_1_0 = (RuleCall)cBodiesAssignment_5_2_1.eContents().get(0); + private final Keyword cFullStopKeyword_6 = (Keyword)cGroup.eContents().get(6); + + //PredicateDefinition: + // (error?="error" "pred"? | "pred") + // name=ID + // "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" + // (":=" bodies+=Conjunction (";" bodies+=Conjunction)*)? + // "."; + @Override public ParserRule getRule() { return rule; } + + //(error?="error" "pred"? | "pred") + //name=ID + //"(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" + //(":=" bodies+=Conjunction (";" bodies+=Conjunction)*)? + //"." + public Group getGroup() { return cGroup; } + + //(error?="error" "pred"? | "pred") + public Alternatives getAlternatives_0() { return cAlternatives_0; } + + //error?="error" "pred"? + public Group getGroup_0_0() { return cGroup_0_0; } + + //error?="error" + public Assignment getErrorAssignment_0_0_0() { return cErrorAssignment_0_0_0; } + + //"error" + public Keyword getErrorErrorKeyword_0_0_0_0() { return cErrorErrorKeyword_0_0_0_0; } + + //"pred"? + public Keyword getPredKeyword_0_0_1() { return cPredKeyword_0_0_1; } + + //"pred" + public Keyword getPredKeyword_0_1() { return cPredKeyword_0_1; } + + //name=ID + public Assignment getNameAssignment_1() { return cNameAssignment_1; } + + //ID + public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; } + + //"(" + public Keyword getLeftParenthesisKeyword_2() { return cLeftParenthesisKeyword_2; } + + //(parameters+=Parameter ("," parameters+=Parameter)*)? + public Group getGroup_3() { return cGroup_3; } + + //parameters+=Parameter + public Assignment getParametersAssignment_3_0() { return cParametersAssignment_3_0; } + + //Parameter + public RuleCall getParametersParameterParserRuleCall_3_0_0() { return cParametersParameterParserRuleCall_3_0_0; } + + //("," parameters+=Parameter)* + public Group getGroup_3_1() { return cGroup_3_1; } + + //"," + public Keyword getCommaKeyword_3_1_0() { return cCommaKeyword_3_1_0; } + + //parameters+=Parameter + public Assignment getParametersAssignment_3_1_1() { return cParametersAssignment_3_1_1; } + + //Parameter + public RuleCall getParametersParameterParserRuleCall_3_1_1_0() { return cParametersParameterParserRuleCall_3_1_1_0; } + + //")" + public Keyword getRightParenthesisKeyword_4() { return cRightParenthesisKeyword_4; } + + //(":=" bodies+=Conjunction (";" bodies+=Conjunction)*)? + public Group getGroup_5() { return cGroup_5; } + + //":=" + public Keyword getColonEqualsSignKeyword_5_0() { return cColonEqualsSignKeyword_5_0; } + + //bodies+=Conjunction + public Assignment getBodiesAssignment_5_1() { return cBodiesAssignment_5_1; } + + //Conjunction + public RuleCall getBodiesConjunctionParserRuleCall_5_1_0() { return cBodiesConjunctionParserRuleCall_5_1_0; } + + //(";" bodies+=Conjunction)* + public Group getGroup_5_2() { return cGroup_5_2; } + + //";" + public Keyword getSemicolonKeyword_5_2_0() { return cSemicolonKeyword_5_2_0; } + + //bodies+=Conjunction + public Assignment getBodiesAssignment_5_2_1() { return cBodiesAssignment_5_2_1; } + + //Conjunction + public RuleCall getBodiesConjunctionParserRuleCall_5_2_1_0() { return cBodiesConjunctionParserRuleCall_5_2_1_0; } + + //"." + public Keyword getFullStopKeyword_6() { return cFullStopKeyword_6; } + } + public class ParameterElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.Parameter"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cParameterTypeAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final CrossReference cParameterTypeClassDeclarationCrossReference_0_0 = (CrossReference)cParameterTypeAssignment_0.eContents().get(0); + private final RuleCall cParameterTypeClassDeclarationIDTerminalRuleCall_0_0_1 = (RuleCall)cParameterTypeClassDeclarationCrossReference_0_0.eContents().get(1); + private final Assignment cNameAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final RuleCall cNameIDTerminalRuleCall_1_0 = (RuleCall)cNameAssignment_1.eContents().get(0); + + //Parameter: + // parameterType=[ClassDeclaration] name=ID; + @Override public ParserRule getRule() { return rule; } + + //parameterType=[ClassDeclaration] name=ID + public Group getGroup() { return cGroup; } + + //parameterType=[ClassDeclaration] + public Assignment getParameterTypeAssignment_0() { return cParameterTypeAssignment_0; } + + //[ClassDeclaration] + public CrossReference getParameterTypeClassDeclarationCrossReference_0_0() { return cParameterTypeClassDeclarationCrossReference_0_0; } + + //ID + public RuleCall getParameterTypeClassDeclarationIDTerminalRuleCall_0_0_1() { return cParameterTypeClassDeclarationIDTerminalRuleCall_0_0_1; } + + //name=ID + public Assignment getNameAssignment_1() { return cNameAssignment_1; } + + //ID + public RuleCall getNameIDTerminalRuleCall_1_0() { return cNameIDTerminalRuleCall_1_0; } + } + public class ConjunctionElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.Conjunction"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cLiteralsAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final RuleCall cLiteralsLiteralParserRuleCall_0_0 = (RuleCall)cLiteralsAssignment_0.eContents().get(0); + private final Group cGroup_1 = (Group)cGroup.eContents().get(1); + private final Keyword cCommaKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0); + private final Assignment cLiteralsAssignment_1_1 = (Assignment)cGroup_1.eContents().get(1); + private final RuleCall cLiteralsLiteralParserRuleCall_1_1_0 = (RuleCall)cLiteralsAssignment_1_1.eContents().get(0); + + //Conjunction: + // literals+=Literal ("," literals+=Literal)*; + @Override public ParserRule getRule() { return rule; } + + //literals+=Literal ("," literals+=Literal)* + public Group getGroup() { return cGroup; } + + //literals+=Literal + public Assignment getLiteralsAssignment_0() { return cLiteralsAssignment_0; } + + //Literal + public RuleCall getLiteralsLiteralParserRuleCall_0_0() { return cLiteralsLiteralParserRuleCall_0_0; } + + //("," literals+=Literal)* + public Group getGroup_1() { return cGroup_1; } + + //"," + public Keyword getCommaKeyword_1_0() { return cCommaKeyword_1_0; } + + //literals+=Literal + public Assignment getLiteralsAssignment_1_1() { return cLiteralsAssignment_1_1; } + + //Literal + public RuleCall getLiteralsLiteralParserRuleCall_1_1_0() { return cLiteralsLiteralParserRuleCall_1_1_0; } + } + public class LiteralElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.Literal"); + private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); + private final RuleCall cAtomParserRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0); + private final RuleCall cNegativeLiteralParserRuleCall_1 = (RuleCall)cAlternatives.eContents().get(1); + + //Literal: + // Atom | NegativeLiteral; + @Override public ParserRule getRule() { return rule; } + + //Atom | NegativeLiteral + public Alternatives getAlternatives() { return cAlternatives; } + + //Atom + public RuleCall getAtomParserRuleCall_0() { return cAtomParserRuleCall_0; } + + //NegativeLiteral + public RuleCall getNegativeLiteralParserRuleCall_1() { return cNegativeLiteralParserRuleCall_1; } + } + public class NegativeLiteralElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.NegativeLiteral"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Keyword cExclamationMarkKeyword_0 = (Keyword)cGroup.eContents().get(0); + private final Assignment cAtomAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final RuleCall cAtomAtomParserRuleCall_1_0 = (RuleCall)cAtomAssignment_1.eContents().get(0); + + //NegativeLiteral: + // "!" atom=Atom; + @Override public ParserRule getRule() { return rule; } + + //"!" atom=Atom + public Group getGroup() { return cGroup; } + + //"!" + public Keyword getExclamationMarkKeyword_0() { return cExclamationMarkKeyword_0; } + + //atom=Atom + public Assignment getAtomAssignment_1() { return cAtomAssignment_1; } + + //Atom + public RuleCall getAtomAtomParserRuleCall_1_0() { return cAtomAtomParserRuleCall_1_0; } + } + public class AtomElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.Atom"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cRelationAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final CrossReference cRelationRelationCrossReference_0_0 = (CrossReference)cRelationAssignment_0.eContents().get(0); + private final RuleCall cRelationRelationQualifiedNameParserRuleCall_0_0_1 = (RuleCall)cRelationRelationCrossReference_0_0.eContents().get(1); + private final Assignment cTransitiveClosureAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final Keyword cTransitiveClosurePlusSignKeyword_1_0 = (Keyword)cTransitiveClosureAssignment_1.eContents().get(0); + private final Keyword cLeftParenthesisKeyword_2 = (Keyword)cGroup.eContents().get(2); + private final Group cGroup_3 = (Group)cGroup.eContents().get(3); + private final Assignment cArgumentsAssignment_3_0 = (Assignment)cGroup_3.eContents().get(0); + private final CrossReference cArgumentsVariableCrossReference_3_0_0 = (CrossReference)cArgumentsAssignment_3_0.eContents().get(0); + private final RuleCall cArgumentsVariableIDTerminalRuleCall_3_0_0_1 = (RuleCall)cArgumentsVariableCrossReference_3_0_0.eContents().get(1); + private final Group cGroup_3_1 = (Group)cGroup_3.eContents().get(1); + private final Keyword cCommaKeyword_3_1_0 = (Keyword)cGroup_3_1.eContents().get(0); + private final Assignment cArgumentsAssignment_3_1_1 = (Assignment)cGroup_3_1.eContents().get(1); + private final CrossReference cArgumentsVariableCrossReference_3_1_1_0 = (CrossReference)cArgumentsAssignment_3_1_1.eContents().get(0); + private final RuleCall cArgumentsVariableIDTerminalRuleCall_3_1_1_0_1 = (RuleCall)cArgumentsVariableCrossReference_3_1_1_0.eContents().get(1); + private final Keyword cRightParenthesisKeyword_4 = (Keyword)cGroup.eContents().get(4); + + //Atom: + // relation=[Relation|QualifiedName] + // transitiveClosure?="+"? + // "(" (arguments+=[Variable] ("," arguments+=[Variable])*)? ")"; + @Override public ParserRule getRule() { return rule; } + + //relation=[Relation|QualifiedName] + //transitiveClosure?="+"? + //"(" (arguments+=[Variable] ("," arguments+=[Variable])*)? ")" + public Group getGroup() { return cGroup; } + + //relation=[Relation|QualifiedName] + public Assignment getRelationAssignment_0() { return cRelationAssignment_0; } + + //[Relation|QualifiedName] + public CrossReference getRelationRelationCrossReference_0_0() { return cRelationRelationCrossReference_0_0; } + + //QualifiedName + public RuleCall getRelationRelationQualifiedNameParserRuleCall_0_0_1() { return cRelationRelationQualifiedNameParserRuleCall_0_0_1; } + + //transitiveClosure?="+"? + public Assignment getTransitiveClosureAssignment_1() { return cTransitiveClosureAssignment_1; } + + //"+" + public Keyword getTransitiveClosurePlusSignKeyword_1_0() { return cTransitiveClosurePlusSignKeyword_1_0; } + + //"(" + public Keyword getLeftParenthesisKeyword_2() { return cLeftParenthesisKeyword_2; } + + //(arguments+=[Variable] ("," arguments+=[Variable])*)? + public Group getGroup_3() { return cGroup_3; } + + //arguments+=[Variable] + public Assignment getArgumentsAssignment_3_0() { return cArgumentsAssignment_3_0; } + + //[Variable] + public CrossReference getArgumentsVariableCrossReference_3_0_0() { return cArgumentsVariableCrossReference_3_0_0; } + + //ID + public RuleCall getArgumentsVariableIDTerminalRuleCall_3_0_0_1() { return cArgumentsVariableIDTerminalRuleCall_3_0_0_1; } + + //("," arguments+=[Variable])* + public Group getGroup_3_1() { return cGroup_3_1; } + + //"," + public Keyword getCommaKeyword_3_1_0() { return cCommaKeyword_3_1_0; } + + //arguments+=[Variable] + public Assignment getArgumentsAssignment_3_1_1() { return cArgumentsAssignment_3_1_1; } + + //[Variable] + public CrossReference getArgumentsVariableCrossReference_3_1_1_0() { return cArgumentsVariableCrossReference_3_1_1_0; } + + //ID + public RuleCall getArgumentsVariableIDTerminalRuleCall_3_1_1_0_1() { return cArgumentsVariableIDTerminalRuleCall_3_1_1_0_1; } + + //")" + public Keyword getRightParenthesisKeyword_4() { return cRightParenthesisKeyword_4; } + } + public class AssertionElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.Assertion"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Alternatives cAlternatives_0 = (Alternatives)cGroup.eContents().get(0); + private final Group cGroup_0_0 = (Group)cAlternatives_0.eContents().get(0); + private final Assignment cRelationAssignment_0_0_0 = (Assignment)cGroup_0_0.eContents().get(0); + private final CrossReference cRelationRelationCrossReference_0_0_0_0 = (CrossReference)cRelationAssignment_0_0_0.eContents().get(0); + private final RuleCall cRelationRelationQualifiedNameParserRuleCall_0_0_0_0_1 = (RuleCall)cRelationRelationCrossReference_0_0_0_0.eContents().get(1); + private final Keyword cLeftParenthesisKeyword_0_0_1 = (Keyword)cGroup_0_0.eContents().get(1); + private final Group cGroup_0_0_2 = (Group)cGroup_0_0.eContents().get(2); + private final Assignment cArgumentsAssignment_0_0_2_0 = (Assignment)cGroup_0_0_2.eContents().get(0); + private final CrossReference cArgumentsNodeCrossReference_0_0_2_0_0 = (CrossReference)cArgumentsAssignment_0_0_2_0.eContents().get(0); + private final RuleCall cArgumentsNodeQualifiedNameParserRuleCall_0_0_2_0_0_1 = (RuleCall)cArgumentsNodeCrossReference_0_0_2_0_0.eContents().get(1); + private final Group cGroup_0_0_2_1 = (Group)cGroup_0_0_2.eContents().get(1); + private final Keyword cCommaKeyword_0_0_2_1_0 = (Keyword)cGroup_0_0_2_1.eContents().get(0); + private final Assignment cArgumentsAssignment_0_0_2_1_1 = (Assignment)cGroup_0_0_2_1.eContents().get(1); + private final CrossReference cArgumentsNodeCrossReference_0_0_2_1_1_0 = (CrossReference)cArgumentsAssignment_0_0_2_1_1.eContents().get(0); + private final RuleCall cArgumentsNodeQualifiedNameParserRuleCall_0_0_2_1_1_0_1 = (RuleCall)cArgumentsNodeCrossReference_0_0_2_1_1_0.eContents().get(1); + private final Keyword cRightParenthesisKeyword_0_0_3 = (Keyword)cGroup_0_0.eContents().get(3); + private final Keyword cColonKeyword_0_0_4 = (Keyword)cGroup_0_0.eContents().get(4); + private final Assignment cValueAssignment_0_0_5 = (Assignment)cGroup_0_0.eContents().get(5); + private final RuleCall cValueLogicValueEnumRuleCall_0_0_5_0 = (RuleCall)cValueAssignment_0_0_5.eContents().get(0); + private final Group cGroup_0_1 = (Group)cAlternatives_0.eContents().get(1); + private final Assignment cValueAssignment_0_1_0 = (Assignment)cGroup_0_1.eContents().get(0); + private final RuleCall cValueShortLogicValueEnumRuleCall_0_1_0_0 = (RuleCall)cValueAssignment_0_1_0.eContents().get(0); + private final Assignment cRelationAssignment_0_1_1 = (Assignment)cGroup_0_1.eContents().get(1); + private final CrossReference cRelationRelationCrossReference_0_1_1_0 = (CrossReference)cRelationAssignment_0_1_1.eContents().get(0); + private final RuleCall cRelationRelationQualifiedNameParserRuleCall_0_1_1_0_1 = (RuleCall)cRelationRelationCrossReference_0_1_1_0.eContents().get(1); + private final Keyword cLeftParenthesisKeyword_0_1_2 = (Keyword)cGroup_0_1.eContents().get(2); + private final Group cGroup_0_1_3 = (Group)cGroup_0_1.eContents().get(3); + private final Assignment cArgumentsAssignment_0_1_3_0 = (Assignment)cGroup_0_1_3.eContents().get(0); + private final CrossReference cArgumentsNodeCrossReference_0_1_3_0_0 = (CrossReference)cArgumentsAssignment_0_1_3_0.eContents().get(0); + private final RuleCall cArgumentsNodeQualifiedNameParserRuleCall_0_1_3_0_0_1 = (RuleCall)cArgumentsNodeCrossReference_0_1_3_0_0.eContents().get(1); + private final Group cGroup_0_1_3_1 = (Group)cGroup_0_1_3.eContents().get(1); + private final Keyword cCommaKeyword_0_1_3_1_0 = (Keyword)cGroup_0_1_3_1.eContents().get(0); + private final Assignment cArgumentsAssignment_0_1_3_1_1 = (Assignment)cGroup_0_1_3_1.eContents().get(1); + private final CrossReference cArgumentsNodeCrossReference_0_1_3_1_1_0 = (CrossReference)cArgumentsAssignment_0_1_3_1_1.eContents().get(0); + private final RuleCall cArgumentsNodeQualifiedNameParserRuleCall_0_1_3_1_1_0_1 = (RuleCall)cArgumentsNodeCrossReference_0_1_3_1_1_0.eContents().get(1); + private final Keyword cRightParenthesisKeyword_0_1_4 = (Keyword)cGroup_0_1.eContents().get(4); + private final Keyword cFullStopKeyword_1 = (Keyword)cGroup.eContents().get(1); + + //Assertion: + // (relation=[Relation|QualifiedName] + // "(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")" + // ":" value=LogicValue | + // value=ShortLogicValue? + // relation=[Relation|QualifiedName] + // "(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")") + // "."; + @Override public ParserRule getRule() { return rule; } + + //(relation=[Relation|QualifiedName] + //"(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")" + //":" value=LogicValue | + //value=ShortLogicValue? + //relation=[Relation|QualifiedName] + //"(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")") + //"." + public Group getGroup() { return cGroup; } + + //(relation=[Relation|QualifiedName] + //"(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")" + //":" value=LogicValue | + //value=ShortLogicValue? + //relation=[Relation|QualifiedName] + //"(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")") + public Alternatives getAlternatives_0() { return cAlternatives_0; } + + //relation=[Relation|QualifiedName] + // "(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")" + // ":" value=LogicValue + public Group getGroup_0_0() { return cGroup_0_0; } + + //relation=[Relation|QualifiedName] + public Assignment getRelationAssignment_0_0_0() { return cRelationAssignment_0_0_0; } + + //[Relation|QualifiedName] + public CrossReference getRelationRelationCrossReference_0_0_0_0() { return cRelationRelationCrossReference_0_0_0_0; } + + //QualifiedName + public RuleCall getRelationRelationQualifiedNameParserRuleCall_0_0_0_0_1() { return cRelationRelationQualifiedNameParserRuleCall_0_0_0_0_1; } + + //"(" + public Keyword getLeftParenthesisKeyword_0_0_1() { return cLeftParenthesisKeyword_0_0_1; } + + //(arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? + public Group getGroup_0_0_2() { return cGroup_0_0_2; } + + //arguments+=[Node|QualifiedName] + public Assignment getArgumentsAssignment_0_0_2_0() { return cArgumentsAssignment_0_0_2_0; } + + //[Node|QualifiedName] + public CrossReference getArgumentsNodeCrossReference_0_0_2_0_0() { return cArgumentsNodeCrossReference_0_0_2_0_0; } + + //QualifiedName + public RuleCall getArgumentsNodeQualifiedNameParserRuleCall_0_0_2_0_0_1() { return cArgumentsNodeQualifiedNameParserRuleCall_0_0_2_0_0_1; } + + //("," arguments+=[Node|QualifiedName])* + public Group getGroup_0_0_2_1() { return cGroup_0_0_2_1; } + + //"," + public Keyword getCommaKeyword_0_0_2_1_0() { return cCommaKeyword_0_0_2_1_0; } + + //arguments+=[Node|QualifiedName] + public Assignment getArgumentsAssignment_0_0_2_1_1() { return cArgumentsAssignment_0_0_2_1_1; } + + //[Node|QualifiedName] + public CrossReference getArgumentsNodeCrossReference_0_0_2_1_1_0() { return cArgumentsNodeCrossReference_0_0_2_1_1_0; } + + //QualifiedName + public RuleCall getArgumentsNodeQualifiedNameParserRuleCall_0_0_2_1_1_0_1() { return cArgumentsNodeQualifiedNameParserRuleCall_0_0_2_1_1_0_1; } + + //")" + public Keyword getRightParenthesisKeyword_0_0_3() { return cRightParenthesisKeyword_0_0_3; } + + //":" + public Keyword getColonKeyword_0_0_4() { return cColonKeyword_0_0_4; } + + //value=LogicValue + public Assignment getValueAssignment_0_0_5() { return cValueAssignment_0_0_5; } + + //LogicValue + public RuleCall getValueLogicValueEnumRuleCall_0_0_5_0() { return cValueLogicValueEnumRuleCall_0_0_5_0; } + + //value=ShortLogicValue? + //relation=[Relation|QualifiedName] + //"(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")" + public Group getGroup_0_1() { return cGroup_0_1; } + + //value=ShortLogicValue? + public Assignment getValueAssignment_0_1_0() { return cValueAssignment_0_1_0; } + + //ShortLogicValue + public RuleCall getValueShortLogicValueEnumRuleCall_0_1_0_0() { return cValueShortLogicValueEnumRuleCall_0_1_0_0; } + + //relation=[Relation|QualifiedName] + public Assignment getRelationAssignment_0_1_1() { return cRelationAssignment_0_1_1; } + + //[Relation|QualifiedName] + public CrossReference getRelationRelationCrossReference_0_1_1_0() { return cRelationRelationCrossReference_0_1_1_0; } + + //QualifiedName + public RuleCall getRelationRelationQualifiedNameParserRuleCall_0_1_1_0_1() { return cRelationRelationQualifiedNameParserRuleCall_0_1_1_0_1; } + + //"(" + public Keyword getLeftParenthesisKeyword_0_1_2() { return cLeftParenthesisKeyword_0_1_2; } + + //(arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? + public Group getGroup_0_1_3() { return cGroup_0_1_3; } + + //arguments+=[Node|QualifiedName] + public Assignment getArgumentsAssignment_0_1_3_0() { return cArgumentsAssignment_0_1_3_0; } + + //[Node|QualifiedName] + public CrossReference getArgumentsNodeCrossReference_0_1_3_0_0() { return cArgumentsNodeCrossReference_0_1_3_0_0; } + + //QualifiedName + public RuleCall getArgumentsNodeQualifiedNameParserRuleCall_0_1_3_0_0_1() { return cArgumentsNodeQualifiedNameParserRuleCall_0_1_3_0_0_1; } + + //("," arguments+=[Node|QualifiedName])* + public Group getGroup_0_1_3_1() { return cGroup_0_1_3_1; } + + //"," + public Keyword getCommaKeyword_0_1_3_1_0() { return cCommaKeyword_0_1_3_1_0; } + + //arguments+=[Node|QualifiedName] + public Assignment getArgumentsAssignment_0_1_3_1_1() { return cArgumentsAssignment_0_1_3_1_1; } + + //[Node|QualifiedName] + public CrossReference getArgumentsNodeCrossReference_0_1_3_1_1_0() { return cArgumentsNodeCrossReference_0_1_3_1_1_0; } + + //QualifiedName + public RuleCall getArgumentsNodeQualifiedNameParserRuleCall_0_1_3_1_1_0_1() { return cArgumentsNodeQualifiedNameParserRuleCall_0_1_3_1_1_0_1; } + + //")" + public Keyword getRightParenthesisKeyword_0_1_4() { return cRightParenthesisKeyword_0_1_4; } + + //"." + public Keyword getFullStopKeyword_1() { return cFullStopKeyword_1; } + } + public class ScopeDeclarationElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.ScopeDeclaration"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Keyword cScopeKeyword_0 = (Keyword)cGroup.eContents().get(0); + private final Assignment cTypeScopesAssignment_1 = (Assignment)cGroup.eContents().get(1); + private final RuleCall cTypeScopesTypeScopeParserRuleCall_1_0 = (RuleCall)cTypeScopesAssignment_1.eContents().get(0); + private final Group cGroup_2 = (Group)cGroup.eContents().get(2); + private final Keyword cCommaKeyword_2_0 = (Keyword)cGroup_2.eContents().get(0); + private final Assignment cTypeScopesAssignment_2_1 = (Assignment)cGroup_2.eContents().get(1); + private final RuleCall cTypeScopesTypeScopeParserRuleCall_2_1_0 = (RuleCall)cTypeScopesAssignment_2_1.eContents().get(0); + private final Keyword cFullStopKeyword_3 = (Keyword)cGroup.eContents().get(3); + + //ScopeDeclaration: + // "scope" typeScopes+=TypeScope ("," typeScopes+=TypeScope)* "."; + @Override public ParserRule getRule() { return rule; } + + //"scope" typeScopes+=TypeScope ("," typeScopes+=TypeScope)* "." + public Group getGroup() { return cGroup; } + + //"scope" + public Keyword getScopeKeyword_0() { return cScopeKeyword_0; } + + //typeScopes+=TypeScope + public Assignment getTypeScopesAssignment_1() { return cTypeScopesAssignment_1; } + + //TypeScope + public RuleCall getTypeScopesTypeScopeParserRuleCall_1_0() { return cTypeScopesTypeScopeParserRuleCall_1_0; } + + //("," typeScopes+=TypeScope)* + public Group getGroup_2() { return cGroup_2; } + + //"," + public Keyword getCommaKeyword_2_0() { return cCommaKeyword_2_0; } + + //typeScopes+=TypeScope + public Assignment getTypeScopesAssignment_2_1() { return cTypeScopesAssignment_2_1; } + + //TypeScope + public RuleCall getTypeScopesTypeScopeParserRuleCall_2_1_0() { return cTypeScopesTypeScopeParserRuleCall_2_1_0; } + + //"." + public Keyword getFullStopKeyword_3() { return cFullStopKeyword_3; } + } + public class TypeScopeElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.TypeScope"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cTargetTypeAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final CrossReference cTargetTypeClassDeclarationCrossReference_0_0 = (CrossReference)cTargetTypeAssignment_0.eContents().get(0); + private final RuleCall cTargetTypeClassDeclarationIDTerminalRuleCall_0_0_1 = (RuleCall)cTargetTypeClassDeclarationCrossReference_0_0.eContents().get(1); + private final Alternatives cAlternatives_1 = (Alternatives)cGroup.eContents().get(1); + private final Assignment cIncrementAssignment_1_0 = (Assignment)cAlternatives_1.eContents().get(0); + private final Keyword cIncrementPlusSignEqualsSignKeyword_1_0_0 = (Keyword)cIncrementAssignment_1_0.eContents().get(0); + private final Keyword cEqualsSignKeyword_1_1 = (Keyword)cAlternatives_1.eContents().get(1); + private final Assignment cMultiplicityAssignment_2 = (Assignment)cGroup.eContents().get(2); + private final RuleCall cMultiplicityMultiplicityParserRuleCall_2_0 = (RuleCall)cMultiplicityAssignment_2.eContents().get(0); + + //TypeScope: + // targetType=[ClassDeclaration] + // (increment?="+=" | "=") + // multiplicity=Multiplicity; + @Override public ParserRule getRule() { return rule; } + + //targetType=[ClassDeclaration] + //(increment?="+=" | "=") + //multiplicity=Multiplicity + public Group getGroup() { return cGroup; } + + //targetType=[ClassDeclaration] + public Assignment getTargetTypeAssignment_0() { return cTargetTypeAssignment_0; } + + //[ClassDeclaration] + public CrossReference getTargetTypeClassDeclarationCrossReference_0_0() { return cTargetTypeClassDeclarationCrossReference_0_0; } + + //ID + public RuleCall getTargetTypeClassDeclarationIDTerminalRuleCall_0_0_1() { return cTargetTypeClassDeclarationIDTerminalRuleCall_0_0_1; } + + //(increment?="+=" | "=") + public Alternatives getAlternatives_1() { return cAlternatives_1; } + + //increment?="+=" + public Assignment getIncrementAssignment_1_0() { return cIncrementAssignment_1_0; } + + //"+=" + public Keyword getIncrementPlusSignEqualsSignKeyword_1_0_0() { return cIncrementPlusSignEqualsSignKeyword_1_0_0; } + + //"=" + public Keyword getEqualsSignKeyword_1_1() { return cEqualsSignKeyword_1_1; } + + //multiplicity=Multiplicity + public Assignment getMultiplicityAssignment_2() { return cMultiplicityAssignment_2; } + + //Multiplicity + public RuleCall getMultiplicityMultiplicityParserRuleCall_2_0() { return cMultiplicityMultiplicityParserRuleCall_2_0; } + } + public class MultiplicityElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.Multiplicity"); + private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); + private final RuleCall cRangeMultiplicityParserRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0); + private final RuleCall cExactMultiplicityParserRuleCall_1 = (RuleCall)cAlternatives.eContents().get(1); + + //Multiplicity: + // RangeMultiplicity | ExactMultiplicity; + @Override public ParserRule getRule() { return rule; } + + //RangeMultiplicity | ExactMultiplicity + public Alternatives getAlternatives() { return cAlternatives; } + + //RangeMultiplicity + public RuleCall getRangeMultiplicityParserRuleCall_0() { return cRangeMultiplicityParserRuleCall_0; } + + //ExactMultiplicity + public RuleCall getExactMultiplicityParserRuleCall_1() { return cExactMultiplicityParserRuleCall_1; } + } + public class RangeMultiplicityElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.RangeMultiplicity"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Assignment cLowerBoundAssignment_0 = (Assignment)cGroup.eContents().get(0); + private final RuleCall cLowerBoundINTTerminalRuleCall_0_0 = (RuleCall)cLowerBoundAssignment_0.eContents().get(0); + private final Keyword cFullStopFullStopKeyword_1 = (Keyword)cGroup.eContents().get(1); + private final Assignment cUpperBoundAssignment_2 = (Assignment)cGroup.eContents().get(2); + private final RuleCall cUpperBoundUpperBoundParserRuleCall_2_0 = (RuleCall)cUpperBoundAssignment_2.eContents().get(0); + + //RangeMultiplicity: + // lowerBound=INT ".." upperBound=UpperBound; + @Override public ParserRule getRule() { return rule; } + + //lowerBound=INT ".." upperBound=UpperBound + public Group getGroup() { return cGroup; } + + //lowerBound=INT + public Assignment getLowerBoundAssignment_0() { return cLowerBoundAssignment_0; } + + //INT + public RuleCall getLowerBoundINTTerminalRuleCall_0_0() { return cLowerBoundINTTerminalRuleCall_0_0; } + + //".." + public Keyword getFullStopFullStopKeyword_1() { return cFullStopFullStopKeyword_1; } + + //upperBound=UpperBound + public Assignment getUpperBoundAssignment_2() { return cUpperBoundAssignment_2; } + + //UpperBound + public RuleCall getUpperBoundUpperBoundParserRuleCall_2_0() { return cUpperBoundUpperBoundParserRuleCall_2_0; } + } + public class ExactMultiplicityElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.ExactMultiplicity"); + private final Assignment cExactValueAssignment = (Assignment)rule.eContents().get(1); + private final RuleCall cExactValueINTTerminalRuleCall_0 = (RuleCall)cExactValueAssignment.eContents().get(0); + + //ExactMultiplicity: + // exactValue=INT; + @Override public ParserRule getRule() { return rule; } + + //exactValue=INT + public Assignment getExactValueAssignment() { return cExactValueAssignment; } + + //INT + public RuleCall getExactValueINTTerminalRuleCall_0() { return cExactValueINTTerminalRuleCall_0; } + } + public class UpperBoundElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.UpperBound"); + private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); + private final RuleCall cINTTerminalRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0); + private final Keyword cAsteriskKeyword_1 = (Keyword)cAlternatives.eContents().get(1); + + //UpperBound returns ecore::EInt: + // INT | "*"; + @Override public ParserRule getRule() { return rule; } + + //INT | "*" + public Alternatives getAlternatives() { return cAlternatives; } + + //INT + public RuleCall getINTTerminalRuleCall_0() { return cINTTerminalRuleCall_0; } + + //"*" + public Keyword getAsteriskKeyword_1() { return cAsteriskKeyword_1; } + } + public class QualifiedNameElements extends AbstractParserRuleElementFinder { + private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.QualifiedName"); + private final Group cGroup = (Group)rule.eContents().get(1); + private final RuleCall cIDTerminalRuleCall_0 = (RuleCall)cGroup.eContents().get(0); + private final Group cGroup_1 = (Group)cGroup.eContents().get(1); + private final Keyword cColonColonKeyword_1_0 = (Keyword)cGroup_1.eContents().get(0); + private final RuleCall cIDTerminalRuleCall_1_1 = (RuleCall)cGroup_1.eContents().get(1); + + //QualifiedName: + // ID ("::" ID)*; + @Override public ParserRule getRule() { return rule; } + + //ID ("::" ID)* + public Group getGroup() { return cGroup; } + + //ID + public RuleCall getIDTerminalRuleCall_0() { return cIDTerminalRuleCall_0; } + + //("::" ID)* + public Group getGroup_1() { return cGroup_1; } + + //"::" + public Keyword getColonColonKeyword_1_0() { return cColonColonKeyword_1_0; } + + //ID + public RuleCall getIDTerminalRuleCall_1_1() { return cIDTerminalRuleCall_1_1; } + } + + public class LogicValueElements extends AbstractElementFinder.AbstractEnumRuleElementFinder { + private final EnumRule rule = (EnumRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.LogicValue"); + private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); + private final EnumLiteralDeclaration cTRUEEnumLiteralDeclaration_0 = (EnumLiteralDeclaration)cAlternatives.eContents().get(0); + private final Keyword cTRUETrueKeyword_0_0 = (Keyword)cTRUEEnumLiteralDeclaration_0.eContents().get(0); + private final EnumLiteralDeclaration cFALSEEnumLiteralDeclaration_1 = (EnumLiteralDeclaration)cAlternatives.eContents().get(1); + private final Keyword cFALSEFalseKeyword_1_0 = (Keyword)cFALSEEnumLiteralDeclaration_1.eContents().get(0); + private final EnumLiteralDeclaration cUNKNOWNEnumLiteralDeclaration_2 = (EnumLiteralDeclaration)cAlternatives.eContents().get(2); + private final Keyword cUNKNOWNUnknownKeyword_2_0 = (Keyword)cUNKNOWNEnumLiteralDeclaration_2.eContents().get(0); + + //enum LogicValue: + // TRUE="true" | FALSE="false" | UNKNOWN="unknown"; + public EnumRule getRule() { return rule; } + + //TRUE="true" | FALSE="false" | UNKNOWN="unknown" + public Alternatives getAlternatives() { return cAlternatives; } + + //TRUE="true" + public EnumLiteralDeclaration getTRUEEnumLiteralDeclaration_0() { return cTRUEEnumLiteralDeclaration_0; } + + //"true" + public Keyword getTRUETrueKeyword_0_0() { return cTRUETrueKeyword_0_0; } + + //FALSE="false" + public EnumLiteralDeclaration getFALSEEnumLiteralDeclaration_1() { return cFALSEEnumLiteralDeclaration_1; } + + //"false" + public Keyword getFALSEFalseKeyword_1_0() { return cFALSEFalseKeyword_1_0; } + + //UNKNOWN="unknown" + public EnumLiteralDeclaration getUNKNOWNEnumLiteralDeclaration_2() { return cUNKNOWNEnumLiteralDeclaration_2; } + + //"unknown" + public Keyword getUNKNOWNUnknownKeyword_2_0() { return cUNKNOWNUnknownKeyword_2_0; } + } + public class ShortLogicValueElements extends AbstractElementFinder.AbstractEnumRuleElementFinder { + private final EnumRule rule = (EnumRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.viatra.solver.language.Problem.ShortLogicValue"); + private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); + private final EnumLiteralDeclaration cFALSEEnumLiteralDeclaration_0 = (EnumLiteralDeclaration)cAlternatives.eContents().get(0); + private final Keyword cFALSEExclamationMarkKeyword_0_0 = (Keyword)cFALSEEnumLiteralDeclaration_0.eContents().get(0); + private final EnumLiteralDeclaration cUNKNOWNEnumLiteralDeclaration_1 = (EnumLiteralDeclaration)cAlternatives.eContents().get(1); + private final Keyword cUNKNOWNQuestionMarkKeyword_1_0 = (Keyword)cUNKNOWNEnumLiteralDeclaration_1.eContents().get(0); + + //enum ShortLogicValue returns LogicValue: + // FALSE="!" | UNKNOWN="?"; + public EnumRule getRule() { return rule; } + + //FALSE="!" | UNKNOWN="?" + public Alternatives getAlternatives() { return cAlternatives; } + + //FALSE="!" + public EnumLiteralDeclaration getFALSEEnumLiteralDeclaration_0() { return cFALSEEnumLiteralDeclaration_0; } + + //"!" + public Keyword getFALSEExclamationMarkKeyword_0_0() { return cFALSEExclamationMarkKeyword_0_0; } + + //UNKNOWN="?" + public EnumLiteralDeclaration getUNKNOWNEnumLiteralDeclaration_1() { return cUNKNOWNEnumLiteralDeclaration_1; } + + //"?" + public Keyword getUNKNOWNQuestionMarkKeyword_1_0() { return cUNKNOWNQuestionMarkKeyword_1_0; } + } + + private final ProblemElements pProblem; + private final StatementElements pStatement; + private final ClassDeclarationElements pClassDeclaration; + private final ReferenceDeclarationElements pReferenceDeclaration; + private final PredicateDefinitionElements pPredicateDefinition; + private final ParameterElements pParameter; + private final ConjunctionElements pConjunction; + private final LiteralElements pLiteral; + private final NegativeLiteralElements pNegativeLiteral; + private final AtomElements pAtom; + private final AssertionElements pAssertion; + private final LogicValueElements eLogicValue; + private final ShortLogicValueElements eShortLogicValue; + private final ScopeDeclarationElements pScopeDeclaration; + private final TypeScopeElements pTypeScope; + private final MultiplicityElements pMultiplicity; + private final RangeMultiplicityElements pRangeMultiplicity; + private final ExactMultiplicityElements pExactMultiplicity; + private final UpperBoundElements pUpperBound; + private final QualifiedNameElements pQualifiedName; + + private final Grammar grammar; + + private final TerminalsGrammarAccess gaTerminals; + + @Inject + public ProblemGrammarAccess(GrammarProvider grammarProvider, + TerminalsGrammarAccess gaTerminals) { + this.grammar = internalFindGrammar(grammarProvider); + this.gaTerminals = gaTerminals; + this.pProblem = new ProblemElements(); + this.pStatement = new StatementElements(); + this.pClassDeclaration = new ClassDeclarationElements(); + this.pReferenceDeclaration = new ReferenceDeclarationElements(); + this.pPredicateDefinition = new PredicateDefinitionElements(); + this.pParameter = new ParameterElements(); + this.pConjunction = new ConjunctionElements(); + this.pLiteral = new LiteralElements(); + this.pNegativeLiteral = new NegativeLiteralElements(); + this.pAtom = new AtomElements(); + this.pAssertion = new AssertionElements(); + this.eLogicValue = new LogicValueElements(); + this.eShortLogicValue = new ShortLogicValueElements(); + this.pScopeDeclaration = new ScopeDeclarationElements(); + this.pTypeScope = new TypeScopeElements(); + this.pMultiplicity = new MultiplicityElements(); + this.pRangeMultiplicity = new RangeMultiplicityElements(); + this.pExactMultiplicity = new ExactMultiplicityElements(); + this.pUpperBound = new UpperBoundElements(); + this.pQualifiedName = new QualifiedNameElements(); + } + + protected Grammar internalFindGrammar(GrammarProvider grammarProvider) { + Grammar grammar = grammarProvider.getGrammar(this); + while (grammar != null) { + if ("org.eclipse.viatra.solver.language.Problem".equals(grammar.getName())) { + return grammar; + } + List grammars = grammar.getUsedGrammars(); + if (!grammars.isEmpty()) { + grammar = grammars.iterator().next(); + } else { + return null; + } + } + return grammar; + } + + @Override + public Grammar getGrammar() { + return grammar; + } + + + public TerminalsGrammarAccess getTerminalsGrammarAccess() { + return gaTerminals; + } + + + //Problem: + // statements+=Statement*; + public ProblemElements getProblemAccess() { + return pProblem; + } + + public ParserRule getProblemRule() { + return getProblemAccess().getRule(); + } + + //Statement: + // ClassDeclaration | PredicateDefinition | Assertion | ScopeDeclaration; + public StatementElements getStatementAccess() { + return pStatement; + } + + public ParserRule getStatementRule() { + return getStatementAccess().getRule(); + } + + //ClassDeclaration: + // abstract?="abstract"? "class" + // name=ID + // ("extends" (superTypes+=[ClassDeclaration] | + // "[" (superTypes+=[ClassDeclaration] ("," superTypes+=[ClassDeclaration])*)? "]") | + // referenceDeclarations+=ReferenceDeclaration)? + // ("," referenceDeclarations+=ReferenceDeclaration)* + // "."; + public ClassDeclarationElements getClassDeclarationAccess() { + return pClassDeclaration; + } + + public ParserRule getClassDeclarationRule() { + return getClassDeclarationAccess().getRule(); + } + + //ReferenceDeclaration: + // (containment?="contains" | "refers") + // referenceType=[ClassDeclaration] + // "[" multiplicity=Multiplicity "]" + // name=ID + // ("opposite" opposite=[ReferenceDeclaration|QualifiedName])?; + public ReferenceDeclarationElements getReferenceDeclarationAccess() { + return pReferenceDeclaration; + } + + public ParserRule getReferenceDeclarationRule() { + return getReferenceDeclarationAccess().getRule(); + } + + //PredicateDefinition: + // (error?="error" "pred"? | "pred") + // name=ID + // "(" (parameters+=Parameter ("," parameters+=Parameter)*)? ")" + // (":=" bodies+=Conjunction (";" bodies+=Conjunction)*)? + // "."; + public PredicateDefinitionElements getPredicateDefinitionAccess() { + return pPredicateDefinition; + } + + public ParserRule getPredicateDefinitionRule() { + return getPredicateDefinitionAccess().getRule(); + } + + //Parameter: + // parameterType=[ClassDeclaration] name=ID; + public ParameterElements getParameterAccess() { + return pParameter; + } + + public ParserRule getParameterRule() { + return getParameterAccess().getRule(); + } + + //Conjunction: + // literals+=Literal ("," literals+=Literal)*; + public ConjunctionElements getConjunctionAccess() { + return pConjunction; + } + + public ParserRule getConjunctionRule() { + return getConjunctionAccess().getRule(); + } + + //Literal: + // Atom | NegativeLiteral; + public LiteralElements getLiteralAccess() { + return pLiteral; + } + + public ParserRule getLiteralRule() { + return getLiteralAccess().getRule(); + } + + //NegativeLiteral: + // "!" atom=Atom; + public NegativeLiteralElements getNegativeLiteralAccess() { + return pNegativeLiteral; + } + + public ParserRule getNegativeLiteralRule() { + return getNegativeLiteralAccess().getRule(); + } + + //Atom: + // relation=[Relation|QualifiedName] + // transitiveClosure?="+"? + // "(" (arguments+=[Variable] ("," arguments+=[Variable])*)? ")"; + public AtomElements getAtomAccess() { + return pAtom; + } + + public ParserRule getAtomRule() { + return getAtomAccess().getRule(); + } + + //Assertion: + // (relation=[Relation|QualifiedName] + // "(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")" + // ":" value=LogicValue | + // value=ShortLogicValue? + // relation=[Relation|QualifiedName] + // "(" (arguments+=[Node|QualifiedName] ("," arguments+=[Node|QualifiedName])*)? ")") + // "."; + public AssertionElements getAssertionAccess() { + return pAssertion; + } + + public ParserRule getAssertionRule() { + return getAssertionAccess().getRule(); + } + + //enum LogicValue: + // TRUE="true" | FALSE="false" | UNKNOWN="unknown"; + public LogicValueElements getLogicValueAccess() { + return eLogicValue; + } + + public EnumRule getLogicValueRule() { + return getLogicValueAccess().getRule(); + } + + //enum ShortLogicValue returns LogicValue: + // FALSE="!" | UNKNOWN="?"; + public ShortLogicValueElements getShortLogicValueAccess() { + return eShortLogicValue; + } + + public EnumRule getShortLogicValueRule() { + return getShortLogicValueAccess().getRule(); + } + + //ScopeDeclaration: + // "scope" typeScopes+=TypeScope ("," typeScopes+=TypeScope)* "."; + public ScopeDeclarationElements getScopeDeclarationAccess() { + return pScopeDeclaration; + } + + public ParserRule getScopeDeclarationRule() { + return getScopeDeclarationAccess().getRule(); + } + + //TypeScope: + // targetType=[ClassDeclaration] + // (increment?="+=" | "=") + // multiplicity=Multiplicity; + public TypeScopeElements getTypeScopeAccess() { + return pTypeScope; + } + + public ParserRule getTypeScopeRule() { + return getTypeScopeAccess().getRule(); + } + + //Multiplicity: + // RangeMultiplicity | ExactMultiplicity; + public MultiplicityElements getMultiplicityAccess() { + return pMultiplicity; + } + + public ParserRule getMultiplicityRule() { + return getMultiplicityAccess().getRule(); + } + + //RangeMultiplicity: + // lowerBound=INT ".." upperBound=UpperBound; + public RangeMultiplicityElements getRangeMultiplicityAccess() { + return pRangeMultiplicity; + } + + public ParserRule getRangeMultiplicityRule() { + return getRangeMultiplicityAccess().getRule(); + } + + //ExactMultiplicity: + // exactValue=INT; + public ExactMultiplicityElements getExactMultiplicityAccess() { + return pExactMultiplicity; + } + + public ParserRule getExactMultiplicityRule() { + return getExactMultiplicityAccess().getRule(); + } + + //UpperBound returns ecore::EInt: + // INT | "*"; + public UpperBoundElements getUpperBoundAccess() { + return pUpperBound; + } + + public ParserRule getUpperBoundRule() { + return getUpperBoundAccess().getRule(); + } + + //QualifiedName: + // ID ("::" ID)*; + public QualifiedNameElements getQualifiedNameAccess() { + return pQualifiedName; + } + + public ParserRule getQualifiedNameRule() { + return getQualifiedNameAccess().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(); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/validation/AbstractProblemValidator.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/validation/AbstractProblemValidator.java new file mode 100644 index 00000000..9cd73e1e --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/validation/AbstractProblemValidator.java @@ -0,0 +1,19 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.validation; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.xtext.validation.AbstractDeclarativeValidator; + +public abstract class AbstractProblemValidator extends AbstractDeclarativeValidator { + + @Override + protected List getEPackages() { + List result = new ArrayList(); + result.add(EPackage.Registry.INSTANCE.getEPackage("http://www.eclipse.org/viatra/solver/language/model/Problem")); + return result; + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/validation/ProblemConfigurableIssueCodesProvider.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/validation/ProblemConfigurableIssueCodesProvider.java new file mode 100644 index 00000000..f5a0d87d --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/main/xtext-gen/org/eclipse/viatra/solver/language/validation/ProblemConfigurableIssueCodesProvider.java @@ -0,0 +1,22 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.validation; + +import org.eclipse.xtext.preferences.PreferenceKey; +import org.eclipse.xtext.util.IAcceptor; +import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider; +import org.eclipse.xtext.validation.SeverityConverter; + +@SuppressWarnings("restriction") +public class ProblemConfigurableIssueCodesProvider extends ConfigurableIssueCodesProvider { + protected static final String ISSUE_CODE_PREFIX = "org.eclipse.viatra.solver.language."; + + public static final String DEPRECATED_MODEL_PART = ISSUE_CODE_PREFIX + "deprecatedModelPart"; + + @Override + protected void initialize(IAcceptor acceptor) { + super.initialize(acceptor); + acceptor.accept(create(DEPRECATED_MODEL_PART, SeverityConverter.SEVERITY_WARNING)); + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/test/java/org/eclipse/viatra/solver/language/tests/ProblemParsingTest.xtend b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/test/java/org/eclipse/viatra/solver/language/tests/ProblemParsingTest.xtend new file mode 100644 index 00000000..b007cf8b --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/test/java/org/eclipse/viatra/solver/language/tests/ProblemParsingTest.xtend @@ -0,0 +1,30 @@ +/* + * generated by Xtext 2.25.0 + */ +package org.eclipse.viatra.solver.language.tests + +import com.google.inject.Inject +import org.eclipse.viatra.solver.language.model.problem.Problem +import org.eclipse.xtext.testing.InjectWith +import org.eclipse.xtext.testing.extensions.InjectionExtension +import org.eclipse.xtext.testing.util.ParseHelper +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.^extension.ExtendWith + +@ExtendWith(InjectionExtension) +@InjectWith(ProblemInjectorProvider) +class ProblemParsingTest { + @Inject + ParseHelper parseHelper + + @Test + def void loadModel() { + val result = parseHelper.parse(''' + Hello Xtext! + ''') + Assertions.assertNotNull(result) + val errors = result.eResource.errors + Assertions.assertTrue(errors.isEmpty, '''Unexpected errors: «errors.join(", ")»''') + } +} diff --git a/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/test/xtext-gen/org/eclipse/viatra/solver/language/tests/ProblemInjectorProvider.java b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/test/xtext-gen/org/eclipse/viatra/solver/language/tests/ProblemInjectorProvider.java new file mode 100644 index 00000000..7d0ef1bb --- /dev/null +++ b/org.eclipse.viatra.solver.language.parent/org.eclipse.viatra.solver.language/src/test/xtext-gen/org/eclipse/viatra/solver/language/tests/ProblemInjectorProvider.java @@ -0,0 +1,69 @@ +/* + * generated by Xtext 2.26.0.M1 + */ +package org.eclipse.viatra.solver.language.tests; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import org.eclipse.viatra.solver.language.ProblemRuntimeModule; +import org.eclipse.viatra.solver.language.ProblemStandaloneSetup; +import org.eclipse.xtext.testing.GlobalRegistries; +import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento; +import org.eclipse.xtext.testing.IInjectorProvider; +import org.eclipse.xtext.testing.IRegistryConfigurator; + +public class ProblemInjectorProvider implements IInjectorProvider, IRegistryConfigurator { + + protected GlobalStateMemento stateBeforeInjectorCreation; + protected GlobalStateMemento stateAfterInjectorCreation; + protected Injector injector; + + static { + GlobalRegistries.initializeDefaults(); + } + + @Override + public Injector getInjector() { + if (injector == null) { + this.injector = internalCreateInjector(); + stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); + } + return injector; + } + + protected Injector internalCreateInjector() { + return new ProblemStandaloneSetup() { + @Override + public Injector createInjector() { + return Guice.createInjector(createRuntimeModule()); + } + }.createInjectorAndDoEMFRegistration(); + } + + protected ProblemRuntimeModule createRuntimeModule() { + // make it work also with Maven/Tycho and OSGI + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672 + return new ProblemRuntimeModule() { + @Override + public ClassLoader bindClassLoaderToInstance() { + return ProblemInjectorProvider.class + .getClassLoader(); + } + }; + } + + @Override + public void restoreRegistry() { + stateBeforeInjectorCreation.restoreGlobalState(); + stateBeforeInjectorCreation = null; + } + + @Override + public void setupRegistry() { + stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); + if (injector == null) { + getInjector(); + } + stateAfterInjectorCreation.restoreGlobalState(); + } +} -- cgit v1.2.3-70-g09d2