| 1 | package ast |
| 2 | |
| 3 | import ( |
| 4 | "github.com/goccmack/gocc/example/astx/token" |
| 5 | ) |
| 6 | |
| 7 | type ( |
| 8 | StmtList []Stmt |
| 9 | Stmt string |
| 10 | ) |
| 11 | |
| 12 | func NewStmtList(stmt interface{}) (StmtList, error) { |
| 13 | return StmtList{stmt.(Stmt)}, nil |
| 14 | } |
| 15 | |
| 16 | func AppendStmt(stmtList, stmt interface{}) (StmtList, error) { |
| 17 | return append(stmtList.(StmtList), stmt.(Stmt)), nil |
| 18 | } |
| 19 | |
| 20 | // stmtList is passed using $T0. |
| 21 | func NewStmt(stmtList *token.Token) (Stmt, error) { |
| 22 | return Stmt(stmtList.Lit), nil |
| 23 | } |