-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from hpi-swa-teaching/fix/weak-smalltalk-parse…
…r-rebased Fixed WeakSmalltalkParser and reenabled the disables tests for it
- Loading branch information
Showing
13 changed files
with
60 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...ge/WeakSmalltalkParserTest.class/instance/testUnkownLowercaseKeywordIsInstanceVariable.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
tests | ||
testUnkownLowercaseKeywordIsInstanceVariable | ||
|
||
"Temporarily disabled until we understand what this test actually asserts" | ||
"| source parsedRanges | | ||
| source parsedRanges | | ||
source := 'someMethodName: someArgument', Character cr, 'someInstanceVariable'. | ||
parsedRanges := self rangesForSource: source. | ||
self assert: #instVar equals: parsedRanges last type. | ||
self assert: 30 equals: parsedRanges last start. | ||
self assert: 49 equals: parsedRanges last end" | ||
self assert: 49 equals: parsedRanges last end |
5 changes: 2 additions & 3 deletions
5
...kage/WeakSmalltalkParserTest.class/instance/testUnkownUppercaseKeywordIsGlobalVariable.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
tests | ||
testUnkownUppercaseKeywordIsGlobalVariable | ||
|
||
"Temporarily disabled until we understand what this test actually asserts" | ||
"| source parsedRanges | | ||
| source parsedRanges | | ||
source := 'someMethodName: someArgument', Character cr, 'SomeGlobalVariable'. | ||
parsedRanges := self rangesForSource: source. | ||
self assert: #globalVar equals: parsedRanges last type. | ||
self assert: 30 equals: parsedRanges last start. | ||
self assert: 47 equals: parsedRanges last end" | ||
self assert: 47 equals: parsedRanges last end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...es/MarkdownEditor-Utilities.package/WeakSmalltalkParser.class/instance/parseIdentifier.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
as yet unclassified | ||
parseIdentifier | ||
"currentToken is either a name of an existing variable, a prefix of a variable or an undefined identifier. Return the appropriate range type for it." | ||
|
||
currentToken = #self ifTrue: [ ^#self ]. | ||
currentToken = #true ifTrue: [ ^#true ]. | ||
currentToken = #false ifTrue: [ ^#false ]. | ||
currentToken = #nil ifTrue: [ ^#nil ]. | ||
currentToken = #super ifTrue: [ ^#super ]. | ||
currentToken = #thisContext ifTrue: [ ^#thisContext ]. | ||
|
||
arguments size to: 1 by: -1 do: [ :level | | ||
(arguments at: level) ifNotNil: [ :levelArguments | | ||
(levelArguments includes: currentToken) ifTrue: [ | ||
^level = 1 | ||
ifTrue: [ #methodArg ] | ||
ifFalse: [ #blockArg ] ] ]. | ||
(temporaries at: level) ifNotNil: [ :levelTemporaries | | ||
(levelTemporaries includes: currentToken) ifTrue: [ | ||
^level = 1 | ||
ifTrue: [ #tempVar ] | ||
ifFalse: [ #blockTempVar ] ] ] ]. | ||
|
||
(instanceVariables includes: currentToken) ifTrue: [^#instVar]. | ||
|
||
workspace | ||
ifNotNil: [(workspace hasBindingOf: currentToken) ifTrue: [^#workspaceVar]]. | ||
|
||
(Symbol lookup: currentToken) ifNotNil: [:sym | | ||
classOrMetaClass | ||
ifNotNil: [ | ||
classOrMetaClass theNonMetaClass withAllSuperclassesDo: [:c | | ||
(c classPool bindingOf: sym) ifNotNil: [^#classVar]. | ||
c sharedPools do: [:p | (p bindingOf: sym) ifNotNil: [^#poolConstant]]. | ||
(c environment bindingOf: sym) ifNotNil: [^#globalVar]]] | ||
ifNil: [(environment bindingOf: sym) ifNotNil: [^#globalVar]]]. | ||
|
||
^ currentToken first isUppercase "Very prone to mistakes, but less chatty" | ||
ifTrue: [#globalVar] | ||
ifFalse: [#instVar] |
3 changes: 2 additions & 1 deletion
3
packages/MarkdownEditor-Utilities.package/WeakSmalltalkParser.class/instance/parseKeyword.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/MarkdownEditor-Utilities.package/WeakSmalltalkParser.class/instance/parseUnary.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
parse | ||
parseUnary | ||
[ self currentTokenType == #name ] whileTrue: [ | ||
|
||
[ self currentTokenType == #name ] whileTrue: [ | ||
self scanPast: #unary] |
16 changes: 0 additions & 16 deletions
16
packages/MarkdownEditor-Utilities.package/WeakSmalltalkParser.class/instance/resolve..st
This file was deleted.
Oops, something went wrong.
14 changes: 7 additions & 7 deletions
14
packages/MarkdownEditor-Utilities.package/WeakSmalltalkParser.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"class" : { | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"initializeInstanceVariables" : "mas 5/17/2020 21:24", | ||
"parseBinary" : "mas 5/18/2020 17:28", | ||
"parseKeyword" : "mas 5/18/2020 17:28", | ||
"parseUnary" : "mas 5/18/2020 17:28", | ||
"resolve:" : "fgo 7/1/2019 10:53" } } | ||
"instance" : { | ||
"initializeInstanceVariables" : "MAS 5/28/2020 11:10", | ||
"parseBinary" : "MAS 5/28/2020 11:10", | ||
"parseIdentifier" : "MAS 5/28/2020 11:09", | ||
"parseKeyword" : "MAS 5/28/2020 11:10", | ||
"parseUnary" : "MAS 5/28/2020 11:10" } } |