From 3ba91186766baf180cc48e3a74201df1bec70a85 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Sat, 25 Mar 2023 21:53:52 +0100 Subject: [PATCH] refactor: generate node functions instead of manual Easier to update now, also more reliable (nothing to forget) --- pkg/ast/ast.go | 9 + pkg/ast/node.go | 1330 +---------------------------- pkg/ast/node_funcs.go | 1665 +++++++++++++++++++++++++++++++++++++ pkg/ast/node_funcs_gen.go | 73 ++ 4 files changed, 1749 insertions(+), 1328 deletions(-) create mode 100644 pkg/ast/node_funcs.go create mode 100644 pkg/ast/node_funcs_gen.go diff --git a/pkg/ast/ast.go b/pkg/ast/ast.go index 34700f7..1ba6082 100644 --- a/pkg/ast/ast.go +++ b/pkg/ast/ast.go @@ -2,6 +2,15 @@ package ast import "github.com/VKCOM/php-parser/pkg/position" +// 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", +} + type Vertex interface { Accept(v Visitor) GetPosition() *position.Position diff --git a/pkg/ast/node.go b/pkg/ast/node.go index e7d7e61..1a64b28 100644 --- a/pkg/ast/node.go +++ b/pkg/ast/node.go @@ -5,6 +5,8 @@ import ( "github.com/VKCOM/php-parser/pkg/token" ) +//go:generate go run node_funcs_gen.go + // Root node type Root struct { Position *position.Position @@ -12,14 +14,6 @@ type Root struct { EndTkn *token.Token } -func (n *Root) Accept(v Visitor) { - v.Root(n) -} - -func (n *Root) GetPosition() *position.Position { - return n.Position -} - // Nullable node is ?Expr type Nullable struct { Position *position.Position @@ -27,14 +21,6 @@ type Nullable struct { Expr Vertex } -func (n *Nullable) Accept(v Visitor) { - v.Nullable(n) -} - -func (n *Nullable) GetPosition() *position.Position { - return n.Position -} - // Union node is Expr|Expr1|... type Union struct { Position *position.Position @@ -42,14 +28,6 @@ type Union struct { SeparatorTkns []*token.Token } -func (n *Union) Accept(v Visitor) { - v.Union(n) -} - -func (n *Union) GetPosition() *position.Position { - return n.Position -} - // Intersection node is Expr&Expr1&... type Intersection struct { Position *position.Position @@ -57,14 +35,6 @@ type Intersection struct { SeparatorTkns []*token.Token } -func (n *Intersection) Accept(v Visitor) { - v.Intersection(n) -} - -func (n *Intersection) GetPosition() *position.Position { - return n.Position -} - // Parameter node type Parameter struct { Position *position.Position @@ -78,14 +48,6 @@ type Parameter struct { DefaultValue Vertex } -func (n *Parameter) Accept(v Visitor) { - v.Parameter(n) -} - -func (n *Parameter) GetPosition() *position.Position { - return n.Position -} - // Identifier node type Identifier struct { Position *position.Position @@ -93,14 +55,6 @@ type Identifier struct { Value []byte } -func (n *Identifier) Accept(v Visitor) { - v.Identifier(n) -} - -func (n *Identifier) GetPosition() *position.Position { - return n.Position -} - // Argument node type Argument struct { Position *position.Position @@ -111,14 +65,6 @@ type Argument struct { Expr Vertex } -func (n *Argument) Accept(v Visitor) { - v.Argument(n) -} - -func (n *Argument) GetPosition() *position.Position { - return n.Position -} - // Attribute node type Attribute struct { Position *position.Position @@ -129,14 +75,6 @@ type Attribute struct { CloseParenthesisTkn *token.Token } -func (n *Attribute) Accept(v Visitor) { - v.Attribute(n) -} - -func (n *Attribute) GetPosition() *position.Position { - return n.Position -} - // AttributeGroup node type AttributeGroup struct { Position *position.Position @@ -146,14 +84,6 @@ type AttributeGroup struct { CloseAttributeTkn *token.Token } -func (n *AttributeGroup) Accept(v Visitor) { - v.AttributeGroup(n) -} - -func (n *AttributeGroup) GetPosition() *position.Position { - return n.Position -} - // ScalarDnumber node type ScalarDnumber struct { Position *position.Position @@ -161,14 +91,6 @@ type ScalarDnumber struct { Value []byte } -func (n *ScalarDnumber) Accept(v Visitor) { - v.ScalarDnumber(n) -} - -func (n *ScalarDnumber) GetPosition() *position.Position { - return n.Position -} - // ScalarEncapsed node type ScalarEncapsed struct { Position *position.Position @@ -177,14 +99,6 @@ type ScalarEncapsed struct { CloseQuoteTkn *token.Token } -func (n *ScalarEncapsed) Accept(v Visitor) { - v.ScalarEncapsed(n) -} - -func (n *ScalarEncapsed) GetPosition() *position.Position { - return n.Position -} - // ScalarEncapsedStringPart node type ScalarEncapsedStringPart struct { Position *position.Position @@ -192,14 +106,6 @@ type ScalarEncapsedStringPart struct { Value []byte } -func (n *ScalarEncapsedStringPart) Accept(v Visitor) { - v.ScalarEncapsedStringPart(n) -} - -func (n *ScalarEncapsedStringPart) GetPosition() *position.Position { - return n.Position -} - // ScalarEncapsedStringVar node type ScalarEncapsedStringVar struct { Position *position.Position @@ -211,14 +117,6 @@ type ScalarEncapsedStringVar struct { CloseCurlyBracketTkn *token.Token } -func (n *ScalarEncapsedStringVar) Accept(v Visitor) { - v.ScalarEncapsedStringVar(n) -} - -func (n *ScalarEncapsedStringVar) GetPosition() *position.Position { - return n.Position -} - // ScalarEncapsedStringVar node type ScalarEncapsedStringBrackets struct { Position *position.Position @@ -227,14 +125,6 @@ type ScalarEncapsedStringBrackets struct { CloseCurlyBracketTkn *token.Token } -func (n *ScalarEncapsedStringBrackets) Accept(v Visitor) { - v.ScalarEncapsedStringBrackets(n) -} - -func (n *ScalarEncapsedStringBrackets) GetPosition() *position.Position { - return n.Position -} - // ScalarHeredoc node type ScalarHeredoc struct { Position *position.Position @@ -243,14 +133,6 @@ type ScalarHeredoc struct { CloseHeredocTkn *token.Token } -func (n *ScalarHeredoc) Accept(v Visitor) { - v.ScalarHeredoc(n) -} - -func (n *ScalarHeredoc) GetPosition() *position.Position { - return n.Position -} - // ScalarLnumber node type ScalarLnumber struct { Position *position.Position @@ -258,14 +140,6 @@ type ScalarLnumber struct { Value []byte } -func (n *ScalarLnumber) Accept(v Visitor) { - v.ScalarLnumber(n) -} - -func (n *ScalarLnumber) GetPosition() *position.Position { - return n.Position -} - // ScalarMagicConstant node type ScalarMagicConstant struct { Position *position.Position @@ -273,14 +147,6 @@ type ScalarMagicConstant struct { Value []byte } -func (n *ScalarMagicConstant) Accept(v Visitor) { - v.ScalarMagicConstant(n) -} - -func (n *ScalarMagicConstant) GetPosition() *position.Position { - return n.Position -} - // ScalarString node type ScalarString struct { Position *position.Position @@ -289,14 +155,6 @@ type ScalarString struct { Value []byte } -func (n *ScalarString) Accept(v Visitor) { - v.ScalarString(n) -} - -func (n *ScalarString) GetPosition() *position.Position { - return n.Position -} - // StmtBreak node type StmtBreak struct { Position *position.Position @@ -305,14 +163,6 @@ type StmtBreak struct { SemiColonTkn *token.Token } -func (n *StmtBreak) Accept(v Visitor) { - v.StmtBreak(n) -} - -func (n *StmtBreak) GetPosition() *position.Position { - return n.Position -} - // StmtCase node type StmtCase struct { Position *position.Position @@ -322,14 +172,6 @@ type StmtCase struct { Stmts []Vertex } -func (n *StmtCase) Accept(v Visitor) { - v.StmtCase(n) -} - -func (n *StmtCase) GetPosition() *position.Position { - return n.Position -} - // StmtCatch node type StmtCatch struct { Position *position.Position @@ -344,14 +186,6 @@ type StmtCatch struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtCatch) Accept(v Visitor) { - v.StmtCatch(n) -} - -func (n *StmtCatch) GetPosition() *position.Position { - return n.Position -} - // StmtEnum node type StmtEnum struct { Position *position.Position @@ -368,14 +202,6 @@ type StmtEnum struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtEnum) Accept(v Visitor) { - v.StmtEnum(n) -} - -func (n *StmtEnum) GetPosition() *position.Position { - return n.Position -} - // EnumCase node type EnumCase struct { Position *position.Position @@ -387,14 +213,6 @@ type EnumCase struct { SemiColonTkn *token.Token } -func (n *EnumCase) Accept(v Visitor) { - v.EnumCase(n) -} - -func (n *EnumCase) GetPosition() *position.Position { - return n.Position -} - // StmtClass node type StmtClass struct { Position *position.Position @@ -416,14 +234,6 @@ type StmtClass struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtClass) Accept(v Visitor) { - v.StmtClass(n) -} - -func (n *StmtClass) GetPosition() *position.Position { - return n.Position -} - // StmtClassConstList node type StmtClassConstList struct { Position *position.Position @@ -435,14 +245,6 @@ type StmtClassConstList struct { SemiColonTkn *token.Token } -func (n *StmtClassConstList) Accept(v Visitor) { - v.StmtClassConstList(n) -} - -func (n *StmtClassConstList) GetPosition() *position.Position { - return n.Position -} - // StmtClassMethod node type StmtClassMethod struct { Position *position.Position @@ -460,14 +262,6 @@ type StmtClassMethod struct { Stmt Vertex } -func (n *StmtClassMethod) Accept(v Visitor) { - v.StmtClassMethod(n) -} - -func (n *StmtClassMethod) GetPosition() *position.Position { - return n.Position -} - // StmtConstList node type StmtConstList struct { Position *position.Position @@ -477,14 +271,6 @@ type StmtConstList struct { SemiColonTkn *token.Token } -func (n *StmtConstList) Accept(v Visitor) { - v.StmtConstList(n) -} - -func (n *StmtConstList) GetPosition() *position.Position { - return n.Position -} - // StmtConstant node type StmtConstant struct { Position *position.Position @@ -493,14 +279,6 @@ type StmtConstant struct { Expr Vertex } -func (n *StmtConstant) Accept(v Visitor) { - v.StmtConstant(n) -} - -func (n *StmtConstant) GetPosition() *position.Position { - return n.Position -} - // StmtContinue node type StmtContinue struct { Position *position.Position @@ -509,14 +287,6 @@ type StmtContinue struct { SemiColonTkn *token.Token } -func (n *StmtContinue) Accept(v Visitor) { - v.StmtContinue(n) -} - -func (n *StmtContinue) GetPosition() *position.Position { - return n.Position -} - // StmtDeclare node type StmtDeclare struct { Position *position.Position @@ -531,14 +301,6 @@ type StmtDeclare struct { SemiColonTkn *token.Token } -func (n *StmtDeclare) Accept(v Visitor) { - v.StmtDeclare(n) -} - -func (n *StmtDeclare) GetPosition() *position.Position { - return n.Position -} - // StmtDefault node type StmtDefault struct { Position *position.Position @@ -547,14 +309,6 @@ type StmtDefault struct { Stmts []Vertex } -func (n *StmtDefault) Accept(v Visitor) { - v.StmtDefault(n) -} - -func (n *StmtDefault) GetPosition() *position.Position { - return n.Position -} - // StmtDo node type StmtDo struct { Position *position.Position @@ -567,14 +321,6 @@ type StmtDo struct { SemiColonTkn *token.Token } -func (n *StmtDo) Accept(v Visitor) { - v.StmtDo(n) -} - -func (n *StmtDo) GetPosition() *position.Position { - return n.Position -} - // StmtEcho node type StmtEcho struct { Position *position.Position @@ -584,14 +330,6 @@ type StmtEcho struct { SemiColonTkn *token.Token } -func (n *StmtEcho) Accept(v Visitor) { - v.StmtEcho(n) -} - -func (n *StmtEcho) GetPosition() *position.Position { - return n.Position -} - // StmtElse node type StmtElse struct { Position *position.Position @@ -600,14 +338,6 @@ type StmtElse struct { Stmt Vertex } -func (n *StmtElse) Accept(v Visitor) { - v.StmtElse(n) -} - -func (n *StmtElse) GetPosition() *position.Position { - return n.Position -} - // StmtElseIf node type StmtElseIf struct { Position *position.Position @@ -619,14 +349,6 @@ type StmtElseIf struct { Stmt Vertex } -func (n *StmtElseIf) Accept(v Visitor) { - v.StmtElseIf(n) -} - -func (n *StmtElseIf) GetPosition() *position.Position { - return n.Position -} - // StmtExpression node type StmtExpression struct { Position *position.Position @@ -634,14 +356,6 @@ type StmtExpression struct { SemiColonTkn *token.Token } -func (n *StmtExpression) Accept(v Visitor) { - v.StmtExpression(n) -} - -func (n *StmtExpression) GetPosition() *position.Position { - return n.Position -} - // StmtFinally node type StmtFinally struct { Position *position.Position @@ -651,14 +365,6 @@ type StmtFinally struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtFinally) Accept(v Visitor) { - v.StmtFinally(n) -} - -func (n *StmtFinally) GetPosition() *position.Position { - return n.Position -} - // StmtFor node type StmtFor struct { Position *position.Position @@ -679,14 +385,6 @@ type StmtFor struct { SemiColonTkn *token.Token } -func (n *StmtFor) Accept(v Visitor) { - v.StmtFor(n) -} - -func (n *StmtFor) GetPosition() *position.Position { - return n.Position -} - // StmtForeach node type StmtForeach struct { Position *position.Position @@ -705,14 +403,6 @@ type StmtForeach struct { SemiColonTkn *token.Token } -func (n *StmtForeach) Accept(v Visitor) { - v.StmtForeach(n) -} - -func (n *StmtForeach) GetPosition() *position.Position { - return n.Position -} - // StmtFunction node type StmtFunction struct { Position *position.Position @@ -731,14 +421,6 @@ type StmtFunction struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtFunction) Accept(v Visitor) { - v.StmtFunction(n) -} - -func (n *StmtFunction) GetPosition() *position.Position { - return n.Position -} - // StmtGlobal node type StmtGlobal struct { Position *position.Position @@ -748,14 +430,6 @@ type StmtGlobal struct { SemiColonTkn *token.Token } -func (n *StmtGlobal) Accept(v Visitor) { - v.StmtGlobal(n) -} - -func (n *StmtGlobal) GetPosition() *position.Position { - return n.Position -} - // StmtGoto node type StmtGoto struct { Position *position.Position @@ -764,14 +438,6 @@ type StmtGoto struct { SemiColonTkn *token.Token } -func (n *StmtGoto) Accept(v Visitor) { - v.StmtGoto(n) -} - -func (n *StmtGoto) GetPosition() *position.Position { - return n.Position -} - // StmtHaltCompiler node type StmtHaltCompiler struct { Position *position.Position @@ -781,14 +447,6 @@ type StmtHaltCompiler struct { SemiColonTkn *token.Token } -func (n *StmtHaltCompiler) Accept(v Visitor) { - v.StmtHaltCompiler(n) -} - -func (n *StmtHaltCompiler) GetPosition() *position.Position { - return n.Position -} - // StmtIf node type StmtIf struct { Position *position.Position @@ -804,14 +462,6 @@ type StmtIf struct { SemiColonTkn *token.Token } -func (n *StmtIf) Accept(v Visitor) { - v.StmtIf(n) -} - -func (n *StmtIf) GetPosition() *position.Position { - return n.Position -} - // StmtInlineHtml node type StmtInlineHtml struct { Position *position.Position @@ -819,14 +469,6 @@ type StmtInlineHtml struct { Value []byte } -func (n *StmtInlineHtml) Accept(v Visitor) { - v.StmtInlineHtml(n) -} - -func (n *StmtInlineHtml) GetPosition() *position.Position { - return n.Position -} - // StmtInterface node type StmtInterface struct { Position *position.Position @@ -841,14 +483,6 @@ type StmtInterface struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtInterface) Accept(v Visitor) { - v.StmtInterface(n) -} - -func (n *StmtInterface) GetPosition() *position.Position { - return n.Position -} - // StmtLabel node type StmtLabel struct { Position *position.Position @@ -856,14 +490,6 @@ type StmtLabel struct { ColonTkn *token.Token } -func (n *StmtLabel) Accept(v Visitor) { - v.StmtLabel(n) -} - -func (n *StmtLabel) GetPosition() *position.Position { - return n.Position -} - // StmtNamespace node type StmtNamespace struct { Position *position.Position @@ -875,28 +501,12 @@ type StmtNamespace struct { SemiColonTkn *token.Token } -func (n *StmtNamespace) Accept(v Visitor) { - v.StmtNamespace(n) -} - -func (n *StmtNamespace) GetPosition() *position.Position { - return n.Position -} - // StmtNop node type StmtNop struct { Position *position.Position SemiColonTkn *token.Token } -func (n *StmtNop) Accept(v Visitor) { - v.StmtNop(n) -} - -func (n *StmtNop) GetPosition() *position.Position { - return n.Position -} - // StmtProperty node type StmtProperty struct { Position *position.Position @@ -905,14 +515,6 @@ type StmtProperty struct { Expr Vertex } -func (n *StmtProperty) Accept(v Visitor) { - v.StmtProperty(n) -} - -func (n *StmtProperty) GetPosition() *position.Position { - return n.Position -} - // StmtPropertyList node type StmtPropertyList struct { Position *position.Position @@ -924,14 +526,6 @@ type StmtPropertyList struct { SemiColonTkn *token.Token } -func (n *StmtPropertyList) Accept(v Visitor) { - v.StmtPropertyList(n) -} - -func (n *StmtPropertyList) GetPosition() *position.Position { - return n.Position -} - // StmtReturn node type StmtReturn struct { Position *position.Position @@ -940,14 +534,6 @@ type StmtReturn struct { SemiColonTkn *token.Token } -func (n *StmtReturn) Accept(v Visitor) { - v.StmtReturn(n) -} - -func (n *StmtReturn) GetPosition() *position.Position { - return n.Position -} - // StmtStatic node type StmtStatic struct { Position *position.Position @@ -957,14 +543,6 @@ type StmtStatic struct { SemiColonTkn *token.Token } -func (n *StmtStatic) Accept(v Visitor) { - v.StmtStatic(n) -} - -func (n *StmtStatic) GetPosition() *position.Position { - return n.Position -} - // StmtStaticVar node type StmtStaticVar struct { Position *position.Position @@ -973,14 +551,6 @@ type StmtStaticVar struct { Expr Vertex } -func (n *StmtStaticVar) Accept(v Visitor) { - v.StmtStaticVar(n) -} - -func (n *StmtStaticVar) GetPosition() *position.Position { - return n.Position -} - // StmtStmtList node type StmtStmtList struct { Position *position.Position @@ -989,14 +559,6 @@ type StmtStmtList struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtStmtList) Accept(v Visitor) { - v.StmtStmtList(n) -} - -func (n *StmtStmtList) GetPosition() *position.Position { - return n.Position -} - // StmtSwitch node type StmtSwitch struct { Position *position.Position @@ -1013,14 +575,6 @@ type StmtSwitch struct { SemiColonTkn *token.Token } -func (n *StmtSwitch) Accept(v Visitor) { - v.StmtSwitch(n) -} - -func (n *StmtSwitch) GetPosition() *position.Position { - return n.Position -} - // StmtThrow node type StmtThrow struct { Position *position.Position @@ -1029,14 +583,6 @@ type StmtThrow struct { SemiColonTkn *token.Token } -func (n *StmtThrow) Accept(v Visitor) { - v.StmtThrow(n) -} - -func (n *StmtThrow) GetPosition() *position.Position { - return n.Position -} - // StmtTrait node type StmtTrait struct { Position *position.Position @@ -1048,14 +594,6 @@ type StmtTrait struct { CloseCurlyBracketTkn *token.Token } -func (n *StmtTrait) Accept(v Visitor) { - v.StmtTrait(n) -} - -func (n *StmtTrait) GetPosition() *position.Position { - return n.Position -} - // StmtTraitUse node type StmtTraitUse struct { Position *position.Position @@ -1068,14 +606,6 @@ type StmtTraitUse struct { SemiColonTkn *token.Token } -func (n *StmtTraitUse) Accept(v Visitor) { - v.StmtTraitUse(n) -} - -func (n *StmtTraitUse) GetPosition() *position.Position { - return n.Position -} - // StmtTraitUseAlias node type StmtTraitUseAlias struct { Position *position.Position @@ -1088,14 +618,6 @@ type StmtTraitUseAlias struct { SemiColonTkn *token.Token } -func (n *StmtTraitUseAlias) Accept(v Visitor) { - v.StmtTraitUseAlias(n) -} - -func (n *StmtTraitUseAlias) GetPosition() *position.Position { - return n.Position -} - // StmtTraitUsePrecedence node type StmtTraitUsePrecedence struct { Position *position.Position @@ -1108,14 +630,6 @@ type StmtTraitUsePrecedence struct { SemiColonTkn *token.Token } -func (n *StmtTraitUsePrecedence) Accept(v Visitor) { - v.StmtTraitUsePrecedence(n) -} - -func (n *StmtTraitUsePrecedence) GetPosition() *position.Position { - return n.Position -} - // StmtTry node type StmtTry struct { Position *position.Position @@ -1127,14 +641,6 @@ type StmtTry struct { Finally Vertex } -func (n *StmtTry) Accept(v Visitor) { - v.StmtTry(n) -} - -func (n *StmtTry) GetPosition() *position.Position { - return n.Position -} - // StmtUnset node type StmtUnset struct { Position *position.Position @@ -1146,14 +652,6 @@ type StmtUnset struct { SemiColonTkn *token.Token } -func (n *StmtUnset) Accept(v Visitor) { - v.StmtUnset(n) -} - -func (n *StmtUnset) GetPosition() *position.Position { - return n.Position -} - // StmtUseList node type StmtUseList struct { Position *position.Position @@ -1164,14 +662,6 @@ type StmtUseList struct { SemiColonTkn *token.Token } -func (n *StmtUseList) Accept(v Visitor) { - v.StmtUse(n) -} - -func (n *StmtUseList) GetPosition() *position.Position { - return n.Position -} - // StmtGroupUseList node type StmtGroupUseList struct { Position *position.Position @@ -1187,14 +677,6 @@ type StmtGroupUseList struct { SemiColonTkn *token.Token } -func (n *StmtGroupUseList) Accept(v Visitor) { - v.StmtGroupUse(n) -} - -func (n *StmtGroupUseList) GetPosition() *position.Position { - return n.Position -} - // StmtUse node type StmtUse struct { Position *position.Position @@ -1205,14 +687,6 @@ type StmtUse struct { Alias Vertex } -func (n *StmtUse) Accept(v Visitor) { - v.StmtUseDeclaration(n) -} - -func (n *StmtUse) GetPosition() *position.Position { - return n.Position -} - // StmtWhile node type StmtWhile struct { Position *position.Position @@ -1226,14 +700,6 @@ type StmtWhile struct { SemiColonTkn *token.Token } -func (n *StmtWhile) Accept(v Visitor) { - v.StmtWhile(n) -} - -func (n *StmtWhile) GetPosition() *position.Position { - return n.Position -} - // ExprArray node type ExprArray struct { Position *position.Position @@ -1244,14 +710,6 @@ type ExprArray struct { CloseBracketTkn *token.Token } -func (n *ExprArray) Accept(v Visitor) { - v.ExprArray(n) -} - -func (n *ExprArray) GetPosition() *position.Position { - return n.Position -} - // ExprArrayDimFetch node type ExprArrayDimFetch struct { Position *position.Position @@ -1261,14 +719,6 @@ type ExprArrayDimFetch struct { CloseBracketTkn *token.Token } -func (n *ExprArrayDimFetch) Accept(v Visitor) { - v.ExprArrayDimFetch(n) -} - -func (n *ExprArrayDimFetch) GetPosition() *position.Position { - return n.Position -} - // ExprArrayItem node type ExprArrayItem struct { Position *position.Position @@ -1279,14 +729,6 @@ type ExprArrayItem struct { Val Vertex } -func (n *ExprArrayItem) Accept(v Visitor) { - v.ExprArrayItem(n) -} - -func (n *ExprArrayItem) GetPosition() *position.Position { - return n.Position -} - // ExprArrowFunction node type ExprArrowFunction struct { Position *position.Position @@ -1304,14 +746,6 @@ type ExprArrowFunction struct { Expr Vertex } -func (n *ExprArrowFunction) Accept(v Visitor) { - v.ExprArrowFunction(n) -} - -func (n *ExprArrowFunction) GetPosition() *position.Position { - return n.Position -} - // ExprBitwiseNot node type ExprBitwiseNot struct { Position *position.Position @@ -1319,14 +753,6 @@ type ExprBitwiseNot struct { Expr Vertex } -func (n *ExprBitwiseNot) Accept(v Visitor) { - v.ExprBitwiseNot(n) -} - -func (n *ExprBitwiseNot) GetPosition() *position.Position { - return n.Position -} - // ExprBooleanNot node type ExprBooleanNot struct { Position *position.Position @@ -1334,14 +760,6 @@ type ExprBooleanNot struct { Expr Vertex } -func (n *ExprBooleanNot) Accept(v Visitor) { - v.ExprBooleanNot(n) -} - -func (n *ExprBooleanNot) GetPosition() *position.Position { - return n.Position -} - type ExprBrackets struct { Position *position.Position OpenParenthesisTkn *token.Token @@ -1349,14 +767,6 @@ type ExprBrackets struct { CloseParenthesisTkn *token.Token } -func (n *ExprBrackets) Accept(v Visitor) { - v.ExprBrackets(n) -} - -func (n *ExprBrackets) GetPosition() *position.Position { - return n.Position -} - // ExprClassConstFetch node type ExprClassConstFetch struct { Position *position.Position @@ -1365,14 +775,6 @@ type ExprClassConstFetch struct { Const Vertex } -func (n *ExprClassConstFetch) Accept(v Visitor) { - v.ExprClassConstFetch(n) -} - -func (n *ExprClassConstFetch) GetPosition() *position.Position { - return n.Position -} - // ExprClone node type ExprClone struct { Position *position.Position @@ -1380,14 +782,6 @@ type ExprClone struct { Expr Vertex } -func (n *ExprClone) Accept(v Visitor) { - v.ExprClone(n) -} - -func (n *ExprClone) GetPosition() *position.Position { - return n.Position -} - // ExprClosure node type ExprClosure struct { Position *position.Position @@ -1411,14 +805,6 @@ type ExprClosure struct { CloseCurlyBracketTkn *token.Token } -func (n *ExprClosure) Accept(v Visitor) { - v.ExprClosure(n) -} - -func (n *ExprClosure) GetPosition() *position.Position { - return n.Position -} - // ExprClosureUse node type ExprClosureUse struct { Position *position.Position @@ -1426,28 +812,12 @@ type ExprClosureUse struct { Var Vertex } -func (n *ExprClosureUse) Accept(v Visitor) { - v.ExprClosureUse(n) -} - -func (n *ExprClosureUse) GetPosition() *position.Position { - return n.Position -} - // ExprConstFetch node type ExprConstFetch struct { Position *position.Position Const Vertex } -func (n *ExprConstFetch) Accept(v Visitor) { - v.ExprConstFetch(n) -} - -func (n *ExprConstFetch) GetPosition() *position.Position { - return n.Position -} - // ExprEmpty node type ExprEmpty struct { Position *position.Position @@ -1457,14 +827,6 @@ type ExprEmpty struct { CloseParenthesisTkn *token.Token } -func (n *ExprEmpty) Accept(v Visitor) { - v.ExprEmpty(n) -} - -func (n *ExprEmpty) GetPosition() *position.Position { - return n.Position -} - // ExprErrorSuppress node type ExprErrorSuppress struct { Position *position.Position @@ -1472,14 +834,6 @@ type ExprErrorSuppress struct { Expr Vertex } -func (n *ExprErrorSuppress) Accept(v Visitor) { - v.ExprErrorSuppress(n) -} - -func (n *ExprErrorSuppress) GetPosition() *position.Position { - return n.Position -} - // ExprEval node type ExprEval struct { Position *position.Position @@ -1489,14 +843,6 @@ type ExprEval struct { CloseParenthesisTkn *token.Token } -func (n *ExprEval) Accept(v Visitor) { - v.ExprEval(n) -} - -func (n *ExprEval) GetPosition() *position.Position { - return n.Position -} - // ExprExit node type ExprExit struct { Position *position.Position @@ -1506,14 +852,6 @@ type ExprExit struct { CloseParenthesisTkn *token.Token } -func (n *ExprExit) Accept(v Visitor) { - v.ExprExit(n) -} - -func (n *ExprExit) GetPosition() *position.Position { - return n.Position -} - // ExprFunctionCall node type ExprFunctionCall struct { Position *position.Position @@ -1525,14 +863,6 @@ type ExprFunctionCall struct { CloseParenthesisTkn *token.Token } -func (n *ExprFunctionCall) Accept(v Visitor) { - v.ExprFunctionCall(n) -} - -func (n *ExprFunctionCall) GetPosition() *position.Position { - return n.Position -} - // ExprInclude node type ExprInclude struct { Position *position.Position @@ -1540,14 +870,6 @@ type ExprInclude struct { Expr Vertex } -func (n *ExprInclude) Accept(v Visitor) { - v.ExprInclude(n) -} - -func (n *ExprInclude) GetPosition() *position.Position { - return n.Position -} - // ExprIncludeOnce node type ExprIncludeOnce struct { Position *position.Position @@ -1555,14 +877,6 @@ type ExprIncludeOnce struct { Expr Vertex } -func (n *ExprIncludeOnce) Accept(v Visitor) { - v.ExprIncludeOnce(n) -} - -func (n *ExprIncludeOnce) GetPosition() *position.Position { - return n.Position -} - // ExprInstanceOf node type ExprInstanceOf struct { Position *position.Position @@ -1571,14 +885,6 @@ type ExprInstanceOf struct { Class Vertex } -func (n *ExprInstanceOf) Accept(v Visitor) { - v.ExprInstanceOf(n) -} - -func (n *ExprInstanceOf) GetPosition() *position.Position { - return n.Position -} - // ExprIsset node type ExprIsset struct { Position *position.Position @@ -1589,14 +895,6 @@ type ExprIsset struct { CloseParenthesisTkn *token.Token } -func (n *ExprIsset) Accept(v Visitor) { - v.ExprIsset(n) -} - -func (n *ExprIsset) GetPosition() *position.Position { - return n.Position -} - // ExprList node type ExprList struct { Position *position.Position @@ -1607,14 +905,6 @@ type ExprList struct { CloseBracketTkn *token.Token } -func (n *ExprList) Accept(v Visitor) { - v.ExprList(n) -} - -func (n *ExprList) GetPosition() *position.Position { - return n.Position -} - // ExprMethodCall node type ExprMethodCall struct { Position *position.Position @@ -1630,14 +920,6 @@ type ExprMethodCall struct { CloseParenthesisTkn *token.Token } -func (n *ExprMethodCall) Accept(v Visitor) { - v.ExprMethodCall(n) -} - -func (n *ExprMethodCall) GetPosition() *position.Position { - return n.Position -} - // ExprNullsafeMethodCall node is $a?->methodName() type ExprNullsafeMethodCall struct { Position *position.Position @@ -1653,14 +935,6 @@ type ExprNullsafeMethodCall struct { CloseParenthesisTkn *token.Token } -func (n *ExprNullsafeMethodCall) Accept(v Visitor) { - v.ExprNullsafeMethodCall(n) -} - -func (n *ExprNullsafeMethodCall) GetPosition() *position.Position { - return n.Position -} - // ExprNew node type ExprNew struct { Position *position.Position @@ -1672,14 +946,6 @@ type ExprNew struct { CloseParenthesisTkn *token.Token } -func (n *ExprNew) Accept(v Visitor) { - v.ExprNew(n) -} - -func (n *ExprNew) GetPosition() *position.Position { - return n.Position -} - // ExprPostDec node type ExprPostDec struct { Position *position.Position @@ -1687,14 +953,6 @@ type ExprPostDec struct { DecTkn *token.Token } -func (n *ExprPostDec) Accept(v Visitor) { - v.ExprPostDec(n) -} - -func (n *ExprPostDec) GetPosition() *position.Position { - return n.Position -} - // ExprPostInc node type ExprPostInc struct { Position *position.Position @@ -1702,14 +960,6 @@ type ExprPostInc struct { IncTkn *token.Token } -func (n *ExprPostInc) Accept(v Visitor) { - v.ExprPostInc(n) -} - -func (n *ExprPostInc) GetPosition() *position.Position { - return n.Position -} - // ExprPreDec node type ExprPreDec struct { Position *position.Position @@ -1717,14 +967,6 @@ type ExprPreDec struct { Var Vertex } -func (n *ExprPreDec) Accept(v Visitor) { - v.ExprPreDec(n) -} - -func (n *ExprPreDec) GetPosition() *position.Position { - return n.Position -} - // ExprPreInc node type ExprPreInc struct { Position *position.Position @@ -1732,14 +974,6 @@ type ExprPreInc struct { Var Vertex } -func (n *ExprPreInc) Accept(v Visitor) { - v.ExprPreInc(n) -} - -func (n *ExprPreInc) GetPosition() *position.Position { - return n.Position -} - // ExprPrint node type ExprPrint struct { Position *position.Position @@ -1747,14 +981,6 @@ type ExprPrint struct { Expr Vertex } -func (n *ExprPrint) Accept(v Visitor) { - v.ExprPrint(n) -} - -func (n *ExprPrint) GetPosition() *position.Position { - return n.Position -} - // ExprPropertyFetch node type ExprPropertyFetch struct { Position *position.Position @@ -1765,14 +991,6 @@ type ExprPropertyFetch struct { CloseCurlyBracketTkn *token.Token } -func (n *ExprPropertyFetch) Accept(v Visitor) { - v.ExprPropertyFetch(n) -} - -func (n *ExprPropertyFetch) GetPosition() *position.Position { - return n.Position -} - // ExprNullsafePropertyFetch node type ExprNullsafePropertyFetch struct { Position *position.Position @@ -1783,14 +1001,6 @@ type ExprNullsafePropertyFetch struct { CloseCurlyBracketTkn *token.Token } -func (n *ExprNullsafePropertyFetch) Accept(v Visitor) { - v.ExprNullsafePropertyFetch(n) -} - -func (n *ExprNullsafePropertyFetch) GetPosition() *position.Position { - return n.Position -} - // ExprRequire node type ExprRequire struct { Position *position.Position @@ -1798,14 +1008,6 @@ type ExprRequire struct { Expr Vertex } -func (n *ExprRequire) Accept(v Visitor) { - v.ExprRequire(n) -} - -func (n *ExprRequire) GetPosition() *position.Position { - return n.Position -} - // ExprRequireOnce node type ExprRequireOnce struct { Position *position.Position @@ -1813,14 +1015,6 @@ type ExprRequireOnce struct { Expr Vertex } -func (n *ExprRequireOnce) Accept(v Visitor) { - v.ExprRequireOnce(n) -} - -func (n *ExprRequireOnce) GetPosition() *position.Position { - return n.Position -} - // ExprShellExec node type ExprShellExec struct { Position *position.Position @@ -1829,14 +1023,6 @@ type ExprShellExec struct { CloseBacktickTkn *token.Token } -func (n *ExprShellExec) Accept(v Visitor) { - v.ExprShellExec(n) -} - -func (n *ExprShellExec) GetPosition() *position.Position { - return n.Position -} - // ExprStaticCall node type ExprStaticCall struct { Position *position.Position @@ -1852,14 +1038,6 @@ type ExprStaticCall struct { CloseParenthesisTkn *token.Token } -func (n *ExprStaticCall) Accept(v Visitor) { - v.ExprStaticCall(n) -} - -func (n *ExprStaticCall) GetPosition() *position.Position { - return n.Position -} - // ExprStaticPropertyFetch node type ExprStaticPropertyFetch struct { Position *position.Position @@ -1868,14 +1046,6 @@ type ExprStaticPropertyFetch struct { Prop Vertex } -func (n *ExprStaticPropertyFetch) Accept(v Visitor) { - v.ExprStaticPropertyFetch(n) -} - -func (n *ExprStaticPropertyFetch) GetPosition() *position.Position { - return n.Position -} - // ExprTernary node type ExprTernary struct { Position *position.Position @@ -1886,14 +1056,6 @@ type ExprTernary struct { IfFalse Vertex } -func (n *ExprTernary) Accept(v Visitor) { - v.ExprTernary(n) -} - -func (n *ExprTernary) GetPosition() *position.Position { - return n.Position -} - // ExprUnaryMinus node type ExprUnaryMinus struct { Position *position.Position @@ -1901,14 +1063,6 @@ type ExprUnaryMinus struct { Expr Vertex } -func (n *ExprUnaryMinus) Accept(v Visitor) { - v.ExprUnaryMinus(n) -} - -func (n *ExprUnaryMinus) GetPosition() *position.Position { - return n.Position -} - // ExprUnaryPlus node type ExprUnaryPlus struct { Position *position.Position @@ -1916,14 +1070,6 @@ type ExprUnaryPlus struct { Expr Vertex } -func (n *ExprUnaryPlus) Accept(v Visitor) { - v.ExprUnaryPlus(n) -} - -func (n *ExprUnaryPlus) GetPosition() *position.Position { - return n.Position -} - // ExprVariable node type ExprVariable struct { Position *position.Position @@ -1933,14 +1079,6 @@ type ExprVariable struct { CloseCurlyBracketTkn *token.Token } -func (n *ExprVariable) Accept(v Visitor) { - v.ExprVariable(n) -} - -func (n *ExprVariable) GetPosition() *position.Position { - return n.Position -} - // ExprYield node type ExprYield struct { Position *position.Position @@ -1950,14 +1088,6 @@ type ExprYield struct { Val Vertex } -func (n *ExprYield) Accept(v Visitor) { - v.ExprYield(n) -} - -func (n *ExprYield) GetPosition() *position.Position { - return n.Position -} - // ExprYieldFrom node type ExprYieldFrom struct { Position *position.Position @@ -1965,14 +1095,6 @@ type ExprYieldFrom struct { Expr Vertex } -func (n *ExprYieldFrom) Accept(v Visitor) { - v.ExprYieldFrom(n) -} - -func (n *ExprYieldFrom) GetPosition() *position.Position { - return n.Position -} - // ExprCastArray node type ExprCastArray struct { Position *position.Position @@ -1980,14 +1102,6 @@ type ExprCastArray struct { Expr Vertex } -func (n *ExprCastArray) Accept(v Visitor) { - v.ExprCastArray(n) -} - -func (n *ExprCastArray) GetPosition() *position.Position { - return n.Position -} - // ExprCastBool node type ExprCastBool struct { Position *position.Position @@ -1995,14 +1109,6 @@ type ExprCastBool struct { Expr Vertex } -func (n *ExprCastBool) Accept(v Visitor) { - v.ExprCastBool(n) -} - -func (n *ExprCastBool) GetPosition() *position.Position { - return n.Position -} - // ExprCastDouble node type ExprCastDouble struct { Position *position.Position @@ -2010,14 +1116,6 @@ type ExprCastDouble struct { Expr Vertex } -func (n *ExprCastDouble) Accept(v Visitor) { - v.ExprCastDouble(n) -} - -func (n *ExprCastDouble) GetPosition() *position.Position { - return n.Position -} - // ExprCastInt node type ExprCastInt struct { Position *position.Position @@ -2025,14 +1123,6 @@ type ExprCastInt struct { Expr Vertex } -func (n *ExprCastInt) Accept(v Visitor) { - v.ExprCastInt(n) -} - -func (n *ExprCastInt) GetPosition() *position.Position { - return n.Position -} - // ExprCastObject node type ExprCastObject struct { Position *position.Position @@ -2040,14 +1130,6 @@ type ExprCastObject struct { Expr Vertex } -func (n *ExprCastObject) Accept(v Visitor) { - v.ExprCastObject(n) -} - -func (n *ExprCastObject) GetPosition() *position.Position { - return n.Position -} - // ExprCastString node type ExprCastString struct { Position *position.Position @@ -2055,14 +1137,6 @@ type ExprCastString struct { Expr Vertex } -func (n *ExprCastString) Accept(v Visitor) { - v.ExprCastString(n) -} - -func (n *ExprCastString) GetPosition() *position.Position { - return n.Position -} - // ExprCastUnset node type ExprCastUnset struct { Position *position.Position @@ -2070,14 +1144,6 @@ type ExprCastUnset struct { Expr Vertex } -func (n *ExprCastUnset) Accept(v Visitor) { - v.ExprCastUnset(n) -} - -func (n *ExprCastUnset) GetPosition() *position.Position { - return n.Position -} - // ExprAssign node type ExprAssign struct { Position *position.Position @@ -2086,14 +1152,6 @@ type ExprAssign struct { Expr Vertex } -func (n *ExprAssign) Accept(v Visitor) { - v.ExprAssign(n) -} - -func (n *ExprAssign) GetPosition() *position.Position { - return n.Position -} - // ExprAssignReference node type ExprAssignReference struct { Position *position.Position @@ -2103,14 +1161,6 @@ type ExprAssignReference struct { Expr Vertex } -func (n *ExprAssignReference) Accept(v Visitor) { - v.ExprAssignReference(n) -} - -func (n *ExprAssignReference) GetPosition() *position.Position { - return n.Position -} - // ExprAssignBitwiseAnd node type ExprAssignBitwiseAnd struct { Position *position.Position @@ -2119,14 +1169,6 @@ type ExprAssignBitwiseAnd struct { Expr Vertex } -func (n *ExprAssignBitwiseAnd) Accept(v Visitor) { - v.ExprAssignBitwiseAnd(n) -} - -func (n *ExprAssignBitwiseAnd) GetPosition() *position.Position { - return n.Position -} - // ExprAssignBitwiseOr node type ExprAssignBitwiseOr struct { Position *position.Position @@ -2135,14 +1177,6 @@ type ExprAssignBitwiseOr struct { Expr Vertex } -func (n *ExprAssignBitwiseOr) Accept(v Visitor) { - v.ExprAssignBitwiseOr(n) -} - -func (n *ExprAssignBitwiseOr) GetPosition() *position.Position { - return n.Position -} - // ExprAssignBitwiseXor node type ExprAssignBitwiseXor struct { Position *position.Position @@ -2151,14 +1185,6 @@ type ExprAssignBitwiseXor struct { Expr Vertex } -func (n *ExprAssignBitwiseXor) Accept(v Visitor) { - v.ExprAssignBitwiseXor(n) -} - -func (n *ExprAssignBitwiseXor) GetPosition() *position.Position { - return n.Position -} - // ExprAssignCoalesce node type ExprAssignCoalesce struct { Position *position.Position @@ -2167,14 +1193,6 @@ type ExprAssignCoalesce struct { Expr Vertex } -func (n *ExprAssignCoalesce) Accept(v Visitor) { - v.ExprAssignCoalesce(n) -} - -func (n *ExprAssignCoalesce) GetPosition() *position.Position { - return n.Position -} - // ExprAssignConcat node type ExprAssignConcat struct { Position *position.Position @@ -2183,14 +1201,6 @@ type ExprAssignConcat struct { Expr Vertex } -func (n *ExprAssignConcat) Accept(v Visitor) { - v.ExprAssignConcat(n) -} - -func (n *ExprAssignConcat) GetPosition() *position.Position { - return n.Position -} - // ExprAssignDiv node type ExprAssignDiv struct { Position *position.Position @@ -2199,14 +1209,6 @@ type ExprAssignDiv struct { Expr Vertex } -func (n *ExprAssignDiv) Accept(v Visitor) { - v.ExprAssignDiv(n) -} - -func (n *ExprAssignDiv) GetPosition() *position.Position { - return n.Position -} - // ExprAssignMinus node type ExprAssignMinus struct { Position *position.Position @@ -2215,14 +1217,6 @@ type ExprAssignMinus struct { Expr Vertex } -func (n *ExprAssignMinus) Accept(v Visitor) { - v.ExprAssignMinus(n) -} - -func (n *ExprAssignMinus) GetPosition() *position.Position { - return n.Position -} - // ExprAssignMod node type ExprAssignMod struct { Position *position.Position @@ -2231,14 +1225,6 @@ type ExprAssignMod struct { Expr Vertex } -func (n *ExprAssignMod) Accept(v Visitor) { - v.ExprAssignMod(n) -} - -func (n *ExprAssignMod) GetPosition() *position.Position { - return n.Position -} - // ExprAssignMul node type ExprAssignMul struct { Position *position.Position @@ -2247,14 +1233,6 @@ type ExprAssignMul struct { Expr Vertex } -func (n *ExprAssignMul) Accept(v Visitor) { - v.ExprAssignMul(n) -} - -func (n *ExprAssignMul) GetPosition() *position.Position { - return n.Position -} - // ExprAssignPlus node type ExprAssignPlus struct { Position *position.Position @@ -2263,14 +1241,6 @@ type ExprAssignPlus struct { Expr Vertex } -func (n *ExprAssignPlus) Accept(v Visitor) { - v.ExprAssignPlus(n) -} - -func (n *ExprAssignPlus) GetPosition() *position.Position { - return n.Position -} - // ExprAssignPow node type ExprAssignPow struct { Position *position.Position @@ -2279,14 +1249,6 @@ type ExprAssignPow struct { Expr Vertex } -func (n *ExprAssignPow) Accept(v Visitor) { - v.ExprAssignPow(n) -} - -func (n *ExprAssignPow) GetPosition() *position.Position { - return n.Position -} - // ExprAssignShiftLeft node type ExprAssignShiftLeft struct { Position *position.Position @@ -2295,14 +1257,6 @@ type ExprAssignShiftLeft struct { Expr Vertex } -func (n *ExprAssignShiftLeft) Accept(v Visitor) { - v.ExprAssignShiftLeft(n) -} - -func (n *ExprAssignShiftLeft) GetPosition() *position.Position { - return n.Position -} - // ExprAssignShiftRight node type ExprAssignShiftRight struct { Position *position.Position @@ -2311,14 +1265,6 @@ type ExprAssignShiftRight struct { Expr Vertex } -func (n *ExprAssignShiftRight) Accept(v Visitor) { - v.ExprAssignShiftRight(n) -} - -func (n *ExprAssignShiftRight) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryBitwiseAnd node type ExprBinaryBitwiseAnd struct { Position *position.Position @@ -2327,14 +1273,6 @@ type ExprBinaryBitwiseAnd struct { Right Vertex } -func (n *ExprBinaryBitwiseAnd) Accept(v Visitor) { - v.ExprBinaryBitwiseAnd(n) -} - -func (n *ExprBinaryBitwiseAnd) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryBitwiseOr node type ExprBinaryBitwiseOr struct { Position *position.Position @@ -2343,14 +1281,6 @@ type ExprBinaryBitwiseOr struct { Right Vertex } -func (n *ExprBinaryBitwiseOr) Accept(v Visitor) { - v.ExprBinaryBitwiseOr(n) -} - -func (n *ExprBinaryBitwiseOr) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryBitwiseXor node type ExprBinaryBitwiseXor struct { Position *position.Position @@ -2359,14 +1289,6 @@ type ExprBinaryBitwiseXor struct { Right Vertex } -func (n *ExprBinaryBitwiseXor) Accept(v Visitor) { - v.ExprBinaryBitwiseXor(n) -} - -func (n *ExprBinaryBitwiseXor) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryBooleanAnd node type ExprBinaryBooleanAnd struct { Position *position.Position @@ -2375,14 +1297,6 @@ type ExprBinaryBooleanAnd struct { Right Vertex } -func (n *ExprBinaryBooleanAnd) Accept(v Visitor) { - v.ExprBinaryBooleanAnd(n) -} - -func (n *ExprBinaryBooleanAnd) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryBooleanOr node type ExprBinaryBooleanOr struct { Position *position.Position @@ -2391,14 +1305,6 @@ type ExprBinaryBooleanOr struct { Right Vertex } -func (n *ExprBinaryBooleanOr) Accept(v Visitor) { - v.ExprBinaryBooleanOr(n) -} - -func (n *ExprBinaryBooleanOr) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryCoalesce node type ExprBinaryCoalesce struct { Position *position.Position @@ -2407,14 +1313,6 @@ type ExprBinaryCoalesce struct { Right Vertex } -func (n *ExprBinaryCoalesce) Accept(v Visitor) { - v.ExprBinaryCoalesce(n) -} - -func (n *ExprBinaryCoalesce) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryConcat node type ExprBinaryConcat struct { Position *position.Position @@ -2423,14 +1321,6 @@ type ExprBinaryConcat struct { Right Vertex } -func (n *ExprBinaryConcat) Accept(v Visitor) { - v.ExprBinaryConcat(n) -} - -func (n *ExprBinaryConcat) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryDiv node type ExprBinaryDiv struct { Position *position.Position @@ -2439,14 +1329,6 @@ type ExprBinaryDiv struct { Right Vertex } -func (n *ExprBinaryDiv) Accept(v Visitor) { - v.ExprBinaryDiv(n) -} - -func (n *ExprBinaryDiv) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryEqual node type ExprBinaryEqual struct { Position *position.Position @@ -2455,14 +1337,6 @@ type ExprBinaryEqual struct { Right Vertex } -func (n *ExprBinaryEqual) Accept(v Visitor) { - v.ExprBinaryEqual(n) -} - -func (n *ExprBinaryEqual) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryGreater node type ExprBinaryGreater struct { Position *position.Position @@ -2471,14 +1345,6 @@ type ExprBinaryGreater struct { Right Vertex } -func (n *ExprBinaryGreater) Accept(v Visitor) { - v.ExprBinaryGreater(n) -} - -func (n *ExprBinaryGreater) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryGreaterOrEqual node type ExprBinaryGreaterOrEqual struct { Position *position.Position @@ -2487,14 +1353,6 @@ type ExprBinaryGreaterOrEqual struct { Right Vertex } -func (n *ExprBinaryGreaterOrEqual) Accept(v Visitor) { - v.ExprBinaryGreaterOrEqual(n) -} - -func (n *ExprBinaryGreaterOrEqual) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryIdentical node type ExprBinaryIdentical struct { Position *position.Position @@ -2503,14 +1361,6 @@ type ExprBinaryIdentical struct { Right Vertex } -func (n *ExprBinaryIdentical) Accept(v Visitor) { - v.ExprBinaryIdentical(n) -} - -func (n *ExprBinaryIdentical) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryLogicalAnd node type ExprBinaryLogicalAnd struct { Position *position.Position @@ -2519,14 +1369,6 @@ type ExprBinaryLogicalAnd struct { Right Vertex } -func (n *ExprBinaryLogicalAnd) Accept(v Visitor) { - v.ExprBinaryLogicalAnd(n) -} - -func (n *ExprBinaryLogicalAnd) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryLogicalOr node type ExprBinaryLogicalOr struct { Position *position.Position @@ -2535,14 +1377,6 @@ type ExprBinaryLogicalOr struct { Right Vertex } -func (n *ExprBinaryLogicalOr) Accept(v Visitor) { - v.ExprBinaryLogicalOr(n) -} - -func (n *ExprBinaryLogicalOr) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryLogicalXor node type ExprBinaryLogicalXor struct { Position *position.Position @@ -2551,14 +1385,6 @@ type ExprBinaryLogicalXor struct { Right Vertex } -func (n *ExprBinaryLogicalXor) Accept(v Visitor) { - v.ExprBinaryLogicalXor(n) -} - -func (n *ExprBinaryLogicalXor) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryMinus node type ExprBinaryMinus struct { Position *position.Position @@ -2567,14 +1393,6 @@ type ExprBinaryMinus struct { Right Vertex } -func (n *ExprBinaryMinus) Accept(v Visitor) { - v.ExprBinaryMinus(n) -} - -func (n *ExprBinaryMinus) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryMod node type ExprBinaryMod struct { Position *position.Position @@ -2583,14 +1401,6 @@ type ExprBinaryMod struct { Right Vertex } -func (n *ExprBinaryMod) Accept(v Visitor) { - v.ExprBinaryMod(n) -} - -func (n *ExprBinaryMod) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryMul node type ExprBinaryMul struct { Position *position.Position @@ -2599,14 +1409,6 @@ type ExprBinaryMul struct { Right Vertex } -func (n *ExprBinaryMul) Accept(v Visitor) { - v.ExprBinaryMul(n) -} - -func (n *ExprBinaryMul) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryNotEqual node type ExprBinaryNotEqual struct { Position *position.Position @@ -2615,14 +1417,6 @@ type ExprBinaryNotEqual struct { Right Vertex } -func (n *ExprBinaryNotEqual) Accept(v Visitor) { - v.ExprBinaryNotEqual(n) -} - -func (n *ExprBinaryNotEqual) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryNotIdentical node type ExprBinaryNotIdentical struct { Position *position.Position @@ -2631,14 +1425,6 @@ type ExprBinaryNotIdentical struct { Right Vertex } -func (n *ExprBinaryNotIdentical) Accept(v Visitor) { - v.ExprBinaryNotIdentical(n) -} - -func (n *ExprBinaryNotIdentical) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryPlus node type ExprBinaryPlus struct { Position *position.Position @@ -2647,14 +1433,6 @@ type ExprBinaryPlus struct { Right Vertex } -func (n *ExprBinaryPlus) Accept(v Visitor) { - v.ExprBinaryPlus(n) -} - -func (n *ExprBinaryPlus) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryPow node type ExprBinaryPow struct { Position *position.Position @@ -2663,14 +1441,6 @@ type ExprBinaryPow struct { Right Vertex } -func (n *ExprBinaryPow) Accept(v Visitor) { - v.ExprBinaryPow(n) -} - -func (n *ExprBinaryPow) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryShiftLeft node type ExprBinaryShiftLeft struct { Position *position.Position @@ -2679,14 +1449,6 @@ type ExprBinaryShiftLeft struct { Right Vertex } -func (n *ExprBinaryShiftLeft) Accept(v Visitor) { - v.ExprBinaryShiftLeft(n) -} - -func (n *ExprBinaryShiftLeft) GetPosition() *position.Position { - return n.Position -} - // ExprBinaryShiftRight node type ExprBinaryShiftRight struct { Position *position.Position @@ -2695,14 +1457,6 @@ type ExprBinaryShiftRight struct { Right Vertex } -func (n *ExprBinaryShiftRight) Accept(v Visitor) { - v.ExprBinaryShiftRight(n) -} - -func (n *ExprBinaryShiftRight) GetPosition() *position.Position { - return n.Position -} - // ExprBinarySmaller node type ExprBinarySmaller struct { Position *position.Position @@ -2711,14 +1465,6 @@ type ExprBinarySmaller struct { Right Vertex } -func (n *ExprBinarySmaller) Accept(v Visitor) { - v.ExprBinarySmaller(n) -} - -func (n *ExprBinarySmaller) GetPosition() *position.Position { - return n.Position -} - // ExprBinarySmallerOrEqual node type ExprBinarySmallerOrEqual struct { Position *position.Position @@ -2727,14 +1473,6 @@ type ExprBinarySmallerOrEqual struct { Right Vertex } -func (n *ExprBinarySmallerOrEqual) Accept(v Visitor) { - v.ExprBinarySmallerOrEqual(n) -} - -func (n *ExprBinarySmallerOrEqual) GetPosition() *position.Position { - return n.Position -} - // ExprBinarySpaceship node type ExprBinarySpaceship struct { Position *position.Position @@ -2743,14 +1481,6 @@ type ExprBinarySpaceship struct { Right Vertex } -func (n *ExprBinarySpaceship) Accept(v Visitor) { - v.ExprBinarySpaceship(n) -} - -func (n *ExprBinarySpaceship) GetPosition() *position.Position { - return n.Position -} - // ExprMatch node is match(expr) { list } type ExprMatch struct { Position *position.Position @@ -2764,14 +1494,6 @@ type ExprMatch struct { CloseCurlyBracketTkn *token.Token } -func (n *ExprMatch) Accept(v Visitor) { - v.ExprMatch(n) -} - -func (n *ExprMatch) GetPosition() *position.Position { - return n.Position -} - // ExprThrow node is 'throw Expr' type ExprThrow struct { Position *position.Position @@ -2780,14 +1502,6 @@ type ExprThrow struct { SemiColonTkn *token.Token } -func (n *ExprThrow) Accept(v Visitor) { - v.ExprThrow(n) -} - -func (n *ExprThrow) GetPosition() *position.Position { - return n.Position -} - // MatchArm node is [expr, expr1, ...]|default => return_expr type MatchArm struct { Position *position.Position @@ -2799,28 +1513,12 @@ type MatchArm struct { ReturnExpr Vertex } -func (n *MatchArm) Accept(v Visitor) { - v.MatchArm(n) -} - -func (n *MatchArm) GetPosition() *position.Position { - return n.Position -} - type Name struct { Position *position.Position Parts []Vertex SeparatorTkns []*token.Token } -func (n *Name) Accept(v Visitor) { - v.NameName(n) -} - -func (n *Name) GetPosition() *position.Position { - return n.Position -} - type NameFullyQualified struct { Position *position.Position NsSeparatorTkn *token.Token @@ -2828,14 +1526,6 @@ type NameFullyQualified struct { SeparatorTkns []*token.Token } -func (n *NameFullyQualified) Accept(v Visitor) { - v.NameFullyQualified(n) -} - -func (n *NameFullyQualified) GetPosition() *position.Position { - return n.Position -} - type NameRelative struct { Position *position.Position NsTkn *token.Token @@ -2844,24 +1534,8 @@ type NameRelative struct { SeparatorTkns []*token.Token } -func (n *NameRelative) Accept(v Visitor) { - v.NameRelative(n) -} - -func (n *NameRelative) GetPosition() *position.Position { - return n.Position -} - type NamePart struct { Position *position.Position StringTkn *token.Token Value []byte } - -func (n *NamePart) Accept(v Visitor) { - v.NameNamePart(n) -} - -func (n *NamePart) GetPosition() *position.Position { - return n.Position -} diff --git a/pkg/ast/node_funcs.go b/pkg/ast/node_funcs.go new file mode 100644 index 0000000..fb5b8fa --- /dev/null +++ b/pkg/ast/node_funcs.go @@ -0,0 +1,1665 @@ +// Code generated by "go generate go run node_funcs_gen.go"; DO NOT EDIT. + +package ast + +import "github.com/VKCOM/php-parser/pkg/position" + +var _ Vertex = &Root{} + +func (n *Root) Accept(v Visitor) { + v.Root(n) +} + +func (n *Root) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &Nullable{} + +func (n *Nullable) Accept(v Visitor) { + v.Nullable(n) +} + +func (n *Nullable) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &Union{} + +func (n *Union) Accept(v Visitor) { + v.Union(n) +} + +func (n *Union) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &Intersection{} + +func (n *Intersection) Accept(v Visitor) { + v.Intersection(n) +} + +func (n *Intersection) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &Parameter{} + +func (n *Parameter) Accept(v Visitor) { + v.Parameter(n) +} + +func (n *Parameter) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &Identifier{} + +func (n *Identifier) Accept(v Visitor) { + v.Identifier(n) +} + +func (n *Identifier) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &Argument{} + +func (n *Argument) Accept(v Visitor) { + v.Argument(n) +} + +func (n *Argument) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &Attribute{} + +func (n *Attribute) Accept(v Visitor) { + v.Attribute(n) +} + +func (n *Attribute) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &AttributeGroup{} + +func (n *AttributeGroup) Accept(v Visitor) { + v.AttributeGroup(n) +} + +func (n *AttributeGroup) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarDnumber{} + +func (n *ScalarDnumber) Accept(v Visitor) { + v.ScalarDnumber(n) +} + +func (n *ScalarDnumber) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarEncapsed{} + +func (n *ScalarEncapsed) Accept(v Visitor) { + v.ScalarEncapsed(n) +} + +func (n *ScalarEncapsed) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarEncapsedStringPart{} + +func (n *ScalarEncapsedStringPart) Accept(v Visitor) { + v.ScalarEncapsedStringPart(n) +} + +func (n *ScalarEncapsedStringPart) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarEncapsedStringVar{} + +func (n *ScalarEncapsedStringVar) Accept(v Visitor) { + v.ScalarEncapsedStringVar(n) +} + +func (n *ScalarEncapsedStringVar) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarEncapsedStringBrackets{} + +func (n *ScalarEncapsedStringBrackets) Accept(v Visitor) { + v.ScalarEncapsedStringBrackets(n) +} + +func (n *ScalarEncapsedStringBrackets) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarHeredoc{} + +func (n *ScalarHeredoc) Accept(v Visitor) { + v.ScalarHeredoc(n) +} + +func (n *ScalarHeredoc) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarLnumber{} + +func (n *ScalarLnumber) Accept(v Visitor) { + v.ScalarLnumber(n) +} + +func (n *ScalarLnumber) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarMagicConstant{} + +func (n *ScalarMagicConstant) Accept(v Visitor) { + v.ScalarMagicConstant(n) +} + +func (n *ScalarMagicConstant) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ScalarString{} + +func (n *ScalarString) Accept(v Visitor) { + v.ScalarString(n) +} + +func (n *ScalarString) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtBreak{} + +func (n *StmtBreak) Accept(v Visitor) { + v.StmtBreak(n) +} + +func (n *StmtBreak) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtCase{} + +func (n *StmtCase) Accept(v Visitor) { + v.StmtCase(n) +} + +func (n *StmtCase) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtCatch{} + +func (n *StmtCatch) Accept(v Visitor) { + v.StmtCatch(n) +} + +func (n *StmtCatch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtEnum{} + +func (n *StmtEnum) Accept(v Visitor) { + v.StmtEnum(n) +} + +func (n *StmtEnum) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &EnumCase{} + +func (n *EnumCase) Accept(v Visitor) { + v.EnumCase(n) +} + +func (n *EnumCase) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtClass{} + +func (n *StmtClass) Accept(v Visitor) { + v.StmtClass(n) +} + +func (n *StmtClass) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtClassConstList{} + +func (n *StmtClassConstList) Accept(v Visitor) { + v.StmtClassConstList(n) +} + +func (n *StmtClassConstList) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtClassMethod{} + +func (n *StmtClassMethod) Accept(v Visitor) { + v.StmtClassMethod(n) +} + +func (n *StmtClassMethod) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtConstList{} + +func (n *StmtConstList) Accept(v Visitor) { + v.StmtConstList(n) +} + +func (n *StmtConstList) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtConstant{} + +func (n *StmtConstant) Accept(v Visitor) { + v.StmtConstant(n) +} + +func (n *StmtConstant) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtContinue{} + +func (n *StmtContinue) Accept(v Visitor) { + v.StmtContinue(n) +} + +func (n *StmtContinue) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtDeclare{} + +func (n *StmtDeclare) Accept(v Visitor) { + v.StmtDeclare(n) +} + +func (n *StmtDeclare) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtDefault{} + +func (n *StmtDefault) Accept(v Visitor) { + v.StmtDefault(n) +} + +func (n *StmtDefault) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtDo{} + +func (n *StmtDo) Accept(v Visitor) { + v.StmtDo(n) +} + +func (n *StmtDo) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtEcho{} + +func (n *StmtEcho) Accept(v Visitor) { + v.StmtEcho(n) +} + +func (n *StmtEcho) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtElse{} + +func (n *StmtElse) Accept(v Visitor) { + v.StmtElse(n) +} + +func (n *StmtElse) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtElseIf{} + +func (n *StmtElseIf) Accept(v Visitor) { + v.StmtElseIf(n) +} + +func (n *StmtElseIf) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtExpression{} + +func (n *StmtExpression) Accept(v Visitor) { + v.StmtExpression(n) +} + +func (n *StmtExpression) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtFinally{} + +func (n *StmtFinally) Accept(v Visitor) { + v.StmtFinally(n) +} + +func (n *StmtFinally) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtFor{} + +func (n *StmtFor) Accept(v Visitor) { + v.StmtFor(n) +} + +func (n *StmtFor) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtForeach{} + +func (n *StmtForeach) Accept(v Visitor) { + v.StmtForeach(n) +} + +func (n *StmtForeach) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtFunction{} + +func (n *StmtFunction) Accept(v Visitor) { + v.StmtFunction(n) +} + +func (n *StmtFunction) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtGlobal{} + +func (n *StmtGlobal) Accept(v Visitor) { + v.StmtGlobal(n) +} + +func (n *StmtGlobal) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtGoto{} + +func (n *StmtGoto) Accept(v Visitor) { + v.StmtGoto(n) +} + +func (n *StmtGoto) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtHaltCompiler{} + +func (n *StmtHaltCompiler) Accept(v Visitor) { + v.StmtHaltCompiler(n) +} + +func (n *StmtHaltCompiler) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtIf{} + +func (n *StmtIf) Accept(v Visitor) { + v.StmtIf(n) +} + +func (n *StmtIf) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtInlineHtml{} + +func (n *StmtInlineHtml) Accept(v Visitor) { + v.StmtInlineHtml(n) +} + +func (n *StmtInlineHtml) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtInterface{} + +func (n *StmtInterface) Accept(v Visitor) { + v.StmtInterface(n) +} + +func (n *StmtInterface) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtLabel{} + +func (n *StmtLabel) Accept(v Visitor) { + v.StmtLabel(n) +} + +func (n *StmtLabel) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtNamespace{} + +func (n *StmtNamespace) Accept(v Visitor) { + v.StmtNamespace(n) +} + +func (n *StmtNamespace) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtNop{} + +func (n *StmtNop) Accept(v Visitor) { + v.StmtNop(n) +} + +func (n *StmtNop) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtProperty{} + +func (n *StmtProperty) Accept(v Visitor) { + v.StmtProperty(n) +} + +func (n *StmtProperty) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtPropertyList{} + +func (n *StmtPropertyList) Accept(v Visitor) { + v.StmtPropertyList(n) +} + +func (n *StmtPropertyList) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtReturn{} + +func (n *StmtReturn) Accept(v Visitor) { + v.StmtReturn(n) +} + +func (n *StmtReturn) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtStatic{} + +func (n *StmtStatic) Accept(v Visitor) { + v.StmtStatic(n) +} + +func (n *StmtStatic) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtStaticVar{} + +func (n *StmtStaticVar) Accept(v Visitor) { + v.StmtStaticVar(n) +} + +func (n *StmtStaticVar) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtStmtList{} + +func (n *StmtStmtList) Accept(v Visitor) { + v.StmtStmtList(n) +} + +func (n *StmtStmtList) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtSwitch{} + +func (n *StmtSwitch) Accept(v Visitor) { + v.StmtSwitch(n) +} + +func (n *StmtSwitch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtThrow{} + +func (n *StmtThrow) Accept(v Visitor) { + v.StmtThrow(n) +} + +func (n *StmtThrow) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtTrait{} + +func (n *StmtTrait) Accept(v Visitor) { + v.StmtTrait(n) +} + +func (n *StmtTrait) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtTraitUse{} + +func (n *StmtTraitUse) Accept(v Visitor) { + v.StmtTraitUse(n) +} + +func (n *StmtTraitUse) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtTraitUseAlias{} + +func (n *StmtTraitUseAlias) Accept(v Visitor) { + v.StmtTraitUseAlias(n) +} + +func (n *StmtTraitUseAlias) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtTraitUsePrecedence{} + +func (n *StmtTraitUsePrecedence) Accept(v Visitor) { + v.StmtTraitUsePrecedence(n) +} + +func (n *StmtTraitUsePrecedence) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtTry{} + +func (n *StmtTry) Accept(v Visitor) { + v.StmtTry(n) +} + +func (n *StmtTry) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtUnset{} + +func (n *StmtUnset) Accept(v Visitor) { + v.StmtUnset(n) +} + +func (n *StmtUnset) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtUseList{} + +func (n *StmtUseList) Accept(v Visitor) { + v.StmtUse(n) +} + +func (n *StmtUseList) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtGroupUseList{} + +func (n *StmtGroupUseList) Accept(v Visitor) { + v.StmtGroupUse(n) +} + +func (n *StmtGroupUseList) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtUse{} + +func (n *StmtUse) Accept(v Visitor) { + v.StmtUseDeclaration(n) +} + +func (n *StmtUse) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &StmtWhile{} + +func (n *StmtWhile) Accept(v Visitor) { + v.StmtWhile(n) +} + +func (n *StmtWhile) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprArray{} + +func (n *ExprArray) Accept(v Visitor) { + v.ExprArray(n) +} + +func (n *ExprArray) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprArrayDimFetch{} + +func (n *ExprArrayDimFetch) Accept(v Visitor) { + v.ExprArrayDimFetch(n) +} + +func (n *ExprArrayDimFetch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprArrayItem{} + +func (n *ExprArrayItem) Accept(v Visitor) { + v.ExprArrayItem(n) +} + +func (n *ExprArrayItem) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprArrowFunction{} + +func (n *ExprArrowFunction) Accept(v Visitor) { + v.ExprArrowFunction(n) +} + +func (n *ExprArrowFunction) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBitwiseNot{} + +func (n *ExprBitwiseNot) Accept(v Visitor) { + v.ExprBitwiseNot(n) +} + +func (n *ExprBitwiseNot) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBooleanNot{} + +func (n *ExprBooleanNot) Accept(v Visitor) { + v.ExprBooleanNot(n) +} + +func (n *ExprBooleanNot) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBrackets{} + +func (n *ExprBrackets) Accept(v Visitor) { + v.ExprBrackets(n) +} + +func (n *ExprBrackets) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprClassConstFetch{} + +func (n *ExprClassConstFetch) Accept(v Visitor) { + v.ExprClassConstFetch(n) +} + +func (n *ExprClassConstFetch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprClone{} + +func (n *ExprClone) Accept(v Visitor) { + v.ExprClone(n) +} + +func (n *ExprClone) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprClosure{} + +func (n *ExprClosure) Accept(v Visitor) { + v.ExprClosure(n) +} + +func (n *ExprClosure) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprClosureUse{} + +func (n *ExprClosureUse) Accept(v Visitor) { + v.ExprClosureUse(n) +} + +func (n *ExprClosureUse) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprConstFetch{} + +func (n *ExprConstFetch) Accept(v Visitor) { + v.ExprConstFetch(n) +} + +func (n *ExprConstFetch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprEmpty{} + +func (n *ExprEmpty) Accept(v Visitor) { + v.ExprEmpty(n) +} + +func (n *ExprEmpty) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprErrorSuppress{} + +func (n *ExprErrorSuppress) Accept(v Visitor) { + v.ExprErrorSuppress(n) +} + +func (n *ExprErrorSuppress) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprEval{} + +func (n *ExprEval) Accept(v Visitor) { + v.ExprEval(n) +} + +func (n *ExprEval) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprExit{} + +func (n *ExprExit) Accept(v Visitor) { + v.ExprExit(n) +} + +func (n *ExprExit) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprFunctionCall{} + +func (n *ExprFunctionCall) Accept(v Visitor) { + v.ExprFunctionCall(n) +} + +func (n *ExprFunctionCall) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprInclude{} + +func (n *ExprInclude) Accept(v Visitor) { + v.ExprInclude(n) +} + +func (n *ExprInclude) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprIncludeOnce{} + +func (n *ExprIncludeOnce) Accept(v Visitor) { + v.ExprIncludeOnce(n) +} + +func (n *ExprIncludeOnce) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprInstanceOf{} + +func (n *ExprInstanceOf) Accept(v Visitor) { + v.ExprInstanceOf(n) +} + +func (n *ExprInstanceOf) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprIsset{} + +func (n *ExprIsset) Accept(v Visitor) { + v.ExprIsset(n) +} + +func (n *ExprIsset) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprList{} + +func (n *ExprList) Accept(v Visitor) { + v.ExprList(n) +} + +func (n *ExprList) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprMethodCall{} + +func (n *ExprMethodCall) Accept(v Visitor) { + v.ExprMethodCall(n) +} + +func (n *ExprMethodCall) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprNullsafeMethodCall{} + +func (n *ExprNullsafeMethodCall) Accept(v Visitor) { + v.ExprNullsafeMethodCall(n) +} + +func (n *ExprNullsafeMethodCall) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprNew{} + +func (n *ExprNew) Accept(v Visitor) { + v.ExprNew(n) +} + +func (n *ExprNew) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprPostDec{} + +func (n *ExprPostDec) Accept(v Visitor) { + v.ExprPostDec(n) +} + +func (n *ExprPostDec) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprPostInc{} + +func (n *ExprPostInc) Accept(v Visitor) { + v.ExprPostInc(n) +} + +func (n *ExprPostInc) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprPreDec{} + +func (n *ExprPreDec) Accept(v Visitor) { + v.ExprPreDec(n) +} + +func (n *ExprPreDec) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprPreInc{} + +func (n *ExprPreInc) Accept(v Visitor) { + v.ExprPreInc(n) +} + +func (n *ExprPreInc) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprPrint{} + +func (n *ExprPrint) Accept(v Visitor) { + v.ExprPrint(n) +} + +func (n *ExprPrint) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprPropertyFetch{} + +func (n *ExprPropertyFetch) Accept(v Visitor) { + v.ExprPropertyFetch(n) +} + +func (n *ExprPropertyFetch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprNullsafePropertyFetch{} + +func (n *ExprNullsafePropertyFetch) Accept(v Visitor) { + v.ExprNullsafePropertyFetch(n) +} + +func (n *ExprNullsafePropertyFetch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprRequire{} + +func (n *ExprRequire) Accept(v Visitor) { + v.ExprRequire(n) +} + +func (n *ExprRequire) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprRequireOnce{} + +func (n *ExprRequireOnce) Accept(v Visitor) { + v.ExprRequireOnce(n) +} + +func (n *ExprRequireOnce) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprShellExec{} + +func (n *ExprShellExec) Accept(v Visitor) { + v.ExprShellExec(n) +} + +func (n *ExprShellExec) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprStaticCall{} + +func (n *ExprStaticCall) Accept(v Visitor) { + v.ExprStaticCall(n) +} + +func (n *ExprStaticCall) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprStaticPropertyFetch{} + +func (n *ExprStaticPropertyFetch) Accept(v Visitor) { + v.ExprStaticPropertyFetch(n) +} + +func (n *ExprStaticPropertyFetch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprTernary{} + +func (n *ExprTernary) Accept(v Visitor) { + v.ExprTernary(n) +} + +func (n *ExprTernary) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprUnaryMinus{} + +func (n *ExprUnaryMinus) Accept(v Visitor) { + v.ExprUnaryMinus(n) +} + +func (n *ExprUnaryMinus) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprUnaryPlus{} + +func (n *ExprUnaryPlus) Accept(v Visitor) { + v.ExprUnaryPlus(n) +} + +func (n *ExprUnaryPlus) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprVariable{} + +func (n *ExprVariable) Accept(v Visitor) { + v.ExprVariable(n) +} + +func (n *ExprVariable) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprYield{} + +func (n *ExprYield) Accept(v Visitor) { + v.ExprYield(n) +} + +func (n *ExprYield) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprYieldFrom{} + +func (n *ExprYieldFrom) Accept(v Visitor) { + v.ExprYieldFrom(n) +} + +func (n *ExprYieldFrom) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprCastArray{} + +func (n *ExprCastArray) Accept(v Visitor) { + v.ExprCastArray(n) +} + +func (n *ExprCastArray) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprCastBool{} + +func (n *ExprCastBool) Accept(v Visitor) { + v.ExprCastBool(n) +} + +func (n *ExprCastBool) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprCastDouble{} + +func (n *ExprCastDouble) Accept(v Visitor) { + v.ExprCastDouble(n) +} + +func (n *ExprCastDouble) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprCastInt{} + +func (n *ExprCastInt) Accept(v Visitor) { + v.ExprCastInt(n) +} + +func (n *ExprCastInt) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprCastObject{} + +func (n *ExprCastObject) Accept(v Visitor) { + v.ExprCastObject(n) +} + +func (n *ExprCastObject) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprCastString{} + +func (n *ExprCastString) Accept(v Visitor) { + v.ExprCastString(n) +} + +func (n *ExprCastString) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprCastUnset{} + +func (n *ExprCastUnset) Accept(v Visitor) { + v.ExprCastUnset(n) +} + +func (n *ExprCastUnset) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssign{} + +func (n *ExprAssign) Accept(v Visitor) { + v.ExprAssign(n) +} + +func (n *ExprAssign) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignReference{} + +func (n *ExprAssignReference) Accept(v Visitor) { + v.ExprAssignReference(n) +} + +func (n *ExprAssignReference) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignBitwiseAnd{} + +func (n *ExprAssignBitwiseAnd) Accept(v Visitor) { + v.ExprAssignBitwiseAnd(n) +} + +func (n *ExprAssignBitwiseAnd) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignBitwiseOr{} + +func (n *ExprAssignBitwiseOr) Accept(v Visitor) { + v.ExprAssignBitwiseOr(n) +} + +func (n *ExprAssignBitwiseOr) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignBitwiseXor{} + +func (n *ExprAssignBitwiseXor) Accept(v Visitor) { + v.ExprAssignBitwiseXor(n) +} + +func (n *ExprAssignBitwiseXor) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignCoalesce{} + +func (n *ExprAssignCoalesce) Accept(v Visitor) { + v.ExprAssignCoalesce(n) +} + +func (n *ExprAssignCoalesce) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignConcat{} + +func (n *ExprAssignConcat) Accept(v Visitor) { + v.ExprAssignConcat(n) +} + +func (n *ExprAssignConcat) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignDiv{} + +func (n *ExprAssignDiv) Accept(v Visitor) { + v.ExprAssignDiv(n) +} + +func (n *ExprAssignDiv) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignMinus{} + +func (n *ExprAssignMinus) Accept(v Visitor) { + v.ExprAssignMinus(n) +} + +func (n *ExprAssignMinus) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignMod{} + +func (n *ExprAssignMod) Accept(v Visitor) { + v.ExprAssignMod(n) +} + +func (n *ExprAssignMod) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignMul{} + +func (n *ExprAssignMul) Accept(v Visitor) { + v.ExprAssignMul(n) +} + +func (n *ExprAssignMul) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignPlus{} + +func (n *ExprAssignPlus) Accept(v Visitor) { + v.ExprAssignPlus(n) +} + +func (n *ExprAssignPlus) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignPow{} + +func (n *ExprAssignPow) Accept(v Visitor) { + v.ExprAssignPow(n) +} + +func (n *ExprAssignPow) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignShiftLeft{} + +func (n *ExprAssignShiftLeft) Accept(v Visitor) { + v.ExprAssignShiftLeft(n) +} + +func (n *ExprAssignShiftLeft) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprAssignShiftRight{} + +func (n *ExprAssignShiftRight) Accept(v Visitor) { + v.ExprAssignShiftRight(n) +} + +func (n *ExprAssignShiftRight) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryBitwiseAnd{} + +func (n *ExprBinaryBitwiseAnd) Accept(v Visitor) { + v.ExprBinaryBitwiseAnd(n) +} + +func (n *ExprBinaryBitwiseAnd) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryBitwiseOr{} + +func (n *ExprBinaryBitwiseOr) Accept(v Visitor) { + v.ExprBinaryBitwiseOr(n) +} + +func (n *ExprBinaryBitwiseOr) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryBitwiseXor{} + +func (n *ExprBinaryBitwiseXor) Accept(v Visitor) { + v.ExprBinaryBitwiseXor(n) +} + +func (n *ExprBinaryBitwiseXor) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryBooleanAnd{} + +func (n *ExprBinaryBooleanAnd) Accept(v Visitor) { + v.ExprBinaryBooleanAnd(n) +} + +func (n *ExprBinaryBooleanAnd) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryBooleanOr{} + +func (n *ExprBinaryBooleanOr) Accept(v Visitor) { + v.ExprBinaryBooleanOr(n) +} + +func (n *ExprBinaryBooleanOr) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryCoalesce{} + +func (n *ExprBinaryCoalesce) Accept(v Visitor) { + v.ExprBinaryCoalesce(n) +} + +func (n *ExprBinaryCoalesce) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryConcat{} + +func (n *ExprBinaryConcat) Accept(v Visitor) { + v.ExprBinaryConcat(n) +} + +func (n *ExprBinaryConcat) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryDiv{} + +func (n *ExprBinaryDiv) Accept(v Visitor) { + v.ExprBinaryDiv(n) +} + +func (n *ExprBinaryDiv) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryEqual{} + +func (n *ExprBinaryEqual) Accept(v Visitor) { + v.ExprBinaryEqual(n) +} + +func (n *ExprBinaryEqual) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryGreater{} + +func (n *ExprBinaryGreater) Accept(v Visitor) { + v.ExprBinaryGreater(n) +} + +func (n *ExprBinaryGreater) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryGreaterOrEqual{} + +func (n *ExprBinaryGreaterOrEqual) Accept(v Visitor) { + v.ExprBinaryGreaterOrEqual(n) +} + +func (n *ExprBinaryGreaterOrEqual) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryIdentical{} + +func (n *ExprBinaryIdentical) Accept(v Visitor) { + v.ExprBinaryIdentical(n) +} + +func (n *ExprBinaryIdentical) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryLogicalAnd{} + +func (n *ExprBinaryLogicalAnd) Accept(v Visitor) { + v.ExprBinaryLogicalAnd(n) +} + +func (n *ExprBinaryLogicalAnd) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryLogicalOr{} + +func (n *ExprBinaryLogicalOr) Accept(v Visitor) { + v.ExprBinaryLogicalOr(n) +} + +func (n *ExprBinaryLogicalOr) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryLogicalXor{} + +func (n *ExprBinaryLogicalXor) Accept(v Visitor) { + v.ExprBinaryLogicalXor(n) +} + +func (n *ExprBinaryLogicalXor) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryMinus{} + +func (n *ExprBinaryMinus) Accept(v Visitor) { + v.ExprBinaryMinus(n) +} + +func (n *ExprBinaryMinus) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryMod{} + +func (n *ExprBinaryMod) Accept(v Visitor) { + v.ExprBinaryMod(n) +} + +func (n *ExprBinaryMod) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryMul{} + +func (n *ExprBinaryMul) Accept(v Visitor) { + v.ExprBinaryMul(n) +} + +func (n *ExprBinaryMul) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryNotEqual{} + +func (n *ExprBinaryNotEqual) Accept(v Visitor) { + v.ExprBinaryNotEqual(n) +} + +func (n *ExprBinaryNotEqual) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryNotIdentical{} + +func (n *ExprBinaryNotIdentical) Accept(v Visitor) { + v.ExprBinaryNotIdentical(n) +} + +func (n *ExprBinaryNotIdentical) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryPlus{} + +func (n *ExprBinaryPlus) Accept(v Visitor) { + v.ExprBinaryPlus(n) +} + +func (n *ExprBinaryPlus) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryPow{} + +func (n *ExprBinaryPow) Accept(v Visitor) { + v.ExprBinaryPow(n) +} + +func (n *ExprBinaryPow) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryShiftLeft{} + +func (n *ExprBinaryShiftLeft) Accept(v Visitor) { + v.ExprBinaryShiftLeft(n) +} + +func (n *ExprBinaryShiftLeft) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinaryShiftRight{} + +func (n *ExprBinaryShiftRight) Accept(v Visitor) { + v.ExprBinaryShiftRight(n) +} + +func (n *ExprBinaryShiftRight) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinarySmaller{} + +func (n *ExprBinarySmaller) Accept(v Visitor) { + v.ExprBinarySmaller(n) +} + +func (n *ExprBinarySmaller) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinarySmallerOrEqual{} + +func (n *ExprBinarySmallerOrEqual) Accept(v Visitor) { + v.ExprBinarySmallerOrEqual(n) +} + +func (n *ExprBinarySmallerOrEqual) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprBinarySpaceship{} + +func (n *ExprBinarySpaceship) Accept(v Visitor) { + v.ExprBinarySpaceship(n) +} + +func (n *ExprBinarySpaceship) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprMatch{} + +func (n *ExprMatch) Accept(v Visitor) { + v.ExprMatch(n) +} + +func (n *ExprMatch) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &ExprThrow{} + +func (n *ExprThrow) Accept(v Visitor) { + v.ExprThrow(n) +} + +func (n *ExprThrow) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &MatchArm{} + +func (n *MatchArm) Accept(v Visitor) { + v.MatchArm(n) +} + +func (n *MatchArm) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &Name{} + +func (n *Name) Accept(v Visitor) { + v.NameName(n) +} + +func (n *Name) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &NameFullyQualified{} + +func (n *NameFullyQualified) Accept(v Visitor) { + v.NameFullyQualified(n) +} + +func (n *NameFullyQualified) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &NameRelative{} + +func (n *NameRelative) Accept(v Visitor) { + v.NameRelative(n) +} + +func (n *NameRelative) GetPosition() *position.Position { + return n.Position +} + +var _ Vertex = &NamePart{} + +func (n *NamePart) Accept(v Visitor) { + v.NameNamePart(n) +} + +func (n *NamePart) GetPosition() *position.Position { + return n.Position +} diff --git a/pkg/ast/node_funcs_gen.go b/pkg/ast/node_funcs_gen.go new file mode 100644 index 0000000..ccb2936 --- /dev/null +++ b/pkg/ast/node_funcs_gen.go @@ -0,0 +1,73 @@ +//go:build ignore +// +build ignore + +package main + +import ( + "fmt" + "os" + "regexp" + "text/template" + + "github.com/VKCOM/php-parser/pkg/ast" +) + +type templData struct { + Types []nodeType +} + +type nodeType struct { + Name string + FuncName string +} + +var fileTempl = template.Must( + template.New(""). + Parse(`// Code generated by "go generate go run node_funcs_gen.go"; DO NOT EDIT. + +package ast + +import "github.com/VKCOM/php-parser/pkg/position" +{{range $typ := .Types}} +var _ Vertex = &{{$typ.Name}}{} + +func (n *{{$typ.Name}}) Accept(v Visitor) { + v.{{$typ.FuncName}}(n) +} + +func (n *{{$typ.Name}}) GetPosition() *position.Position { + return n.Position +} +{{end}}`), +) + +var typesRgx = regexp.MustCompile(`type ([a-zA-Z]+) struct`) + +func main() { + content, err := os.ReadFile("node.go") + if err != nil { + panic(fmt.Errorf("reading 'ast.go': %w", err)) + } + + matches := typesRgx.FindAllSubmatch(content, -1) + types := make([]nodeType, 0, len(matches)) + for _, match := range matches { + name := string(match[1]) + funcName := name + if overwrite, ok := ast.TypeToVisitorNameMap[name]; ok { + funcName = overwrite + } + + types = append(types, nodeType{ + Name: name, + FuncName: funcName, + }) + } + + f, err := os.Create("node_funcs.go") + if err != nil { + panic(fmt.Errorf("creating/opening 'node_funcs.go': %w", err)) + } + + fileTempl.Execute(f, templData{types}) +}