From e5bfc46ccb459404aea46e0fe0659938295fdefa Mon Sep 17 00:00:00 2001 From: lsafina Date: Fri, 15 Sep 2023 13:19:02 +0200 Subject: [PATCH] adding BinaryExpression and UnaryExpression to the Core Fast Traits --- .../FASTTBinaryExpression.trait.st | 18 ++++++++++++++++++ .../FASTTUnaryExpression.trait.st | 18 ++++++++++++++++++ .../FASTMetamodelGenerator.class.st | 18 +++++++++++++++++- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/FAST-Core-Model/FASTTBinaryExpression.trait.st create mode 100644 src/FAST-Core-Model/FASTTUnaryExpression.trait.st diff --git a/src/FAST-Core-Model/FASTTBinaryExpression.trait.st b/src/FAST-Core-Model/FASTTBinaryExpression.trait.st new file mode 100644 index 0000000..bfb4dfe --- /dev/null +++ b/src/FAST-Core-Model/FASTTBinaryExpression.trait.st @@ -0,0 +1,18 @@ +" +A trait representing a binary expression of a node of a source code. +" +Trait { + #name : #FASTTBinaryExpression, + #traits : 'FASTTExpression', + #classTraits : 'FASTTExpression classTrait', + #category : #'FAST-Core-Model-Traits' +} + +{ #category : #meta } +FASTTBinaryExpression classSide >> annotation [ + + + + + ^ self +] diff --git a/src/FAST-Core-Model/FASTTUnaryExpression.trait.st b/src/FAST-Core-Model/FASTTUnaryExpression.trait.st new file mode 100644 index 0000000..4cc694a --- /dev/null +++ b/src/FAST-Core-Model/FASTTUnaryExpression.trait.st @@ -0,0 +1,18 @@ +" +A trait representing an unary expression of a node of a source code. +" +Trait { + #name : #FASTTUnaryExpression, + #traits : 'FASTTExpression', + #classTraits : 'FASTTExpression classTrait', + #category : #'FAST-Core-Model-Traits' +} + +{ #category : #meta } +FASTTUnaryExpression classSide >> annotation [ + + + + + ^ self +] diff --git a/src/FAST-Model-Generator/FASTMetamodelGenerator.class.st b/src/FAST-Model-Generator/FASTMetamodelGenerator.class.st index b6a1e90..6a7b92d 100644 --- a/src/FAST-Model-Generator/FASTMetamodelGenerator.class.st +++ b/src/FAST-Model-Generator/FASTMetamodelGenerator.class.st @@ -31,7 +31,9 @@ Class { 'tAssignment', 'tVariableEntity', 'tComment', - 'tWithComments' + 'tWithComments', + 'tBinaryExpression', + 'tUnaryExpression' ], #category : #'FAST-Model-Generator' } @@ -68,6 +70,11 @@ Has parameters , and a body (StatementBlock). Local variables are intended to be stored in the local entities of the body' ] +{ #category : #comments } +FASTMetamodelGenerator >> commentForTBinaryExpression [ + ^ 'A trait representing a binary expression of a node of a source code.' +] + { #category : #comments } FASTMetamodelGenerator >> commentForTBooleanLiteral [ ^ 'A boolean literal' @@ -163,6 +170,11 @@ FASTMetamodelGenerator >> commentForTStringLiteral [ ^ 'A string literal' ] +{ #category : #comments } +FASTMetamodelGenerator >> commentForTUnaryExpression [ + ^ 'A trait representing an unary expression of a node of a source code.' +] + { #category : #comments } FASTMetamodelGenerator >> commentForTVariableEntity [ ^ 'A node for variable name not in a expression (example: assigned variable or parameter)' @@ -193,6 +205,8 @@ FASTMetamodelGenerator >> defineHierarchy [ entity --|> tEntity. tLiteral --|> tExpression. + tBinaryExpression --|> tExpression. + tUnaryExpression --|> tExpression. tBooleanLiteral --|> tLiteral. tCharacterLiteral --|> tLiteral. @@ -278,6 +292,8 @@ FASTMetamodelGenerator >> defineTraits [ tEntity := builder newTraitNamed: #TEntity comment: 'any entity'. tNamedEntity := builder newTraitNamed: #TNamedEntity comment: 'A entity with a name'. tExpression := builder newTraitNamed: #TExpression comment: self commentForTExpression. + tBinaryExpression := builder newTraitNamed: #TBinaryExpression comment: self commentForTBinaryExpression. + tUnaryExpression := builder newTraitNamed: #TUnaryExpression comment: self commentForTUnaryExpression. tLiteral := builder newTraitNamed: #TLiteral comment: self commentForTLiteral. tBooleanLiteral := builder newTraitNamed: #TBooleanLiteral comment: self commentForTBooleanLiteral. tCharacterLiteral := builder newTraitNamed: #TCharacterLiteral comment: self commentForTCharacterLiteral.