Skip to content

Weird behavior with alternivies. #108

@lolbinarycat

Description

@lolbinarycat

I have the following files:
main.go:

package main

func main() {
	p := &Parser{Buffer:"test"}
	p.Init()
	err := p.Parse()
	if err != nil {panic(err)}
}

grammer.peg

package main

type Parser Peg {}

Rule <- ( "t"  / "test" ) !. 

running peg grammar.go && go run . results in the following error:

panic: 
parse error near Unknown (line 1 symbol 1 - line 1 symbol 1):
""


goroutine 1 [running]:
main.main()
        /home/binarycat/go/src/github.com/lolbinarycat/peg-bug/main.go:7 +0xb4
exit status 2

This doesn't seem intended, as it makes lots of things much harder to do. If it was intended, then this behavior should be clarified on the readme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions