-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Pinging @josevalim because of the discussion on the NimbleParsec repo.
Currently, the lexer behaviour defines these two callbacks: https://github.com/elixir-makeup/makeup/blob/master/lib/makeup/lexer.ex#L8-L17
However, when I defined this behaviour, I was thinking of reusing combinators from one lexer inside another lexer. The goal would be to be able (for example) to create an EEx lexer that would call the Elixir lexer for the Elixir part. This means that the root_element and the root combinators should be accessible from outside of the Lexer as combinators (not only as functions).
My question is:
- Should we keep the behaviour as it is and add combinators corresponding to these entrypoints? (that is, a
root_element__0/6function and aroot__0/6function? - Should we change the behaviour so that only the combinators (i.e.
fun__0/6) are exported?
I think that for backward compatibility reasons we should go with option 1. Also, the way we are implementing the lex/2 function in most lexers is based on a the fact that a root/1 function exists.
What do you think @josevalim? This would be a good case for the export_combinator: true option you've talked about?