Add ParseFile convenience method
This commit is contained in:
parent
eb73b388d6
commit
ecd222ef42
|
@ -59,3 +59,11 @@ func (this *Tree) Parse (name string, file io.Reader) error {
|
|||
this.Declarations = append(this.Declarations, parsed.Declarations...)
|
||||
return err
|
||||
}
|
||||
|
||||
// ParseFile parses the contents of the given file into the tree.
|
||||
func (this *Tree) ParseFile (name string) error {
|
||||
file, err := os.Open(name)
|
||||
if err != nil { return err }
|
||||
defer file.Close()
|
||||
return this.Parse(name, file)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue