Closed andrew-boyarshin closed 4 years ago
That makes sense to me. Out of curiosity, what line was throwing that cast exception?
@kswoll line 375 of course, if you're talking about line in the snippet above. But that doesn't matter, since I had to refactor the whole function to fix all arising issues (it wasn't just this one). I'll send a PR with it today.
This project is truly amazing, the use of code generation behind the scenes really simplified the PEG description in natural C#. It was a bit unfortunate that there is no docs or example on how to use Consume and AST attributes, but I figured it out and will soon publish a project with a sample of Consume usage.
The exception was due to my mistake, but it still wouldn't hurt.
This can be considered as closed and fixed by #7.
https://github.com/kswoll/npeg/blob/51d0302348f9574845d3221fe8748e5298498cf0/PEG/Builder/PegBuilder.cs#L366-L376
It's logical to process
Optional
in the same way asZeroOrMore