| 1 | // Copyright (c) 2021 Lars Pontoppidan. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT license |
| 3 | // that can be found in the LICENSE file. |
| 4 | module ast |
| 5 | |
| 6 | import toml.input |
| 7 | |
| 8 | // Root represents the root structure of any parsed TOML text snippet or file. |
| 9 | @[heap] |
| 10 | pub struct Root { |
| 11 | pub: |
| 12 | input input.Config // User input configuration |
| 13 | pub mut: |
| 14 | comments []Comment |
| 15 | table Value |
| 16 | // errors []errors.Error // all the checker errors in the file |
| 17 | } |
| 18 | |
| 19 | // str returns the string representation of the root node. |
| 20 | pub fn (r Root) str() string { |
| 21 | mut s := typeof(r).name + '{\n' |
| 22 | s += ' input: ${r.input}\n' |
| 23 | s += ' table: ${r.table}\n' |
| 24 | s += '}' |
| 25 | return s |
| 26 | } |
| 27 | |