Skip to content

Commit

Permalink
Merge pull request #69 from moosetechnology/52-TBinaryExpression-shou…
Browse files Browse the repository at this point in the history
…ld-have-an-operator--leftOperand--rightOperand-

issue-52: TBinaryExpression should have an operator,  left operand, right operand
  • Loading branch information
NicolasAnquetil authored Mar 12, 2024
2 parents 3da5f10 + 1440247 commit 9602896
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 20 deletions.
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTAssignment.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ A node representing an assignment
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
### Children
Expand Down
76 changes: 76 additions & 0 deletions src/FAST-Core-Model/FASTTBinaryExpression.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,35 @@ A trait representing a binary expression of a node of a source code.
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
### Children
| Relation | Origin | Opposite | Type | Comment |
|---|
| `left` | `FASTTBinaryExpression` | `parentExpressionLeft` | `FASTTExpression` | left part of a binary expression|
| `right` | `FASTTBinaryExpression` | `parentExpressionRight` | `FASTTExpression` | left part of the expression|
## Properties
======================
| Name | Type | Default value | Comment |
|---|
| `endPos` | `Number` | nil | |
| `operator` | `String` | nil | Binary expression operator|
| `startPos` | `Number` | nil | |
"
Trait {
#name : #FASTTBinaryExpression,
#instVars : [
'#left => FMOne type: #FASTTExpression opposite: #parentExpressionLeft',
'#operator => FMProperty',
'#right => FMOne type: #FASTTExpression opposite: #parentExpressionRight'
],
#traits : 'FASTTExpression',
#classTraits : 'FASTTExpression classTrait',
#category : #'FAST-Core-Model-Traits'
Expand All @@ -37,3 +52,64 @@ FASTTBinaryExpression classSide >> annotation [
<generated>
^ self
]

{ #category : #accessing }
FASTTBinaryExpression >> left [
"Relation named: #left type: #FASTTExpression opposite: #parentExpressionLeft"

<generated>
<FMComment: 'left part of a binary expression'>
^ left
]

{ #category : #accessing }
FASTTBinaryExpression >> left: anObject [

<generated>
left := anObject
]

{ #category : #navigation }
FASTTBinaryExpression >> leftGroup [
<generated>
<navigation: 'Left'>
^ MooseSpecializedGroup with: self left
]

{ #category : #accessing }
FASTTBinaryExpression >> operator [

<FMProperty: #operator type: #String>
<generated>
<FMComment: 'Binary expression operator'>
^ operator
]

{ #category : #accessing }
FASTTBinaryExpression >> operator: anObject [
<generated>
operator := anObject
]

{ #category : #accessing }
FASTTBinaryExpression >> right [
"Relation named: #right type: #FASTTExpression opposite: #parentExpressionRight"

<generated>
<FMComment: 'left part of the expression'>
^ right
]

{ #category : #accessing }
FASTTBinaryExpression >> right: anObject [

<generated>
right := anObject
]

{ #category : #navigation }
FASTTBinaryExpression >> rightGroup [
<generated>
<navigation: 'Right'>
^ MooseSpecializedGroup with: self right
]
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTBooleanLiteral.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ A boolean literal
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
Expand Down
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTCharacterLiteral.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ A character literal
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
Expand Down
81 changes: 81 additions & 0 deletions src/FAST-Core-Model/FASTTExpression.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ An abstract superclass representing an expression node of a source code.
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
Expand All @@ -28,6 +31,9 @@ Trait {
'#argumentOwner => FMOne type: #FASTTWithArguments opposite: #arguments',
'#assignedIn => FMOne type: #FASTTAssignment opposite: #expression',
'#expressionStatementOwner => FMOne type: #FASTTExpressionStatement opposite: #expression',
'#parentExpression => FMOne type: #FASTTUnaryExpression opposite: #expression',
'#parentExpressionLeft => FMOne type: #FASTTBinaryExpression opposite: #left',
'#parentExpressionRight => FMOne type: #FASTTBinaryExpression opposite: #right',
'#returnOwner => FMOne type: #FASTTReturnStatement opposite: #expression'
],
#traits : 'FASTTEntity',
Expand Down Expand Up @@ -118,6 +124,81 @@ FASTTExpression >> expressionStatementOwnerGroup [
^ MooseSpecializedGroup with: self expressionStatementOwner
]

{ #category : #accessing }
FASTTExpression >> parentExpression [
"Relation named: #parentExpression type: #FASTTUnaryExpression opposite: #expression"

<generated>
<FMComment: 'Parent (unary) expression'>
<container>
<derived>
^ parentExpression
]

{ #category : #accessing }
FASTTExpression >> parentExpression: anObject [

<generated>
parentExpression := anObject
]

{ #category : #navigation }
FASTTExpression >> parentExpressionGroup [
<generated>
<navigation: 'ParentExpression'>
^ MooseSpecializedGroup with: self parentExpression
]

{ #category : #accessing }
FASTTExpression >> parentExpressionLeft [
"Relation named: #parentExpressionLeft type: #FASTTBinaryExpression opposite: #left"

<generated>
<FMComment: 'Parent (binary) expression of which I am left side'>
<container>
<derived>
^ parentExpressionLeft
]

{ #category : #accessing }
FASTTExpression >> parentExpressionLeft: anObject [

<generated>
parentExpressionLeft := anObject
]

{ #category : #navigation }
FASTTExpression >> parentExpressionLeftGroup [
<generated>
<navigation: 'ParentExpressionLeft'>
^ MooseSpecializedGroup with: self parentExpressionLeft
]

{ #category : #accessing }
FASTTExpression >> parentExpressionRight [
"Relation named: #parentExpressionRight type: #FASTTBinaryExpression opposite: #right"

<generated>
<FMComment: 'Parent (binary) expression of which I am right side'>
<container>
<derived>
^ parentExpressionRight
]

{ #category : #accessing }
FASTTExpression >> parentExpressionRight: anObject [

<generated>
parentExpressionRight := anObject
]

{ #category : #navigation }
FASTTExpression >> parentExpressionRightGroup [
<generated>
<navigation: 'ParentExpressionRight'>
^ MooseSpecializedGroup with: self parentExpressionRight
]

{ #category : #accessing }
FASTTExpression >> returnOwner [
"Relation named: #returnOwner type: #FASTTReturnStatement opposite: #expression"
Expand Down
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTInvocation.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ A invocation of a behavioural entity
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
### Children
Expand Down
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTLiteral.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ FLAG: should refactor some literals to core-model
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
Expand Down
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTNullPointerLiteral.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ An undefined object literal
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
Expand Down
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTNumericalLiteral.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ A numerical literal
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
Expand Down
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTStringLiteral.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ A string literal
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
Expand Down
51 changes: 51 additions & 0 deletions src/FAST-Core-Model/FASTTUnaryExpression.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,33 @@ A trait representing an unary expression of a node of a source code.
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
### Children
| Relation | Origin | Opposite | Type | Comment |
|---|
| `expression` | `FASTTUnaryExpression` | `parentExpression` | `FASTTExpression` | (sub-)expression in the unary expression|
## Properties
======================
| Name | Type | Default value | Comment |
|---|
| `endPos` | `Number` | nil | |
| `operator` | `String` | nil | Unary expression operator|
| `startPos` | `Number` | nil | |
"
Trait {
#name : #FASTTUnaryExpression,
#instVars : [
'#expression => FMOne type: #FASTTExpression opposite: #parentExpression',
'#operator => FMProperty'
],
#traits : 'FASTTExpression',
#classTraits : 'FASTTExpression classTrait',
#category : #'FAST-Core-Model-Traits'
Expand All @@ -37,3 +50,41 @@ FASTTUnaryExpression classSide >> annotation [
<generated>
^ self
]

{ #category : #accessing }
FASTTUnaryExpression >> expression [
"Relation named: #expression type: #FASTTExpression opposite: #parentExpression"

<generated>
<FMComment: '(sub-)expression in the unary expression'>
^ expression
]

{ #category : #accessing }
FASTTUnaryExpression >> expression: anObject [

<generated>
expression := anObject
]

{ #category : #navigation }
FASTTUnaryExpression >> expressionGroup [
<generated>
<navigation: 'Expression'>
^ MooseSpecializedGroup with: self expression
]

{ #category : #accessing }
FASTTUnaryExpression >> operator [

<FMProperty: #operator type: #String>
<generated>
<FMComment: 'Unary expression operator'>
^ operator
]

{ #category : #accessing }
FASTTUnaryExpression >> operator: anObject [
<generated>
operator := anObject
]
3 changes: 3 additions & 0 deletions src/FAST-Core-Model/FASTTVariableExpression.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ A node that wraps around structural entity
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `invokedIn` | `FASTTNamedEntity` | `invoked` | `FASTTInvocation` | Optional invocation where this name is used|
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
| `parentExpressionLeft` | `FASTTExpression` | `left` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
| `parentExpressionRight` | `FASTTExpression` | `right` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
Expand Down
Loading

0 comments on commit 9602896

Please sign in to comment.