-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathast.go
46 lines (37 loc) · 894 Bytes
/
ast.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package ast
import "github.com/gobuffalo/plush/v5/token"
type TokenAble struct {
token.Token
}
func (t TokenAble) T() token.Token {
return t.Token
}
func (t TokenAble) TokenLiteral() string {
return t.Token.Literal
}
type Printable interface {
Printable() bool
}
// The base Node interface
type Node interface {
T() token.Token
TokenLiteral() string
String() string
}
// All statement nodes implement this
type Statement interface {
Node
statementNode()
}
// All expression nodes implement this
type Expression interface {
Node
expressionNode()
}
type Comparable interface {
// TODO: not sure what is the purpose of this interface.
// The only method of this interface is validIfCondition that returns
// true always for all implementations. Need to check but it could be
// something like isCondition or isComparable of Expression interface.
validIfCondition() bool
}