2020-03-12 22:20:48 +00:00
|
|
|
package ast
|
|
|
|
|
2023-12-09 21:36:19 +00:00
|
|
|
import "git.maride.cc/maride/php-parser/pkg/position"
|
2020-12-07 22:04:12 +00:00
|
|
|
|
2023-03-25 20:53:52 +00:00
|
|
|
// The edge-case/overwrites, from node type name to their visitor function name.
|
|
|
|
var TypeToVisitorNameMap = map[string]string{
|
|
|
|
"Name": "NameName",
|
|
|
|
"NamePart": "NameNamePart",
|
|
|
|
"StmtGroupUseList": "StmtGroupUse",
|
|
|
|
"StmtUseList": "StmtUse",
|
|
|
|
"StmtUse": "StmtUseDeclaration",
|
|
|
|
}
|
|
|
|
|
2020-03-12 22:20:48 +00:00
|
|
|
type Vertex interface {
|
2020-12-28 19:13:08 +00:00
|
|
|
Accept(v Visitor)
|
2020-12-07 22:04:12 +00:00
|
|
|
GetPosition() *position.Position
|
2023-03-26 19:31:37 +00:00
|
|
|
GetType() Type
|
2020-03-12 22:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Visitor interface {
|
|
|
|
Root(n *Root)
|
|
|
|
Nullable(n *Nullable)
|
|
|
|
Parameter(n *Parameter)
|
|
|
|
Identifier(n *Identifier)
|
|
|
|
Argument(n *Argument)
|
2021-07-30 17:53:27 +00:00
|
|
|
MatchArm(n *MatchArm)
|
|
|
|
Union(n *Union)
|
2022-06-26 00:31:29 +00:00
|
|
|
Intersection(n *Intersection)
|
2021-07-30 17:53:27 +00:00
|
|
|
Attribute(n *Attribute)
|
|
|
|
AttributeGroup(n *AttributeGroup)
|
2020-03-12 22:20:48 +00:00
|
|
|
|
|
|
|
StmtBreak(n *StmtBreak)
|
|
|
|
StmtCase(n *StmtCase)
|
|
|
|
StmtCatch(n *StmtCatch)
|
2021-07-31 16:44:09 +00:00
|
|
|
StmtEnum(n *StmtEnum)
|
|
|
|
EnumCase(n *EnumCase)
|
2020-03-12 22:20:48 +00:00
|
|
|
StmtClass(n *StmtClass)
|
|
|
|
StmtClassConstList(n *StmtClassConstList)
|
|
|
|
StmtClassMethod(n *StmtClassMethod)
|
|
|
|
StmtConstList(n *StmtConstList)
|
|
|
|
StmtConstant(n *StmtConstant)
|
|
|
|
StmtContinue(n *StmtContinue)
|
|
|
|
StmtDeclare(n *StmtDeclare)
|
|
|
|
StmtDefault(n *StmtDefault)
|
|
|
|
StmtDo(n *StmtDo)
|
|
|
|
StmtEcho(n *StmtEcho)
|
|
|
|
StmtElse(n *StmtElse)
|
|
|
|
StmtElseIf(n *StmtElseIf)
|
|
|
|
StmtExpression(n *StmtExpression)
|
|
|
|
StmtFinally(n *StmtFinally)
|
|
|
|
StmtFor(n *StmtFor)
|
|
|
|
StmtForeach(n *StmtForeach)
|
|
|
|
StmtFunction(n *StmtFunction)
|
|
|
|
StmtGlobal(n *StmtGlobal)
|
|
|
|
StmtGoto(n *StmtGoto)
|
|
|
|
StmtHaltCompiler(n *StmtHaltCompiler)
|
|
|
|
StmtIf(n *StmtIf)
|
|
|
|
StmtInlineHtml(n *StmtInlineHtml)
|
|
|
|
StmtInterface(n *StmtInterface)
|
|
|
|
StmtLabel(n *StmtLabel)
|
|
|
|
StmtNamespace(n *StmtNamespace)
|
|
|
|
StmtNop(n *StmtNop)
|
|
|
|
StmtProperty(n *StmtProperty)
|
|
|
|
StmtPropertyList(n *StmtPropertyList)
|
|
|
|
StmtReturn(n *StmtReturn)
|
|
|
|
StmtStatic(n *StmtStatic)
|
|
|
|
StmtStaticVar(n *StmtStaticVar)
|
|
|
|
StmtStmtList(n *StmtStmtList)
|
|
|
|
StmtSwitch(n *StmtSwitch)
|
|
|
|
StmtThrow(n *StmtThrow)
|
|
|
|
StmtTrait(n *StmtTrait)
|
|
|
|
StmtTraitUse(n *StmtTraitUse)
|
|
|
|
StmtTraitUseAlias(n *StmtTraitUseAlias)
|
|
|
|
StmtTraitUsePrecedence(n *StmtTraitUsePrecedence)
|
|
|
|
StmtTry(n *StmtTry)
|
|
|
|
StmtUnset(n *StmtUnset)
|
2020-12-28 21:01:02 +00:00
|
|
|
StmtUse(n *StmtUseList)
|
|
|
|
StmtGroupUse(n *StmtGroupUseList)
|
|
|
|
StmtUseDeclaration(n *StmtUse)
|
2020-03-12 22:20:48 +00:00
|
|
|
StmtWhile(n *StmtWhile)
|
|
|
|
|
|
|
|
ExprArray(n *ExprArray)
|
|
|
|
ExprArrayDimFetch(n *ExprArrayDimFetch)
|
|
|
|
ExprArrayItem(n *ExprArrayItem)
|
|
|
|
ExprArrowFunction(n *ExprArrowFunction)
|
2020-12-27 22:02:14 +00:00
|
|
|
ExprBrackets(n *ExprBrackets)
|
2020-03-12 22:20:48 +00:00
|
|
|
ExprBitwiseNot(n *ExprBitwiseNot)
|
|
|
|
ExprBooleanNot(n *ExprBooleanNot)
|
|
|
|
ExprClassConstFetch(n *ExprClassConstFetch)
|
|
|
|
ExprClone(n *ExprClone)
|
|
|
|
ExprClosure(n *ExprClosure)
|
|
|
|
ExprClosureUse(n *ExprClosureUse)
|
|
|
|
ExprConstFetch(n *ExprConstFetch)
|
|
|
|
ExprEmpty(n *ExprEmpty)
|
|
|
|
ExprErrorSuppress(n *ExprErrorSuppress)
|
|
|
|
ExprEval(n *ExprEval)
|
|
|
|
ExprExit(n *ExprExit)
|
|
|
|
ExprFunctionCall(n *ExprFunctionCall)
|
|
|
|
ExprInclude(n *ExprInclude)
|
|
|
|
ExprIncludeOnce(n *ExprIncludeOnce)
|
|
|
|
ExprInstanceOf(n *ExprInstanceOf)
|
|
|
|
ExprIsset(n *ExprIsset)
|
|
|
|
ExprList(n *ExprList)
|
|
|
|
ExprMethodCall(n *ExprMethodCall)
|
2021-07-30 17:53:27 +00:00
|
|
|
ExprNullsafeMethodCall(n *ExprNullsafeMethodCall)
|
|
|
|
ExprMatch(n *ExprMatch)
|
2020-03-12 22:20:48 +00:00
|
|
|
ExprNew(n *ExprNew)
|
|
|
|
ExprPostDec(n *ExprPostDec)
|
|
|
|
ExprPostInc(n *ExprPostInc)
|
|
|
|
ExprPreDec(n *ExprPreDec)
|
|
|
|
ExprPreInc(n *ExprPreInc)
|
|
|
|
ExprPrint(n *ExprPrint)
|
|
|
|
ExprPropertyFetch(n *ExprPropertyFetch)
|
2021-07-30 17:53:27 +00:00
|
|
|
ExprNullsafePropertyFetch(n *ExprNullsafePropertyFetch)
|
2020-03-12 22:20:48 +00:00
|
|
|
ExprRequire(n *ExprRequire)
|
|
|
|
ExprRequireOnce(n *ExprRequireOnce)
|
|
|
|
ExprShellExec(n *ExprShellExec)
|
|
|
|
ExprStaticCall(n *ExprStaticCall)
|
|
|
|
ExprStaticPropertyFetch(n *ExprStaticPropertyFetch)
|
|
|
|
ExprTernary(n *ExprTernary)
|
2021-07-30 17:53:27 +00:00
|
|
|
ExprThrow(n *ExprThrow)
|
2020-03-12 22:20:48 +00:00
|
|
|
ExprUnaryMinus(n *ExprUnaryMinus)
|
|
|
|
ExprUnaryPlus(n *ExprUnaryPlus)
|
|
|
|
ExprVariable(n *ExprVariable)
|
|
|
|
ExprYield(n *ExprYield)
|
|
|
|
ExprYieldFrom(n *ExprYieldFrom)
|
|
|
|
|
|
|
|
ExprAssign(n *ExprAssign)
|
|
|
|
ExprAssignReference(n *ExprAssignReference)
|
|
|
|
ExprAssignBitwiseAnd(n *ExprAssignBitwiseAnd)
|
|
|
|
ExprAssignBitwiseOr(n *ExprAssignBitwiseOr)
|
|
|
|
ExprAssignBitwiseXor(n *ExprAssignBitwiseXor)
|
|
|
|
ExprAssignCoalesce(n *ExprAssignCoalesce)
|
|
|
|
ExprAssignConcat(n *ExprAssignConcat)
|
|
|
|
ExprAssignDiv(n *ExprAssignDiv)
|
|
|
|
ExprAssignMinus(n *ExprAssignMinus)
|
|
|
|
ExprAssignMod(n *ExprAssignMod)
|
|
|
|
ExprAssignMul(n *ExprAssignMul)
|
|
|
|
ExprAssignPlus(n *ExprAssignPlus)
|
|
|
|
ExprAssignPow(n *ExprAssignPow)
|
|
|
|
ExprAssignShiftLeft(n *ExprAssignShiftLeft)
|
|
|
|
ExprAssignShiftRight(n *ExprAssignShiftRight)
|
|
|
|
|
|
|
|
ExprBinaryBitwiseAnd(n *ExprBinaryBitwiseAnd)
|
|
|
|
ExprBinaryBitwiseOr(n *ExprBinaryBitwiseOr)
|
|
|
|
ExprBinaryBitwiseXor(n *ExprBinaryBitwiseXor)
|
|
|
|
ExprBinaryBooleanAnd(n *ExprBinaryBooleanAnd)
|
|
|
|
ExprBinaryBooleanOr(n *ExprBinaryBooleanOr)
|
|
|
|
ExprBinaryCoalesce(n *ExprBinaryCoalesce)
|
|
|
|
ExprBinaryConcat(n *ExprBinaryConcat)
|
|
|
|
ExprBinaryDiv(n *ExprBinaryDiv)
|
|
|
|
ExprBinaryEqual(n *ExprBinaryEqual)
|
|
|
|
ExprBinaryGreater(n *ExprBinaryGreater)
|
|
|
|
ExprBinaryGreaterOrEqual(n *ExprBinaryGreaterOrEqual)
|
|
|
|
ExprBinaryIdentical(n *ExprBinaryIdentical)
|
|
|
|
ExprBinaryLogicalAnd(n *ExprBinaryLogicalAnd)
|
|
|
|
ExprBinaryLogicalOr(n *ExprBinaryLogicalOr)
|
|
|
|
ExprBinaryLogicalXor(n *ExprBinaryLogicalXor)
|
|
|
|
ExprBinaryMinus(n *ExprBinaryMinus)
|
|
|
|
ExprBinaryMod(n *ExprBinaryMod)
|
|
|
|
ExprBinaryMul(n *ExprBinaryMul)
|
|
|
|
ExprBinaryNotEqual(n *ExprBinaryNotEqual)
|
|
|
|
ExprBinaryNotIdentical(n *ExprBinaryNotIdentical)
|
|
|
|
ExprBinaryPlus(n *ExprBinaryPlus)
|
|
|
|
ExprBinaryPow(n *ExprBinaryPow)
|
|
|
|
ExprBinaryShiftLeft(n *ExprBinaryShiftLeft)
|
|
|
|
ExprBinaryShiftRight(n *ExprBinaryShiftRight)
|
|
|
|
ExprBinarySmaller(n *ExprBinarySmaller)
|
|
|
|
ExprBinarySmallerOrEqual(n *ExprBinarySmallerOrEqual)
|
|
|
|
ExprBinarySpaceship(n *ExprBinarySpaceship)
|
|
|
|
|
|
|
|
ExprCastArray(n *ExprCastArray)
|
|
|
|
ExprCastBool(n *ExprCastBool)
|
|
|
|
ExprCastDouble(n *ExprCastDouble)
|
|
|
|
ExprCastInt(n *ExprCastInt)
|
|
|
|
ExprCastObject(n *ExprCastObject)
|
|
|
|
ExprCastString(n *ExprCastString)
|
|
|
|
ExprCastUnset(n *ExprCastUnset)
|
|
|
|
|
|
|
|
ScalarDnumber(n *ScalarDnumber)
|
|
|
|
ScalarEncapsed(n *ScalarEncapsed)
|
|
|
|
ScalarEncapsedStringPart(n *ScalarEncapsedStringPart)
|
2020-12-27 22:38:39 +00:00
|
|
|
ScalarEncapsedStringVar(n *ScalarEncapsedStringVar)
|
2020-12-27 22:53:48 +00:00
|
|
|
ScalarEncapsedStringBrackets(n *ScalarEncapsedStringBrackets)
|
2020-03-12 22:20:48 +00:00
|
|
|
ScalarHeredoc(n *ScalarHeredoc)
|
|
|
|
ScalarLnumber(n *ScalarLnumber)
|
|
|
|
ScalarMagicConstant(n *ScalarMagicConstant)
|
|
|
|
ScalarString(n *ScalarString)
|
2020-05-12 21:16:36 +00:00
|
|
|
|
2020-12-28 21:01:02 +00:00
|
|
|
NameName(n *Name)
|
2020-05-12 21:16:36 +00:00
|
|
|
NameFullyQualified(n *NameFullyQualified)
|
|
|
|
NameRelative(n *NameRelative)
|
2020-12-28 21:01:02 +00:00
|
|
|
NameNamePart(n *NamePart)
|
2020-03-12 22:20:48 +00:00
|
|
|
}
|