-
Notifications
You must be signed in to change notification settings - Fork 68
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
Matched text not accessible from state blocks #105
Comments
Thanks for reaching out. Can you please provide some more details, in the best case some minimal examples together with the information, what you expect to see and what you actually see. Then we might be able to work from there. |
Here is a minimal reproducer:
package issue105
import (
"testing"
)
func TestTextFromStateBlock(t *testing.T) {
out, err := Parse("", []byte("hello"))
if err != nil {
t.Fatal(err)
}
if out != "1:hello" {
t.Fatalf("expected %q, got %q", "1:hello", out)
}
} The test fails with: 17:33 ❱ go test ./test/issue_105
--- FAIL: TestOptimizeGrammar (0.00s)
issue_105_test.go:13: expected "1:hello", got "1:"
FAIL
FAIL github.com/mna/pigeon/test/issue_105 0.001s
FAIL I expect to be able to get |
@vincentbernat Thanks for the minimal reproducer. It has been a while, since I last touched this code, so I needed to dig into it in a little bit more detail. The way, the state change blocks are currently designed, it is not possible to provide the valid content for
The same applies for the state change code blocks, but it looks like, this limitation is not yet reflected in the documentation. |
If this is not trivial, I can live without this feature (it just makes my code a bit more repetitive). I don't have time myself to try to fix this. Thanks! |
Hey!
When inside state blocks,
c.text
does not seem to be what's expected (often empty, sometimes something parsed previously). Would it be easy to "fix"?Thanks.
The text was updated successfully, but these errors were encountered: