Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- This file:
--   http://anggtwu.net/LUA/SmallTalk1.lua.html
--   http://anggtwu.net/LUA/SmallTalk1.lua
--           (find-angg "LUA/SmallTalk1.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (defun s () (interactive) (find-angg "LUA/SmallTalk1.lua"))
-- (defun l () (interactive) (find-angg "LUA/Lisp3.lua"))
-- (defun sl () (interactive) (find-2a '(s) '(l)))




require "Tree1"    -- (find-anggfile "LUA/Tree1.lua")
require "lpeg"     -- (find-es "lpeg" "lpeg-quickref")
loadlpegrex()      -- (find-angg "LUA/lua50init.lua" "loadlpegrex")


uppercase = function (word) return string.upper(word) end
lowercase = function (word) return string.lower(word) end
capitalize = function (word)
    return uppercase(word:sub(1,1))..word:sub(2)
  end
toMethodName = function (str)
    str = str:gsub("[^A-Za-z0-9 ]", "")
    local words = split(str)
    local out = lowercase(words[1])
    for i=2,#words do out = out .. capitalize(words[i]) end
    return out
  end

--[[
* (eepitch-lua52)
* (eepitch-kill)
* (eepitch-lua52)
dofile "SmallTalk1.lua"
= toMethodName("Extending the System")

--]]



lpegrex_compilef = function (patstr, f)
    return lpegrex.compile(patstr, {__options={tag=f}})
  end

Tagged = Class {
  type    = "Tagged",
  __tostring = function (tgd) return tgd:abody() end,
  __index = {
    body = function (tgd)
        return subj:sub(tgd.pos, tgd.endpos-1)
      end,
    abody = function (tgd) return "<"..tgd:body()..">" end,
    value = function (ast)
        if ast[0] == "String" then return ast:body():sub(2,-2) end
        if ast[0] == "Symbol" then return ast:body():sub(2) end
        if ast[0] == "Name"   then return ast:body() end
        if ast[0] == "aName"  then return ast:body():sub(3) end
        if ast[0] == "List"   then return ast:body():sub(2,-2) end
      end,
  },
}

smalltalkexpr = lpegrex_compilef([[
    top           <-- skip List

    skip          <-- [ %ct]*
    linebreak     <-- %cn

    Element        <-- Symbol / aName / Name / String / List
    ElementSep     <-- skip "." skip
    anotherElement <-- ElementSep Element
    Elements       <-- (Element anotherElement*) / ""
    List           <== "{" Elements "}"

    String        <== "'" strchar* "'"
 -- strchar       <-- "''" / (!"'" .)
    strchar       <--        (!"'" .)

    Symbol        <== '#'  [A-Za-z0-9:]+
    Name          <==      [A-Za-z0-9]+
    aName         <== "a " [A-Za-z0-9]+
  ]],
  function (name, node)
      node[0] = name
      return Tagged(node)
    end)


bigstr = [[
{'Squeak Help' . a TheWorldMainDockingBar . #squeakHelp . nil}
{'Send Feedback...' . a TheWorldMainDockingBar . #sendFeedback . nil}
{'Online Resources' . a TheWorldMainDockingBar . #squeakOnlineResources . nil}
{'Squeak Swiki' . a TheWorldMainDockingBar . #swiki . nil}
{'Keyboard Shortcuts' . a TheWorldMainDockingBar . #commandKeyHelp . nil}
{'Extending the system' . a TheWorldMainDockingBar . #extendingTheSystem . nil}
{'Release Notes' . a TheWorldMainDockingBar . #releaseNotes . nil}
{'License Information' . a TheWorldMainDockingBar . #licenseInformation . nil}
{'About Squeak...' . a TheWorldMainDockingBar . #aboutSqueak . nil}
]]


-- fileList
--   "Same as: Tools -> File List.
--    Test:
--     See fileList.
--   "
--   ^ StandardToolSet openFileList.


methodfmt = [[
%s
  "Same as: %s -> %s.
   Test:
    See %s.
  "
  ^ %s %s %s.
]]

whichmenu = "Foo"

genmethod = function ()
    return format(methodfmt,
             toMethodName(comment),
             whichmenu, comment,
             toMethodName(comment),
             target or class, method, arguments)
  end

genmethodnames = function (bigstr)
    for _,line in ipairs(splitlines(bigstr)) do
      subj = line
      ast = smalltalkexpr:match(subj)
      if ast then
        comment   = ast[1]:value()
        class     = ast[2]:value()
        method    = ast[3]:value()
        arguments = ast[4]:value()
        print(genmethod())
        print()
      end
    end
  end



--[==[
* (eepitch-lua52)
* (eepitch-kill)
* (eepitch-lua52)
dofile "SmallTalk1.lua"

whichmenu = "Help"
bigstr = [[
{'Squeak Help' . a TheWorldMainDockingBar . #squeakHelp . nil}
{'Send Feedback...' . a TheWorldMainDockingBar . #sendFeedback . nil}
{'Online Resources' . a TheWorldMainDockingBar . #squeakOnlineResources . nil}
{'Squeak Swiki' . a TheWorldMainDockingBar . #swiki . nil}
{'Keyboard Shortcuts' . a TheWorldMainDockingBar . #commandKeyHelp . nil}
{'Extending the system' . a TheWorldMainDockingBar . #extendingTheSystem . nil}
{'Release Notes' . a TheWorldMainDockingBar . #releaseNotes . nil}
{'License Information' . a TheWorldMainDockingBar . #licenseInformation . nil}
{'About Squeak...' . a TheWorldMainDockingBar . #aboutSqueak . nil}
]]
target = "See theWorldMainDockingBar"
genmethodnames(bigstr)
--]==]


--[==[
* (eepitch-lua52)
* (eepitch-kill)
* (eepitch-lua52)
dofile "SmallTalk1.lua"

whichmenu = "World"
target = nil
bigstr = [[
{'Browser' . a TheWorldMenu . #doMenuItem:with: . {{StandardToolSet . #openClassBrowser}}}
{'Workspace' . a TheWorldMenu . #doMenuItem:with: . {{Workspace . #open}}}
{'Transcript' . a TheWorldMenu . #doMenuItem:with: . {{a TranscriptStream . #open}}}
{'Test Runner' . a TheWorldMenu . #doMenuItem:with: . {{TestRunner . #open}}}
{'previous project' . a TheWorldMenu . #doMenuItem:with: . #(#(#myWorld #goBack))}
{'jump to project...' . a TheWorldMenu . #doMenuItem:with: . #(#(#myWorld #jumpToProject))}
{'save project on file...' . a TheWorldMenu . #doMenuItem:with: . #(#(#myWorld #saveOnFile))}
{'load project from file...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #loadProject}}}
{'can''t undo' . a CommandHistory . #undoOrRedoCommand . #()}
{'restore display (r)' . a TheWorldMenu . #doMenuItem:with: . {{a MorphicProject (HomeProject) in a PasteUpMorph(2434915) [world] . #restoreDisplay}}}
{'open...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #openWindow}}}
{'windows...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #windowsDo}}}
{'changes...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #changesDo}}}
{'help...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #helpDo}}}
{'appearance...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #appearanceDo}}}
{'do...' . a TheWorldMenu . #doMenuItem:with: . {{Utilities . #offerCommonRequests}}}
{'objects (o)' . a TheWorldMenu . #doMenuItem:with: . #(#(#myWorld #activateObjectsTool))}
{'new morph...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #newMorph}}}
{'authoring tools...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #scriptingDo}}}
{'playfield options...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #playfieldDo}}}
{'flaps...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #flapsDo}}}
{'projects...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #projectDo}}}
{'telemorphic...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #remoteDo}}}
{'make screenshot' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #saveScreenshot}}}
{'debug...' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #debugDo}}}
{'save' . a TheWorldMenu . #doMenuItem:with: . {{Smalltalk . #saveSession}}}
{'save as...' . a TheWorldMenu . #doMenuItem:with: . {{Smalltalk . #saveAs}}}
{'save as new version' . a TheWorldMenu . #doMenuItem:with: . {{Smalltalk . #saveAsNewVersion}}}
{'save and quit' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #saveAndQuit}}}
{'quit' . a TheWorldMenu . #doMenuItem:with: . {{a TheWorldMenu . #quitSession}}}
]]
target = "See theWorldMenu"
genmethodnames(bigstr)

--]==]



--[==[
* (eepitch-lua52)
* (eepitch-kill)
* (eepitch-lua52)
dofile "SmallTalk1.lua"

subj = [[ {'Squeak Help' . a TheWorldMainDockingBar . #squeakHelp . nil} ]]
ast = smalltalkexpr:match(subj)
= ast
= ast[1]
= ast[1]:value()
= ast[2]:value()
= ast[3]:value()
= ast[4]:value()
= trees(ast)


subj = [[  'Squeak Help' . a TheWorldMainDockingBar . #squeakHelp . nil  ]]
subj = [[ . 'Squeak Help' . a TheWorldMainDockingBar . #squeakHelp . nil  ]]
subj = line
subj = "Foo"
subj = "a Foo"
subj = "#Foo bar"
subj = " 'flippi' woo"



-- (find-eev "eev-videolinks.el" "more-info")
bigstr = ee_readfile "~/eev-current/eev-videolinks.el"
pos = bigstr:match "()%(defvar ee%-1stclassvideos%-info"
= pos
subj = bigstr
ast = sexp:match(subj, pos)
= ast
= ast[2]
= ast[3]
= ast[3][1]
= ast[3][1][1]
= ast[3][1][1]:asvideo()
= ast[3][1]:asvideos()
vs = ast[3][1]:asvideos()
= videos_to_expr(vs)

--]==]






-- Local Variables:
-- coding:  utf-8-unix
-- End: