2 summary:: Parse SCDoc markup text
3 categories:: HelpSystem
4 related:: Classes/SCDoc, Classes/SCDocRenderer, Guides/WritingHelp, Reference/SCDocSyntax
7 This class is part of the SCDoc help system, and handles the parsing of the help sourcefiles into an internal tree of elements.
9 The markup language used in the help sourcefile is explained in link::Reference/SCDocSyntax::.
11 The internal tree representation consists of an array of nodes, each node looks like this:
13 (tag:'tagSymbol', text:"textString", children:[], display:\block)
15 If the tag has text, it is put in the code::text:: field. If it has children, then the code::children:: field contains an array of children nodes. The code::display:: element is either code::\block:: or code::\inline::
17 In normal cases you won't need to use this class directly, link::Classes/SCDoc:: uses this class to parse and render all help sourcefiles.
22 Create a parser instance.
25 Find helpfile for class and parse it to get the documentation for a specific method.
27 The name of the class.
29 The name of the method, must be prefixed with code::*:: for classmethods and code::-:: for instancemethods.
30 returns:: The parsed node tree for the specific method documentation.
32 This is used internally by the code::copymethod\:::: tag.
35 private:: init, leaveLevel, popTree, pushTree, setTopNode, enterLevel, endCurrent, addTag, handleWord, addText, endLine, dumpSubTree, makeCategoryTree, generateUndocumentedMethods, dumpClassTree, handleCopyMethod
38 Parse a help sourcefile written in SCDoc markup language.
39 returns:: the parser object.
41 The full path to the file.
42 discussion:: The resulting tree is available in code::parser.root::
45 Parse a string of SCDoc markup language.
46 returns:: the parser object.
49 discussion:: The resulting tree is available in code::parser.root::
52 Parse metadata of document and collect methods.
54 This method will leave a list of all method names in code::parser.methodList::, prefixed with xk where
56 ## x is "+" for extended methods, or else "_"
57 ## k is "*" for classmethods, "-" for instancemethods and "." for generic methods (often interfaces documented in a non-class helpfile)
59 It will also leave a list of all explicitly added keywords in code::parser.keywordList::
62 Set/get the root array of the internal document tree.
65 Get the list of documented methods after running link::-parseMetaData::
68 Get the list of keywords after running link::-parseMetaData::
71 Dump the internal document tree to the post window in a human-readable form.
75 returns:: An object representing the node, if the node was not found the resulting object will have code::.tag:: set to nil.
77 The tag to search for.
79 The array to search, defaults to code::this.root::.
83 p = SCDocParser.new.parseFile("/path/to/myfile.schelp");
84 p.findNode("related").text.postln;
91 p.parseFile("/path/to/an/example.schelp");
93 p.findNode("summary").text.postln;
94 p.parse("inline code::code example::.").dump;