[squeak-dev] Squeak 6.0 alpha-20601 browsing revisions fails because of wrong class of requestor
gettimothy
gettimothy at zoho.com
Tue Sep 14 12:25:32 UTC 2021
I have created a stub PragmasHelp up at 'https://www.squeaksource.com/Doc'
I created it using Emacs Org mode and the super-beta DocOrgToCustomHelp tool which I will be figuring out how to include the dependencies for it later today.
DocOrgToCustomHelp viewFromFileChooser.
DocOrgToCustomHelp createFromFileChooser.
Creating content is a breeze..no need to program.
Below is the Markup for the PragmasHelp copied-n-pasted from Emacs. (Pillar style Markdown etc, will be in the pipeline...I gotta learn (and Docuument with this handy-dandy tool !) the big XML package first.
If you want to edit in-line via email, I will be happy to update the PragmasHelp and upload it to Doc.
cheers,
t
* Pragmas [PragmasHelp]
** Overview
Many see pragmas as labels. But they are executable. With pragmas, to label is human, to execute is divine.
This is Eliot Miranda's comments on Pragmas from an email exchange on Squeak-Dev
#+BEGIN_EXAMPLE
put code or text that might be missed by the parser in between these example blocks.
It is perfectly fine to put an entire page between them if you want
#+END_EXAMPLE
** Pragma Basics
** Pragma Uses
** A Pattern that Works [patternthatworks]
1. Create a builder object that understnds the pragma(s) in question
2. Visit the method(s) implementing the pragma
3. Send the pragma to the builder
** How Pragmas for Menus Should Be Done [pragmaformenus]
1. Give the base menu to a menudecorator builder which is parameterized with the name of the menu and class(es) involved in the menu.
2. Have the menu decorator builder visit the relevant pragma methods in the class(es)
3. Use the resulting decorated menu.
** Pragmas in Senders Of [senders]
discusson of the code behind the 'Senders' button on the Browser
** Pragmas in Xtreams-Parsing [PragmasXtreamsParsingHelp]
*** Associate a PEG Grammar Rule with a callback [xtreamscallbacks]
In the XTreams-parsing application that processes this document, we use a Pragma to associate a callback with one or more grammar rules.
#+BEGIN_EXAMPLE
The rules that handle '** Stuff Like This [optionalselector]...' handle 1 to eight '*' and are defined below.
HeadlineItem1 <- ^STAR{1} s HeadLineText Paragraph*
HeadlineItem2 <- ^STAR{2} s HeadLineText Paragraph*
HeadlineItem3 <- ^STAR{3} s HeadLineText Paragraph*
HeadlineItem4 <- ^STAR{4} s HeadLineText Paragraph*
HeadlineItem5 <- ^STAR{5} s HeadLineText Paragraph*
HeadlineItem6 <- ^STAR{6} s HeadLineText Paragraph*
HeadlineItem7 <- ^STAR{7} s HeadLineText Paragraph*
HeadlineItem8 <- ^STAR{8} s HeadLineText Paragraph*
#+END_EXAMPLE
When the parser matches a pattern, we can associate a callback that will be executed when the match occurs.
Below is the callback for the HeadlineItem rules above.
#+BEGIN_EXAMPLE
HeadlineItem: starOrderedCollection topic: aHelpTopic content: anOrderedCollection
<action: 'HeadlineItem1' arguments: #(2 4 5)>
<action: 'HeadlineItem2' arguments: #(2 4 5)>
<action: 'HeadlineItem3' arguments: #(2 4 5)>
<action: 'HeadlineItem4' arguments: #(2 4 5)>
<action: 'HeadlineItem5' arguments: #(2 4 5)>
<action: 'HeadlineItem6' arguments: #(2 4 5)>
<action: 'HeadlineItem7' arguments: #(2 4 5)>
<action: 'HeadlineItem8' arguments: #(2 4 5)>
|ht index ios |
index := starOrderedCollection size.
ht := aHelpTopic.
ios := (String streamContents:
[ : stream |
paragraphcache do:[:each |
stream nextPutAll: each.
]]).
ht contents: (ios contents).
ht priority: index.
(helptopiccache at: index) addLast: ht.
paragraphcache := OrderedCollection new.
transcripton ifTrue:[Transcript show:'HeadlineItem', (index asString) , '->' , (ht key);cr. ].
^ht
#+END_EXAMPLE
Note that more than one Pragma can be placed in a callback. And that this one method handles all the rules.
In Xtreams-Parsing, look at any of the subclasses of PEGActor for the callbacks.
To see the Grammars for those callbacks, look at the class side of PEGParser.
** Common Methods [commonmethods]
#+BEGIN_EXAMPLE
perform: withArguments:
#+END_EXAMPLE
#+BEGIN_EXAMPLE
sendTo:
#+END_EXAMPLE
#+BEGIN_EXAMPLE
sendMessage:
#+END_EXAMPLE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210914/7b4305b7/attachment.html>
More information about the Squeak-dev
mailing list
|