aboutsummaryrefslogtreecommitdiff
path: root/h/parser.go
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2019-11-28 17:43:40 +0000
committerChristine Dodrill <me@christine.website>2019-11-28 18:24:54 +0000
commitcf54450bec48494cbd729fc5c13af43c0eb0f657 (patch)
tree1c56eba80b98013e7b55fee85709cd65dd5a8705 /h/parser.go
parent41bb9eb9d3881bfb48bb3077a0d83b802a5bb1ab (diff)
downloadx-cf54450bec48494cbd729fc5c13af43c0eb0f657.tar.xz
x-cf54450bec48494cbd729fc5c13af43c0eb0f657.zip
move this
Diffstat (limited to 'h/parser.go')
-rw-r--r--h/parser.go42
1 files changed, 0 insertions, 42 deletions
diff --git a/h/parser.go b/h/parser.go
deleted file mode 100644
index 4daa833..0000000
--- a/h/parser.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package h
-
-//go:generate peggy -o h_gen.go h.peg
-
-import (
- "fmt"
-
- "github.com/eaburns/peggy/peg"
- "within.website/x/jbo/namcu"
-)
-
-func (p *_Parser) Parse() (int, bool) {
- pos, perr := _HAccepts(p, 0)
- return perr, pos >= 0
-}
-
-func (p *_Parser) ErrorTree(minPos int) *peg.Fail {
- p.fail = make(map[_key]*peg.Fail) // reset fail memo table
- _, tree := _HFail(p, 0, minPos)
- return tree
-}
-
-func (p *_Parser) ParseTree() *peg.Node {
- _, tree := _HNode(p, 0)
- return tree
-}
-
-// Parse parses h.
-// On success, the parseTree is returned.
-// On failure, both the word-level and the raw, morphological errors are returned.
-func Parse(text string) (*peg.Node, error) {
- p := _NewParser(text)
- if perr, ok := p.Parse(); !ok {
- return nil, fmt.Errorf("h: gentoldra fi'o zvati fe li %s", namcu.Lerfu(perr))
- }
-
- tree := p.ParseTree()
- RemoveSpace(tree)
- CollapseLists(tree)
-
- return tree, nil
-}