[squeak-dev] The Trunk: ST80-ul.282.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Mar 31 15:07:46 UTC 2022
Levente Uzonyi uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-ul.282.mcz
==================== Summary ====================
Name: ST80-ul.282
Author: ul
Time: 31 March 2022, 5:07:26.869823 pm
UUID: 43f230dd-7d32-473c-8271-c8b724e16044
Ancestors: ST80-mt.281
- use Symbol class >> #lookup: instead of #hasInterned:ifTrue:
=============== Diff against ST80-mt.281 ===============
Item was changed:
----- Method: ParagraphEditor>>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 delimitors reply numbers tiVars selectors sorry cgVars |
- [ | symbol string delimitors reply numbers tiVars selectors sorry cgVars |
sorry := '"Sorry, I can''t explain that. Please select a single
token, construct, or special character.'.
sorry := sorry , (view 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 detect: [:char | (char isLetter or: [char isDigit]) not]
ifNone: []) ifNil:
[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
|