Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding BinaryExpression and UnaryExpression to the Core Fast Traits #25

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/FAST-Core-Model/FASTTBinaryExpression.trait.st
Original file line number Diff line number Diff line change
@@ -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 [

<FMClass: #TBinaryExpression super: #Object>
<package: #'FAST-Core-Model'>
<generated>
^ self
]
18 changes: 18 additions & 0 deletions src/FAST-Core-Model/FASTTUnaryExpression.trait.st
Original file line number Diff line number Diff line change
@@ -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 [

<FMClass: #TUnaryExpression super: #Object>
<package: #'FAST-Core-Model'>
<generated>
^ self
]
18 changes: 17 additions & 1 deletion src/FAST-Model-Generator/FASTMetamodelGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ Class {
'tAssignment',
'tVariableEntity',
'tComment',
'tWithComments'
'tWithComments',
'tBinaryExpression',
'tUnaryExpression'
],
#category : #'FAST-Model-Generator'
}
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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)'
Expand Down Expand Up @@ -193,6 +205,8 @@ FASTMetamodelGenerator >> defineHierarchy [
entity --|> tEntity.

tLiteral --|> tExpression.
tBinaryExpression --|> tExpression.
tUnaryExpression --|> tExpression.

tBooleanLiteral --|> tLiteral.
tCharacterLiteral --|> tLiteral.
Expand Down Expand Up @@ -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.
Expand Down