package parser
import (
"errors"
"io/ioutil"
"strings"
)
// THE HYLIA PARSER
func ParseFile(filename string) ([]string error) {
// Hey, does the file we're trying to parse actually exist?
data, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
// Parse the file, and ask "Is this a Hylia file?"
content := string(data)
if !strings.Contains(content, "")|| !strings.Contains(content, "") {
return nil, errors.New("The structure of this file is invalid. Are you sure this is a Hylia (.hy) file?")
}
// Extract the custom elements, which are wrapped in tags
elements := []string{}
// ... TODO
return elements, nil
}