[squeak-dev] The Trunk: Morphic-ul.1956.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Mar 31 15:06:32 UTC 2022
Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.1956.mcz
==================== Summary ====================
Name: Morphic-ul.1956
Author: ul
Time: 31 March 2022, 5:06:23.743688 pm
UUID: f3e1fb7d-6d9f-41a8-b27e-7ac48a323b48
Ancestors: Morphic-mt.1955
- use Symbol class >> #lookup: instead of #hasInterned:ifTrue:
=============== Diff against Morphic-mt.1955 ===============
Item was changed:
----- Method: StandardScriptingSystem>>formAtKey: (in category 'form dictionary') -----
formAtKey: aString
"Answer the form saved under the given key"
+ ^(Symbol lookup: aString)
+ ifNotNil: [ :aKey | FormDictionary at: aKey ifAbsent: [ FormDictionary at: #Cat ] ]
+ ifNil: [ FormDictionary at: #Cat ]!
- Symbol hasInterned: aString ifTrue:
- [:aKey | ^ FormDictionary at: aKey ifAbsent: [FormDictionary at: #Cat]].
- ^ FormDictionary at: #Cat!
Item was changed:
----- Method: TextEditor>>explain (in category 'menu messages') -----
explain
"Try to shed some light on what kind of entity the current selection is.
The selection must be a single token or construct. Insert the answer after
the selection. Send private messages whose names begin with 'explain'
that return a string if they recognize the selection, else nil."
Cursor execute showWhile:
+ [ | string numbers delimitors cgVars reply selectors tiVars sorry |
- [ | string numbers delimitors cgVars reply selectors tiVars symbol sorry |
sorry := '"Sorry, I can''t explain that. Please select a single
token, construct, or special character.'.
sorry := sorry , (morph canDiscardEdits
ifFalse: [' Also, please cancel or accept."']
ifTrue: ['"']).
(string := self selection asString) isEmpty
ifTrue: [reply := '']
ifFalse: [string := self explainScan: string.
"Remove space, tab, cr"
"Temps and Instance vars need only test strings that are all letters"
(string allSatisfy: [:char | char isLetter or: [char isDigit]])
ifTrue:
[tiVars := self explainTemp: string.
tiVars == nil ifTrue: [tiVars := self explainInst: string]].
(tiVars == nil and: [model respondsTo: #explainSpecial:])
ifTrue: [tiVars := model explainSpecial: string].
tiVars == nil
ifTrue: [tiVars := '']
ifFalse: [tiVars := tiVars , '\' withCRs].
"Context, Class, Pool, and Global vars, and Selectors need
only test symbols"
+ (Symbol lookup: string)
+ ifNotNil: [ :symbol |
+ cgVars := self explainCtxt: symbol.
- (Symbol hasInterned: string ifTrue: [:s | symbol := s])
- ifTrue: [cgVars := self explainCtxt: symbol.
cgVars == nil
ifTrue: [cgVars := self explainClass: symbol.
cgVars == nil ifTrue: [cgVars := self explainGlobal: symbol]].
"See if it is a Selector (sent here or not)"
selectors := self explainMySel: symbol.
selectors == nil
ifTrue:
[selectors := self explainPartSel: string.
selectors == nil ifTrue: [
selectors := self explainAnySel: symbol]]]
+ ifNil: [selectors := self explainPartSel: string].
- ifFalse: [selectors := self explainPartSel: string].
cgVars == nil
ifTrue: [cgVars := '']
ifFalse: [cgVars := cgVars , '\' withCRs].
selectors == nil
ifTrue: [selectors := '']
ifFalse: [selectors := selectors , '\' withCRs].
string size = 1
ifTrue: ["single special characters"
delimitors := self explainChar: string]
ifFalse: ["matched delimitors"
delimitors := self explainDelimitor: string].
numbers := self explainNumber: string.
numbers == nil ifTrue: [numbers := ''].
delimitors == nil ifTrue: [delimitors := ''].
reply := tiVars , cgVars , selectors , delimitors , numbers].
reply size = 0 ifTrue: [reply := sorry].
self afterSelectionInsertAndSelect: reply]!
More information about the Squeak-dev
mailing list
|