Closed onokonem closed 5 years ago
Thanks for the PR.
Could you also please include a small description explaining why separate handling of */
symbol is required ?
I've updated the PR description and added a brief comment to the source
Sorry for the delay on this.
For others' convenience, this is the generated (buggy) actiontable from the EBNF mentioned above, and this is the result after applying the fix.
As an aside, Go's spec uses the term general comments instead of multiline comments so maybe we could switch to using it.
I would personally suggest safeSym
to be something along the lines of the following, although deferring to @awalterschulze @mewmew for suggestions -
func safeSym(sym string) string {
if sym == `*/` {
// A '*/' token in the EBNF causes compilation error in the
// generated actiontable due to buggy comments like `/* */ */`.
// Avoid this by replacing them in the generated code with -
// `/* closing general comment token */`.
return "closing general comment token"
} else {
return sym
}
}
Alternatively, we can also replace the general comments with line comments in actiontable. This will be the resulting actiontable.
I like the line comments.
Fixed in 07ce4bc.
how to reproduce a closing multiline comment sequence problem