Documentation
¶
Overview ¶
Code generated by the `ir/codegen` package. DO NOT EDIT.
Code generated by the `ir/codegen` package. DO NOT EDIT.
Code generated by the `ir/codegen` package. DO NOT EDIT.
Package ir declares intermediate representation type suitable for the analysis.
IR is generated from the AST, see ir/irconv package.
Code generated by the `ir/codegen` package. DO NOT EDIT.
Code generated by the `ir/codegen` package. DO NOT EDIT.
Index ¶
- func GetFirstToken(n Node) *token.Token
- func GetPosition(n Node) *position.Position
- type AnonClassExpr
- type Argument
- type ArrayDimFetchExpr
- type ArrayExpr
- type ArrayItemExpr
- type ArrowFunctionExpr
- type Assign
- type AssignBitwiseAnd
- type AssignBitwiseOr
- type AssignBitwiseXor
- type AssignCoalesce
- type AssignConcat
- type AssignDiv
- type AssignMinus
- type AssignMod
- type AssignMul
- type AssignPlus
- type AssignPow
- type AssignReference
- type AssignShiftLeft
- type AssignShiftRight
- type Attribute
- type AttributeGroup
- type BadString
- type BitwiseAndExpr
- type BitwiseNotExpr
- type BitwiseOrExpr
- type BitwiseXorExpr
- type BooleanAndExpr
- type BooleanNotExpr
- type BooleanOrExpr
- type BreakStmt
- type CaseStmt
- type CatchStmt
- type Class
- type ClassConstFetchExpr
- type ClassConstListStmt
- type ClassExtendsStmt
- type ClassImplementsStmt
- type ClassMethodStmt
- type ClassStmt
- type CloneExpr
- type CloseTagStmt
- type ClosureExpr
- type ClosureUsesExpr
- type CoalesceExpr
- type ConcatExpr
- type ConstFetchExpr
- type ConstListStmt
- type ConstantStmt
- type ContinueStmt
- type DeclareStmt
- type DefaultStmt
- type DivExpr
- type Dnumber
- type DoStmt
- type EchoStmt
- type ElseIfStmt
- type ElseStmt
- type EmptyExpr
- type Encapsed
- type EncapsedStringPart
- type EqualExpr
- type ErrorSuppressExpr
- type EvalExpr
- type ExitExpr
- type ExpressionStmt
- type FinallyStmt
- type ForStmt
- type ForeachStmt
- type FunctionCallExpr
- type FunctionStmt
- type GlobalStmt
- type GotoStmt
- type GreaterExpr
- type GreaterOrEqualExpr
- type GroupUseStmt
- type HaltCompilerStmt
- type Heredoc
- type IdenticalExpr
- type Identifier
- type IfStmt
- type ImportExpr
- type InlineHTMLStmt
- type InstanceOfExpr
- type InterfaceExtendsStmt
- type InterfaceStmt
- type IssetExpr
- type LabelStmt
- type ListExpr
- type Lnumber
- type Location
- type LogicalAndExpr
- type LogicalOrExpr
- type LogicalXorExpr
- type MagicConstant
- type MatchArm
- type MatchExpr
- type MethodCallExpr
- type MinusExpr
- type ModExpr
- type MulExpr
- type Name
- func (n *Name) FirstPart() string
- func (n *Name) HeadTail() (head, tail string)
- func (n *Name) IsFullyQualified() bool
- func (n *Name) IterateTokens(cb func(*token.Token) bool)
- func (n *Name) LastPart() string
- func (n *Name) NumParts() int
- func (n *Name) RestParts() string
- func (n *Name) Walk(v Visitor)
- type NamespaceStmt
- type NewExpr
- type Node
- type NodeKind
- type NopStmt
- type NotEqualExpr
- type NotIdenticalExpr
- type Nullable
- type NullsafeMethodCallExpr
- type NullsafePropertyFetchExpr
- type Parameter
- type ParenExpr
- type PlusExpr
- type PostDecExpr
- type PostIncExpr
- type PowExpr
- type PreDecExpr
- type PreIncExpr
- type PrintExpr
- type PropertyFetchExpr
- type PropertyListStmt
- type PropertyStmt
- type ReferenceExpr
- type ReturnStmt
- type Root
- type ShellExecExpr
- type ShiftLeftExpr
- type ShiftRightExpr
- type SimpleVar
- type SmallerExpr
- type SmallerOrEqualExpr
- type SpaceshipExpr
- type StaticCallExpr
- type StaticPropertyFetchExpr
- type StaticStmt
- type StaticVarStmt
- type StmtList
- type String
- type SwitchStmt
- type TernaryExpr
- type ThrowExpr
- type ThrowStmt
- type TraitAdaptationListStmt
- type TraitMethodRefStmt
- type TraitStmt
- type TraitUseAliasStmt
- type TraitUsePrecedenceStmt
- type TraitUseStmt
- type TryStmt
- type TypeCastExpr
- type UnaryMinusExpr
- type UnaryPlusExpr
- type Union
- type UnsetCastExpr
- type UnsetStmt
- type UseListStmt
- type UseStmt
- type Var
- type Visitor
- type WhileStmt
- type YieldExpr
- type YieldFromExpr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFirstToken ¶ added in v0.4.0
func GetPosition ¶
Types ¶
type AnonClassExpr ¶
type AnonClassExpr struct {
Position *position.Position
ClassTkn *token.Token
OpenParenthesisTkn *token.Token
Args []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
OpenCurlyBracketTkn *token.Token
CloseCurlyBracketTkn *token.Token
Class
}
AnonClassExpr is an anonymous class expression. $Args may contain constructor call arguments `new class ($Args...) {}`.
func (*AnonClassExpr) Arg ¶
func (n *AnonClassExpr) Arg(i int) *Argument
Arg returns the ith argument.
func (*AnonClassExpr) IterateTokens ¶ added in v0.4.0
func (n *AnonClassExpr) IterateTokens(cb func(*token.Token) bool)
func (*AnonClassExpr) Walk ¶
func (n *AnonClassExpr) Walk(v Visitor)
type Argument ¶
type Argument struct {
Position *position.Position
Name *Identifier
ColonTkn *token.Token
VariadicTkn *token.Token
AmpersandTkn *token.Token
Expr Node
Variadic bool
IsReference bool
}
Argument is a wrapper node for func/method arguments. Possible syntax's:
$Name: $Expr $Expr
If $Variadic is true, it's `...$Expr`. If $IsReference is true, it's `&$Expr`.
func (*Argument) IterateTokens ¶ added in v0.4.0
type ArrayDimFetchExpr ¶
type ArrayDimFetchExpr struct {
Position *position.Position
Variable Node
OpenBracketTkn *token.Token
Dim Node
CloseBracketTkn *token.Token
CurlyBrace bool
}
ArrayDimFetchExpr is a `$Variable[$Dim]` expression. If $CurlyBrace is true, it's `$Variable{$Dim}`
func (*ArrayDimFetchExpr) IterateTokens ¶ added in v0.4.0
func (n *ArrayDimFetchExpr) IterateTokens(cb func(*token.Token) bool)
func (*ArrayDimFetchExpr) Walk ¶
func (n *ArrayDimFetchExpr) Walk(v Visitor)
type ArrayExpr ¶
type ArrayExpr struct {
Position *position.Position
ArrayTkn *token.Token
OpenBracketTkn *token.Token
Items []*ArrayItemExpr
SeparatorTkns []*token.Token
CloseBracketTkn *token.Token
ShortSyntax bool
}
ArrayExpr is a `array($Items...)` expression. If $ShortSyntax is true, it's `[$Items...]`.
func (*ArrayExpr) IterateTokens ¶ added in v0.4.0
type ArrayItemExpr ¶
type ArrayItemExpr struct {
Position *position.Position
EllipsisTkn *token.Token
Key Node
DoubleArrowTkn *token.Token
AmpersandTkn *token.Token
Val Node
Unpack bool
}
ArrayItemExpr is a `$Key => $Val` expression. If $Unpack is true, it's `...$Val` ($Key is nil).
TODO: make unpack a separate node?
func (*ArrayItemExpr) IterateTokens ¶ added in v0.4.0
func (n *ArrayItemExpr) IterateTokens(cb func(*token.Token) bool)
func (*ArrayItemExpr) Walk ¶
func (n *ArrayItemExpr) Walk(v Visitor)
type ArrowFunctionExpr ¶
type ArrowFunctionExpr struct {
Position *position.Position
AttrGroups []*AttributeGroup
StaticTkn *token.Token
FnTkn *token.Token
AmpersandTkn *token.Token
OpenParenthesisTkn *token.Token
Params []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
ReturnType Node
DoubleArrowTkn *token.Token
Expr Node
ReturnsRef bool
Static bool
Doc phpdoc.Comment
}
ArrowFunctionExpr is a `#[$AttrGroups] fn($Params...): $ReturnType => $Expr` expression. If $ReturnsRef is true, it's `fn&($Params...): $ReturnType => $Expr`. If $Static is true, it's `static fn($Params...): $ReturnType => $Expr`. $ReturnType is optional, without it we have `fn($Params...) => $Expr` syntax.
func (*ArrowFunctionExpr) IterateTokens ¶ added in v0.4.0
func (n *ArrowFunctionExpr) IterateTokens(cb func(*token.Token) bool)
func (*ArrowFunctionExpr) Walk ¶
func (n *ArrowFunctionExpr) Walk(v Visitor)
type Assign ¶
Assign is a `$Variable = $Expression` expression.
func (*Assign) IterateTokens ¶ added in v0.4.0
type AssignBitwiseAnd ¶
type AssignBitwiseAnd struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignBitwiseAnd is a `$Variable &= $Expression` expression.
func (*AssignBitwiseAnd) IterateTokens ¶ added in v0.4.0
func (n *AssignBitwiseAnd) IterateTokens(cb func(*token.Token) bool)
func (*AssignBitwiseAnd) Walk ¶
func (n *AssignBitwiseAnd) Walk(v Visitor)
type AssignBitwiseOr ¶
type AssignBitwiseOr struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignBitwiseOr is a `$Variable |= $Expression` expression.
func (*AssignBitwiseOr) IterateTokens ¶ added in v0.4.0
func (n *AssignBitwiseOr) IterateTokens(cb func(*token.Token) bool)
func (*AssignBitwiseOr) Walk ¶
func (n *AssignBitwiseOr) Walk(v Visitor)
type AssignBitwiseXor ¶
type AssignBitwiseXor struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignBitwiseXor is a `$Variable ^= $Expression` expression.
func (*AssignBitwiseXor) IterateTokens ¶ added in v0.4.0
func (n *AssignBitwiseXor) IterateTokens(cb func(*token.Token) bool)
func (*AssignBitwiseXor) Walk ¶
func (n *AssignBitwiseXor) Walk(v Visitor)
type AssignCoalesce ¶
type AssignCoalesce struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignCoalesce is a `$Variable ??= $Expression` expression.
func (*AssignCoalesce) IterateTokens ¶ added in v0.4.0
func (n *AssignCoalesce) IterateTokens(cb func(*token.Token) bool)
func (*AssignCoalesce) Walk ¶
func (n *AssignCoalesce) Walk(v Visitor)
type AssignConcat ¶
type AssignConcat struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignConcat is a `$Variable .= $Expression` expression.
func (*AssignConcat) IterateTokens ¶ added in v0.4.0
func (n *AssignConcat) IterateTokens(cb func(*token.Token) bool)
func (*AssignConcat) Walk ¶
func (n *AssignConcat) Walk(v Visitor)
type AssignDiv ¶
AssignDiv is a `$Variable /= $Expression` expression.
func (*AssignDiv) IterateTokens ¶ added in v0.4.0
type AssignMinus ¶
type AssignMinus struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignMinus is a `$Variable -= $Expression` expression.
func (*AssignMinus) IterateTokens ¶ added in v0.4.0
func (n *AssignMinus) IterateTokens(cb func(*token.Token) bool)
func (*AssignMinus) Walk ¶
func (n *AssignMinus) Walk(v Visitor)
type AssignMod ¶
AssignMod is a `$Variable %= $Expression` expression.
func (*AssignMod) IterateTokens ¶ added in v0.4.0
type AssignMul ¶
AssignMul is a `$Variable *= $Expression` expression.
func (*AssignMul) IterateTokens ¶ added in v0.4.0
type AssignPlus ¶
type AssignPlus struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignPlus is a `$Variable += $Expression` expression.
func (*AssignPlus) IterateTokens ¶ added in v0.4.0
func (n *AssignPlus) IterateTokens(cb func(*token.Token) bool)
func (*AssignPlus) Walk ¶
func (n *AssignPlus) Walk(v Visitor)
type AssignPow ¶
AssignPow is a `$Variable **= $Expression` expression.
func (*AssignPow) IterateTokens ¶ added in v0.4.0
type AssignReference ¶
type AssignReference struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignReference is a `$Variable &= $Expression` expression.
func (*AssignReference) IterateTokens ¶ added in v0.4.0
func (n *AssignReference) IterateTokens(cb func(*token.Token) bool)
func (*AssignReference) Walk ¶
func (n *AssignReference) Walk(v Visitor)
type AssignShiftLeft ¶
type AssignShiftLeft struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignShiftLeft is a `$Variable <<= $Expression` expression.
func (*AssignShiftLeft) IterateTokens ¶ added in v0.4.0
func (n *AssignShiftLeft) IterateTokens(cb func(*token.Token) bool)
func (*AssignShiftLeft) Walk ¶
func (n *AssignShiftLeft) Walk(v Visitor)
type AssignShiftRight ¶
type AssignShiftRight struct {
Position *position.Position
Variable Node
EqualTkn *token.Token
Expr Node
}
AssignShiftRight is a `$Variable >>= $Expression` expression.
func (*AssignShiftRight) IterateTokens ¶ added in v0.4.0
func (n *AssignShiftRight) IterateTokens(cb func(*token.Token) bool)
func (*AssignShiftRight) Walk ¶
func (n *AssignShiftRight) Walk(v Visitor)
type Attribute ¶ added in v0.4.0
type Attribute struct {
Position *position.Position
Name Node
OpenParenthesisTkn *token.Token
Args []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
}
Attribute node is a `$Name($Args)` inside `#[...]`
func (*Attribute) IterateTokens ¶ added in v0.4.0
type AttributeGroup ¶ added in v0.4.0
type AttributeGroup struct {
Position *position.Position
OpenAttributeTkn *token.Token
Attrs []*Attribute
SeparatorTkns []*token.Token
CloseAttributeTkn *token.Token
}
AttributeGroup node is #[$Attrs]
func (*AttributeGroup) IterateTokens ¶ added in v0.4.0
func (n *AttributeGroup) IterateTokens(cb func(*token.Token) bool)
func (*AttributeGroup) Walk ¶ added in v0.4.0
func (n *AttributeGroup) Walk(v Visitor)
type BadString ¶
BadString is a string that we couldn't interpret correctly. The $Value contains uninterpreted (raw) string bytes. $Error contains the reason why this string is "bad".
func (*BadString) IterateTokens ¶ added in v0.4.0
type BitwiseAndExpr ¶
BitwiseAndExpr is a `$Left & $Right` expression.
func (*BitwiseAndExpr) IterateTokens ¶ added in v0.4.0
func (n *BitwiseAndExpr) IterateTokens(cb func(*token.Token) bool)
func (*BitwiseAndExpr) Walk ¶
func (n *BitwiseAndExpr) Walk(v Visitor)
type BitwiseNotExpr ¶
BitwiseNotExpr is a `~$Expr` expression.
func (*BitwiseNotExpr) IterateTokens ¶ added in v0.4.0
func (n *BitwiseNotExpr) IterateTokens(cb func(*token.Token) bool)
func (*BitwiseNotExpr) Walk ¶
func (n *BitwiseNotExpr) Walk(v Visitor)
type BitwiseOrExpr ¶
BitwiseOrExpr is a `$Left | $Right` expression.
func (*BitwiseOrExpr) IterateTokens ¶ added in v0.4.0
func (n *BitwiseOrExpr) IterateTokens(cb func(*token.Token) bool)
func (*BitwiseOrExpr) Walk ¶
func (n *BitwiseOrExpr) Walk(v Visitor)
type BitwiseXorExpr ¶
BitwiseXorExpr is a `$Left ^ $Right` expression.
func (*BitwiseXorExpr) IterateTokens ¶ added in v0.4.0
func (n *BitwiseXorExpr) IterateTokens(cb func(*token.Token) bool)
func (*BitwiseXorExpr) Walk ¶
func (n *BitwiseXorExpr) Walk(v Visitor)
type BooleanAndExpr ¶
BooleanAndExpr is a `$Left && $Right` expression.
func (*BooleanAndExpr) IterateTokens ¶ added in v0.4.0
func (n *BooleanAndExpr) IterateTokens(cb func(*token.Token) bool)
func (*BooleanAndExpr) Walk ¶
func (n *BooleanAndExpr) Walk(v Visitor)
type BooleanNotExpr ¶
BooleanNotExpr is a `!$Expr` expression.
func (*BooleanNotExpr) IterateTokens ¶ added in v0.4.0
func (n *BooleanNotExpr) IterateTokens(cb func(*token.Token) bool)
func (*BooleanNotExpr) Walk ¶
func (n *BooleanNotExpr) Walk(v Visitor)
type BooleanOrExpr ¶
BooleanOrExpr is a `$Left || $Right` expression.
func (*BooleanOrExpr) IterateTokens ¶ added in v0.4.0
func (n *BooleanOrExpr) IterateTokens(cb func(*token.Token) bool)
func (*BooleanOrExpr) Walk ¶
func (n *BooleanOrExpr) Walk(v Visitor)
type BreakStmt ¶
type BreakStmt struct {
Position *position.Position
BreakTkn *token.Token
Expr Node
SemiColonTkn *token.Token
}
BreakStmt is a `break $Expr` statement.
func (*BreakStmt) IterateTokens ¶ added in v0.4.0
type CaseStmt ¶
type CaseStmt struct {
Position *position.Position
CaseTkn *token.Token
Cond Node
CaseSeparatorTkn *token.Token
Stmts []Node
}
CaseStmt is a `case $Cond: $Stmts...` statement.
func (*CaseStmt) IterateTokens ¶ added in v0.4.0
type CatchStmt ¶
type CatchStmt struct {
Position *position.Position
CatchTkn *token.Token
OpenParenthesisTkn *token.Token
Types []Node
SeparatorTkns []*token.Token
Variable Node
CloseParenthesisTkn *token.Token
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
}
CatchStmt is a `catch ($Types... $Variable) { $Stmts... }` statement. Note that $Types are |-separated, like in `T1 | T2`.
func (*CatchStmt) IterateTokens ¶ added in v0.4.0
type Class ¶
type Class struct {
Extends *ClassExtendsStmt
Implements *ClassImplementsStmt
Stmts []Node
Doc phpdoc.Comment
}
Class is a common shape between the ClassStmt and AnonClassExpr. It doesn't include positions info.
type ClassConstFetchExpr ¶
type ClassConstFetchExpr struct {
Position *position.Position
Class Node
DoubleColonTkn *token.Token
ConstantName *Identifier
}
ClassConstFetchExpr is a `$Class::$ConstantName` expression.
func (*ClassConstFetchExpr) IterateTokens ¶ added in v0.4.0
func (n *ClassConstFetchExpr) IterateTokens(cb func(*token.Token) bool)
func (*ClassConstFetchExpr) Walk ¶
func (n *ClassConstFetchExpr) Walk(v Visitor)
type ClassConstListStmt ¶
type ClassConstListStmt struct {
Position *position.Position
AttrGroups []*AttributeGroup
Modifiers []*Identifier
ConstTkn *token.Token
Consts []Node
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
Doc phpdoc.Comment
}
ClassConstListStmt is a `#[$AttrGroups] $Modifiers... const $Consts...` statement. $Modifiers may specify the constant access level. Every element in $Consts is a *ConstantStmt.
func (*ClassConstListStmt) IterateTokens ¶ added in v0.4.0
func (n *ClassConstListStmt) IterateTokens(cb func(*token.Token) bool)
func (*ClassConstListStmt) Walk ¶
func (n *ClassConstListStmt) Walk(v Visitor)
type ClassExtendsStmt ¶
type ClassExtendsStmt struct {
Position *position.Position
ExtendsTkn *token.Token
ClassName *Name
}
ClassExtendsStmt is a `extends $ClassName` statement.
func (*ClassExtendsStmt) IterateTokens ¶ added in v0.4.0
func (n *ClassExtendsStmt) IterateTokens(cb func(*token.Token) bool)
func (*ClassExtendsStmt) Walk ¶
func (n *ClassExtendsStmt) Walk(v Visitor)
type ClassImplementsStmt ¶
type ClassImplementsStmt struct {
Position *position.Position
ImplementsTkn *token.Token
ImplementsSeparatorTkns []*token.Token
InterfaceNames []Node
}
ClassImplementsStmt is a `implements $InterfaceNames...` statement. TODO: shouldn't every InterfaceName be a *Name?
func (*ClassImplementsStmt) IterateTokens ¶ added in v0.4.0
func (n *ClassImplementsStmt) IterateTokens(cb func(*token.Token) bool)
func (*ClassImplementsStmt) Walk ¶
func (n *ClassImplementsStmt) Walk(v Visitor)
type ClassMethodStmt ¶
type ClassMethodStmt struct {
Position *position.Position
AttrGroups []*AttributeGroup
Modifiers []*Identifier
FunctionTkn *token.Token
AmpersandTkn *token.Token
MethodName *Identifier
OpenParenthesisTkn *token.Token
Params []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
ReturnType Node
Stmt Node
ReturnsRef bool
Doc phpdoc.Comment
}
ClassMethodStmt is a class method declaration.
func (*ClassMethodStmt) IterateTokens ¶ added in v0.4.0
func (n *ClassMethodStmt) IterateTokens(cb func(*token.Token) bool)
func (*ClassMethodStmt) Walk ¶
func (n *ClassMethodStmt) Walk(v Visitor)
type ClassStmt ¶
type ClassStmt struct {
Position *position.Position
AttrGroups []*AttributeGroup
Modifiers []*Identifier
ClassTkn *token.Token
ClassName *Identifier
OpenCurlyBracketTkn *token.Token
CloseCurlyBracketTkn *token.Token
Class
}
ClassStmt is a named class declaration. $Modifiers consist of identifiers like `final` and `abstract`.
func (*ClassStmt) IterateTokens ¶ added in v0.4.0
type CloneExpr ¶
CloneExpr is a `clone $Expr` expression.
func (*CloneExpr) IterateTokens ¶ added in v0.4.0
type CloseTagStmt ¶ added in v0.4.0
CloseTagStmt is `?>` (script closing marker).
func (*CloseTagStmt) IterateTokens ¶ added in v0.4.0
func (n *CloseTagStmt) IterateTokens(cb func(*token.Token) bool)
func (*CloseTagStmt) Walk ¶ added in v0.4.0
func (n *CloseTagStmt) Walk(v Visitor)
type ClosureExpr ¶
type ClosureExpr struct {
Position *position.Position
AttrGroups []*AttributeGroup
StaticTkn *token.Token
FunctionTkn *token.Token
AmpersandTkn *token.Token
OpenParenthesisTkn *token.Token
Params []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
ClosureUse *ClosureUsesExpr
ColonTkn *token.Token
ReturnType Node
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
ReturnsRef bool
Static bool
Doc phpdoc.Comment
}
ClosureExpr is a `#[$AttrGroups] function($Params...) use ($ClosureUse) : $ReturnType { $Stmts... }` expression. If $ReturnsRef is true, it's `function&($Params...) use ($ClosureUse) : $ReturnType { $Stmts... }`. If $Static is true, it's `static function($Params...) use ($ClosureUse) : $ReturnType { $Stmts... }`. $ReturnType is optional, without it we have `function($Params...) use ($ClosureUse) { $Stmts... }` syntax. $ClosureUse is optional, without it we have `function($Params...) : $ReturnType { $Stmts... }` syntax.
func (*ClosureExpr) IterateTokens ¶ added in v0.4.0
func (n *ClosureExpr) IterateTokens(cb func(*token.Token) bool)
func (*ClosureExpr) Walk ¶
func (n *ClosureExpr) Walk(v Visitor)
type ClosureUsesExpr ¶ added in v0.4.0
type ClosureUsesExpr struct {
Position *position.Position
UseTkn *token.Token
UseOpenParenthesisTkn *token.Token
Uses []Node
UseSeparatorTkns []*token.Token
UseCloseParenthesisTkn *token.Token
}
ClosureUsesExpr is a `use ($Uses...)` expression. TODO: it's not a expression really.
func (*ClosureUsesExpr) IterateTokens ¶ added in v0.4.0
func (n *ClosureUsesExpr) IterateTokens(cb func(*token.Token) bool)
func (*ClosureUsesExpr) Walk ¶ added in v0.4.0
func (n *ClosureUsesExpr) Walk(v Visitor)
type CoalesceExpr ¶
CoalesceExpr is a `$Left ?? $Right` expression.
func (*CoalesceExpr) IterateTokens ¶ added in v0.4.0
func (n *CoalesceExpr) IterateTokens(cb func(*token.Token) bool)
func (*CoalesceExpr) Walk ¶
func (n *CoalesceExpr) Walk(v Visitor)
type ConcatExpr ¶
ConcatExpr is a `$Left . $Right` expression.
func (*ConcatExpr) IterateTokens ¶ added in v0.4.0
func (n *ConcatExpr) IterateTokens(cb func(*token.Token) bool)
func (*ConcatExpr) Walk ¶
func (n *ConcatExpr) Walk(v Visitor)
type ConstFetchExpr ¶
ConstFetchExpr is a `$Constant` expression.
func (*ConstFetchExpr) IterateTokens ¶ added in v0.4.0
func (n *ConstFetchExpr) IterateTokens(cb func(*token.Token) bool)
func (*ConstFetchExpr) Walk ¶
func (n *ConstFetchExpr) Walk(v Visitor)
type ConstListStmt ¶
type ConstListStmt struct {
Position *position.Position
ConstTkn *token.Token
Consts []Node
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
}
ConstListStmt is a `const $Consts` statement. Every element in $Consts is a *ConstantStmt.
func (*ConstListStmt) IterateTokens ¶ added in v0.4.0
func (n *ConstListStmt) IterateTokens(cb func(*token.Token) bool)
func (*ConstListStmt) Walk ¶
func (n *ConstListStmt) Walk(v Visitor)
type ConstantStmt ¶
type ConstantStmt struct {
Position *position.Position
ConstantName *Identifier
EqualTkn *token.Token
Expr Node
}
ConstantStmt is a `$ConstantName = $Expr` statement. It's a part of the *ConstListStmt, *ClassConstListStmt and *DeclareStmt.
func (*ConstantStmt) IterateTokens ¶ added in v0.4.0
func (n *ConstantStmt) IterateTokens(cb func(*token.Token) bool)
func (*ConstantStmt) Walk ¶
func (n *ConstantStmt) Walk(v Visitor)
type ContinueStmt ¶
type ContinueStmt struct {
Position *position.Position
ContinueTkn *token.Token
Expr Node
SemiColonTkn *token.Token
}
ContinueStmt is a `continue $Expr` statement.
func (*ContinueStmt) IterateTokens ¶ added in v0.4.0
func (n *ContinueStmt) IterateTokens(cb func(*token.Token) bool)
func (*ContinueStmt) Walk ¶
func (n *ContinueStmt) Walk(v Visitor)
type DeclareStmt ¶
type DeclareStmt struct {
Position *position.Position
DeclareTkn *token.Token
OpenParenthesisTkn *token.Token
Consts []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
Stmt Node
EndDeclareTkn *token.Token
SemiColonTkn *token.Token
Alt bool
}
DeclareStmt is a `declare ($Consts...) $Stmt` statement. $Stmt can be an empty statement, like in `declare ($Consts...);`, but it can also be a block like in `declare ($Consts...) {}`. If $Alt is true, the block will begin with `:` and end with `enddeclare`. Every element in $Consts is a *ConstantStmt.
func (*DeclareStmt) IterateTokens ¶ added in v0.4.0
func (n *DeclareStmt) IterateTokens(cb func(*token.Token) bool)
func (*DeclareStmt) Walk ¶
func (n *DeclareStmt) Walk(v Visitor)
type DefaultStmt ¶
type DefaultStmt struct {
Position *position.Position
DefaultTkn *token.Token
CaseSeparatorTkn *token.Token
Stmts []Node
}
DefaultStmt is a `default: $Stmts...` statement.
func (*DefaultStmt) IterateTokens ¶ added in v0.4.0
func (n *DefaultStmt) IterateTokens(cb func(*token.Token) bool)
func (*DefaultStmt) Walk ¶
func (n *DefaultStmt) Walk(v Visitor)
type DivExpr ¶
DivExpr is a `$Left / $Right` expression.
func (*DivExpr) IterateTokens ¶ added in v0.4.0
type DoStmt ¶
type DoStmt struct {
Position *position.Position
DoTkn *token.Token
Stmt Node
WhileTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Node
CloseParenthesisTkn *token.Token
SemiColonTkn *token.Token
}
DoStmt is a `do $Stmt while ($Cond)` statement.
func (*DoStmt) IterateTokens ¶ added in v0.4.0
type EchoStmt ¶
type EchoStmt struct {
Position *position.Position
EchoTkn *token.Token
Exprs []Node
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
}
EchoStmt is a `echo $Exprs...` statement.
func (*EchoStmt) IterateTokens ¶ added in v0.4.0
type ElseIfStmt ¶
type ElseIfStmt struct {
Position *position.Position
ElseIfTkn *token.Token
ElseTkn *token.Token
IfTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Node
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
Stmt Node
AltSyntax bool
Merged bool
}
ElseIfStmt is a `elseif ($Cond) $Stmt` statement. If $AltSyntax is true, the block will begin with `:` and end with `endif`. $Merged tells whether this elseif is a merged `else if` statement.
func (*ElseIfStmt) IterateTokens ¶ added in v0.4.0
func (n *ElseIfStmt) IterateTokens(cb func(*token.Token) bool)
func (*ElseIfStmt) Walk ¶
func (n *ElseIfStmt) Walk(v Visitor)
type ElseStmt ¶
type ElseStmt struct {
Position *position.Position
ElseTkn *token.Token
ColonTkn *token.Token
Stmt Node
AltSyntax bool
}
ElseStmt is a `else $Stmt` statement. If $AltSyntax is true, the block will begin with `:`.
func (*ElseStmt) IterateTokens ¶ added in v0.4.0
type EmptyExpr ¶
type EmptyExpr struct {
Position *position.Position
EmptyTkn *token.Token
OpenParenthesisTkn *token.Token
Expr Node
CloseParenthesisTkn *token.Token
}
EmptyExpr is a `empty($Expr)` expression.
func (*EmptyExpr) IterateTokens ¶ added in v0.4.0
type Encapsed ¶
type Encapsed struct {
Position *position.Position
OpenQuoteTkn *token.Token
Parts []Node
CloseQuoteTkn *token.Token
}
Encapsed is a string literal with interpolated parts.
func (*Encapsed) IterateTokens ¶ added in v0.4.0
type EncapsedStringPart ¶
type EncapsedStringPart struct {
Position *position.Position
EncapsedStrTkn *token.Token
Value string
}
EncapsedStringPart is a part of the Encapsed literal.
func (*EncapsedStringPart) IterateTokens ¶ added in v0.4.0
func (n *EncapsedStringPart) IterateTokens(cb func(*token.Token) bool)
func (*EncapsedStringPart) Walk ¶
func (n *EncapsedStringPart) Walk(v Visitor)
type EqualExpr ¶
EqualExpr is a `$Left == $Right` expression.
func (*EqualExpr) IterateTokens ¶ added in v0.4.0
type ErrorSuppressExpr ¶
ErrorSuppressExpr is a `@$Expr` expression.
func (*ErrorSuppressExpr) IterateTokens ¶ added in v0.4.0
func (n *ErrorSuppressExpr) IterateTokens(cb func(*token.Token) bool)
func (*ErrorSuppressExpr) Walk ¶
func (n *ErrorSuppressExpr) Walk(v Visitor)
type EvalExpr ¶
type EvalExpr struct {
Position *position.Position
EvalTkn *token.Token
OpenParenthesisTkn *token.Token
Expr Node
CloseParenthesisTkn *token.Token
}
EvalExpr is a `eval($Expr)` expression.
func (*EvalExpr) IterateTokens ¶ added in v0.4.0
type ExitExpr ¶
type ExitExpr struct {
Position *position.Position
ExitTkn *token.Token
OpenParenthesisTkn *token.Token
Expr Node
CloseParenthesisTkn *token.Token
Die bool
}
ExitExpr is a `exit($Expr)` expression. If $Die is true, it's `die($Expr)`.
func (*ExitExpr) IterateTokens ¶ added in v0.4.0
type ExpressionStmt ¶
ExpressionStmt is an expression $Expr that is evaluated for side-effects only. When expression is used in a place where statement is expected, it becomes an ExpressionStmt.
func (*ExpressionStmt) IterateTokens ¶ added in v0.4.0
func (n *ExpressionStmt) IterateTokens(cb func(*token.Token) bool)
func (*ExpressionStmt) Walk ¶
func (n *ExpressionStmt) Walk(v Visitor)
type FinallyStmt ¶
type FinallyStmt struct {
Position *position.Position
FinallyTkn *token.Token
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
}
FinallyStmt is a `finally { $Stmts... }` statement.
func (*FinallyStmt) IterateTokens ¶ added in v0.4.0
func (n *FinallyStmt) IterateTokens(cb func(*token.Token) bool)
func (*FinallyStmt) Walk ¶
func (n *FinallyStmt) Walk(v Visitor)
type ForStmt ¶
type ForStmt struct {
Position *position.Position
ForTkn *token.Token
OpenParenthesisTkn *token.Token
Init []Node
InitSeparatorTkns []*token.Token
InitSemiColonTkn *token.Token
Cond []Node
CondSeparatorTkns []*token.Token
CondSemiColonTkn *token.Token
Loop []Node
LoopSeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
Stmt Node
EndForTkn *token.Token
SemiColonTkn *token.Token
AltSyntax bool
}
ForStmt is a `for ($Init; $Cond; $Loop) $Stmt` statement. If $AltSyntax is true, the block will begin with `:` and end with `endfor`.
func (*ForStmt) IterateTokens ¶ added in v0.4.0
type ForeachStmt ¶
type ForeachStmt struct {
Position *position.Position
ForeachTkn *token.Token
OpenParenthesisTkn *token.Token
Expr Node
AsTkn *token.Token
Key Node
DoubleArrowTkn *token.Token
AmpersandTkn *token.Token
Variable Node
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
Stmt Node
EndForeachTkn *token.Token
SemiColonTkn *token.Token
AltSyntax bool
}
ForeachStmt is a `foreach ($Expr as $Key => $Variable) $Stmt` statement. If $AltSyntax is true, the block will begin with `:` and end with `endforeach`.
func (*ForeachStmt) IterateTokens ¶ added in v0.4.0
func (n *ForeachStmt) IterateTokens(cb func(*token.Token) bool)
func (*ForeachStmt) Walk ¶
func (n *ForeachStmt) Walk(v Visitor)
type FunctionCallExpr ¶
type FunctionCallExpr struct {
Position *position.Position
Function Node
OpenParenthesisTkn *token.Token
Args []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
}
FunctionCallExpr is a `$Function($Args...)` expression.
func (*FunctionCallExpr) Arg ¶
func (n *FunctionCallExpr) Arg(i int) *Argument
Arg returns the ith argument.
func (*FunctionCallExpr) IterateTokens ¶ added in v0.4.0
func (n *FunctionCallExpr) IterateTokens(cb func(*token.Token) bool)
func (*FunctionCallExpr) Walk ¶
func (n *FunctionCallExpr) Walk(v Visitor)
type FunctionStmt ¶
type FunctionStmt struct {
Position *position.Position
AttrGroups []*AttributeGroup
FunctionTkn *token.Token
AmpersandTkn *token.Token
FunctionName *Identifier
OpenParenthesisTkn *token.Token
Params []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
ReturnType Node
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
ReturnsRef bool
Doc phpdoc.Comment
}
FunctionStmt is a named function declaration.
func (*FunctionStmt) IterateTokens ¶ added in v0.4.0
func (n *FunctionStmt) IterateTokens(cb func(*token.Token) bool)
func (*FunctionStmt) Walk ¶
func (n *FunctionStmt) Walk(v Visitor)
type GlobalStmt ¶
type GlobalStmt struct {
Position *position.Position
GlobalTkn *token.Token
Vars []Node
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
}
GlobalStmt is a `global $Vars` statement.
func (*GlobalStmt) IterateTokens ¶ added in v0.4.0
func (n *GlobalStmt) IterateTokens(cb func(*token.Token) bool)
func (*GlobalStmt) Walk ¶
func (n *GlobalStmt) Walk(v Visitor)
type GotoStmt ¶
type GotoStmt struct {
Position *position.Position
GotoTkn *token.Token
Label *Identifier
SemiColonTkn *token.Token
}
GotoStmt is a `goto $Label` statement.
func (*GotoStmt) IterateTokens ¶ added in v0.4.0
type GreaterExpr ¶
GreaterExpr is a `$Left > $Right` expression.
func (*GreaterExpr) IterateTokens ¶ added in v0.4.0
func (n *GreaterExpr) IterateTokens(cb func(*token.Token) bool)
func (*GreaterExpr) Walk ¶
func (n *GreaterExpr) Walk(v Visitor)
type GreaterOrEqualExpr ¶
type GreaterOrEqualExpr struct {
Position *position.Position
Left Node
OpTkn *token.Token
Right Node
}
GreaterOrEqualExpr is a `$Left >= $Right` expression.
func (*GreaterOrEqualExpr) IterateTokens ¶ added in v0.4.0
func (n *GreaterOrEqualExpr) IterateTokens(cb func(*token.Token) bool)
func (*GreaterOrEqualExpr) Walk ¶
func (n *GreaterOrEqualExpr) Walk(v Visitor)
type GroupUseStmt ¶
type GroupUseStmt struct {
Position *position.Position
UseTkn *token.Token
UseType *Identifier
LeadingNsSeparatorTkn *token.Token
Prefix *Name
NsSeparatorTkn *token.Token
OpenCurlyBracketTkn *token.Token
UseList []Node
SeparatorTkns []*token.Token
CloseCurlyBracketTkn *token.Token
SemiColonTkn *token.Token
}
GroupUseStmt is a `use $UseType $Prefix\{ $UseList }` statement. $UseType is a "function" or "const".
func (*GroupUseStmt) IterateTokens ¶ added in v0.4.0
func (n *GroupUseStmt) IterateTokens(cb func(*token.Token) bool)
func (*GroupUseStmt) Walk ¶
func (n *GroupUseStmt) Walk(v Visitor)
type HaltCompilerStmt ¶
type HaltCompilerStmt struct {
Position *position.Position
HaltCompilerTkn *token.Token
OpenParenthesisTkn *token.Token
CloseParenthesisTkn *token.Token
SemiColonTkn *token.Token
}
HaltCompilerStmt is a `__halt_compiler()` statement.
func (*HaltCompilerStmt) IterateTokens ¶ added in v0.4.0
func (n *HaltCompilerStmt) IterateTokens(cb func(*token.Token) bool)
func (*HaltCompilerStmt) Walk ¶
func (n *HaltCompilerStmt) Walk(v Visitor)
type Heredoc ¶
type Heredoc struct {
Position *position.Position
Label string
OpenHeredocTkn *token.Token
Parts []Node
CloseHeredocTkn *token.Token
}
Heredoc is special PHP literal. Note that it may be a nowdoc, depending on the label.
func (*Heredoc) IterateTokens ¶ added in v0.4.0
type IdenticalExpr ¶
IdenticalExpr is a `$Left === $Right` expression.
func (*IdenticalExpr) IterateTokens ¶ added in v0.4.0
func (n *IdenticalExpr) IterateTokens(cb func(*token.Token) bool)
func (*IdenticalExpr) Walk ¶
func (n *IdenticalExpr) Walk(v Visitor)
type Identifier ¶
Identifier is like a name, but it's always resolved to itself. Identifier always consists of a single part.
func (*Identifier) IterateTokens ¶ added in v0.4.0
func (n *Identifier) IterateTokens(cb func(*token.Token) bool)
func (*Identifier) Walk ¶
func (n *Identifier) Walk(v Visitor)
type IfStmt ¶
type IfStmt struct {
Position *position.Position
IfTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Node
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
Stmt Node
ElseIf []Node
Else Node
EndIfTkn *token.Token
SemiColonTkn *token.Token
ElseTkn *token.Token
AltSyntax bool
}
IfStmt is a `if ($Cond) $Stmt` statement. $ElseIf contains an entire elseif chain, if any. $Else may contain an else part of the statement.
func (*IfStmt) IterateTokens ¶ added in v0.4.0
type ImportExpr ¶
type ImportExpr struct {
Position *position.Position
ImportTkn *token.Token
Func string // "include" "include_once" "require" "require_once"
Expr Node
}
ImportExpr is a `$Func $Expr` expression. It could be `include $Expr`, `require $Expr` and so on.
func (*ImportExpr) IterateTokens ¶ added in v0.4.0
func (n *ImportExpr) IterateTokens(cb func(*token.Token) bool)
func (*ImportExpr) Walk ¶
func (n *ImportExpr) Walk(v Visitor)
type InlineHTMLStmt ¶
InlineHTMLStmt is a part of the script that will not be interpreted as a PHP script. In other words, it's everything outside of the <? and ?> tags.
func (*InlineHTMLStmt) IterateTokens ¶ added in v0.4.0
func (n *InlineHTMLStmt) IterateTokens(cb func(*token.Token) bool)
func (*InlineHTMLStmt) Walk ¶
func (n *InlineHTMLStmt) Walk(v Visitor)
type InstanceOfExpr ¶
type InstanceOfExpr struct {
Position *position.Position
Expr Node
InstanceOfTkn *token.Token
Class Node
}
InstanceOfExpr is a `$Expr instanceof $Class` expression.
func (*InstanceOfExpr) IterateTokens ¶ added in v0.4.0
func (n *InstanceOfExpr) IterateTokens(cb func(*token.Token) bool)
func (*InstanceOfExpr) Walk ¶
func (n *InstanceOfExpr) Walk(v Visitor)
type InterfaceExtendsStmt ¶
type InterfaceExtendsStmt struct {
Position *position.Position
ExtendsTkn *token.Token
InterfaceNames []Node
ExtendsSeparatorTkns []*token.Token
}
InterfaceExtendsStmt is a `extends $InterfaceNames...` statement. TODO: InterfaceNames could be a []*Name.
func (*InterfaceExtendsStmt) IterateTokens ¶ added in v0.4.0
func (n *InterfaceExtendsStmt) IterateTokens(cb func(*token.Token) bool)
func (*InterfaceExtendsStmt) Walk ¶
func (n *InterfaceExtendsStmt) Walk(v Visitor)
type InterfaceStmt ¶
type InterfaceStmt struct {
Position *position.Position
AttrGroups []*AttributeGroup
InterfaceTkn *token.Token
InterfaceName *Identifier
Extends *InterfaceExtendsStmt
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
Doc phpdoc.Comment
}
InterfaceStmt is an interface declaration.
func (*InterfaceStmt) IterateTokens ¶ added in v0.4.0
func (n *InterfaceStmt) IterateTokens(cb func(*token.Token) bool)
func (*InterfaceStmt) Walk ¶
func (n *InterfaceStmt) Walk(v Visitor)
type IssetExpr ¶
type IssetExpr struct {
Position *position.Position
IssetTkn *token.Token
OpenParenthesisTkn *token.Token
Variables []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
}
IssetExpr is a `isset($Variables...)` expression.
func (*IssetExpr) IterateTokens ¶ added in v0.4.0
type LabelStmt ¶
type LabelStmt struct {
Position *position.Position
LabelName *Identifier
ColonTkn *token.Token
}
LabelStmt is a `$LabelName:` statement.
func (*LabelStmt) IterateTokens ¶ added in v0.4.0
type ListExpr ¶
type ListExpr struct {
Position *position.Position
ListTkn *token.Token
OpenBracketTkn *token.Token
Items []*ArrayItemExpr
SeparatorTkns []*token.Token
CloseBracketTkn *token.Token
ShortSyntax bool
}
ListExpr is a `list($Items...)` expression. Note that it may appear not only in assignments as LHS, but also in foreach value expressions. If $ShortSyntax is true, it's `[$Items]`.
func (*ListExpr) IterateTokens ¶ added in v0.4.0
type Location ¶ added in v0.4.0
Location stores the position of some element, where StartChar and EndChar are offsets relative to the current line, as opposed to position.Position, where the offset is relative to the beginning of the file.
type LogicalAndExpr ¶
LogicalAndExpr is a `$Left and $Right` expression.
func (*LogicalAndExpr) IterateTokens ¶ added in v0.4.0
func (n *LogicalAndExpr) IterateTokens(cb func(*token.Token) bool)
func (*LogicalAndExpr) Walk ¶
func (n *LogicalAndExpr) Walk(v Visitor)
type LogicalOrExpr ¶
LogicalOrExpr is a `$Left or $Right` expression.
func (*LogicalOrExpr) IterateTokens ¶ added in v0.4.0
func (n *LogicalOrExpr) IterateTokens(cb func(*token.Token) bool)
func (*LogicalOrExpr) Walk ¶
func (n *LogicalOrExpr) Walk(v Visitor)
type LogicalXorExpr ¶
LogicalXorExpr is a `$Left xor $Right` expression.
func (*LogicalXorExpr) IterateTokens ¶ added in v0.4.0
func (n *LogicalXorExpr) IterateTokens(cb func(*token.Token) bool)
func (*LogicalXorExpr) Walk ¶
func (n *LogicalXorExpr) Walk(v Visitor)
type MagicConstant ¶
MagicConstant is a special PHP constant like __FILE__ or __CLASS__.
func (*MagicConstant) IterateTokens ¶ added in v0.4.0
func (n *MagicConstant) IterateTokens(cb func(*token.Token) bool)
func (*MagicConstant) Walk ¶
func (n *MagicConstant) Walk(v Visitor)
type MatchArm ¶ added in v0.4.0
type MatchArm struct {
Position *position.Position
DefaultTkn *token.Token
DefaultCommaTkn *token.Token
Exprs []Node
SeparatorTkns []*token.Token
DoubleArrowTkn *token.Token
ReturnExpr Node
IsDefault bool
}
MatchArm node is a `$Exprs or 'default' => $ReturnExpr`
func (*MatchArm) IterateTokens ¶ added in v0.4.0
type MatchExpr ¶ added in v0.4.0
type MatchExpr struct {
Position *position.Position
MatchTkn *token.Token
OpenParenthesisTkn *token.Token
Expr Node
CloseParenthesisTkn *token.Token
OpenCurlyBracketTkn *token.Token
Arms []*MatchArm
SeparatorTkns []*token.Token
CloseCurlyBracketTkn *token.Token
}
MatchExpr node is a `match($Expr) { $Arms }`
func (*MatchExpr) IterateTokens ¶ added in v0.4.0
type MethodCallExpr ¶
type MethodCallExpr struct {
Position *position.Position
Variable Node
ObjectOperatorTkn *token.Token
OpenCurlyBracketTkn *token.Token
Method Node
CloseCurlyBracketTkn *token.Token
OpenParenthesisTkn *token.Token
Args []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
}
MethodCallExpr is a `$Variable->$Method($Args...)` expression.
func (*MethodCallExpr) Arg ¶
func (n *MethodCallExpr) Arg(i int) *Argument
Arg returns the ith argument.
func (*MethodCallExpr) IterateTokens ¶ added in v0.4.0
func (n *MethodCallExpr) IterateTokens(cb func(*token.Token) bool)
func (*MethodCallExpr) Walk ¶
func (n *MethodCallExpr) Walk(v Visitor)
type MinusExpr ¶
MinusExpr is a `$Left - $Right` expression.
func (*MinusExpr) IterateTokens ¶ added in v0.4.0
type ModExpr ¶
ModExpr is a `$Left % $Right` expression.
func (*ModExpr) IterateTokens ¶ added in v0.4.0
type MulExpr ¶
MulExpr is a `$Left * $Right` expression.
func (*MulExpr) IterateTokens ¶ added in v0.4.0
type Name ¶
Name is either a FQN, local name or a name that may need a further resolving. Use Name methods to interpret the $Value correctly.
func (*Name) FirstPart ¶
FirstPart returns only the first name part. If name contains only one part, that part is returned.
func (*Name) IsFullyQualified ¶
IsFullyQualified reports whether the name is fully qualified. FQN don't need any further resolution.
func (*Name) IterateTokens ¶ added in v0.4.0
func (*Name) LastPart ¶
LastPart returns only the last name part. If name contains only one part, that part is returned.
type NamespaceStmt ¶
type NamespaceStmt struct {
Position *position.Position
NsTkn *token.Token
NamespaceName *Name
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
SemiColonTkn *token.Token
}
NamespaceStmt is a `namespace $NamespaceName` statement. If $Stmts is not nil, it's `namespace $NamespaceName { $Stmts... }`.
func (*NamespaceStmt) IterateTokens ¶ added in v0.4.0
func (n *NamespaceStmt) IterateTokens(cb func(*token.Token) bool)
func (*NamespaceStmt) Walk ¶
func (n *NamespaceStmt) Walk(v Visitor)
type NewExpr ¶
type NewExpr struct {
Position *position.Position
NewTkn *token.Token
Class Node
OpenParenthesisTkn *token.Token
Args []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
}
NewExpr is a `new $Class($Args...)` expression. If $Args is nil, it's `new $Class`.
func (*NewExpr) IterateTokens ¶ added in v0.4.0
type Node ¶
Node is a type that is implemented by all IR types. node_types.go contains all implementations.
type NodeKind ¶
type NodeKind int
const ( KindAnonClassExpr NodeKind = iota KindArgument KindArrayDimFetchExpr KindArrayExpr KindArrayItemExpr KindArrowFunctionExpr KindAssign KindAssignBitwiseAnd KindAssignBitwiseOr KindAssignBitwiseXor KindAssignCoalesce KindAssignConcat KindAssignDiv KindAssignMinus KindAssignMod KindAssignMul KindAssignPlus KindAssignPow KindAssignReference KindAssignShiftLeft KindAssignShiftRight KindAttribute KindAttributeGroup KindBadString KindBitwiseAndExpr KindBitwiseNotExpr KindBitwiseOrExpr KindBitwiseXorExpr KindBooleanAndExpr KindBooleanNotExpr KindBooleanOrExpr KindBreakStmt KindCaseStmt KindCatchStmt KindClassConstFetchExpr KindClassConstListStmt KindClassExtendsStmt KindClassImplementsStmt KindClassMethodStmt KindClassStmt KindCloneExpr KindCloseTagStmt KindClosureExpr KindClosureUsesExpr KindCoalesceExpr KindConcatExpr KindConstFetchExpr KindConstListStmt KindConstantStmt KindContinueStmt KindDeclareStmt KindDefaultStmt KindDivExpr KindDnumber KindDoStmt KindEchoStmt KindElseIfStmt KindElseStmt KindEmptyExpr KindEncapsed KindEncapsedStringPart KindEqualExpr KindErrorSuppressExpr KindEvalExpr KindExitExpr KindExpressionStmt KindFinallyStmt KindForStmt KindForeachStmt KindFunctionCallExpr KindFunctionStmt KindGlobalStmt KindGotoStmt KindGreaterExpr KindGreaterOrEqualExpr KindGroupUseStmt KindHaltCompilerStmt KindHeredoc KindIdenticalExpr KindIdentifier KindIfStmt KindImportExpr KindInlineHTMLStmt KindInstanceOfExpr KindInterfaceExtendsStmt KindInterfaceStmt KindIssetExpr KindLabelStmt KindListExpr KindLnumber KindLogicalAndExpr KindLogicalOrExpr KindLogicalXorExpr KindMagicConstant KindMatchArm KindMatchExpr KindMethodCallExpr KindMinusExpr KindModExpr KindMulExpr KindName KindNamespaceStmt KindNewExpr KindNopStmt KindNotEqualExpr KindNotIdenticalExpr KindNullable KindNullsafeMethodCallExpr KindNullsafePropertyFetchExpr KindParameter KindParenExpr KindPlusExpr KindPostDecExpr KindPostIncExpr KindPowExpr KindPreDecExpr KindPreIncExpr KindPrintExpr KindPropertyFetchExpr KindPropertyListStmt KindPropertyStmt KindReferenceExpr KindReturnStmt KindRoot KindShellExecExpr KindShiftLeftExpr KindShiftRightExpr KindSimpleVar KindSmallerExpr KindSmallerOrEqualExpr KindSpaceshipExpr KindStaticCallExpr KindStaticPropertyFetchExpr KindStaticStmt KindStaticVarStmt KindStmtList KindString KindSwitchStmt KindTernaryExpr KindThrowExpr KindThrowStmt KindTraitAdaptationListStmt KindTraitMethodRefStmt KindTraitStmt KindTraitUseAliasStmt KindTraitUsePrecedenceStmt KindTraitUseStmt KindTryStmt KindTypeCastExpr KindUnaryMinusExpr KindUnaryPlusExpr KindUnion KindUnsetCastExpr KindUnsetStmt KindUseListStmt KindUseStmt KindVar KindWhileStmt KindYieldExpr KindYieldFromExpr NumKinds )
func GetNodeKind ¶
type NopStmt ¶
NopStmt is a `;` statement. It's also known as "empty statement".
func (*NopStmt) IterateTokens ¶ added in v0.4.0
type NotEqualExpr ¶
NotEqualExpr is a `$Left != $Right` expression.
func (*NotEqualExpr) IterateTokens ¶ added in v0.4.0
func (n *NotEqualExpr) IterateTokens(cb func(*token.Token) bool)
func (*NotEqualExpr) Walk ¶
func (n *NotEqualExpr) Walk(v Visitor)
type NotIdenticalExpr ¶
type NotIdenticalExpr struct {
Position *position.Position
Left Node
OpTkn *token.Token
Right Node
}
NotIdenticalExpr is a `$Left !== $Right` expression.
func (*NotIdenticalExpr) IterateTokens ¶ added in v0.4.0
func (n *NotIdenticalExpr) IterateTokens(cb func(*token.Token) bool)
func (*NotIdenticalExpr) Walk ¶
func (n *NotIdenticalExpr) Walk(v Visitor)
type NullsafeMethodCallExpr ¶ added in v0.4.0
type NullsafeMethodCallExpr struct {
Position *position.Position
Variable Node
ObjectOperatorTkn *token.Token
OpenCurlyBracketTkn *token.Token
Method Node
CloseCurlyBracketTkn *token.Token
OpenParenthesisTkn *token.Token
Args []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
}
NullsafeMethodCallExpr node is a `$Var?->$Method($Args)`
func (*NullsafeMethodCallExpr) IterateTokens ¶ added in v0.4.0
func (n *NullsafeMethodCallExpr) IterateTokens(cb func(*token.Token) bool)
func (*NullsafeMethodCallExpr) Walk ¶ added in v0.4.0
func (n *NullsafeMethodCallExpr) Walk(v Visitor)
type NullsafePropertyFetchExpr ¶ added in v0.4.0
type NullsafePropertyFetchExpr struct {
Position *position.Position
Variable Node
ObjectOperatorTkn *token.Token
OpenCurlyBracketTkn *token.Token
Property Node
CloseCurlyBracketTkn *token.Token
}
NullsafePropertyFetchExpr node is a `$Var?->Prop`
func (*NullsafePropertyFetchExpr) IterateTokens ¶ added in v0.4.0
func (n *NullsafePropertyFetchExpr) IterateTokens(cb func(*token.Token) bool)
func (*NullsafePropertyFetchExpr) Walk ¶ added in v0.4.0
func (n *NullsafePropertyFetchExpr) Walk(v Visitor)
type Parameter ¶
type Parameter struct {
Position *position.Position
AttrGroups []*AttributeGroup
Modifiers []*Identifier
VariableType Node
AmpersandTkn *token.Token
VariadicTkn *token.Token
Variable *SimpleVar
EqualTkn *token.Token
DefaultValue Node
ByRef bool
Variadic bool
}
Parameter is a function param declaration. Possible syntax's:
#[$AttrGroups] $Modifiers $VariableType $Variable = $DefaultValue
#[$AttrGroups] $VariableType $Variable = $DefaultValue
$VariableType $Variable = $DefaultValue
$VariableType $Variable
$Variable
If $ByRef is true, it's `&$Variable`. If $Variadic is true, it's `...$Variable`.
func (*Parameter) IterateTokens ¶ added in v0.4.0
type ParenExpr ¶
type ParenExpr struct {
Position *position.Position
OpenParenthesisTkn *token.Token
Expr Node
CloseParenthesisTkn *token.Token
}
ParenExpr is a `($Expr)` expression.
func (*ParenExpr) IterateTokens ¶ added in v0.4.0
type PlusExpr ¶
PlusExpr is a `$Left + $Right` expression.
func (*PlusExpr) IterateTokens ¶ added in v0.4.0
type PostDecExpr ¶
PostDecExpr is a `$Variable--` expression.
func (*PostDecExpr) IterateTokens ¶ added in v0.4.0
func (n *PostDecExpr) IterateTokens(cb func(*token.Token) bool)
func (*PostDecExpr) Walk ¶
func (n *PostDecExpr) Walk(v Visitor)
type PostIncExpr ¶
PostIncExpr is a `$Variable++` expression.
func (*PostIncExpr) IterateTokens ¶ added in v0.4.0
func (n *PostIncExpr) IterateTokens(cb func(*token.Token) bool)
func (*PostIncExpr) Walk ¶
func (n *PostIncExpr) Walk(v Visitor)
type PowExpr ¶
PowExpr is a `$Left ** $Right` expression.
func (*PowExpr) IterateTokens ¶ added in v0.4.0
type PreDecExpr ¶
PreDecExpr is a `--$Variable` expression.
func (*PreDecExpr) IterateTokens ¶ added in v0.4.0
func (n *PreDecExpr) IterateTokens(cb func(*token.Token) bool)
func (*PreDecExpr) Walk ¶
func (n *PreDecExpr) Walk(v Visitor)
type PreIncExpr ¶
PreIncExpr is a `++$Variable` expression.
func (*PreIncExpr) IterateTokens ¶ added in v0.4.0
func (n *PreIncExpr) IterateTokens(cb func(*token.Token) bool)
func (*PreIncExpr) Walk ¶
func (n *PreIncExpr) Walk(v Visitor)
type PrintExpr ¶
PrintExpr is a `print $Expr` expression.
func (*PrintExpr) IterateTokens ¶ added in v0.4.0
type PropertyFetchExpr ¶
type PropertyFetchExpr struct {
Position *position.Position
Variable Node
ObjectOperatorTkn *token.Token
OpenCurlyBracketTkn *token.Token
Property Node
CloseCurlyBracketTkn *token.Token
}
PropertyFetchExpr is a `$Variable->$Property` expression.
func (*PropertyFetchExpr) IterateTokens ¶ added in v0.4.0
func (n *PropertyFetchExpr) IterateTokens(cb func(*token.Token) bool)
func (*PropertyFetchExpr) Walk ¶
func (n *PropertyFetchExpr) Walk(v Visitor)
type PropertyListStmt ¶
type PropertyListStmt struct {
Position *position.Position
AttrGroups []*AttributeGroup
Modifiers []*Identifier
Type Node
Properties []Node
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
Doc phpdoc.Comment
}
PropertyListStmt is a `#[$AttrGroups] $Modifiers $Type $Properties` statement. Every element in $Properties is a *PropertyStmt.
func (*PropertyListStmt) IterateTokens ¶ added in v0.4.0
func (n *PropertyListStmt) IterateTokens(cb func(*token.Token) bool)
func (*PropertyListStmt) Walk ¶
func (n *PropertyListStmt) Walk(v Visitor)
type PropertyStmt ¶
type PropertyStmt struct {
Position *position.Position
Variable *SimpleVar
EqualTkn *token.Token
Expr Node
}
PropertyStmt is a `$Variable = $Expr` statement. It's a part of the *PropertyListStmt.
func (*PropertyStmt) IterateTokens ¶ added in v0.4.0
func (n *PropertyStmt) IterateTokens(cb func(*token.Token) bool)
func (*PropertyStmt) Walk ¶
func (n *PropertyStmt) Walk(v Visitor)
type ReferenceExpr ¶
ReferenceExpr is a `&$Variable` expression.
func (*ReferenceExpr) IterateTokens ¶ added in v0.4.0
func (n *ReferenceExpr) IterateTokens(cb func(*token.Token) bool)
func (*ReferenceExpr) Walk ¶
func (n *ReferenceExpr) Walk(v Visitor)
type ReturnStmt ¶
type ReturnStmt struct {
Position *position.Position
ReturnTkn *token.Token
Expr Node
SemiColonTkn *token.Token
}
ReturnStmt is a `return $Expr` statement.
func (*ReturnStmt) IterateTokens ¶ added in v0.4.0
func (n *ReturnStmt) IterateTokens(cb func(*token.Token) bool)
func (*ReturnStmt) Walk ¶
func (n *ReturnStmt) Walk(v Visitor)
type Root ¶
Root is a node that wraps all file statements.
func (*Root) IterateTokens ¶ added in v0.4.0
type ShellExecExpr ¶
type ShellExecExpr struct {
Position *position.Position
OpenBacktickTkn *token.Token
Parts []Node
CloseBacktickTkn *token.Token
}
ShellExecExpr is a `$shell`-quoted string.
func (*ShellExecExpr) IterateTokens ¶ added in v0.4.0
func (n *ShellExecExpr) IterateTokens(cb func(*token.Token) bool)
func (*ShellExecExpr) Walk ¶
func (n *ShellExecExpr) Walk(v Visitor)
type ShiftLeftExpr ¶
ShiftLeftExpr is a `$Left << $Right` expression.
func (*ShiftLeftExpr) IterateTokens ¶ added in v0.4.0
func (n *ShiftLeftExpr) IterateTokens(cb func(*token.Token) bool)
func (*ShiftLeftExpr) Walk ¶
func (n *ShiftLeftExpr) Walk(v Visitor)
type ShiftRightExpr ¶
ShiftRightExpr is a `$Left >> $Right` expression.
func (*ShiftRightExpr) IterateTokens ¶ added in v0.4.0
func (n *ShiftRightExpr) IterateTokens(cb func(*token.Token) bool)
func (*ShiftRightExpr) Walk ¶
func (n *ShiftRightExpr) Walk(v Visitor)
type SimpleVar ¶
type SimpleVar struct {
Position *position.Position
DollarTkn *token.Token
IdentifierTkn *token.Token
Name string
}
SimpleVar is a normal PHP variable like `$foo` or `$bar`.
func (*SimpleVar) IterateTokens ¶ added in v0.4.0
type SmallerExpr ¶
SmallerExpr is a `$Left < $Right` expression.
func (*SmallerExpr) IterateTokens ¶ added in v0.4.0
func (n *SmallerExpr) IterateTokens(cb func(*token.Token) bool)
func (*SmallerExpr) Walk ¶
func (n *SmallerExpr) Walk(v Visitor)
type SmallerOrEqualExpr ¶
type SmallerOrEqualExpr struct {
Position *position.Position
Left Node
OpTkn *token.Token
Right Node
}
SmallerOrEqualExpr is a `$Left <= $Right` expression.
func (*SmallerOrEqualExpr) IterateTokens ¶ added in v0.4.0
func (n *SmallerOrEqualExpr) IterateTokens(cb func(*token.Token) bool)
func (*SmallerOrEqualExpr) Walk ¶
func (n *SmallerOrEqualExpr) Walk(v Visitor)
type SpaceshipExpr ¶
SpaceshipExpr is a `$Left <=> $Right` expression.
func (*SpaceshipExpr) IterateTokens ¶ added in v0.4.0
func (n *SpaceshipExpr) IterateTokens(cb func(*token.Token) bool)
func (*SpaceshipExpr) Walk ¶
func (n *SpaceshipExpr) Walk(v Visitor)
type StaticCallExpr ¶
type StaticCallExpr struct {
Position *position.Position
Class Node
DoubleColonTkn *token.Token
OpenCurlyBracketTkn *token.Token
Call Node
CloseCurlyBracketTkn *token.Token
OpenParenthesisTkn *token.Token
Args []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
}
StaticCallExpr is a `$Class::$Call($Args...)` expression.
func (*StaticCallExpr) Arg ¶
func (n *StaticCallExpr) Arg(i int) *Argument
Arg returns the ith argument.
func (*StaticCallExpr) IterateTokens ¶ added in v0.4.0
func (n *StaticCallExpr) IterateTokens(cb func(*token.Token) bool)
func (*StaticCallExpr) Walk ¶
func (n *StaticCallExpr) Walk(v Visitor)
type StaticPropertyFetchExpr ¶
type StaticPropertyFetchExpr struct {
Position *position.Position
Class Node
DoubleColonTkn *token.Token
Property Node
}
StaticPropertyFetchExpr is a `$Class::$Property` expression.
func (*StaticPropertyFetchExpr) IterateTokens ¶ added in v0.4.0
func (n *StaticPropertyFetchExpr) IterateTokens(cb func(*token.Token) bool)
func (*StaticPropertyFetchExpr) Walk ¶
func (n *StaticPropertyFetchExpr) Walk(v Visitor)
type StaticStmt ¶
type StaticStmt struct {
Position *position.Position
StaticTkn *token.Token
Vars []Node
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
}
StaticStmt is a `static $Vars...` statement. Every element in $Vars is a *StaticVarStmt.
func (*StaticStmt) IterateTokens ¶ added in v0.4.0
func (n *StaticStmt) IterateTokens(cb func(*token.Token) bool)
func (*StaticStmt) Walk ¶
func (n *StaticStmt) Walk(v Visitor)
type StaticVarStmt ¶
type StaticVarStmt struct {
Position *position.Position
Variable *SimpleVar
EqualTkn *token.Token
Expr Node
}
StaticVarStmt is a `$Variable = $Expr`. It's a part of the *StaticStmt.
func (*StaticVarStmt) IterateTokens ¶ added in v0.4.0
func (n *StaticVarStmt) IterateTokens(cb func(*token.Token) bool)
func (*StaticVarStmt) Walk ¶
func (n *StaticVarStmt) Walk(v Visitor)
type StmtList ¶
type StmtList struct {
Position *position.Position
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
}
StmtList is a `{ $Stmts... }` statement. It's also known as "block statement".
func (*StmtList) IterateTokens ¶ added in v0.4.0
type String ¶
type String struct {
Position *position.Position
MinusTkn *token.Token
StringTkn *token.Token
Value string
DoubleQuotes bool
}
String is a simple (no interpolation) string literal.
The $Value contains interpreted string bytes, if you need a raw string value, use positions and fetch relevant the source bytes.
$DoubleQuotes tell whether originally this string literal was ""-quoted.
func (*String) IterateTokens ¶ added in v0.4.0
type SwitchStmt ¶
type SwitchStmt struct {
Position *position.Position
SwitchTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Node
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
OpenCurlyBracketTkn *token.Token
CaseSeparatorTkn *token.Token
Cases []Node
CloseCurlyBracketTkn *token.Token
EndSwitchTkn *token.Token
SemiColonTkn *token.Token
AltSyntax bool
}
SwitchStmt is a `switch ($Cond) $CaseList` statement. If $AltSyntax is true, the block will begin with `:` and end with `endswitch`.
func (*SwitchStmt) IterateTokens ¶ added in v0.4.0
func (n *SwitchStmt) IterateTokens(cb func(*token.Token) bool)
func (*SwitchStmt) Walk ¶
func (n *SwitchStmt) Walk(v Visitor)
type TernaryExpr ¶
type TernaryExpr struct {
Position *position.Position
Condition Node
QuestionTkn *token.Token
IfTrue Node
ColonTkn *token.Token
IfFalse Node
}
TernaryExpr is a `$Condition ? $IfTrue : $IfFalse` expression. If $IfTrue is nil, it's `$Condition ?: $IfFalse`.
func (*TernaryExpr) IterateTokens ¶ added in v0.4.0
func (n *TernaryExpr) IterateTokens(cb func(*token.Token) bool)
func (*TernaryExpr) Walk ¶
func (n *TernaryExpr) Walk(v Visitor)
type ThrowExpr ¶ added in v0.4.0
type ThrowExpr struct {
Position *position.Position
ThrowTkn *token.Token
Expr Node
SemiColonTkn *token.Token
}
ThrowExpr node is a `throw $Expr;`
func (*ThrowExpr) IterateTokens ¶ added in v0.4.0
type ThrowStmt ¶
type ThrowStmt struct {
Position *position.Position
ThrowTkn *token.Token
Expr Node
SemiColonTkn *token.Token
}
ThrowStmt is a `throw $Expr` statement.
func (*ThrowStmt) IterateTokens ¶ added in v0.4.0
type TraitAdaptationListStmt ¶
TraitAdaptationListStmt is a block inside a *TraitUseStmt.
func (*TraitAdaptationListStmt) IterateTokens ¶ added in v0.4.0
func (n *TraitAdaptationListStmt) IterateTokens(cb func(*token.Token) bool)
func (*TraitAdaptationListStmt) Walk ¶
func (n *TraitAdaptationListStmt) Walk(v Visitor)
type TraitMethodRefStmt ¶
type TraitMethodRefStmt struct {
Position *position.Position
Trait Node
Method *Identifier
}
func (*TraitMethodRefStmt) IterateTokens ¶ added in v0.4.0
func (n *TraitMethodRefStmt) IterateTokens(cb func(*token.Token) bool)
func (*TraitMethodRefStmt) Walk ¶
func (n *TraitMethodRefStmt) Walk(v Visitor)
type TraitStmt ¶
type TraitStmt struct {
Position *position.Position
AttrGroups []*AttributeGroup
TraitTkn *token.Token
TraitName *Identifier
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
Doc phpdoc.Comment
}
TraitStmt is a trait declaration.
func (*TraitStmt) IterateTokens ¶ added in v0.4.0
type TraitUseAliasStmt ¶
type TraitUseAliasStmt struct {
Position *position.Position
DoubleColonTkn *token.Token
Ref Node
AsTkn *token.Token
Modifier Node
Alias *Identifier
SemiColonTkn *token.Token
}
func (*TraitUseAliasStmt) IterateTokens ¶ added in v0.4.0
func (n *TraitUseAliasStmt) IterateTokens(cb func(*token.Token) bool)
func (*TraitUseAliasStmt) Walk ¶
func (n *TraitUseAliasStmt) Walk(v Visitor)
type TraitUsePrecedenceStmt ¶
type TraitUsePrecedenceStmt struct {
Position *position.Position
DoubleColonTkn *token.Token
Ref Node
InsteadofTkn *token.Token
Insteadof []Node
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
}
func (*TraitUsePrecedenceStmt) IterateTokens ¶ added in v0.4.0
func (n *TraitUsePrecedenceStmt) IterateTokens(cb func(*token.Token) bool)
func (*TraitUsePrecedenceStmt) Walk ¶
func (n *TraitUsePrecedenceStmt) Walk(v Visitor)
type TraitUseStmt ¶
type TraitUseStmt struct {
Position *position.Position
UseTkn *token.Token
Traits []Node
SeparatorTkns []*token.Token
OpenCurlyBracketTkn *token.Token
TraitAdaptationList Node
CloseCurlyBracketTkn *token.Token
SemiColonTkn *token.Token
}
func (*TraitUseStmt) IterateTokens ¶ added in v0.4.0
func (n *TraitUseStmt) IterateTokens(cb func(*token.Token) bool)
func (*TraitUseStmt) Walk ¶
func (n *TraitUseStmt) Walk(v Visitor)
type TryStmt ¶
type TryStmt struct {
Position *position.Position
TryTkn *token.Token
OpenCurlyBracketTkn *token.Token
Stmts []Node
CloseCurlyBracketTkn *token.Token
Catches []Node
Finally Node
}
TryStmt is a `try { $Stmts... } $Catches` statement. $Finally only presents if `finally {...}` block exists.
func (*TryStmt) IterateTokens ¶ added in v0.4.0
type TypeCastExpr ¶
type TypeCastExpr struct {
Position *position.Position
CastTkn *token.Token
Type string // "array" "bool" "int" "float" "object" "string"
Expr Node
}
TypeCastExpr is a `($Type)$Expr` expression.
func (*TypeCastExpr) IterateTokens ¶ added in v0.4.0
func (n *TypeCastExpr) IterateTokens(cb func(*token.Token) bool)
func (*TypeCastExpr) Walk ¶
func (n *TypeCastExpr) Walk(v Visitor)
type UnaryMinusExpr ¶
UnaryMinusExpr is a `-$Expr` expression.
func (*UnaryMinusExpr) IterateTokens ¶ added in v0.4.0
func (n *UnaryMinusExpr) IterateTokens(cb func(*token.Token) bool)
func (*UnaryMinusExpr) Walk ¶
func (n *UnaryMinusExpr) Walk(v Visitor)
type UnaryPlusExpr ¶
UnaryPlusExpr is a `+$Expr` expression.
func (*UnaryPlusExpr) IterateTokens ¶ added in v0.4.0
func (n *UnaryPlusExpr) IterateTokens(cb func(*token.Token) bool)
func (*UnaryPlusExpr) Walk ¶
func (n *UnaryPlusExpr) Walk(v Visitor)
type Union ¶ added in v0.4.0
Union node is a `Type|Type1|...`
func (*Union) IterateTokens ¶ added in v0.4.0
type UnsetCastExpr ¶
UnsetCastExpr is a `(unset)$Expr` expression.
func (*UnsetCastExpr) IterateTokens ¶ added in v0.4.0
func (n *UnsetCastExpr) IterateTokens(cb func(*token.Token) bool)
func (*UnsetCastExpr) Walk ¶
func (n *UnsetCastExpr) Walk(v Visitor)
type UnsetStmt ¶
type UnsetStmt struct {
Position *position.Position
UnsetTkn *token.Token
OpenParenthesisTkn *token.Token
Vars []Node
SeparatorTkns []*token.Token
CloseParenthesisTkn *token.Token
SemiColonTkn *token.Token
}
UnsetStmt is a `unset($Vars...)` statement.
func (*UnsetStmt) IterateTokens ¶ added in v0.4.0
type UseListStmt ¶
type UseListStmt struct {
Position *position.Position
UseTkn *token.Token
UseType *Identifier
Uses []Node
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
}
func (*UseListStmt) IterateTokens ¶ added in v0.4.0
func (n *UseListStmt) IterateTokens(cb func(*token.Token) bool)
func (*UseListStmt) Walk ¶
func (n *UseListStmt) Walk(v Visitor)
type UseStmt ¶
type UseStmt struct {
Position *position.Position
UseType *Identifier
NsSeparatorTkn *token.Token
Use *Name
AsTkn *token.Token
Alias *Identifier
}
func (*UseStmt) IterateTokens ¶ added in v0.4.0
type Var ¶
type Var struct {
Position *position.Position
DollarTkn *token.Token
OpenCurlyBracketTkn *token.Token
Expr Node
CloseCurlyBracketTkn *token.Token
}
Var is variable variable expression like `$$foo` or `${"foo"}`.
type WhileStmt ¶
type WhileStmt struct {
Position *position.Position
WhileTkn *token.Token
OpenParenthesisTkn *token.Token
Cond Node
CloseParenthesisTkn *token.Token
ColonTkn *token.Token
Stmt Node
EndWhileTkn *token.Token
SemiColonTkn *token.Token
AltSyntax bool
}
WhileStmt is a `while ($Cond) $Stmt` statement. If $AltSyntax is true, the block will begin with `:` and end with `endwhile`.
func (*WhileStmt) IterateTokens ¶ added in v0.4.0
type YieldExpr ¶
type YieldExpr struct {
Position *position.Position
YieldTkn *token.Token
Key Node
DoubleArrowTkn *token.Token
Value Node
}
YieldExpr is a `yield $Key => $Value` expression. If $Key is nil, it's `yield $Value`.
func (*YieldExpr) IterateTokens ¶ added in v0.4.0
type YieldFromExpr ¶
YieldFromExpr is a `yield from $Expr` expression.
func (*YieldFromExpr) IterateTokens ¶ added in v0.4.0
func (n *YieldFromExpr) IterateTokens(cb func(*token.Token) bool)
func (*YieldFromExpr) Walk ¶
func (n *YieldFromExpr) Walk(v Visitor)