Please sign in to comment.
Avoid emitting unused combinators via macros.
This is a stop-gap to reduce dialyzer errors in generated parsers, i.e. until a more thorough approach can be taken. Essentially neotoma's parser tracks which combinators are used by in grammar, and then the generator emits macros at the top of the Erlang output to ensure that those used combinators are present, but no others. peg_includes.hrl wraps each optional combinator in appropriate -ifdef macros. There's still a possibility that a successful sub-tree of a failed branch will cause an unused function to be included, but most grammars should not encounter this problem. Globally-unused combinators were also removed from peg_includes.hrl, namely p_and/1 and p/4. p_eof/0 remains for future use but is guarded by a macro. The line/1 and column/1 functions must be manually turned on by defining the 'line' and/or 'column' macros in the global code block. Fixed the remaining dialyzer bugs in neotoma.erl, removing an unnecessary clause of validate_params/4 and fixing the option() type to include an option used by the escript. Provided additional specs for the remaining functions in peg_includes.hrl.
- Loading branch information...
Showing with 215 additions and 69 deletions.
Oops, something went wrong.