$modules
$modules : \Phug\Util\Partial\array<ModuleInterface>
Takes tokens from the Lexer and creates an AST out of it.
This class takes generated tokens from the Lexer sequentially and produces an Abstract Syntax Tree (AST) out of it
The AST is an object-tree containing Phug\Parser\Node instances with parent/child relations
This AST is passed to the compiler to generate PHTML out of it
Usage example:
use Phug\Parser;
$parser = new Parser();
var_dump($parser->parse($pugInput));
$lexer : \Phug\Lexer
The lexer used in this parser instance.
$state : \Phug\Parser\State
hasModule(string|\Phug\Util\ModuleInterface $module) : boolean
string|\Phug\Util\ModuleInterface | $module |
getModule(string|\Phug\Util\ModuleInterface $module) : \Phug\Util\ModuleInterface
string|\Phug\Util\ModuleInterface | $module |
addModule(string|\Phug\Util\ModuleInterface $module) : $this
string|\Phug\Util\ModuleInterface | $module |
removeModule(string|\Phug\Util\ModuleInterface $module) : $this
string|\Phug\Util\ModuleInterface | $module |
__construct(array|null $options = null)
Creates a new parser instance.
The parser will run the provided input through the lexer and generate an AST out of it.
The AST will be an object-tree consisting of Phug\Parser\Node instances
You can take the AST and either compile it with the Compiler or handle it yourself
array|null | $options | the options array |
getLexer() : \Phug\Lexer
Returns the currently used Lexer instance.
parse(string $input, string $path = null) : \Phug\Parser\NodeInterface
Parses the provided input-string to an AST.
The Abstract Syntax Tree (AST) will be an object-tree consisting of \Phug\Parser\Node instances.
You can either let the compiler compile it or compile it yourself
The root-node will always be of type 'document', from there on it can contain several kinds of nodes
string | $input | the input jade string that is to be parsed |
string | $path | optional path of file the input comes from |
the root-node of the parsed AST
getNodeName(\Phug\Parser\NodeInterface $node)
\Phug\Parser\NodeInterface | $node |
dumpNode(\Phug\Parser\NodeInterface $node, $level = null)
\Phug\Parser\NodeInterface | $node | |
$level |