Skip to content

Commit

Permalink
Yet another findSelector fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jvuletich committed Dec 30, 2020
1 parent 5e0c6f3 commit f8f785c
Showing 1 changed file with 24 additions and 0 deletions.
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.! !

0 comments on commit f8f785c

Please sign in to comment.