Retain the bytes used to construct a file

Later on this will be useful when printing diagnostics with source code
snippets as context.
This commit is contained in:
Martin Atkins 2017-05-18 08:07:52 -07:00
parent 160f56abb1
commit 41527d1a3c
2 changed files with 3 additions and 1 deletions

View File

@ -33,6 +33,7 @@ func Parse(src []byte, filename string) (*zcl.File, zcl.Diagnostics) {
Body: &body{
obj: rootNode.(*objectVal),
},
Bytes: src,
}
}
return file, diags

View File

@ -6,7 +6,8 @@ import (
// File is the top-level node that results from parsing a ZCL file.
type File struct {
Body Body
Body Body
Bytes []byte
}
// Block represents a nested block within a Body.