From 92d341cbb570c17022e1f6889ba90ebec661e17e Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Sun, 26 Mar 2023 21:31:37 +0200 Subject: [PATCH] feat: generate ast.Type "enum" --- internal/php7/node.go | 24 ++ internal/php8/node.go | 28 ++ pkg/ast/ast.go | 1 + pkg/ast/node_funcs.go | 837 ++++++++++++++++++++++++++++++++++++++ pkg/ast/node_funcs_gen.go | 14 + 5 files changed, 904 insertions(+) diff --git a/internal/php7/node.go b/internal/php7/node.go index 4870266..7287f75 100644 --- a/internal/php7/node.go +++ b/internal/php7/node.go @@ -21,6 +21,10 @@ func (n *ParserBrackets) GetPosition() *position.Position { return n.Position } +func (n *ParserBrackets) GetType() ast.Type { + return ast.TypeNone +} + type ParserSeparatedList struct { Position *position.Position Items []ast.Vertex @@ -35,6 +39,10 @@ func (n *ParserSeparatedList) GetPosition() *position.Position { return n.Position } +func (n *ParserSeparatedList) GetType() ast.Type { + return ast.TypeNone +} + // TraitAdaptationList node type TraitAdaptationList struct { Position *position.Position @@ -51,6 +59,10 @@ func (n *TraitAdaptationList) GetPosition() *position.Position { return n.Position } +func (n *TraitAdaptationList) GetType() ast.Type { + return ast.TypeNone +} + // ArgumentList node type ArgumentList struct { Position *position.Position @@ -68,6 +80,10 @@ func (n *ArgumentList) GetPosition() *position.Position { return n.Position } +func (n *ArgumentList) GetType() ast.Type { + return ast.TypeNone +} + type ReturnType struct { Position *position.Position ColonTkn *token.Token @@ -82,6 +98,10 @@ func (n *ReturnType) GetPosition() *position.Position { return n.Position } +func (n *ReturnType) GetType() ast.Type { + return ast.TypeNone +} + // TraitMethodRef node type TraitMethodRef struct { Position *position.Position @@ -97,3 +117,7 @@ func (n *TraitMethodRef) Accept(v ast.Visitor) { func (n *TraitMethodRef) GetPosition() *position.Position { return n.Position } + +func (n *TraitMethodRef) GetType() ast.Type { + return ast.TypeNone +} diff --git a/internal/php8/node.go b/internal/php8/node.go index 37e87c8..a383c2d 100644 --- a/internal/php8/node.go +++ b/internal/php8/node.go @@ -21,6 +21,10 @@ func (n *ParserBrackets) GetPosition() *position.Position { return n.Position } +func (n *ParserBrackets) GetType() ast.Type { + return ast.TypeNone +} + type ParserSeparatedList struct { Position *position.Position Items []ast.Vertex @@ -35,6 +39,10 @@ func (n *ParserSeparatedList) GetPosition() *position.Position { return n.Position } +func (n *ParserSeparatedList) GetType() ast.Type { + return ast.TypeNone +} + // TraitAdaptationList node type TraitAdaptationList struct { Position *position.Position @@ -51,6 +59,10 @@ func (n *TraitAdaptationList) GetPosition() *position.Position { return n.Position } +func (n *TraitAdaptationList) GetType() ast.Type { + return ast.TypeNone +} + // ArgumentList node type ArgumentList struct { Position *position.Position @@ -69,6 +81,10 @@ func (n *ArgumentList) GetPosition() *position.Position { return n.Position } +func (n *ArgumentList) GetType() ast.Type { + return ast.TypeNone +} + type EnumCaseExpr struct { Position *position.Position AssignTkn *token.Token @@ -83,6 +99,10 @@ func (n *EnumCaseExpr) GetPosition() *position.Position { return n.Position } +func (n *EnumCaseExpr) GetType() ast.Type { + return ast.TypeNone +} + type ReturnType struct { Position *position.Position ColonTkn *token.Token @@ -97,6 +117,10 @@ func (n *ReturnType) GetPosition() *position.Position { return n.Position } +func (n *ReturnType) GetType() ast.Type { + return ast.TypeNone +} + // TraitMethodRef node type TraitMethodRef struct { Position *position.Position @@ -112,3 +136,7 @@ func (n *TraitMethodRef) Accept(v ast.Visitor) { func (n *TraitMethodRef) GetPosition() *position.Position { return n.Position } + +func (n *TraitMethodRef) GetType() ast.Type { + return ast.TypeNone +} diff --git a/pkg/ast/ast.go b/pkg/ast/ast.go index 1ba6082..8cf2594 100644 --- a/pkg/ast/ast.go +++ b/pkg/ast/ast.go @@ -14,6 +14,7 @@ var TypeToVisitorNameMap = map[string]string{ type Vertex interface { Accept(v Visitor) GetPosition() *position.Position + GetType() Type } type Visitor interface { diff --git a/pkg/ast/node_funcs.go b/pkg/ast/node_funcs.go index fb5b8fa..8b55164 100644 --- a/pkg/ast/node_funcs.go +++ b/pkg/ast/node_funcs.go @@ -4,6 +4,179 @@ package ast import "github.com/VKCOM/php-parser/pkg/position" +type Type int + +const ( + TypeNone Type = iota + TypeRoot + TypeNullable + TypeUnion + TypeIntersection + TypeParameter + TypeIdentifier + TypeArgument + TypeAttribute + TypeAttributeGroup + TypeScalarDnumber + TypeScalarEncapsed + TypeScalarEncapsedStringPart + TypeScalarEncapsedStringVar + TypeScalarEncapsedStringBrackets + TypeScalarHeredoc + TypeScalarLnumber + TypeScalarMagicConstant + TypeScalarString + TypeStmtBreak + TypeStmtCase + TypeStmtCatch + TypeStmtEnum + TypeEnumCase + TypeStmtClass + TypeStmtClassConstList + TypeStmtClassMethod + TypeStmtConstList + TypeStmtConstant + TypeStmtContinue + TypeStmtDeclare + TypeStmtDefault + TypeStmtDo + TypeStmtEcho + TypeStmtElse + TypeStmtElseIf + TypeStmtExpression + TypeStmtFinally + TypeStmtFor + TypeStmtForeach + TypeStmtFunction + TypeStmtGlobal + TypeStmtGoto + TypeStmtHaltCompiler + TypeStmtIf + TypeStmtInlineHtml + TypeStmtInterface + TypeStmtLabel + TypeStmtNamespace + TypeStmtNop + TypeStmtProperty + TypeStmtPropertyList + TypeStmtReturn + TypeStmtStatic + TypeStmtStaticVar + TypeStmtStmtList + TypeStmtSwitch + TypeStmtThrow + TypeStmtTrait + TypeStmtTraitUse + TypeStmtTraitUseAlias + TypeStmtTraitUsePrecedence + TypeStmtTry + TypeStmtUnset + TypeStmtUseList + TypeStmtGroupUseList + TypeStmtUse + TypeStmtWhile + TypeExprArray + TypeExprArrayDimFetch + TypeExprArrayItem + TypeExprArrowFunction + TypeExprBitwiseNot + TypeExprBooleanNot + TypeExprBrackets + TypeExprClassConstFetch + TypeExprClone + TypeExprClosure + TypeExprClosureUse + TypeExprConstFetch + TypeExprEmpty + TypeExprErrorSuppress + TypeExprEval + TypeExprExit + TypeExprFunctionCall + TypeExprInclude + TypeExprIncludeOnce + TypeExprInstanceOf + TypeExprIsset + TypeExprList + TypeExprMethodCall + TypeExprNullsafeMethodCall + TypeExprNew + TypeExprPostDec + TypeExprPostInc + TypeExprPreDec + TypeExprPreInc + TypeExprPrint + TypeExprPropertyFetch + TypeExprNullsafePropertyFetch + TypeExprRequire + TypeExprRequireOnce + TypeExprShellExec + TypeExprStaticCall + TypeExprStaticPropertyFetch + TypeExprTernary + TypeExprUnaryMinus + TypeExprUnaryPlus + TypeExprVariable + TypeExprYield + TypeExprYieldFrom + TypeExprCastArray + TypeExprCastBool + TypeExprCastDouble + TypeExprCastInt + TypeExprCastObject + TypeExprCastString + TypeExprCastUnset + TypeExprAssign + TypeExprAssignReference + TypeExprAssignBitwiseAnd + TypeExprAssignBitwiseOr + TypeExprAssignBitwiseXor + TypeExprAssignCoalesce + TypeExprAssignConcat + TypeExprAssignDiv + TypeExprAssignMinus + TypeExprAssignMod + TypeExprAssignMul + TypeExprAssignPlus + TypeExprAssignPow + TypeExprAssignShiftLeft + TypeExprAssignShiftRight + TypeExprBinaryBitwiseAnd + TypeExprBinaryBitwiseOr + TypeExprBinaryBitwiseXor + TypeExprBinaryBooleanAnd + TypeExprBinaryBooleanOr + TypeExprBinaryCoalesce + TypeExprBinaryConcat + TypeExprBinaryDiv + TypeExprBinaryEqual + TypeExprBinaryGreater + TypeExprBinaryGreaterOrEqual + TypeExprBinaryIdentical + TypeExprBinaryLogicalAnd + TypeExprBinaryLogicalOr + TypeExprBinaryLogicalXor + TypeExprBinaryMinus + TypeExprBinaryMod + TypeExprBinaryMul + TypeExprBinaryNotEqual + TypeExprBinaryNotIdentical + TypeExprBinaryPlus + TypeExprBinaryPow + TypeExprBinaryShiftLeft + TypeExprBinaryShiftRight + TypeExprBinarySmaller + TypeExprBinarySmallerOrEqual + TypeExprBinarySpaceship + TypeExprMatch + TypeExprThrow + TypeMatchArm + TypeName + TypeNameFullyQualified + TypeNameRelative + TypeNamePart + TypeCount +) + var _ Vertex = &Root{} func (n *Root) Accept(v Visitor) { @@ -14,6 +187,10 @@ func (n *Root) GetPosition() *position.Position { return n.Position } +func (n *Root) GetType() Type { + return TypeRoot +} + var _ Vertex = &Nullable{} func (n *Nullable) Accept(v Visitor) { @@ -24,6 +201,10 @@ func (n *Nullable) GetPosition() *position.Position { return n.Position } +func (n *Nullable) GetType() Type { + return TypeNullable +} + var _ Vertex = &Union{} func (n *Union) Accept(v Visitor) { @@ -34,6 +215,10 @@ func (n *Union) GetPosition() *position.Position { return n.Position } +func (n *Union) GetType() Type { + return TypeUnion +} + var _ Vertex = &Intersection{} func (n *Intersection) Accept(v Visitor) { @@ -44,6 +229,10 @@ func (n *Intersection) GetPosition() *position.Position { return n.Position } +func (n *Intersection) GetType() Type { + return TypeIntersection +} + var _ Vertex = &Parameter{} func (n *Parameter) Accept(v Visitor) { @@ -54,6 +243,10 @@ func (n *Parameter) GetPosition() *position.Position { return n.Position } +func (n *Parameter) GetType() Type { + return TypeParameter +} + var _ Vertex = &Identifier{} func (n *Identifier) Accept(v Visitor) { @@ -64,6 +257,10 @@ func (n *Identifier) GetPosition() *position.Position { return n.Position } +func (n *Identifier) GetType() Type { + return TypeIdentifier +} + var _ Vertex = &Argument{} func (n *Argument) Accept(v Visitor) { @@ -74,6 +271,10 @@ func (n *Argument) GetPosition() *position.Position { return n.Position } +func (n *Argument) GetType() Type { + return TypeArgument +} + var _ Vertex = &Attribute{} func (n *Attribute) Accept(v Visitor) { @@ -84,6 +285,10 @@ func (n *Attribute) GetPosition() *position.Position { return n.Position } +func (n *Attribute) GetType() Type { + return TypeAttribute +} + var _ Vertex = &AttributeGroup{} func (n *AttributeGroup) Accept(v Visitor) { @@ -94,6 +299,10 @@ func (n *AttributeGroup) GetPosition() *position.Position { return n.Position } +func (n *AttributeGroup) GetType() Type { + return TypeAttributeGroup +} + var _ Vertex = &ScalarDnumber{} func (n *ScalarDnumber) Accept(v Visitor) { @@ -104,6 +313,10 @@ func (n *ScalarDnumber) GetPosition() *position.Position { return n.Position } +func (n *ScalarDnumber) GetType() Type { + return TypeScalarDnumber +} + var _ Vertex = &ScalarEncapsed{} func (n *ScalarEncapsed) Accept(v Visitor) { @@ -114,6 +327,10 @@ func (n *ScalarEncapsed) GetPosition() *position.Position { return n.Position } +func (n *ScalarEncapsed) GetType() Type { + return TypeScalarEncapsed +} + var _ Vertex = &ScalarEncapsedStringPart{} func (n *ScalarEncapsedStringPart) Accept(v Visitor) { @@ -124,6 +341,10 @@ func (n *ScalarEncapsedStringPart) GetPosition() *position.Position { return n.Position } +func (n *ScalarEncapsedStringPart) GetType() Type { + return TypeScalarEncapsedStringPart +} + var _ Vertex = &ScalarEncapsedStringVar{} func (n *ScalarEncapsedStringVar) Accept(v Visitor) { @@ -134,6 +355,10 @@ func (n *ScalarEncapsedStringVar) GetPosition() *position.Position { return n.Position } +func (n *ScalarEncapsedStringVar) GetType() Type { + return TypeScalarEncapsedStringVar +} + var _ Vertex = &ScalarEncapsedStringBrackets{} func (n *ScalarEncapsedStringBrackets) Accept(v Visitor) { @@ -144,6 +369,10 @@ func (n *ScalarEncapsedStringBrackets) GetPosition() *position.Position { return n.Position } +func (n *ScalarEncapsedStringBrackets) GetType() Type { + return TypeScalarEncapsedStringBrackets +} + var _ Vertex = &ScalarHeredoc{} func (n *ScalarHeredoc) Accept(v Visitor) { @@ -154,6 +383,10 @@ func (n *ScalarHeredoc) GetPosition() *position.Position { return n.Position } +func (n *ScalarHeredoc) GetType() Type { + return TypeScalarHeredoc +} + var _ Vertex = &ScalarLnumber{} func (n *ScalarLnumber) Accept(v Visitor) { @@ -164,6 +397,10 @@ func (n *ScalarLnumber) GetPosition() *position.Position { return n.Position } +func (n *ScalarLnumber) GetType() Type { + return TypeScalarLnumber +} + var _ Vertex = &ScalarMagicConstant{} func (n *ScalarMagicConstant) Accept(v Visitor) { @@ -174,6 +411,10 @@ func (n *ScalarMagicConstant) GetPosition() *position.Position { return n.Position } +func (n *ScalarMagicConstant) GetType() Type { + return TypeScalarMagicConstant +} + var _ Vertex = &ScalarString{} func (n *ScalarString) Accept(v Visitor) { @@ -184,6 +425,10 @@ func (n *ScalarString) GetPosition() *position.Position { return n.Position } +func (n *ScalarString) GetType() Type { + return TypeScalarString +} + var _ Vertex = &StmtBreak{} func (n *StmtBreak) Accept(v Visitor) { @@ -194,6 +439,10 @@ func (n *StmtBreak) GetPosition() *position.Position { return n.Position } +func (n *StmtBreak) GetType() Type { + return TypeStmtBreak +} + var _ Vertex = &StmtCase{} func (n *StmtCase) Accept(v Visitor) { @@ -204,6 +453,10 @@ func (n *StmtCase) GetPosition() *position.Position { return n.Position } +func (n *StmtCase) GetType() Type { + return TypeStmtCase +} + var _ Vertex = &StmtCatch{} func (n *StmtCatch) Accept(v Visitor) { @@ -214,6 +467,10 @@ func (n *StmtCatch) GetPosition() *position.Position { return n.Position } +func (n *StmtCatch) GetType() Type { + return TypeStmtCatch +} + var _ Vertex = &StmtEnum{} func (n *StmtEnum) Accept(v Visitor) { @@ -224,6 +481,10 @@ func (n *StmtEnum) GetPosition() *position.Position { return n.Position } +func (n *StmtEnum) GetType() Type { + return TypeStmtEnum +} + var _ Vertex = &EnumCase{} func (n *EnumCase) Accept(v Visitor) { @@ -234,6 +495,10 @@ func (n *EnumCase) GetPosition() *position.Position { return n.Position } +func (n *EnumCase) GetType() Type { + return TypeEnumCase +} + var _ Vertex = &StmtClass{} func (n *StmtClass) Accept(v Visitor) { @@ -244,6 +509,10 @@ func (n *StmtClass) GetPosition() *position.Position { return n.Position } +func (n *StmtClass) GetType() Type { + return TypeStmtClass +} + var _ Vertex = &StmtClassConstList{} func (n *StmtClassConstList) Accept(v Visitor) { @@ -254,6 +523,10 @@ func (n *StmtClassConstList) GetPosition() *position.Position { return n.Position } +func (n *StmtClassConstList) GetType() Type { + return TypeStmtClassConstList +} + var _ Vertex = &StmtClassMethod{} func (n *StmtClassMethod) Accept(v Visitor) { @@ -264,6 +537,10 @@ func (n *StmtClassMethod) GetPosition() *position.Position { return n.Position } +func (n *StmtClassMethod) GetType() Type { + return TypeStmtClassMethod +} + var _ Vertex = &StmtConstList{} func (n *StmtConstList) Accept(v Visitor) { @@ -274,6 +551,10 @@ func (n *StmtConstList) GetPosition() *position.Position { return n.Position } +func (n *StmtConstList) GetType() Type { + return TypeStmtConstList +} + var _ Vertex = &StmtConstant{} func (n *StmtConstant) Accept(v Visitor) { @@ -284,6 +565,10 @@ func (n *StmtConstant) GetPosition() *position.Position { return n.Position } +func (n *StmtConstant) GetType() Type { + return TypeStmtConstant +} + var _ Vertex = &StmtContinue{} func (n *StmtContinue) Accept(v Visitor) { @@ -294,6 +579,10 @@ func (n *StmtContinue) GetPosition() *position.Position { return n.Position } +func (n *StmtContinue) GetType() Type { + return TypeStmtContinue +} + var _ Vertex = &StmtDeclare{} func (n *StmtDeclare) Accept(v Visitor) { @@ -304,6 +593,10 @@ func (n *StmtDeclare) GetPosition() *position.Position { return n.Position } +func (n *StmtDeclare) GetType() Type { + return TypeStmtDeclare +} + var _ Vertex = &StmtDefault{} func (n *StmtDefault) Accept(v Visitor) { @@ -314,6 +607,10 @@ func (n *StmtDefault) GetPosition() *position.Position { return n.Position } +func (n *StmtDefault) GetType() Type { + return TypeStmtDefault +} + var _ Vertex = &StmtDo{} func (n *StmtDo) Accept(v Visitor) { @@ -324,6 +621,10 @@ func (n *StmtDo) GetPosition() *position.Position { return n.Position } +func (n *StmtDo) GetType() Type { + return TypeStmtDo +} + var _ Vertex = &StmtEcho{} func (n *StmtEcho) Accept(v Visitor) { @@ -334,6 +635,10 @@ func (n *StmtEcho) GetPosition() *position.Position { return n.Position } +func (n *StmtEcho) GetType() Type { + return TypeStmtEcho +} + var _ Vertex = &StmtElse{} func (n *StmtElse) Accept(v Visitor) { @@ -344,6 +649,10 @@ func (n *StmtElse) GetPosition() *position.Position { return n.Position } +func (n *StmtElse) GetType() Type { + return TypeStmtElse +} + var _ Vertex = &StmtElseIf{} func (n *StmtElseIf) Accept(v Visitor) { @@ -354,6 +663,10 @@ func (n *StmtElseIf) GetPosition() *position.Position { return n.Position } +func (n *StmtElseIf) GetType() Type { + return TypeStmtElseIf +} + var _ Vertex = &StmtExpression{} func (n *StmtExpression) Accept(v Visitor) { @@ -364,6 +677,10 @@ func (n *StmtExpression) GetPosition() *position.Position { return n.Position } +func (n *StmtExpression) GetType() Type { + return TypeStmtExpression +} + var _ Vertex = &StmtFinally{} func (n *StmtFinally) Accept(v Visitor) { @@ -374,6 +691,10 @@ func (n *StmtFinally) GetPosition() *position.Position { return n.Position } +func (n *StmtFinally) GetType() Type { + return TypeStmtFinally +} + var _ Vertex = &StmtFor{} func (n *StmtFor) Accept(v Visitor) { @@ -384,6 +705,10 @@ func (n *StmtFor) GetPosition() *position.Position { return n.Position } +func (n *StmtFor) GetType() Type { + return TypeStmtFor +} + var _ Vertex = &StmtForeach{} func (n *StmtForeach) Accept(v Visitor) { @@ -394,6 +719,10 @@ func (n *StmtForeach) GetPosition() *position.Position { return n.Position } +func (n *StmtForeach) GetType() Type { + return TypeStmtForeach +} + var _ Vertex = &StmtFunction{} func (n *StmtFunction) Accept(v Visitor) { @@ -404,6 +733,10 @@ func (n *StmtFunction) GetPosition() *position.Position { return n.Position } +func (n *StmtFunction) GetType() Type { + return TypeStmtFunction +} + var _ Vertex = &StmtGlobal{} func (n *StmtGlobal) Accept(v Visitor) { @@ -414,6 +747,10 @@ func (n *StmtGlobal) GetPosition() *position.Position { return n.Position } +func (n *StmtGlobal) GetType() Type { + return TypeStmtGlobal +} + var _ Vertex = &StmtGoto{} func (n *StmtGoto) Accept(v Visitor) { @@ -424,6 +761,10 @@ func (n *StmtGoto) GetPosition() *position.Position { return n.Position } +func (n *StmtGoto) GetType() Type { + return TypeStmtGoto +} + var _ Vertex = &StmtHaltCompiler{} func (n *StmtHaltCompiler) Accept(v Visitor) { @@ -434,6 +775,10 @@ func (n *StmtHaltCompiler) GetPosition() *position.Position { return n.Position } +func (n *StmtHaltCompiler) GetType() Type { + return TypeStmtHaltCompiler +} + var _ Vertex = &StmtIf{} func (n *StmtIf) Accept(v Visitor) { @@ -444,6 +789,10 @@ func (n *StmtIf) GetPosition() *position.Position { return n.Position } +func (n *StmtIf) GetType() Type { + return TypeStmtIf +} + var _ Vertex = &StmtInlineHtml{} func (n *StmtInlineHtml) Accept(v Visitor) { @@ -454,6 +803,10 @@ func (n *StmtInlineHtml) GetPosition() *position.Position { return n.Position } +func (n *StmtInlineHtml) GetType() Type { + return TypeStmtInlineHtml +} + var _ Vertex = &StmtInterface{} func (n *StmtInterface) Accept(v Visitor) { @@ -464,6 +817,10 @@ func (n *StmtInterface) GetPosition() *position.Position { return n.Position } +func (n *StmtInterface) GetType() Type { + return TypeStmtInterface +} + var _ Vertex = &StmtLabel{} func (n *StmtLabel) Accept(v Visitor) { @@ -474,6 +831,10 @@ func (n *StmtLabel) GetPosition() *position.Position { return n.Position } +func (n *StmtLabel) GetType() Type { + return TypeStmtLabel +} + var _ Vertex = &StmtNamespace{} func (n *StmtNamespace) Accept(v Visitor) { @@ -484,6 +845,10 @@ func (n *StmtNamespace) GetPosition() *position.Position { return n.Position } +func (n *StmtNamespace) GetType() Type { + return TypeStmtNamespace +} + var _ Vertex = &StmtNop{} func (n *StmtNop) Accept(v Visitor) { @@ -494,6 +859,10 @@ func (n *StmtNop) GetPosition() *position.Position { return n.Position } +func (n *StmtNop) GetType() Type { + return TypeStmtNop +} + var _ Vertex = &StmtProperty{} func (n *StmtProperty) Accept(v Visitor) { @@ -504,6 +873,10 @@ func (n *StmtProperty) GetPosition() *position.Position { return n.Position } +func (n *StmtProperty) GetType() Type { + return TypeStmtProperty +} + var _ Vertex = &StmtPropertyList{} func (n *StmtPropertyList) Accept(v Visitor) { @@ -514,6 +887,10 @@ func (n *StmtPropertyList) GetPosition() *position.Position { return n.Position } +func (n *StmtPropertyList) GetType() Type { + return TypeStmtPropertyList +} + var _ Vertex = &StmtReturn{} func (n *StmtReturn) Accept(v Visitor) { @@ -524,6 +901,10 @@ func (n *StmtReturn) GetPosition() *position.Position { return n.Position } +func (n *StmtReturn) GetType() Type { + return TypeStmtReturn +} + var _ Vertex = &StmtStatic{} func (n *StmtStatic) Accept(v Visitor) { @@ -534,6 +915,10 @@ func (n *StmtStatic) GetPosition() *position.Position { return n.Position } +func (n *StmtStatic) GetType() Type { + return TypeStmtStatic +} + var _ Vertex = &StmtStaticVar{} func (n *StmtStaticVar) Accept(v Visitor) { @@ -544,6 +929,10 @@ func (n *StmtStaticVar) GetPosition() *position.Position { return n.Position } +func (n *StmtStaticVar) GetType() Type { + return TypeStmtStaticVar +} + var _ Vertex = &StmtStmtList{} func (n *StmtStmtList) Accept(v Visitor) { @@ -554,6 +943,10 @@ func (n *StmtStmtList) GetPosition() *position.Position { return n.Position } +func (n *StmtStmtList) GetType() Type { + return TypeStmtStmtList +} + var _ Vertex = &StmtSwitch{} func (n *StmtSwitch) Accept(v Visitor) { @@ -564,6 +957,10 @@ func (n *StmtSwitch) GetPosition() *position.Position { return n.Position } +func (n *StmtSwitch) GetType() Type { + return TypeStmtSwitch +} + var _ Vertex = &StmtThrow{} func (n *StmtThrow) Accept(v Visitor) { @@ -574,6 +971,10 @@ func (n *StmtThrow) GetPosition() *position.Position { return n.Position } +func (n *StmtThrow) GetType() Type { + return TypeStmtThrow +} + var _ Vertex = &StmtTrait{} func (n *StmtTrait) Accept(v Visitor) { @@ -584,6 +985,10 @@ func (n *StmtTrait) GetPosition() *position.Position { return n.Position } +func (n *StmtTrait) GetType() Type { + return TypeStmtTrait +} + var _ Vertex = &StmtTraitUse{} func (n *StmtTraitUse) Accept(v Visitor) { @@ -594,6 +999,10 @@ func (n *StmtTraitUse) GetPosition() *position.Position { return n.Position } +func (n *StmtTraitUse) GetType() Type { + return TypeStmtTraitUse +} + var _ Vertex = &StmtTraitUseAlias{} func (n *StmtTraitUseAlias) Accept(v Visitor) { @@ -604,6 +1013,10 @@ func (n *StmtTraitUseAlias) GetPosition() *position.Position { return n.Position } +func (n *StmtTraitUseAlias) GetType() Type { + return TypeStmtTraitUseAlias +} + var _ Vertex = &StmtTraitUsePrecedence{} func (n *StmtTraitUsePrecedence) Accept(v Visitor) { @@ -614,6 +1027,10 @@ func (n *StmtTraitUsePrecedence) GetPosition() *position.Position { return n.Position } +func (n *StmtTraitUsePrecedence) GetType() Type { + return TypeStmtTraitUsePrecedence +} + var _ Vertex = &StmtTry{} func (n *StmtTry) Accept(v Visitor) { @@ -624,6 +1041,10 @@ func (n *StmtTry) GetPosition() *position.Position { return n.Position } +func (n *StmtTry) GetType() Type { + return TypeStmtTry +} + var _ Vertex = &StmtUnset{} func (n *StmtUnset) Accept(v Visitor) { @@ -634,6 +1055,10 @@ func (n *StmtUnset) GetPosition() *position.Position { return n.Position } +func (n *StmtUnset) GetType() Type { + return TypeStmtUnset +} + var _ Vertex = &StmtUseList{} func (n *StmtUseList) Accept(v Visitor) { @@ -644,6 +1069,10 @@ func (n *StmtUseList) GetPosition() *position.Position { return n.Position } +func (n *StmtUseList) GetType() Type { + return TypeStmtUseList +} + var _ Vertex = &StmtGroupUseList{} func (n *StmtGroupUseList) Accept(v Visitor) { @@ -654,6 +1083,10 @@ func (n *StmtGroupUseList) GetPosition() *position.Position { return n.Position } +func (n *StmtGroupUseList) GetType() Type { + return TypeStmtGroupUseList +} + var _ Vertex = &StmtUse{} func (n *StmtUse) Accept(v Visitor) { @@ -664,6 +1097,10 @@ func (n *StmtUse) GetPosition() *position.Position { return n.Position } +func (n *StmtUse) GetType() Type { + return TypeStmtUse +} + var _ Vertex = &StmtWhile{} func (n *StmtWhile) Accept(v Visitor) { @@ -674,6 +1111,10 @@ func (n *StmtWhile) GetPosition() *position.Position { return n.Position } +func (n *StmtWhile) GetType() Type { + return TypeStmtWhile +} + var _ Vertex = &ExprArray{} func (n *ExprArray) Accept(v Visitor) { @@ -684,6 +1125,10 @@ func (n *ExprArray) GetPosition() *position.Position { return n.Position } +func (n *ExprArray) GetType() Type { + return TypeExprArray +} + var _ Vertex = &ExprArrayDimFetch{} func (n *ExprArrayDimFetch) Accept(v Visitor) { @@ -694,6 +1139,10 @@ func (n *ExprArrayDimFetch) GetPosition() *position.Position { return n.Position } +func (n *ExprArrayDimFetch) GetType() Type { + return TypeExprArrayDimFetch +} + var _ Vertex = &ExprArrayItem{} func (n *ExprArrayItem) Accept(v Visitor) { @@ -704,6 +1153,10 @@ func (n *ExprArrayItem) GetPosition() *position.Position { return n.Position } +func (n *ExprArrayItem) GetType() Type { + return TypeExprArrayItem +} + var _ Vertex = &ExprArrowFunction{} func (n *ExprArrowFunction) Accept(v Visitor) { @@ -714,6 +1167,10 @@ func (n *ExprArrowFunction) GetPosition() *position.Position { return n.Position } +func (n *ExprArrowFunction) GetType() Type { + return TypeExprArrowFunction +} + var _ Vertex = &ExprBitwiseNot{} func (n *ExprBitwiseNot) Accept(v Visitor) { @@ -724,6 +1181,10 @@ func (n *ExprBitwiseNot) GetPosition() *position.Position { return n.Position } +func (n *ExprBitwiseNot) GetType() Type { + return TypeExprBitwiseNot +} + var _ Vertex = &ExprBooleanNot{} func (n *ExprBooleanNot) Accept(v Visitor) { @@ -734,6 +1195,10 @@ func (n *ExprBooleanNot) GetPosition() *position.Position { return n.Position } +func (n *ExprBooleanNot) GetType() Type { + return TypeExprBooleanNot +} + var _ Vertex = &ExprBrackets{} func (n *ExprBrackets) Accept(v Visitor) { @@ -744,6 +1209,10 @@ func (n *ExprBrackets) GetPosition() *position.Position { return n.Position } +func (n *ExprBrackets) GetType() Type { + return TypeExprBrackets +} + var _ Vertex = &ExprClassConstFetch{} func (n *ExprClassConstFetch) Accept(v Visitor) { @@ -754,6 +1223,10 @@ func (n *ExprClassConstFetch) GetPosition() *position.Position { return n.Position } +func (n *ExprClassConstFetch) GetType() Type { + return TypeExprClassConstFetch +} + var _ Vertex = &ExprClone{} func (n *ExprClone) Accept(v Visitor) { @@ -764,6 +1237,10 @@ func (n *ExprClone) GetPosition() *position.Position { return n.Position } +func (n *ExprClone) GetType() Type { + return TypeExprClone +} + var _ Vertex = &ExprClosure{} func (n *ExprClosure) Accept(v Visitor) { @@ -774,6 +1251,10 @@ func (n *ExprClosure) GetPosition() *position.Position { return n.Position } +func (n *ExprClosure) GetType() Type { + return TypeExprClosure +} + var _ Vertex = &ExprClosureUse{} func (n *ExprClosureUse) Accept(v Visitor) { @@ -784,6 +1265,10 @@ func (n *ExprClosureUse) GetPosition() *position.Position { return n.Position } +func (n *ExprClosureUse) GetType() Type { + return TypeExprClosureUse +} + var _ Vertex = &ExprConstFetch{} func (n *ExprConstFetch) Accept(v Visitor) { @@ -794,6 +1279,10 @@ func (n *ExprConstFetch) GetPosition() *position.Position { return n.Position } +func (n *ExprConstFetch) GetType() Type { + return TypeExprConstFetch +} + var _ Vertex = &ExprEmpty{} func (n *ExprEmpty) Accept(v Visitor) { @@ -804,6 +1293,10 @@ func (n *ExprEmpty) GetPosition() *position.Position { return n.Position } +func (n *ExprEmpty) GetType() Type { + return TypeExprEmpty +} + var _ Vertex = &ExprErrorSuppress{} func (n *ExprErrorSuppress) Accept(v Visitor) { @@ -814,6 +1307,10 @@ func (n *ExprErrorSuppress) GetPosition() *position.Position { return n.Position } +func (n *ExprErrorSuppress) GetType() Type { + return TypeExprErrorSuppress +} + var _ Vertex = &ExprEval{} func (n *ExprEval) Accept(v Visitor) { @@ -824,6 +1321,10 @@ func (n *ExprEval) GetPosition() *position.Position { return n.Position } +func (n *ExprEval) GetType() Type { + return TypeExprEval +} + var _ Vertex = &ExprExit{} func (n *ExprExit) Accept(v Visitor) { @@ -834,6 +1335,10 @@ func (n *ExprExit) GetPosition() *position.Position { return n.Position } +func (n *ExprExit) GetType() Type { + return TypeExprExit +} + var _ Vertex = &ExprFunctionCall{} func (n *ExprFunctionCall) Accept(v Visitor) { @@ -844,6 +1349,10 @@ func (n *ExprFunctionCall) GetPosition() *position.Position { return n.Position } +func (n *ExprFunctionCall) GetType() Type { + return TypeExprFunctionCall +} + var _ Vertex = &ExprInclude{} func (n *ExprInclude) Accept(v Visitor) { @@ -854,6 +1363,10 @@ func (n *ExprInclude) GetPosition() *position.Position { return n.Position } +func (n *ExprInclude) GetType() Type { + return TypeExprInclude +} + var _ Vertex = &ExprIncludeOnce{} func (n *ExprIncludeOnce) Accept(v Visitor) { @@ -864,6 +1377,10 @@ func (n *ExprIncludeOnce) GetPosition() *position.Position { return n.Position } +func (n *ExprIncludeOnce) GetType() Type { + return TypeExprIncludeOnce +} + var _ Vertex = &ExprInstanceOf{} func (n *ExprInstanceOf) Accept(v Visitor) { @@ -874,6 +1391,10 @@ func (n *ExprInstanceOf) GetPosition() *position.Position { return n.Position } +func (n *ExprInstanceOf) GetType() Type { + return TypeExprInstanceOf +} + var _ Vertex = &ExprIsset{} func (n *ExprIsset) Accept(v Visitor) { @@ -884,6 +1405,10 @@ func (n *ExprIsset) GetPosition() *position.Position { return n.Position } +func (n *ExprIsset) GetType() Type { + return TypeExprIsset +} + var _ Vertex = &ExprList{} func (n *ExprList) Accept(v Visitor) { @@ -894,6 +1419,10 @@ func (n *ExprList) GetPosition() *position.Position { return n.Position } +func (n *ExprList) GetType() Type { + return TypeExprList +} + var _ Vertex = &ExprMethodCall{} func (n *ExprMethodCall) Accept(v Visitor) { @@ -904,6 +1433,10 @@ func (n *ExprMethodCall) GetPosition() *position.Position { return n.Position } +func (n *ExprMethodCall) GetType() Type { + return TypeExprMethodCall +} + var _ Vertex = &ExprNullsafeMethodCall{} func (n *ExprNullsafeMethodCall) Accept(v Visitor) { @@ -914,6 +1447,10 @@ func (n *ExprNullsafeMethodCall) GetPosition() *position.Position { return n.Position } +func (n *ExprNullsafeMethodCall) GetType() Type { + return TypeExprNullsafeMethodCall +} + var _ Vertex = &ExprNew{} func (n *ExprNew) Accept(v Visitor) { @@ -924,6 +1461,10 @@ func (n *ExprNew) GetPosition() *position.Position { return n.Position } +func (n *ExprNew) GetType() Type { + return TypeExprNew +} + var _ Vertex = &ExprPostDec{} func (n *ExprPostDec) Accept(v Visitor) { @@ -934,6 +1475,10 @@ func (n *ExprPostDec) GetPosition() *position.Position { return n.Position } +func (n *ExprPostDec) GetType() Type { + return TypeExprPostDec +} + var _ Vertex = &ExprPostInc{} func (n *ExprPostInc) Accept(v Visitor) { @@ -944,6 +1489,10 @@ func (n *ExprPostInc) GetPosition() *position.Position { return n.Position } +func (n *ExprPostInc) GetType() Type { + return TypeExprPostInc +} + var _ Vertex = &ExprPreDec{} func (n *ExprPreDec) Accept(v Visitor) { @@ -954,6 +1503,10 @@ func (n *ExprPreDec) GetPosition() *position.Position { return n.Position } +func (n *ExprPreDec) GetType() Type { + return TypeExprPreDec +} + var _ Vertex = &ExprPreInc{} func (n *ExprPreInc) Accept(v Visitor) { @@ -964,6 +1517,10 @@ func (n *ExprPreInc) GetPosition() *position.Position { return n.Position } +func (n *ExprPreInc) GetType() Type { + return TypeExprPreInc +} + var _ Vertex = &ExprPrint{} func (n *ExprPrint) Accept(v Visitor) { @@ -974,6 +1531,10 @@ func (n *ExprPrint) GetPosition() *position.Position { return n.Position } +func (n *ExprPrint) GetType() Type { + return TypeExprPrint +} + var _ Vertex = &ExprPropertyFetch{} func (n *ExprPropertyFetch) Accept(v Visitor) { @@ -984,6 +1545,10 @@ func (n *ExprPropertyFetch) GetPosition() *position.Position { return n.Position } +func (n *ExprPropertyFetch) GetType() Type { + return TypeExprPropertyFetch +} + var _ Vertex = &ExprNullsafePropertyFetch{} func (n *ExprNullsafePropertyFetch) Accept(v Visitor) { @@ -994,6 +1559,10 @@ func (n *ExprNullsafePropertyFetch) GetPosition() *position.Position { return n.Position } +func (n *ExprNullsafePropertyFetch) GetType() Type { + return TypeExprNullsafePropertyFetch +} + var _ Vertex = &ExprRequire{} func (n *ExprRequire) Accept(v Visitor) { @@ -1004,6 +1573,10 @@ func (n *ExprRequire) GetPosition() *position.Position { return n.Position } +func (n *ExprRequire) GetType() Type { + return TypeExprRequire +} + var _ Vertex = &ExprRequireOnce{} func (n *ExprRequireOnce) Accept(v Visitor) { @@ -1014,6 +1587,10 @@ func (n *ExprRequireOnce) GetPosition() *position.Position { return n.Position } +func (n *ExprRequireOnce) GetType() Type { + return TypeExprRequireOnce +} + var _ Vertex = &ExprShellExec{} func (n *ExprShellExec) Accept(v Visitor) { @@ -1024,6 +1601,10 @@ func (n *ExprShellExec) GetPosition() *position.Position { return n.Position } +func (n *ExprShellExec) GetType() Type { + return TypeExprShellExec +} + var _ Vertex = &ExprStaticCall{} func (n *ExprStaticCall) Accept(v Visitor) { @@ -1034,6 +1615,10 @@ func (n *ExprStaticCall) GetPosition() *position.Position { return n.Position } +func (n *ExprStaticCall) GetType() Type { + return TypeExprStaticCall +} + var _ Vertex = &ExprStaticPropertyFetch{} func (n *ExprStaticPropertyFetch) Accept(v Visitor) { @@ -1044,6 +1629,10 @@ func (n *ExprStaticPropertyFetch) GetPosition() *position.Position { return n.Position } +func (n *ExprStaticPropertyFetch) GetType() Type { + return TypeExprStaticPropertyFetch +} + var _ Vertex = &ExprTernary{} func (n *ExprTernary) Accept(v Visitor) { @@ -1054,6 +1643,10 @@ func (n *ExprTernary) GetPosition() *position.Position { return n.Position } +func (n *ExprTernary) GetType() Type { + return TypeExprTernary +} + var _ Vertex = &ExprUnaryMinus{} func (n *ExprUnaryMinus) Accept(v Visitor) { @@ -1064,6 +1657,10 @@ func (n *ExprUnaryMinus) GetPosition() *position.Position { return n.Position } +func (n *ExprUnaryMinus) GetType() Type { + return TypeExprUnaryMinus +} + var _ Vertex = &ExprUnaryPlus{} func (n *ExprUnaryPlus) Accept(v Visitor) { @@ -1074,6 +1671,10 @@ func (n *ExprUnaryPlus) GetPosition() *position.Position { return n.Position } +func (n *ExprUnaryPlus) GetType() Type { + return TypeExprUnaryPlus +} + var _ Vertex = &ExprVariable{} func (n *ExprVariable) Accept(v Visitor) { @@ -1084,6 +1685,10 @@ func (n *ExprVariable) GetPosition() *position.Position { return n.Position } +func (n *ExprVariable) GetType() Type { + return TypeExprVariable +} + var _ Vertex = &ExprYield{} func (n *ExprYield) Accept(v Visitor) { @@ -1094,6 +1699,10 @@ func (n *ExprYield) GetPosition() *position.Position { return n.Position } +func (n *ExprYield) GetType() Type { + return TypeExprYield +} + var _ Vertex = &ExprYieldFrom{} func (n *ExprYieldFrom) Accept(v Visitor) { @@ -1104,6 +1713,10 @@ func (n *ExprYieldFrom) GetPosition() *position.Position { return n.Position } +func (n *ExprYieldFrom) GetType() Type { + return TypeExprYieldFrom +} + var _ Vertex = &ExprCastArray{} func (n *ExprCastArray) Accept(v Visitor) { @@ -1114,6 +1727,10 @@ func (n *ExprCastArray) GetPosition() *position.Position { return n.Position } +func (n *ExprCastArray) GetType() Type { + return TypeExprCastArray +} + var _ Vertex = &ExprCastBool{} func (n *ExprCastBool) Accept(v Visitor) { @@ -1124,6 +1741,10 @@ func (n *ExprCastBool) GetPosition() *position.Position { return n.Position } +func (n *ExprCastBool) GetType() Type { + return TypeExprCastBool +} + var _ Vertex = &ExprCastDouble{} func (n *ExprCastDouble) Accept(v Visitor) { @@ -1134,6 +1755,10 @@ func (n *ExprCastDouble) GetPosition() *position.Position { return n.Position } +func (n *ExprCastDouble) GetType() Type { + return TypeExprCastDouble +} + var _ Vertex = &ExprCastInt{} func (n *ExprCastInt) Accept(v Visitor) { @@ -1144,6 +1769,10 @@ func (n *ExprCastInt) GetPosition() *position.Position { return n.Position } +func (n *ExprCastInt) GetType() Type { + return TypeExprCastInt +} + var _ Vertex = &ExprCastObject{} func (n *ExprCastObject) Accept(v Visitor) { @@ -1154,6 +1783,10 @@ func (n *ExprCastObject) GetPosition() *position.Position { return n.Position } +func (n *ExprCastObject) GetType() Type { + return TypeExprCastObject +} + var _ Vertex = &ExprCastString{} func (n *ExprCastString) Accept(v Visitor) { @@ -1164,6 +1797,10 @@ func (n *ExprCastString) GetPosition() *position.Position { return n.Position } +func (n *ExprCastString) GetType() Type { + return TypeExprCastString +} + var _ Vertex = &ExprCastUnset{} func (n *ExprCastUnset) Accept(v Visitor) { @@ -1174,6 +1811,10 @@ func (n *ExprCastUnset) GetPosition() *position.Position { return n.Position } +func (n *ExprCastUnset) GetType() Type { + return TypeExprCastUnset +} + var _ Vertex = &ExprAssign{} func (n *ExprAssign) Accept(v Visitor) { @@ -1184,6 +1825,10 @@ func (n *ExprAssign) GetPosition() *position.Position { return n.Position } +func (n *ExprAssign) GetType() Type { + return TypeExprAssign +} + var _ Vertex = &ExprAssignReference{} func (n *ExprAssignReference) Accept(v Visitor) { @@ -1194,6 +1839,10 @@ func (n *ExprAssignReference) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignReference) GetType() Type { + return TypeExprAssignReference +} + var _ Vertex = &ExprAssignBitwiseAnd{} func (n *ExprAssignBitwiseAnd) Accept(v Visitor) { @@ -1204,6 +1853,10 @@ func (n *ExprAssignBitwiseAnd) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignBitwiseAnd) GetType() Type { + return TypeExprAssignBitwiseAnd +} + var _ Vertex = &ExprAssignBitwiseOr{} func (n *ExprAssignBitwiseOr) Accept(v Visitor) { @@ -1214,6 +1867,10 @@ func (n *ExprAssignBitwiseOr) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignBitwiseOr) GetType() Type { + return TypeExprAssignBitwiseOr +} + var _ Vertex = &ExprAssignBitwiseXor{} func (n *ExprAssignBitwiseXor) Accept(v Visitor) { @@ -1224,6 +1881,10 @@ func (n *ExprAssignBitwiseXor) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignBitwiseXor) GetType() Type { + return TypeExprAssignBitwiseXor +} + var _ Vertex = &ExprAssignCoalesce{} func (n *ExprAssignCoalesce) Accept(v Visitor) { @@ -1234,6 +1895,10 @@ func (n *ExprAssignCoalesce) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignCoalesce) GetType() Type { + return TypeExprAssignCoalesce +} + var _ Vertex = &ExprAssignConcat{} func (n *ExprAssignConcat) Accept(v Visitor) { @@ -1244,6 +1909,10 @@ func (n *ExprAssignConcat) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignConcat) GetType() Type { + return TypeExprAssignConcat +} + var _ Vertex = &ExprAssignDiv{} func (n *ExprAssignDiv) Accept(v Visitor) { @@ -1254,6 +1923,10 @@ func (n *ExprAssignDiv) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignDiv) GetType() Type { + return TypeExprAssignDiv +} + var _ Vertex = &ExprAssignMinus{} func (n *ExprAssignMinus) Accept(v Visitor) { @@ -1264,6 +1937,10 @@ func (n *ExprAssignMinus) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignMinus) GetType() Type { + return TypeExprAssignMinus +} + var _ Vertex = &ExprAssignMod{} func (n *ExprAssignMod) Accept(v Visitor) { @@ -1274,6 +1951,10 @@ func (n *ExprAssignMod) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignMod) GetType() Type { + return TypeExprAssignMod +} + var _ Vertex = &ExprAssignMul{} func (n *ExprAssignMul) Accept(v Visitor) { @@ -1284,6 +1965,10 @@ func (n *ExprAssignMul) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignMul) GetType() Type { + return TypeExprAssignMul +} + var _ Vertex = &ExprAssignPlus{} func (n *ExprAssignPlus) Accept(v Visitor) { @@ -1294,6 +1979,10 @@ func (n *ExprAssignPlus) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignPlus) GetType() Type { + return TypeExprAssignPlus +} + var _ Vertex = &ExprAssignPow{} func (n *ExprAssignPow) Accept(v Visitor) { @@ -1304,6 +1993,10 @@ func (n *ExprAssignPow) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignPow) GetType() Type { + return TypeExprAssignPow +} + var _ Vertex = &ExprAssignShiftLeft{} func (n *ExprAssignShiftLeft) Accept(v Visitor) { @@ -1314,6 +2007,10 @@ func (n *ExprAssignShiftLeft) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignShiftLeft) GetType() Type { + return TypeExprAssignShiftLeft +} + var _ Vertex = &ExprAssignShiftRight{} func (n *ExprAssignShiftRight) Accept(v Visitor) { @@ -1324,6 +2021,10 @@ func (n *ExprAssignShiftRight) GetPosition() *position.Position { return n.Position } +func (n *ExprAssignShiftRight) GetType() Type { + return TypeExprAssignShiftRight +} + var _ Vertex = &ExprBinaryBitwiseAnd{} func (n *ExprBinaryBitwiseAnd) Accept(v Visitor) { @@ -1334,6 +2035,10 @@ func (n *ExprBinaryBitwiseAnd) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryBitwiseAnd) GetType() Type { + return TypeExprBinaryBitwiseAnd +} + var _ Vertex = &ExprBinaryBitwiseOr{} func (n *ExprBinaryBitwiseOr) Accept(v Visitor) { @@ -1344,6 +2049,10 @@ func (n *ExprBinaryBitwiseOr) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryBitwiseOr) GetType() Type { + return TypeExprBinaryBitwiseOr +} + var _ Vertex = &ExprBinaryBitwiseXor{} func (n *ExprBinaryBitwiseXor) Accept(v Visitor) { @@ -1354,6 +2063,10 @@ func (n *ExprBinaryBitwiseXor) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryBitwiseXor) GetType() Type { + return TypeExprBinaryBitwiseXor +} + var _ Vertex = &ExprBinaryBooleanAnd{} func (n *ExprBinaryBooleanAnd) Accept(v Visitor) { @@ -1364,6 +2077,10 @@ func (n *ExprBinaryBooleanAnd) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryBooleanAnd) GetType() Type { + return TypeExprBinaryBooleanAnd +} + var _ Vertex = &ExprBinaryBooleanOr{} func (n *ExprBinaryBooleanOr) Accept(v Visitor) { @@ -1374,6 +2091,10 @@ func (n *ExprBinaryBooleanOr) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryBooleanOr) GetType() Type { + return TypeExprBinaryBooleanOr +} + var _ Vertex = &ExprBinaryCoalesce{} func (n *ExprBinaryCoalesce) Accept(v Visitor) { @@ -1384,6 +2105,10 @@ func (n *ExprBinaryCoalesce) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryCoalesce) GetType() Type { + return TypeExprBinaryCoalesce +} + var _ Vertex = &ExprBinaryConcat{} func (n *ExprBinaryConcat) Accept(v Visitor) { @@ -1394,6 +2119,10 @@ func (n *ExprBinaryConcat) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryConcat) GetType() Type { + return TypeExprBinaryConcat +} + var _ Vertex = &ExprBinaryDiv{} func (n *ExprBinaryDiv) Accept(v Visitor) { @@ -1404,6 +2133,10 @@ func (n *ExprBinaryDiv) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryDiv) GetType() Type { + return TypeExprBinaryDiv +} + var _ Vertex = &ExprBinaryEqual{} func (n *ExprBinaryEqual) Accept(v Visitor) { @@ -1414,6 +2147,10 @@ func (n *ExprBinaryEqual) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryEqual) GetType() Type { + return TypeExprBinaryEqual +} + var _ Vertex = &ExprBinaryGreater{} func (n *ExprBinaryGreater) Accept(v Visitor) { @@ -1424,6 +2161,10 @@ func (n *ExprBinaryGreater) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryGreater) GetType() Type { + return TypeExprBinaryGreater +} + var _ Vertex = &ExprBinaryGreaterOrEqual{} func (n *ExprBinaryGreaterOrEqual) Accept(v Visitor) { @@ -1434,6 +2175,10 @@ func (n *ExprBinaryGreaterOrEqual) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryGreaterOrEqual) GetType() Type { + return TypeExprBinaryGreaterOrEqual +} + var _ Vertex = &ExprBinaryIdentical{} func (n *ExprBinaryIdentical) Accept(v Visitor) { @@ -1444,6 +2189,10 @@ func (n *ExprBinaryIdentical) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryIdentical) GetType() Type { + return TypeExprBinaryIdentical +} + var _ Vertex = &ExprBinaryLogicalAnd{} func (n *ExprBinaryLogicalAnd) Accept(v Visitor) { @@ -1454,6 +2203,10 @@ func (n *ExprBinaryLogicalAnd) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryLogicalAnd) GetType() Type { + return TypeExprBinaryLogicalAnd +} + var _ Vertex = &ExprBinaryLogicalOr{} func (n *ExprBinaryLogicalOr) Accept(v Visitor) { @@ -1464,6 +2217,10 @@ func (n *ExprBinaryLogicalOr) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryLogicalOr) GetType() Type { + return TypeExprBinaryLogicalOr +} + var _ Vertex = &ExprBinaryLogicalXor{} func (n *ExprBinaryLogicalXor) Accept(v Visitor) { @@ -1474,6 +2231,10 @@ func (n *ExprBinaryLogicalXor) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryLogicalXor) GetType() Type { + return TypeExprBinaryLogicalXor +} + var _ Vertex = &ExprBinaryMinus{} func (n *ExprBinaryMinus) Accept(v Visitor) { @@ -1484,6 +2245,10 @@ func (n *ExprBinaryMinus) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryMinus) GetType() Type { + return TypeExprBinaryMinus +} + var _ Vertex = &ExprBinaryMod{} func (n *ExprBinaryMod) Accept(v Visitor) { @@ -1494,6 +2259,10 @@ func (n *ExprBinaryMod) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryMod) GetType() Type { + return TypeExprBinaryMod +} + var _ Vertex = &ExprBinaryMul{} func (n *ExprBinaryMul) Accept(v Visitor) { @@ -1504,6 +2273,10 @@ func (n *ExprBinaryMul) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryMul) GetType() Type { + return TypeExprBinaryMul +} + var _ Vertex = &ExprBinaryNotEqual{} func (n *ExprBinaryNotEqual) Accept(v Visitor) { @@ -1514,6 +2287,10 @@ func (n *ExprBinaryNotEqual) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryNotEqual) GetType() Type { + return TypeExprBinaryNotEqual +} + var _ Vertex = &ExprBinaryNotIdentical{} func (n *ExprBinaryNotIdentical) Accept(v Visitor) { @@ -1524,6 +2301,10 @@ func (n *ExprBinaryNotIdentical) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryNotIdentical) GetType() Type { + return TypeExprBinaryNotIdentical +} + var _ Vertex = &ExprBinaryPlus{} func (n *ExprBinaryPlus) Accept(v Visitor) { @@ -1534,6 +2315,10 @@ func (n *ExprBinaryPlus) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryPlus) GetType() Type { + return TypeExprBinaryPlus +} + var _ Vertex = &ExprBinaryPow{} func (n *ExprBinaryPow) Accept(v Visitor) { @@ -1544,6 +2329,10 @@ func (n *ExprBinaryPow) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryPow) GetType() Type { + return TypeExprBinaryPow +} + var _ Vertex = &ExprBinaryShiftLeft{} func (n *ExprBinaryShiftLeft) Accept(v Visitor) { @@ -1554,6 +2343,10 @@ func (n *ExprBinaryShiftLeft) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryShiftLeft) GetType() Type { + return TypeExprBinaryShiftLeft +} + var _ Vertex = &ExprBinaryShiftRight{} func (n *ExprBinaryShiftRight) Accept(v Visitor) { @@ -1564,6 +2357,10 @@ func (n *ExprBinaryShiftRight) GetPosition() *position.Position { return n.Position } +func (n *ExprBinaryShiftRight) GetType() Type { + return TypeExprBinaryShiftRight +} + var _ Vertex = &ExprBinarySmaller{} func (n *ExprBinarySmaller) Accept(v Visitor) { @@ -1574,6 +2371,10 @@ func (n *ExprBinarySmaller) GetPosition() *position.Position { return n.Position } +func (n *ExprBinarySmaller) GetType() Type { + return TypeExprBinarySmaller +} + var _ Vertex = &ExprBinarySmallerOrEqual{} func (n *ExprBinarySmallerOrEqual) Accept(v Visitor) { @@ -1584,6 +2385,10 @@ func (n *ExprBinarySmallerOrEqual) GetPosition() *position.Position { return n.Position } +func (n *ExprBinarySmallerOrEqual) GetType() Type { + return TypeExprBinarySmallerOrEqual +} + var _ Vertex = &ExprBinarySpaceship{} func (n *ExprBinarySpaceship) Accept(v Visitor) { @@ -1594,6 +2399,10 @@ func (n *ExprBinarySpaceship) GetPosition() *position.Position { return n.Position } +func (n *ExprBinarySpaceship) GetType() Type { + return TypeExprBinarySpaceship +} + var _ Vertex = &ExprMatch{} func (n *ExprMatch) Accept(v Visitor) { @@ -1604,6 +2413,10 @@ func (n *ExprMatch) GetPosition() *position.Position { return n.Position } +func (n *ExprMatch) GetType() Type { + return TypeExprMatch +} + var _ Vertex = &ExprThrow{} func (n *ExprThrow) Accept(v Visitor) { @@ -1614,6 +2427,10 @@ func (n *ExprThrow) GetPosition() *position.Position { return n.Position } +func (n *ExprThrow) GetType() Type { + return TypeExprThrow +} + var _ Vertex = &MatchArm{} func (n *MatchArm) Accept(v Visitor) { @@ -1624,6 +2441,10 @@ func (n *MatchArm) GetPosition() *position.Position { return n.Position } +func (n *MatchArm) GetType() Type { + return TypeMatchArm +} + var _ Vertex = &Name{} func (n *Name) Accept(v Visitor) { @@ -1634,6 +2455,10 @@ func (n *Name) GetPosition() *position.Position { return n.Position } +func (n *Name) GetType() Type { + return TypeName +} + var _ Vertex = &NameFullyQualified{} func (n *NameFullyQualified) Accept(v Visitor) { @@ -1644,6 +2469,10 @@ func (n *NameFullyQualified) GetPosition() *position.Position { return n.Position } +func (n *NameFullyQualified) GetType() Type { + return TypeNameFullyQualified +} + var _ Vertex = &NameRelative{} func (n *NameRelative) Accept(v Visitor) { @@ -1654,6 +2483,10 @@ func (n *NameRelative) GetPosition() *position.Position { return n.Position } +func (n *NameRelative) GetType() Type { + return TypeNameRelative +} + var _ Vertex = &NamePart{} func (n *NamePart) Accept(v Visitor) { @@ -1663,3 +2496,7 @@ func (n *NamePart) Accept(v Visitor) { func (n *NamePart) GetPosition() *position.Position { return n.Position } + +func (n *NamePart) GetType() Type { + return TypeNamePart +} diff --git a/pkg/ast/node_funcs_gen.go b/pkg/ast/node_funcs_gen.go index ccb2936..b09fa4b 100644 --- a/pkg/ast/node_funcs_gen.go +++ b/pkg/ast/node_funcs_gen.go @@ -28,6 +28,16 @@ var fileTempl = template.Must( package ast import "github.com/VKCOM/php-parser/pkg/position" + +type Type int + +const ( + TypeNone Type = iota + {{- range $i, $typ := .Types }} + Type{{ $typ.Name }} + {{- end }} + TypeCount +) {{range $typ := .Types}} var _ Vertex = &{{$typ.Name}}{} @@ -38,6 +48,10 @@ func (n *{{$typ.Name}}) Accept(v Visitor) { func (n *{{$typ.Name}}) GetPosition() *position.Position { return n.Position } + +func (n *{{$typ.Name}}) GetType() Type { + return Type{{$typ.Name}} +} {{end}}`), )