Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule redeclaration causes segmentation fault #123

Open
romshark opened this issue Dec 12, 2020 · 0 comments
Open

Rule redeclaration causes segmentation fault #123

romshark opened this issue Dec 12, 2020 · 0 comments

Comments

@romshark
Copy link

Expected behavior

In case of rule redeclaration the generator should return an error:

package main

type parser Peg {
}

main <- (a)+
a <- 'a'
a <- 'a'

Actual behavior

The invalid grammar crashes the generator due to a segmentation fault:

romanscharkov@RomMac pegbug % peg grammar.peg
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1164e55]

goroutine 1 [running]:
github.com/pointlander/peg/tree.(*Tree).Compile(0xc000074000, 0xc00001a0e0, 0xe, 0xc00000c060, 0x2, 0x2, 0x1200e60, 0xc00000e030, 0x0, 0x0)
        /Users/romanscharkov/go/src/github.com/pointlander/peg/tree/peg.go:1506 +0x1475
main.main()
        /Users/romanscharkov/go/src/github.com/pointlander/peg/main.go:87 +0x575
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant