1/*
2 * gomacro - A Go interpreter with Lisp-like macros
3 *
4 * Copyright (C) 2017-2019 Massimiliano Ghilardi
5 *
6 *     This Source Code Form is subject to the terms of the Mozilla Public
7 *     License, v. 2.0. If a copy of the MPL was not distributed with this
8 *     file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 *
10 *
11 * ast.go
12 *
13 *  Created on Feb 24, 2017
14 *      Author Massimiliano Ghilardi
15 */
16
17package ast2
18
19import (
20	"go/ast"
21	"go/token"
22)
23
24type (
25	Ast interface {
26		Interface() interface{}
27		Op() token.Token
28		Size() int
29		Get(i int) Ast
30		Set(i int, child Ast)
31		New() Ast // returns a copy of Ast. the children are not copied
32	}
33	AstWithNode interface {
34		Ast
35		Node() ast.Node
36	}
37	AstWithSlice interface {
38		Ast
39		Slice(lo, hi int) AstWithSlice
40		Append(child Ast) AstWithSlice
41	}
42
43	AstSlice   struct{ X []Ast }
44	NodeSlice  struct{ X []ast.Node }
45	ExprSlice  struct{ X []ast.Expr }
46	FieldSlice struct{ X []*ast.Field }
47	DeclSlice  struct{ X []ast.Decl }
48	IdentSlice struct{ X []*ast.Ident }
49	StmtSlice  struct{ X []ast.Stmt }
50	SpecSlice  struct{ X []ast.Spec }
51
52	ArrayType      struct{ X *ast.ArrayType }
53	AssignStmt     struct{ X *ast.AssignStmt }
54	BadDecl        struct{ X *ast.BadDecl }
55	BadExpr        struct{ X *ast.BadExpr }
56	BadStmt        struct{ X *ast.BadStmt }
57	BasicLit       struct{ X *ast.BasicLit }
58	BinaryExpr     struct{ X *ast.BinaryExpr }
59	BlockStmt      struct{ X *ast.BlockStmt }
60	BranchStmt     struct{ X *ast.BranchStmt }
61	CallExpr       struct{ X *ast.CallExpr }
62	CaseClause     struct{ X *ast.CaseClause }
63	ChanType       struct{ X *ast.ChanType }
64	CommClause     struct{ X *ast.CommClause }
65	CompositeLit   struct{ X *ast.CompositeLit }
66	DeclStmt       struct{ X *ast.DeclStmt }
67	DeferStmt      struct{ X *ast.DeferStmt }
68	Ellipsis       struct{ X *ast.Ellipsis }
69	EmptyStmt      struct{ X *ast.EmptyStmt }
70	ExprStmt       struct{ X *ast.ExprStmt }
71	Field          struct{ X *ast.Field }
72	FieldList      struct{ X *ast.FieldList }
73	File           struct{ X *ast.File }
74	ForStmt        struct{ X *ast.ForStmt }
75	FuncDecl       struct{ X *ast.FuncDecl }
76	FuncLit        struct{ X *ast.FuncLit }
77	FuncType       struct{ X *ast.FuncType }
78	GenDecl        struct{ X *ast.GenDecl }
79	GoStmt         struct{ X *ast.GoStmt }
80	Ident          struct{ X *ast.Ident }
81	IfStmt         struct{ X *ast.IfStmt }
82	ImportSpec     struct{ X *ast.ImportSpec }
83	IncDecStmt     struct{ X *ast.IncDecStmt }
84	IndexExpr      struct{ X *ast.IndexExpr }
85	InterfaceType  struct{ X *ast.InterfaceType }
86	KeyValueExpr   struct{ X *ast.KeyValueExpr }
87	LabeledStmt    struct{ X *ast.LabeledStmt }
88	MapType        struct{ X *ast.MapType }
89	Package        struct{ X *ast.Package }
90	ParenExpr      struct{ X *ast.ParenExpr }
91	RangeStmt      struct{ X *ast.RangeStmt }
92	ReturnStmt     struct{ X *ast.ReturnStmt }
93	SelectStmt     struct{ X *ast.SelectStmt }
94	SelectorExpr   struct{ X *ast.SelectorExpr }
95	SendStmt       struct{ X *ast.SendStmt }
96	SliceExpr      struct{ X *ast.SliceExpr }
97	StarExpr       struct{ X *ast.StarExpr }
98	StructType     struct{ X *ast.StructType }
99	SwitchStmt     struct{ X *ast.SwitchStmt }
100	TypeAssertExpr struct{ X *ast.TypeAssertExpr }
101	TypeSpec       struct{ X *ast.TypeSpec }
102	TypeSwitchStmt struct{ X *ast.TypeSwitchStmt }
103	UnaryExpr      struct{ X *ast.UnaryExpr }
104	ValueSpec      struct{ X *ast.ValueSpec }
105)
106