phpDocumentor

Parser

Process

ParseDirectoryParseFileCall Parser's parse() methodAdd document to DocumentationSetAdd document to MetasReset EnvironmentCreate DocumentParserCall DocumentParser's parse() methodPreParseDocumentEventCreate new DocumentNodeSet scope for ReferenceBuilderLoad File Contents into DocumentIteratorRecursively merge included files into DocumentIteratorApply DocumentRulePostParseDocumentEventReset List of Sections in DocumentRuleSectionClose as many open sections as thedifference between the old andnew levelyesHeading level is less than currentOpen a new section on the DocumentyesProduction Rule is TitleConsume each line until Rule endsCreate Node from consumed linesReturn Node to DocumentRuleyesLine starts Production RuleAdd Node to Documenteach lineSectionClose any open sectionsStartParserDocumentParserDocumentRule

Message Flow

Parsing is powered using Tactician's command bus and has the following messages, in order of handling:

Name Description
LoadCache Populates the stored file metadata, including a serialized AST.
ParseDirectory Initiates parsing of all files for one Documentation Set, based on a directory
ParseFile Generate an AST for a single file and adds it to the metadata and Documentation Set
PersistCache Persists the stored file metadata to disk to be reloaded on the next run

LoadCache

ParseDirectory

ParseFile

PersistCache

Parsing a file

Loading the file's contents

Creating a Document

As soon as the source file's contents are loaded into a \phpDocumentor\Guides\RestructuredText\Parser\LinesIterator, it is time to create our first Node: the \phpDocumentor\Guides\Nodes\DocumentNode.

Search results