Overview

Namespaces

  • Pharborist
    • Constants
    • ControlStructures
    • Exceptions
    • Functions
    • Generators
    • Namespaces
    • Objects
    • Operators
    • Types
    • Variables

Classes

  • ArrayLookupNode
  • BacktickNode
  • BlankStatementNode
  • CommaListNode
  • CommentNode
  • DocCommentNode
  • EchoStatementNode
  • EchoTagStatementNode
  • ExpressionStatementNode
  • Filter
  • Formatter
  • FormatterFactory
  • LineCommentBlockNode
  • Node
  • NodeCollection
  • OperatorFactory
  • ParenthesisNode
  • ParentNode
  • Parser
  • PartialCommentNode
  • PartialNode
  • RootNode
  • SourceDiscovery
  • SourcePosition
  • SplatNode
  • StatementBlockNode
  • StatementNode
  • TemplateNode
  • Token
  • TokenIterator
  • Tokenizer
  • TokenNode
  • UnsetStatementNode
  • VisitorBase
  • WhitespaceNode

Interfaces

  • ExpressionNode
  • NodeInterface
  • ParentNodeInterface
  • ParserException
  • VisitorInterface

Traits

  • DocCommentTrait
  • ParenTrait
  • UncommentTrait
  • Overview
  • Namespace
  • Class

Class Parser

Parses PHP tokens into syntax tree.

Namespace: Pharborist
Located at Parser.php
Methods summary
public
# __construct( )

Constructor.

Constructor.

public Pharborist\RootNode
# buildTree( Pharborist\TokenIterator $iterator )

Build a syntax tree from the token iterator.

Build a syntax tree from the token iterator.

Parameters

$iterator

Returns

Pharborist\RootNode
Root node of the tree
public static Pharborist\RootNode|boolean
# parseFile( string $filename )

Parse a file and return the parsed tree

Parse a file and return the parsed tree

Parameters

$filename
Path to file

Returns

Pharborist\RootNode|boolean

The top-level node of the parsed tree or FALSE if the file contents could not be read.

public static Pharborist\RootNode
# parseSource( string $source )

Parse PHP source code and return the parsed tree.

Parse PHP source code and return the parsed tree.

Parameters

$source
PHP source code

Returns

Pharborist\RootNode
The top-level node of the parsed tree
public static Pharborist\Node
# parseSnippet( string $snippet )

Parse a snippet of PHP and return the node of first element.

Parse a snippet of PHP and return the node of first element.

Parameters

$snippet
PHP snippet without the opening PHP tag

Returns

Pharborist\Node
The first node in the snippet.
public static Pharborist\ExpressionNode
# parseExpression( string $expression )

Parse a PHP expression.

Parse a PHP expression.

Parameters

$expression
PHP expression snippet.

Returns

Pharborist\ExpressionNode
The expression.
Pharborist API documentation generated by ApiGen