Skip to content

Rule redeclaration causes segmentation fault #123

Description

@romshark

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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