AST
triptec opened this issue · comments
Hello, is it possible to parse a string and just get the ast without having had it transformed so one can change it and then send it to the transformer?
That's a great idea -- unless you want to give it a go, I'll play with implementing it next week.
Hey @triptec -- there's currently a slightly convoluted way for you to accomplish what you want:
For some My.Grammar
using Neotomex.ExGrammar
and a custom transform function my_transform
you might do:
parsed = My.Grammar.grammar
|> Neotomex.Grammar.match("string to parse")
|> my_transform
|> Neotomex.Grammar.transform_match
Moving forward, we could wrap the match
function for the ExGrammar
allowing something like the following -- what do you think?
parsed = "string to parse"
|> My.Grammar.match
|> my_transform
|> Neotomex.Grammar.transform_match
Ok, I'll have to look in to this next week. Thanks for taking the time
On 16 aug. 2016, at 22:27, Thomas Moulia notifications@github.com wrote:
Hey @triptec -- there's a slightly convoluted for you to accomplish what you want:
For some My.Grammar using Neotomex.ExGrammar and a custom transform function my_transform you might do:
parsed = My.Grammar.grammar
|> Neotomex.Grammar.match("string to parse")
|> my_transform
|> Neotomex.Grammar.transform_match
Moving forward, we could wrap the match function for the ExGrammar allowing something like the following -- what do you think?parsed = "string to parse"
|> My.Grammar.match
|> my_transform
|> Neotomex.Grammar.transform_match
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
I'm going to mark this as closed since I have no current plans to implement and their are instructions for hacking around it above.