v2 / vlib / toml / ast / ast.v
26 lines · 23 sloc · 681 bytes · 757929392e0e7a75fc1272116460981e589737d5
Raw
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.
4module ast
5
6import toml.input
7
8// Root represents the root structure of any parsed TOML text snippet or file.
9@[heap]
10pub struct Root {
11pub:
12 input input.Config // User input configuration
13pub 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.
20pub 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