blob: 3f629562116b0bbf484cb6c2ee6610e7b7d4a2d8 [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
grammar org.eclipse.osbp.dsl.common.xtext.CommonGrammar with org.eclipse.osbp.xtext.oxtype.OXtype
import "http://osbp.eclipse.org/dsl/common/types/v1" as types
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
TypedPackage returns types::LTypedPackage:
{types::LTypedPackage}
'package' name=QualifiedName ('{'
(types+=Type)*
'}')?;
Type returns types::LType:
ScalarType | Class;
/**
* Needs to be overridden by sub grammar
*/
Class returns types::LClass:
{types::LClass} annotations+=AnnotationDef*
{types::LClass.annotationInfo=current}
'class';
DataType returns types::LDataType:
'datatype' name=ValidIDWithKeywords
(('jvmType' jvmTypeReference=JvmTypeReference (asPrimitive?='asPrimitive')? constraints+=DataTypeConstraint* ('properties' '(' properties+=KeyAndValue (','
properties+=KeyAndValue)* ')')?)
|
(date?='dateType' dateType=DateType constraints+=DateConstraint* ('properties' '(' properties+=KeyAndValue (','
properties+=KeyAndValue)* ')')?)
|
(asBlob?='asBlob' constraints+=BlobTypeConstraint* ('properties' '(' properties+=KeyAndValue (','
properties+=KeyAndValue)* ')')?))
;
AllConstraints returns types::LDatatypeConstraint:
DtCAssertFalse | DtCAssertTrue | DtCDecimalMax | DtCDecimalMin | DtCDigits |
DtCNumericMax | DtCNumericMin | DtCNotNull | DtCNull | DtCRegEx | DtCSize | DtCFuture | DtCPast
;
DataTypeConstraint returns types::LDatatypeConstraint:
DtCAssertFalse | DtCAssertTrue | DtCDecimalMax | DtCDecimalMin | DtCDigits |
DtCNumericMax | DtCNumericMin | DtCNotNull | DtCNull | DtCRegEx | DtCSize
;
DateConstraint returns types::LDatatypeConstraint:
DtCFuture | DtCPast | DtCNotNull | DtCNull
;
BlobTypeConstraint returns types::LDatatypeConstraint:
DtCNotNull | DtCNull
;
enum ConstraintSeverity returns types::LConstraintSeverity:
INFO = "info" | WARNING ="warn" | ERROR = "error"
;
DtCAssertFalse returns types::LDtCAssertFalse:
{types::LDtCAssertFalse}
'isFalse' ('['(('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?;
DtCAssertTrue returns types::LDtCAssertTrue:
{types::LDtCAssertTrue}
'isTrue' ('['(('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?;
DtCDecimalMax returns types::LDtCDecimalMax:
{types::LDtCDecimalMax}
'maxDecimal' '('max=LDecimal ('[' (('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?')';
DtCDecimalMin returns types::LDtCDecimalMin:
{types::LDtCDecimalMin}
'minDecimal' '('min=LDecimal ('[' (('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?')';
DtCDigits returns types::LDtCDigits:
{types::LDtCDigits}
'digits' '(' intDigits=INT ',' fractionDigits=INT ('[' (('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?')';
DtCFuture returns types::LDtCFuture:
{types::LDtCFuture}
'isFuture' ('['(('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?;
DtCPast returns types::LDtCPast:
{types::LDtCPast}
'isPast' ('['(('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?;
DtCNumericMax returns types::LDtCNumericMax:
{types::LDtCNumericMax}
'maxNumber' '(' max=LInt ('[' (('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?')';
DtCNumericMin returns types::LDtCNumericMin:
{types::LDtCNumericMin}
'minNumber' '(' min=LInt ('[' (('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?')';
DtCNotNull returns types::LDtCNotNull:
{types::LDtCNotNull}
'isNotNull' ('['(('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?;
DtCNull returns types::LDtCNull:
{types::LDtCNull}
'isNull' ('['(('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?;
DtCRegEx returns types::LDtCRegEx:
{types::LDtCRegEx}
'regex' '(' pattern=STRING ('[' (('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?')';
DtCSize returns types::LDtCSize:
{types::LDtCSize}
'minMaxSize' '('min=INT ',' max=INT ('[' (('msgCode' '=' msgCode=QualifiedName)? & ('msgI18nKey' '=' msgI18nKey=QualifiedName)? &('severity' '=' severity=ConstraintSeverity)?) ']')?')';
enum DateType returns types::LDateType:
DATE='date' | TIME='time' | TIMESTAMP='timestamp';
ScalarType returns types::LScalarType:
DataType | Enum;
Modifier returns types::LModifier:
final?='final'? & static?='static'? & visibility=LVisibility;
Enum returns types::LEnum:
'enum' name=ID
'{'
literals+=EnumLiteral (',' literals+=EnumLiteral)*
'}';
EnumLiteral returns types::LEnumLiteral:
name=TRANSLATABLEID ((default?='asDefault')? & (null?='forNull')?) ('=' (value=INT|stringValue=STRING))?;
AnnotationDef returns types::LAnnotationDef:
=> (annotation=XAnnotation);
enum LVisibility returns types::LVisibility:
PACKAGE='package' | PRIVATE='private' | PROTECTED='protected' | PUBLIC='public';
ResultFilters returns types::LResultFilters:
{types::LResultFilters}
'filter' '{'
resultFilters+=ResultFilter*
'}';
ResultFilter returns types::LResultFilter:
AttributeMatchingConstraint;
AttributeMatchingConstraint returns types::LAttributeMatchingConstraint:
attribute=[types::LAttribute] comparatorType=LComparatorType (matchingValue=STRING | =>
matchingLiteral=[types::LEnumLiteral]) ;
KeyAndValue returns types::LKeyAndValue:
'key' '=' key=STRING 'value' '=' value=STRING;
enum LComparatorType returns types::LComparatorType:
EQUALS='==' |
GREATER='>' |
LOWER='<' |
GREATER_EQ='>=' |
LOWER_EQ='<=' |
NOT_EQ='<>';
LQualifiedNameWithWildCard:
QualifiedName ('.' '*')?;
LFQN:
ID ('.' ID)*;
TYPE_CROSS_REFERENCE:
ID;
ValidIDWithKeywords:
'cachable' | 'id' | 'uuid' | 'transient' | 'version' | 'derived' |
'collection' | 'refers' | 'settings' | 'lazy' |
'notnull' | 'dto' | 'date' | 'mapto' | 'ref' | 'cascadeMergePersist' | 'cascadeRemove'| 'var' |
ID;
ValidLFQNWithKeywords:
ValidIDWithKeywords ('.' ValidIDWithKeywords)*;
Multiplicity returns types::LMultiplicity:
'[' (lower=LowerBound) ('..' upper=UpperBound)? ']';
enum LowerBound returns types::LLowerBound:
MANY='*' | ZERO='0' | OPTIONAL='?' | ATLEASTONE='+' | ONE='1';
enum UpperBound returns types::LUpperBound:
MANY='*' | ONE='1';
LInt returns ecore::EInt:
('+'|'-')? INT;
LDecimal returns ecore::EFloat:
LInt ('.' INT)?
;
TRANSLATABLEID:
ID;