Skip to content
Snippets Groups Projects
Commit 90364345 authored by Luca Cristoforetti's avatar Luca Cristoforetti
Browse files

Added missing files from master

parent 15f54341
No related branches found
No related tags found
No related merge requests found
Showing
with 277 additions and 0 deletions
/*
* TODO: License and author (Petter Isberg - MDH)
*/
grammar org.polarsys.chess.xtext.FlaDsl with org.eclipse.xtext.common.Terminals
import "http://www.eclipse.org/uml2/5.0.0/UML" as uml
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
generate flaDsl "http://www.intecs.org/chess/xtext/FlaDsl"
/*
* FLA Grammar
*/
Behaviour:
rules+=Expression+;
Expression:
'FLA:' lhs=Lhs '->' rhs=Rhs ';';
Lhs: failures+=InputExpression (',' failures+=InputExpression)*;
Rhs: failures+=OutputExpression (',' failures+=OutputExpression)*;
InputExpression: (ref=[uml::Port]| "undefined") '.' failureExpr=InFailureExpr;
OutputExpression: (ref=[uml::Port]| "undefined") '.' failureExpr=OutFailureExpr;
InFailureExpr:
failures+=WildcardDefinition |
failures+=NoFailureDefinition |
failures+=FailureDefinition |
'{' failures+=FailureDefinition (',' failures+=FailureDefinition)+ '}' |
failures+=VariableDefinition
;
OutFailureExpr:
failures+=NoFailureDefinition |
failures+=ComplexNofailureDefinition |
failures+=FailureDefinition |
'{' failures+=FailureDefinition (',' failures+=FailureDefinition)+ '}' |
failures+=VariableDefinition
;
Definitions: FailureDefinition | NoFailureDefinition | ComplexNofailureDefinition | WildcardDefinition | VariableDefinition;
FailureDefinition: {FailureDefinition} type = ActualFailureType ('.' acidAvoidable = ACIDavoidable)?;
NoFailureDefinition: {NoFailureDefinition} 'noFailure';
ComplexNofailureDefinition: {NoFailureDefinition} 'noFailure' '.' acidMitigation = ACIDMitigation;
WildcardDefinition: {WildcardDefinition} 'wildcard';
VariableDefinition: {VariableDefinition} variableName=ID;
enum FailureType: NO_FAILURE='noFailure' | EARLY='early'| LATE='late' | COMMISSION='commission' | OMISSION='omission' | VALUE_SUBTLE='valueSubtle' | VALUE_COARSE='valueCoarse' | WILDCARD="wildcard" | VARIABLE='variable';
enum ActualFailureType returns FailureType: EARLY | LATE | COMMISSION | OMISSION | VALUE_SUBTLE | VALUE_COARSE;
enum NoFailureType returns FailureType: NO_FAILURE;
enum Wildcard returns FailureType: WILDCARD;
ACIDavoidable: a = Aavoidable '.' c = Cavoidable '.' i = Iavoidable '.' d = Davoidable;
enum Aavoidable: INCOMPLETION='incompletion' | NONE='none' | UNSPECIFIED='unspecified';
enum Cavoidable: INCONSISTENCY='inconsistency' | NONE='none' | UNSPECIFIED='unspecified';
enum Iavoidable: INTERFERENCE='interference' | NONE='none' | UNSPECIFIED='unspecified';
enum Davoidable: IMPERMANENCE='impermanence' | NONE='none' | UNSPECIFIED='unspecified';
ACIDMitigation: a = Amitigation '.' c = Cmitigation '.' i = Imitigation '.' d = Dmitigation;
enum Amitigation: ALL_OR_NOTHING='all_or_nothing' | ALL_OR_COMPENSATION='all_or_compensation' | NONE='none' | UNSPECIFIED='unspecified';
enum Cmitigation: FULL_CONSISTENCY='full_consistency' | RANGE_VIOLATION_ALLOWED='range_violation_allowed' | NONE='none' | UNSPECIFIED='unspecified';
enum Imitigation: SERIALIZABLE='serializable' | PORTABLE_LEVEL='portable_level' | NONE='none' | UNSPECIFIED='unspecified';
enum Dmitigation: NO_LOSS='no_loss' | PARTIAL_LOSS_ALLOWED='partial_loss_allowed' | NONE='none' | UNSPECIFIED='unspecified';
/*
* Additional rule to refer UML elements in a Model
*/
FQN returns ecore::EString :
ID('::'ID)*
;
File added
/*------------------------------------------------------------------------------
-
- Copyright (c) 2013, 2015 Intecs SpA
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
-
- Stefano Puri stefano.puri@intecs.it
-
- Initial API and implementation and/or initial documentation
------------------------------------------------------------------------------*/
module org.polarsys.chess.xtext.GenerateFlaDsl
import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*
var grammarURI = "classpath:/org/polarsys/chess/xtext/FlaDsl.xtext"
var fileExtensions = "fladsl"
var projectName = "org.polarsys.chess.xtext.fladsl"
var runtimeProject = "../${projectName}"
var generateXtendStub = true
var encoding = "UTF-8"
Workflow {
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
//load EMF ECORE
uriMap = {
from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore"
to = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore"
}
uriMap = { from = "platform:/plugin/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
to = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel"
to = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
}
registerGeneratedEPackage = "org.eclipse.emf.ecore.EcorePackage"
registerGeneratedEPackage = "org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage"
registerGenModelFile = "platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
//load UML
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.types/model/Types.genmodel"
to = "platform:/resource/org.eclipse.uml2.types/model/Types.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel"
to = "platform:/resource/org.eclipse.uml2.uml/model/UML.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
to = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.codegen.ecore/model/GenModel.ecore"
to = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore"
to = "platform:/resource/org.eclipse.uml2.uml/model/UML.ecore"
}
uriMap = {
from = "platform:/plugin/org.eclipse.uml2.types/model/Types.ecore"
to = "platform:/resource/org.eclipse.uml2.types/model/Types.ecore"
}
registerGeneratedEPackage = "org.eclipse.uml2.types.TypesPackage"
registerGeneratedEPackage = "org.eclipse.uml2.uml.UMLPackage"
registerGeneratedEPackage = "org.eclipse.uml2.codegen.ecore.genmodel.GenModelPackage"
registerGenModelFile = "platform:/resource/org.eclipse.uml2.types/model/Types.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.uml2.uml/model/UML.genmodel"
registerGenModelFile = "platform:/resource/org.eclipse.uml2.codegen.ecore/model/GenModel.genmodel"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/model/generated"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.tests/src-gen"
}
component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
encoding = encoding
language = auto-inject {
uri = grammarURI
// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment auto-inject {}
// generates Java API for the generated EPackages
fragment = ecore.EMFGeneratorFragment auto-inject {}
// the old serialization component
// fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}
// serializer 2.0
fragment = serializer.SerializerFragment auto-inject {
generateStub = false
}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
// options = {
// backtrack = true
// }
}
// Xtend-based API for validation
fragment = validation.ValidatorFragment auto-inject {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// old scoping and exporting API
// fragment = scoping.ImportURIScopingFragment auto-inject {}
// fragment = exporting.SimpleNamesFragment auto-inject {}
// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
fragment = exporting.QualifiedNamesFragment auto-inject {}
fragment = builder.BuilderIntegrationFragment auto-inject {}
// generator API
fragment = generator.GeneratorFragment auto-inject {}
// formatter API
fragment = formatting.FormatterFragment auto-inject {}
// labeling API
fragment = labeling.LabelProviderFragment auto-inject {}
// outline API
fragment = outline.OutlineTreeProviderFragment auto-inject {}
fragment = outline.QuickOutlineFragment auto-inject {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment auto-inject {}
// content assist API
fragment = contentAssist.ContentAssistFragment auto-inject {}
// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {}
// generates junit test support classes into Generator#pathTestProject
fragment = junit.Junit4Fragment auto-inject {}
// rename refactoring
fragment = refactoring.RefactorElementNameFragment auto-inject {}
// provides the necessary bindings for java types integration
fragment = types.TypesGeneratorFragment auto-inject {}
// generates the required bindings only if the grammar inherits from Xbase
fragment = xbase.XbaseGeneratorFragment auto-inject {}
// generates the required bindings only if the grammar inherits from Xtype
fragment = xbase.XtypeGeneratorFragment auto-inject {}
// provides a preference page for template proposals
fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
// provides a compare view
fragment = compare.CompareFragment auto-inject {}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment