StringWithFlags returns the AST formatted as a string (with the given flags).
(flags tree.FmtFlags)
| 68 | |
| 69 | // StringWithFlags returns the AST formatted as a string (with the given flags). |
| 70 | func (stmts Statements) StringWithFlags(flags tree.FmtFlags) string { |
| 71 | ctx := tree.NewFmtCtx(flags) |
| 72 | for i, s := range stmts { |
| 73 | if i > 0 { |
| 74 | ctx.WriteString("; ") |
| 75 | } |
| 76 | ctx.FormatNode(s.AST) |
| 77 | } |
| 78 | return ctx.CloseAndGetString() |
| 79 | } |
| 80 | |
| 81 | // Parser wraps a scanner, parser and other utilities present in the parser |
| 82 | // package. |