zclparse: keep ParseZCL results in the files registry

This is important to make the source code and context available for
printing diagnostics.
This commit is contained in:
Martin Atkins 2017-06-04 09:02:41 -07:00
parent 19064ef9ee
commit 44670ddd50

View File

@ -43,7 +43,9 @@ func (p *Parser) ParseZCL(src []byte, filename string) (*zcl.File, zcl.Diagnosti
return existing, nil
}
return zclsyntax.ParseConfig(src, filename, zcl.Pos{Byte: 0, Line: 1, Column: 1})
file, diags := zclsyntax.ParseConfig(src, filename, zcl.Pos{Byte: 0, Line: 1, Column: 1})
p.files[filename] = file
return file, diags
}
// ParseZCLFile reads the given filename and parses it as a native-syntax zcl