You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
Hi,
I am building a simple parser for an extended Markdown format. One thing I try to include is macro support, which are stored within the state as Dict String String, with name and code to inject. Instead of running multiple string replacements, I would like to add the code in front of the current input stream, if the macro pattern is detected, and then go on with straight forward parsing ...
Is the "primitive" function the appropriate method and if so, how can I use it?
Kind regards,
André
The text was updated successfully, but these errors were encountered:
found a solution. Could you please add the following function? Using this, it is possible to modify the InputStream at parsing time. I use it to define macros, that change the parser state and if a macro pattern is detected also the input stream.
{-| Modify the parser's InputStream.
-}
modifyStream : (String -> String) -> Parser s ()
modifyStream f =
Parser <|
\state stream ->
app (succeed ()) state { stream | input = f stream.input }
Hi,
I am building a simple parser for an extended Markdown format. One thing I try to include is macro support, which are stored within the state as Dict String String, with name and code to inject. Instead of running multiple string replacements, I would like to add the code in front of the current input stream, if the macro pattern is detected, and then go on with straight forward parsing ...
Is the "primitive" function the appropriate method and if so, how can I use it?
Kind regards,
André
The text was updated successfully, but these errors were encountered: