-
Notifications
You must be signed in to change notification settings - Fork 95
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
Native/abstracted sub-parsers #340
Comments
Could you post what kind of input you are trying to parse and how the output is expected to look like? I am not sure I understand it entirely, best I can tell the syntax seem rather ambigous.
With combine being LL it will consume eagerly so the first case (1+4 and 2+3) is the one that is parsed. |
Overall it's a mix of Org-mode and Markdown so 1+4 and 2+3 seem right, although they don't really have any special meaning and will just get optimized out later: *hi* ; BlockExprNode::Bold(BlockExprNode::Text("hi"))
*/italics & bold/* ; BlockExprNode::Bold(BlockExprNode::Italics(BlockExprNode::Text("italics & bold")))
**this is kinda useless** ; BlockExprNode::Bold(BlockExprNode::Bold(BlockExprNode::Text("this is kinda useless"))) |
If that is the case, why is |
Because eventually Ideally I could make |
It wouldn't be an unreasonable addition, however To parse it as Another solution may be to do something like |
That would probably work, but you still need to treat
Should I have a go at making a PR then? It seems tricky and I am still scared of all the types so I would need some mentoring probably |
I'm in a similar situation to #199:
many1(block_expr_node).parse("*hi*")
I think this does not work because once it starts to parse in
bold
, themany1(block_expr_node())
pickschar
and the input is consumed until EOF:Replacing the
bold
implementation with:..parses correctly but is obviously messy and handling errors correctly as in #199 (comment) only adds more boilerplate. Do you think it could be possible to add an abstraction above
flat_map
so this could be done like:It'd still create the sub-parser in a
flat_map
but would hide the scary types from me :PThe text was updated successfully, but these errors were encountered: