[squeak-dev] Ya gotta love parsing!    - .+/\*~<>@%|&?

gettimothy gettimothy at zoho.com
Thu Sep 9 17:01:49 UTC 2021


I am putting together a "simple" PEG Grammar to parse Org mode into CustomHelp topics....





All test pass on the initial coding so I decided to put the first parts of the Terse Guide into the input stream.





Last things first, here is the collection of HelpTopics created by the parse.





an OrderedCollection(an OrderedCollection(a HelpTopic<Terse Guide> a HelpTopic<~<>@%|&?>))




HEE!





Here is where it blows up....





Allowable characters:

    - a-z

    - A-Z

    - 0-9

    - .+/\*~<>@%|&?     <--- I got your parsing regex right here!

    - blank, tab, cr, ff, lf









I am pretty sure that ORG has the equivalent of the <pre>  </pre>  markup, so I will do that in a bit.






Here is the input:



'*  Terse Guide

**  General





Allowable characters:

    - a-z

    - A-Z

    - 0-9

    - .+/\*~<>@%|&?

    - blank, tab, cr, ff, lf



Variables:

    - Variables must be declared before use

    - Shared vars must begin with uppercase

    - Local vars must begin with lowercase

    - Reserved names: self, super, thisContext, true, false, and nil



Variable scope:

    - Global: defined in current environment (that is usually Smalltalk) and accessible by all objects in system

    - Special (reserved): self, super, thisContext, true, false, and nil

    - Method Temporary: local to a method

    - Block Temporary: local to a block

    - Pool: variables in a Dictionary object

    - Method Parameters: automatic local vars created as a result of  message call with params

    - Block Parameters: automatic local vars created as a result of value: message call

    - Class: shared with all instances of one class & its subclasses

    - Class Instance: unique to each instance of a class

    - Instance Variables: unique to each instance





"Comments are enclosed in quotes - like this"



Period (.) is the statement separator







**  Transcript





Transcript clear.						"clear to transcript window"

'




Anyhoo...the goal is from Org to CustomHelp back to Org....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210909/8814dc63/attachment.html>


More information about the Squeak-dev mailing list