master
Jordan Orelli 10 years ago
parent 82ecd83bee
commit 5fa482c1d0

@ -29,6 +29,7 @@ import (
"strings"
)
// Doc represents a Moon document.
type Doc struct {
items map[string]interface{}
}

@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"io"
"os"
"strings"
)
@ -42,6 +43,16 @@ func ReadBytes(b []byte) (*Doc, error) {
return Read(bytes.NewBuffer(b))
}
func ReadFile(path string) (*Doc, error) {
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
return Read(f)
}
func parse(r io.Reader) (node, error) {
p := &parser{
root: newRootNode(),

Loading…
Cancel
Save