Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

1.7.0: Avoid emitting unused combinators via macros.

@seancribbs seancribbs tagged this · 14 commits to master since this tag

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.

Downloads

Something went wrong with that request. Please try again.