Skip to content
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
22 changes: 11 additions & 11 deletions src/AST-Core-Tests/RBErrorNodeParserTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ RBErrorNodeParserTest >> testFaultyAssigment [

self assert: node isFaulty.
self assert: node isParseError.
self deny: node content first isFaulty.
self assert: node content first value equals: 1.
self deny: node contents first isFaulty.
self assert: node contents first value equals: 1.
self assert: node sourceInterval equals: (1 to: 3).
self assert: node errorMessage equals: 'identifier expected in assigment'.
self assert: node formattedCode equals: ':= 1'
Expand Down Expand Up @@ -375,17 +375,17 @@ RBErrorNodeParserTest >> testFaultyLiterabByteArray [
self assert: node isFaulty.
self assert: node isLiteralByteArrayError.

self deny: node content first isFaulty.
self assert: node content first value equals: 1.
self deny: node contents first isFaulty.
self assert: node contents first value equals: 1.

self assert: node content second isFaulty.
self assert: node content second value equals: 'hello'.
self assert: node content second sourceInterval equals: (6 to: 10).
self assert: node content second errorMessage equals: 'Expecting 8-bit integer'.
self assert: node content second formattedCode equals: 'hello'.
self assert: node contents second isFaulty.
self assert: node contents second value equals: 'hello'.
self assert: node contents second sourceInterval equals: (6 to: 10).
self assert: node contents second errorMessage equals: 'Expecting 8-bit integer'.
self assert: node contents second formattedCode equals: 'hello'.

self deny: node content third isFaulty.
self assert: node content third value equals: 3.
self deny: node contents third isFaulty.
self assert: node contents third value equals: 3.

self assert: node sourceInterval equals: (1 to: 13).
self assert: node formattedCode equals: source
Expand Down
6 changes: 3 additions & 3 deletions src/AST-Core/RBArrayErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ RBArrayErrorNode class >> error: aToken withNodes: aCollection [
ifFalse: [ '''{'' expected' ].
"If the collection is empty, there is only the token in the error."
aCollection isEmpty
ifTrue: [ ^self new content: aCollection; start: aToken start; stop: aToken stop; errorMessage: message ].
ifTrue: [ ^self new contents: aCollection; start: aToken start; stop: aToken stop; errorMessage: message ].
"If the collection is not empty, we have to sort where the node begins and where it ends."
^message = '''}'' expected'
ifTrue: [ self new content: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: message ]
ifFalse: [ self new content: aCollection; start: aCollection first start; stop: aToken stop; errorMessage: message ]
ifTrue: [ self new contents: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: message ]
ifFalse: [ self new contents: aCollection; start: aCollection first start; stop: aToken stop; errorMessage: message ]
]

{ #category : #testing }
Expand Down
6 changes: 3 additions & 3 deletions src/AST-Core/RBBlockErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ RBBlockErrorNode class >> error: aToken withNodes: aCollection [
ifFalse: [ '''['' expected' ].
"If the collection is empty, there is only the token in the error."
aCollection isEmpty
ifTrue: [ ^self new content: aCollection; start: aToken start; stop: aToken stop; errorMessage: message ].
ifTrue: [ ^self new contents: aCollection; start: aToken start; stop: aToken stop; errorMessage: message ].
"If the collection is not empty, we have to sort where the node begins and where it ends."
^message = ''']'' expected'
ifTrue: [ self new content: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: message ]
ifFalse: [ self new content: aCollection; start: aCollection first start; stop: aToken stop; errorMessage: message ]
ifTrue: [ self new contents: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: message ]
ifFalse: [ self new contents: aCollection; start: aCollection first start; stop: aToken stop; errorMessage: message ]
]

{ #category : #testing }
Expand Down
4 changes: 2 additions & 2 deletions src/AST-Core/RBDumpVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ RBDumpVisitor >> visitEnglobingErrorNode: anEnglobingErrorNode [
stream
nextPutAll: '(';
nextPutAll: anEnglobingErrorNode class name;
nextPutAll: ' content: {'.
anEnglobingErrorNode content
nextPutAll: ' contents: {'.
anEnglobingErrorNode contents
do: [ :each |
each acceptVisitor: self.
stream nextPutAll: '. ' ].
Expand Down
25 changes: 13 additions & 12 deletions src/AST-Core/RBEnglobingErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Class {
#name : #RBEnglobingErrorNode,
#superclass : #RBParseErrorNode,
#instVars : [
'content',
'valueAfter'
'valueAfter',
'contents'
],
#category : #'AST-Core-Nodes - ErrorNodes'
}

{ #category : #'instance creation' }
RBEnglobingErrorNode class >> content: aCollection start: aStart stop: aStop errorMessage: message [
RBEnglobingErrorNode class >> contents: aCollection start: aStart stop: aStop errorMessage: message [
^self new
content: aCollection;
contents: aCollection;
start: aStart;
stop: aStop;
errorMessage: message
Expand All @@ -50,7 +50,7 @@ RBEnglobingErrorNode class >> error: aToken withNodes: aCollection [
ifTrue: [ ^RBTemporariesErrorNode error: aToken withNodes: aCollection ].
('<' = aToken value asString)
ifTrue: [ ^RBPragmaErrorNode error: aToken withNodes: aCollection ].
^self new content: aCollection; start: aCollection first start; stop: aToken stop; errorMessage: 'complementary of''',aToken value,''' expected'
^self new contents: aCollection; start: aCollection first start; stop: aToken stop; errorMessage: 'complementary of''',aToken value,''' expected'
]

{ #category : #visiting }
Expand All @@ -61,26 +61,27 @@ RBEnglobingErrorNode >> acceptVisitor: aVisitor [

{ #category : #accessing }
RBEnglobingErrorNode >> children [
^ content
^ contents
]

{ #category : #accessing }
RBEnglobingErrorNode >> content [
^content
RBEnglobingErrorNode >> contents [
^contents
]

{ #category : #accessing }
RBEnglobingErrorNode >> content: aCollection [
content := aCollection.
RBEnglobingErrorNode >> contents: aCollection [
contents := aCollection.
aCollection do: [:each | each parent: self ]
]

{ #category : #initialization }
RBEnglobingErrorNode >> initialize [

super initialize.
content := OrderedCollection new.
contents := OrderedCollection new.
value := ''.
valueAfter := ''.
valueAfter := ''
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/AST-Core/RBInvalidCascadeErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ RBInvalidCascadeErrorNode >> isCascadeError [

{ #category : #accessing }
RBInvalidCascadeErrorNode >> receiver [
^ content first
^ contents first
]
4 changes: 2 additions & 2 deletions src/AST-Core/RBLiteralArrayErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ RBLiteralArrayErrorNode class >> error: aToken withNodes: aCollection [
This could be change by an analysis of prior nodes."
"If the collection is empty, there is only the token in the error."
^aCollection isEmpty
ifTrue: [ self new content: aCollection; start: aToken start; stop: aToken stop; errorMessage: ''')'' expected' ]
ifFalse: [ self new content: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: ''')'' expected' ]
ifTrue: [ self new contents: aCollection; start: aToken start; stop: aToken stop; errorMessage: ''')'' expected' ]
ifFalse: [ self new contents: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: ''')'' expected' ]
]

{ #category : #testing }
Expand Down
4 changes: 2 additions & 2 deletions src/AST-Core/RBLiteralByteArrayErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ RBLiteralByteArrayErrorNode class >> error: aToken withNodes: aCollection [
This could be change by an analysis of prior nodes."
"If the collection is empty, there is only the token in the error."
^aCollection isEmpty
ifTrue: [ self new content: aCollection; start: aToken start; stop: aToken stop; errorMessage: ''']'' expected' ]
ifFalse: [ self new content: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: ''']'' expected' ]
ifTrue: [ self new contents: aCollection; start: aToken start; stop: aToken stop; errorMessage: ''']'' expected' ]
ifFalse: [ self new contents: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: ''']'' expected' ]
]

{ #category : #testing }
Expand Down
6 changes: 3 additions & 3 deletions src/AST-Core/RBParenthesesErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ RBParenthesesErrorNode class >> error: aToken withNodes: aCollection [
ifFalse: [ '''('' expected' ].
"If the collection is empty, there is only the token in the error."
aCollection isEmpty
ifTrue: [ ^self new content: aCollection; start: aToken start; stop: aToken stop; errorMessage: message ].
ifTrue: [ ^self new contents: aCollection; start: aToken start; stop: aToken stop; errorMessage: message ].
"If the collection is not empty, we have to sort where the node begins and where it ends."
^message = ''')'' expected'
ifTrue: [ self new content: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: message ]
ifFalse: [ self new content: aCollection; start: aCollection first start; stop: aToken stop; errorMessage: message ]
ifTrue: [ self new contents: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: message ]
ifFalse: [ self new contents: aCollection; start: aCollection first start; stop: aToken stop; errorMessage: message ]
]

{ #category : #testing }
Expand Down
14 changes: 7 additions & 7 deletions src/AST-Core/RBParser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ RBParser >> parseAssignment [
position := currentToken start.
self step. "Consume the :="
node := self parseAssignment. "parse the right side".
node := RBAssignmentErrorNode content: { node } start: position stop: node stop errorMessage: 'identifier expected in assigment'.
node := RBAssignmentErrorNode contents: { node } start: position stop: node stop errorMessage: 'identifier expected in assigment'.
node value: ':='.
^ node
].
Expand Down Expand Up @@ -482,7 +482,7 @@ RBParser >> parseCascadeMessage [
Note that this bad cascade node will be added to the list of messages."
self parserError: 'cascaded message not allowed'.
node := RBInvalidCascadeErrorNode
content: { node }
contents: { node }
start: node start
stop: currentToken stop
errorMessage: 'Message expected'.
Expand Down Expand Up @@ -545,9 +545,9 @@ RBParser >> parseDoIt [
RBParser >> parseEnglobingError: aCollection with: aToken errorMessage: anErrorMessage [
| firstParse |
firstParse := self parserError: anErrorMessage.
^[firstParse isParseError
^firstParse isParseError
ifTrue: [ (self englobingErrorNodeClass error: aToken withNodes: aCollection) value: aToken value asString ]
ifFalse: [ firstParse ]] on: Error do: [ firstParse ]
ifFalse: [ firstParse ]
]

{ #category : #'error handling' }
Expand Down Expand Up @@ -1009,7 +1009,7 @@ RBParser >> parseStatementInto: statementList periodList: periods withAcceptedSt
whileTrue: [
self parserError: 'Missing opener for closer: ', currentToken value asString.
node := RBUnfinishedStatementErrorNode
content: { node }
contents: { node }
start: node start
stop: currentToken stop
errorMessage: 'Missing opener for closer: ', currentToken value asString.
Expand All @@ -1026,7 +1026,7 @@ RBParser >> parseStatementInto: statementList periodList: periods withAcceptedSt
and: [ currentToken isEOF not ] ] ) ifTrue: [
self parserError: 'End of statement expected'.
node := RBUnfinishedStatementErrorNode
content: { node }
contents: { node }
start: node start
stop: node stop
errorMessage: 'End of statement expected'
Expand All @@ -1048,7 +1048,7 @@ RBParser >> parseStatementInto: statementList periodList: periods withAcceptedSt
(statementList notEmpty and: [ statementList last isReturn ]) ifTrue: [
self parserError: 'Unreachable code'.
node := RBUnreachableStatementErrorNode
content: { node }
contents: { node }
start: node start
stop: node stop
errorMessage: 'Unreachable code' ].
Expand Down
4 changes: 2 additions & 2 deletions src/AST-Core/RBPragmaErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ RBPragmaErrorNode class >> error: aToken withNodes: aCollection [
Since the closure is a superior sign, the default assumption is that it's a binary selector."
"If the collection is empty, there is only the token in the error."
^aCollection isEmpty
ifTrue: [ self new content: aCollection; start: aToken start; stop: aToken stop; errorMessage: '''>'' expected' ]
ifFalse: [ self new content: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: '''>'' expected' ]
ifTrue: [ self new contents: aCollection; start: aToken start; stop: aToken stop; errorMessage: '''>'' expected' ]
ifFalse: [ self new contents: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: '''>'' expected' ]
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/AST-Core/RBProgramNodeVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ RBProgramNodeVisitor >> visitClassVariableNode: aNode [

{ #category : #visiting }
RBProgramNodeVisitor >> visitEnglobingErrorNode: anEnglobingErrorNode [
anEnglobingErrorNode content do: [ :each | self visitNode: each ]
anEnglobingErrorNode contents do: [ :each | self visitNode: each ]
]

{ #category : #visiting }
Expand Down
4 changes: 2 additions & 2 deletions src/AST-Core/RBTemporariesErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ RBTemporariesErrorNode class >> error: aToken withNodes: aCollection [
Since the closure is a |, the default assumption is that it's a binary selector."
"If the collection is empty, there is only the token in the error."
^aCollection isEmpty
ifTrue: [ self new content: aCollection; start: aToken start; stop: aToken stop; errorMessage: '''|'' expected' ]
ifFalse: [ self new content: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: '''|'' expected' ]
ifTrue: [ self new contents: aCollection; start: aToken start; stop: aToken stop; errorMessage: '''|'' expected' ]
ifFalse: [ self new contents: aCollection; start: aToken start; stop: aCollection last stop; errorMessage: '''|'' expected' ]
]

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/AST-Core/RBUnfinishedStatementErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ RBUnfinishedStatementErrorNode >> isUnfinishedStatement [
{ #category : #accessing }
RBUnfinishedStatementErrorNode >> statement [

^ content first
^ contents first
]
2 changes: 1 addition & 1 deletion src/Reflectivity-Tools/ErrorNodeStyler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ErrorNodeStyler >> visitEnglobingErrorNode: anEnglobingNode [
r borderColor: self borderColor ].
textModel announce: conf.

anEnglobingNode content do: [ :each | self visitNode: each ]
anEnglobingNode contents do: [ :each | self visitNode: each ]
]

{ #category : #visiting }
Expand Down
2 changes: 1 addition & 1 deletion src/Reflectivity-Tools/IconStyler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ IconStyler >> visitCascadeNode: aCascadeNode [
{ #category : #visiting }
IconStyler >> visitEnglobingErrorNode: anEnglobingNode [
self addIconStyle: anEnglobingNode.
anEnglobingNode content do: [ :each | self visitNode: each ]
anEnglobingNode contents do: [ :each | self visitNode: each ]
]

{ #category : #visiting }
Expand Down
2 changes: 1 addition & 1 deletion src/Shout/SHRBTextStyler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ SHRBTextStyler >> visitCascadeNode: aCascadeNode [
SHRBTextStyler >> visitEnglobingErrorNode: anEnglobingErrorNode [

self addStyle: #invalid from: anEnglobingErrorNode stop to: anEnglobingErrorNode stop + 1.
anEnglobingErrorNode content do: [:each | self visitNode: each ]
anEnglobingErrorNode contents do: [:each | self visitNode: each ]
]

{ #category : #visiting }
Expand Down