Fix unicode handling and add tests

We now also return an incomplete triple to aid in debugging - non-nil
error means that this is not usable except for manual examination.
This commit is contained in:
kortschak 2014-07-25 10:46:10 +09:30
parent 59e3d620a5
commit dc17ccae80
5 changed files with 79 additions and 10 deletions

View file

@ -30,12 +30,10 @@ var (
ErrUnterminated = errors.New("nqauds: unterminated quad")
)
// Parse returns a valid graph.Triple or a non-nil error.
func Parse(str string) (*graph.Triple, error) {
t, err := parse([]rune(str))
if err != nil {
return nil, err
}
return &t, nil
return &t, err
}
type Decoder struct {