This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Kinda.ParserHelper do | |
@moduledoc false | |
@doc """ | |
define a parser combinator and variable with same name | |
""" | |
defmacro defcv(name, expr) do | |
quote do | |
defcombinatorp(unquote(name), unquote(expr)) | |
Kernel.var!(unquote({name, [], nil})) = parsec(unquote(name)) | |
_ = Kernel.var!(unquote({name, [], nil})) |