blob: 9b0ccdcf9338ac1e16d0b59d1011953ce13c08a5 [file] [log] [blame]
// automatically generated by Xtext
grammar org.eclipse.mylyn.docs.intent.parser.modelingunit.ModelingUnitXTextGrammar with org.eclipse.xtext.common.Terminals
import "platform:/resource/org.eclipse.mylyn.docs.intent.core/model/document.ecore" as document
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "platform:/resource/org.eclipse.mylyn.docs.intent.core/model/genericUnit.ecore" as genericUnit
import "platform:/resource/org.eclipse.mylyn.docs.intent.core/model/modelingUnit.ecore" as modelingUnit
// Entry rule : Beginning of a Modeling Unit.
ModelingUnit returns modelingUnit::ModelingUnit :
{modelingUnit::ModelingUnit}
// A Modeling Unit may have a name
(unitName = StringWithoutQuotes)?
(LINE_BREAK)?
// A Modeling may be attache to a resource
(resource = ResourceReference)?
// A Modeling Unit is composed of ModelingUnitInstruction or some insctructions avalaible in a Generic Unit.
(instructions+= (ModelingUnitInstruction |
LabelReferenceInstruction | AdressedAnnotation) )*;
/* ------------ TOKENS ------------ */
EBoolean returns ecore::EBoolean:
'true' | 'false';
terminal EInt returns ecore::EInt:
INT;
EString returns ecore::EString:
StringWithQuotes | StringWithoutQuotes;
// Represents a String without any quotes around.
terminal StringWithoutQuotes returns ecore::EString:
('a'..'z' | 'A'..'Z' | '0'..'9' | '.' | ':' | "_" | "-")+;
// Represents a String with quotes around.
StringWithQuotes returns ecore::EString:
STRING;
// Represents a standard URI.
terminal URI returns document::URI:
/* TODO: implement this rule and an appropriate IValueConverter */
'"' ( 'file:/' | 'platform:/' | 'cdo:/') ('a'..'z' | 'A'..'Z' | '0'..'9' | '.' | '/' | ':' | "_" | "-")+ '"';
// Represents a user's line jump
terminal LINE_BREAK returns ecore::EString:
"\n";
/* ------------ END TOKENS ------------ */
/* ------------ ENUM AND DATATYPES ------------ */
enum TypeLabel returns genericUnit::TypeLabel:
LAZY = '@lazylabel' | EXPLICIT = '@label';
enum AffectationOperator returns modelingUnit::AffectationOperator :
MULTI_VALUED_AFFECTATION = '+=' | SINGLE_VALUED_AFFECTATION = '=';
/* ------------ END ENUM AND DATATYPES ------------ */
/* ------------ GENERIC INSTRUCTIONS FROM GENERIC UNIT ------------ */
UnitInstruction returns genericUnit::UnitInstruction:
SectionReferenceInstruction | LabelReferenceInstruction | AdressedAnnotation;
LabelReferenceInstruction returns genericUnit::LabelReferenceInstruction:
'@see'
//COMMENT RENSEIGNER CE TYPE ?
type = TypeLabel
referencedLabel=LabelDeclarationReference
(lineBreak?= LINE_BREAK)?;
SectionReferenceInstruction returns genericUnit::IntentSectionReferenceInstruction:
'@see' referencedObject=SectionOrParagraphReference
(textToPrint=EString)?
(lineBreak?= LINE_BREAK)?;
AdressedAnnotation returns genericUnit::AdressedAnnotation:
(lineBreak?='lineBreak')?
'AdressedAnnotation'
'{'
'receiver' '{' receiver+=EString ( "," receiver+=EString)* '}'
'source' source=EString
'message' message=EString
'type' type=EString
'}';
SectionOrParagraphReference returns document::IntentSectionOrParagraphReference:
IntentHref=StringWithQuotes
/* ('referencedObject' referencedObject=[markup::StructureElement|EString])?
'}'*/;
UnitInstructionReference returns genericUnit::UnitInstructionReference:
'href' IntentHref=EString;
LabelDeclarationReference returns genericUnit::LabelDeclarationReference:
'href' IntentHref=EString
('referencedElement' referencedElement=[genericUnit::LabelDeclaration|EString])?
;
/* ------------ END GENERIC INSTRUCTIONS FROM GENERIC UNIT ------------ */
/* ------------ INSTRUCTIONS FROM MODELING UNIT ------------ */
ModelingUnitInstructionReference returns modelingUnit::ModelingUnitInstructionReference:
ModelingUnitInstructionReference_Impl ;
ModelingUnitInstruction returns modelingUnit::ModelingUnitInstruction:
InstanceLevelInstruction | ResourceDeclaration | ContributionInstruction | AnnotationDeclaration | SectionReferenceinModelingUnit | LabelinModelingUnit;
InstanceLevelInstruction returns modelingUnit::InstanceLevelInstruction:
InstanciationInstruction | StructuralFeatureAffectation;
ValueForStructuralFeature returns modelingUnit::ValueForStructuralFeature:
NativeValueForStructuralFeature | ReferenceValueForStructuralFeature | NewObjectValueForStructuralFeature;
ModelingUnitInstructionReference_Impl returns modelingUnit::ModelingUnitInstructionReference:
IntentHref=StringWithoutQuotes;
SectionReferenceinModelingUnit returns modelingUnit::IntentSectionReferenceinModelingUnit:
'@see' referencedObject=SectionOrParagraphReference
(textToPrint=EString)?
(lineBreak?= LINE_BREAK)?;
LabelinModelingUnit returns modelingUnit::LabelinModelingUnit:
type=TypeLabel labelValue=EString
(textToPrint=EString)?
(lineBreak?= LINE_BREAK)?;
AnnotationDeclaration returns modelingUnit::AnnotationDeclaration:
'@Annotation'
annotationID=StringWithoutQuotes
map+=KeyValForAnnotation ( "," map+=KeyValForAnnotation)*
(lineBreak ?= LINE_BREAK)?;
InstanciationInstruction returns modelingUnit::InstanciationInstruction:
'new' metaType=TypeReference
(name=StringWithoutQuotes)?
'{'
( structuralFeatures+= StructuralFeatureAffectation)*
'}'
(lineBreak ?= LINE_BREAK)?;
StructuralFeatureAffectation returns modelingUnit::StructuralFeatureAffectation:
//metaType=TypeReference
name=StringWithoutQuotes
(
usedOperator = AffectationOperator
( values += ValueForStructuralFeature
| '[' values+=ValueForStructuralFeature ( "," values+=ValueForStructuralFeature)* ']')
) ';'
(lineBreak ?= LINE_BREAK)?;
NativeValueForStructuralFeature returns modelingUnit::NativeValueForStructuralFeature:
value=StringWithQuotes
(lineBreak ?= LINE_BREAK)?;
NewObjectValueForStructuralFeature returns modelingUnit::NewObjectValueForStructuralFeature:
value=InstanciationInstruction;
ReferenceValueForStructuralFeature returns modelingUnit::ReferenceValueForStructuralFeature:
referencedElement=InstanciationInstructionReference;
ContributionInstruction returns modelingUnit::ContributionInstruction:
referencedElement = ModelingUnitInstructionReference
'{'
(contributions+=ModelingUnitInstruction)*
'}'
(lineBreak?=LINE_BREAK)?;
TypeReference returns modelingUnit::TypeReference:
{modelingUnit::TypeReference}
IntentHref = StringWithoutQuotes;
InstanciationInstructionReference returns modelingUnit::InstanciationInstructionReference:
{ modelingUnit::InstanciationInstructionReference}
IntentHref=StringWithoutQuotes;
KeyValForAnnotation returns modelingUnit::KeyValForAnnotation:
{modelingUnit::KeyValForAnnotation}
key=StringWithoutQuotes '='
value=EString;
ResourceReference returns modelingUnit::ResourceReference:
'[' IntentHref=EString ']'
(lineBreak?=LINE_BREAK)?;
ResourceDeclaration returns modelingUnit::ResourceDeclaration:
{modelingUnit::ResourceDeclaration}
'Resource' (name = StringWithoutQuotes)?
'{' (LINE_BREAK)?
('URI' '=' uri = URI ';' (LINE_BREAK)?)?
('contentType' '=' contentType=EString ';' (LINE_BREAK)?)?
('content' '+=' content+=ModelingUnitInstructionReference ';' (LINE_BREAK)?)*
'}'
(lineBreak?=LINE_BREAK)?;
/* ------------ END INSTRUCTIONS FROM MODELING UNIT ------------ */