forked from Cuis-Smalltalk/Cuis-Smalltalk-Dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
CoreUpdates/4507-findSelectorFix-JuanVuletich-2020Dec30-14h38m-jmv.001.cs.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,24 @@ | ||
'From Cuis 5.0 [latest update: #4506] on 30 December 2020 at 2:38:52 pm'! | ||
|
||
!String methodsFor: 'converting' stamp: 'jmv 12/30/2020 14:38:23'! | ||
findSelector | ||
"Revised to use scanner for better removal of extraneous stuff" | ||
| potentialSelector colonIndex | | ||
potentialSelector _ self withBlanksTrimmed withoutEnclosing: $". | ||
colonIndex _ potentialSelector indexOf: $:. | ||
"possible keyword selector" | ||
(colonIndex > 1 and: [ (potentialSelector at: colonIndex - 1) isValidInIdentifiers ]) ifTrue: [ | ||
potentialSelector _ [ Scanner findSelectorIn: potentialSelector ] on: Error do: [ :anError | | ||
anError messageText = Scanner unmatechedCommentQuoteErrorDescription | ||
ifTrue: [ | ||
potentialSelector _ potentialSelector copyWithout: $". | ||
anError retry ] | ||
ifFalse: [ anError return: '']]]. | ||
|
||
potentialSelector isEmpty ifTrue: [ ^ nil ]. | ||
Symbol | ||
hasInterned: potentialSelector | ||
ifTrue: [ :aSymbol | ^ aSymbol ]. | ||
|
||
^ nil.! ! | ||
|