Hi !
To keep the abnf syntax clear, I could be cool to provide a transform module to the parse function. So insteal of writing this :
special-number = integer (frac / frac exp / exp) !!!
case do_something_complicated_here(state, values) do
stuff -> more_stuff()
:error -> fail_badly()
end
!!!
You just pass a transform module and implement the function transform/4 where you can match on the rule name. And you can return :ignore to keep the original behaviour (when there is no !!! code block !!!)
def transform("special-number", state, values, string_values) do
case do_something_complicated_here(state, values) do
stuff -> more_stuff()
:error -> fail_badly()
end
end
def transform(_other, state, values, string_values) do
:ignore
end
What do you think about that ?
Hi !
To keep the abnf syntax clear, I could be cool to provide a transform module to the parse function. So insteal of writing this :
You just pass a transform module and implement the function
transform/4where you can match on the rule name. And you can return:ignoreto keep the original behaviour (when there is no!!! code block !!!)What do you think about that ?