• Roger Peppe's avatar
    Change goyacc to be reentrant. · 6c3befc8
    Roger Peppe authored
    Instead of calling the package scope Lex function,
    Parse now takes an argument which is used to
    do the lexing.
    I reverted to having the generated switch
    code inside Parse rather than a separate function because
    the function needs 7 arguments or a context structure,
    which seems unnecessary.
    I used yyrun(), not the original $A so that
    it's possible to run the backquoted code through gofmt.
    
    R=rsc, ken2, ken3
    CC=golang-dev
    https://golang.org/cl/879041
    6c3befc8
goyacc.go 62.7 KB