parseutil

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(code []byte) (ast.Vertex, []byte, error)

Parse combines ParseFile and ParseStmt.

If input code is a proper PHP file, it's parsed with ParseFile. Otherwise it parsed with ParseStmt.

Useful for testing.

func ParseFile

func ParseFile(code []byte) (*ast.Root, error)

ParseFile parses PHP file sources and returns its AST root.

Useful for testing.

func ParseStmt

func ParseStmt(code []byte) (ast.Vertex, []byte, error)

ParseStmt parses a single PHP statement (which can be an expression).

Due to the fact that we extend the input slice with <?php tags so our parser can handle it, updated slice is returned. Result node source positions are precise only for that updated slice.

Useful for testing.

func ParseStmtList added in v0.4.0

func ParseStmtList(code []byte) (*ast.Root, error)

ParseStmtList parses a list of PHP statement (which can be an expression).

Useful for testing.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL