Natural Docs Version 0.9 |
NaturalDocs:: ParserA package that parses the input file either for symbols or to send to NaturalDocs::Builder. Usage and Dependencies
Summary
synonyms
A hash of the text synonyms for the tokens. For example, “procedure”, “routine”, and “function” all map to TOPIC_FUNCTION. The keys are the synonyms in all lowercase, and the values are one of the Topic Types. language
The language of the file currently being parsed. Is a NaturalDocs::Languages::Language object. modeWhat mode the parser is currently in.
menuTitleStateThe state of the default menu title, since it can be determined different ways. StatesParseForInformation
Parses the input file for information. Will update the information about the file in NaturalDocs::SymbolTable and NaturalDocs::Project. Parameters
ParseForBuild
Parses the input file for building, returning it as a NaturalDocs::Parser::ParsedTopic arrayref. Note that all new and changed files should be parsed for symbols via ParseForInformation() before calling this function on any file. The reason is that NaturalDocs::SymbolTable needs to know about all the symbol definitions and references to resolve them properly. Parameters
ReturnsAn arrayref of the source file as NaturalDocs::Parser::ParsedTopic objects. Parser StagesDo not call these functions directly, as they are stages in the parsing process. Rather, call ParseForInformation() or ParseForBuild(). Parse
Begins the parsing process. Do not call directly; rather, call ParseForInformation() or ParseForBuild(). file and mode should be set prior to calling; it will set everything else itself. ExtractComments
Extracts comments from the passed content and sends them individually to CleanComment(). Parameters
ExtractLineComments
Parses the passed content for single line comments. Merges adjacent ones and sends them to CleanComment(). Parameters
CleanComment
Removes any extraneous formatting or whitespace from the comment and sends it to ExtractTopics(). Eliminates comment boxes, horizontal lines, leading and trailing line breaks, leading and trailing whitespace from lines, and more than two line breaks in a row. Parameters
ExtractTopics
Takes the comment and extracts any Natural Docs topics in it. Parameters
InterpretTopic
Handles the parsed topic as appropriate for the parser mode. If we’re parsing for build, it adds it to parsedFile. If we’re parsing for symbols, it adds all symbol definitions and references to NaturalDocs::SymbolTable. Scope is gotten from the package variable scope instead of from the parameters. Parameters
RichFormatTextBlock
Applies rich NDMarkup formatting to a chunk of text. This includes both amp chars, formatting tags, and link tags. Parameters
ReturnsThe formatted text block. TagType
Returns whether the tag is a possible opening or closing tag, or neither. “Possible” because it doesn’t check if an opening tag is closed or a closing tag is opened, just whether the surrounding characters allow it to be a candidate for a tag. For example, in “A _B” the underscore is a possible opening underline tag, but in “A_B” it is not. Support function for RichFormatTextBlock(). Parameters
ReturnsPOSSIBLE_OPENING_TAG, POSSIBLE_CLOSING_TAG, or NOT_A_TAG. ClosingTag
Returns whether a tag is closed or not, where it’s closed if it is, and optionally whether there is any whitespace between the tags. Support function for RichFormatTextBlock(). The results of this function are in full context, meaning that if it says a tag is closed, it can be interpreted as that tag in the final output. It takes into account any spoiling factors, like there being two opening tags in a row. Parameters
ReturnsIf the tag is closed, it returns the index of the closing tag and puts whether there was whitespace between the tags in hasWhitespaceRef if it was specified. If the tag is not closed, it returns -1 and doesn’t touch the variable pointed to by hasWhitespaceRef. |