Skip to content

Commit

Permalink
Added engine option to plyplus (ply is still default)
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Jun 22, 2016
1 parent 7cd3242 commit ca76dbd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plyplus/plyplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ def __init__(self, options_dict):
self.tree_class = o.pop('tree_class', STree)
self.cache_grammar = o.pop('cache_grammar', False)
self.ignore_postproc = bool(o.pop('ignore_postproc', False))
self.engine = o.pop('engine', 'ply')

if o:
raise ValueError("Unknown options: %s" % o.keys())
Expand Down Expand Up @@ -635,8 +636,12 @@ def __init__(self, grammar_tree, source_name, tab_filename, options):
self.lexer_postproc = None
self._newline_value = '\n'

# self.engine = Engine_PLY(self.options, self.rules_to_flatten, self.rules_to_expand)
self.engine = Engine_Pearley(self.options, self.rules_to_flatten, self.rules_to_expand)
engine_class = {
'ply': Engine_PLY,
'pearley': Engine_Pearley,
}[options.engine]

self.engine = engine_class(self.options, self.rules_to_flatten, self.rules_to_expand)

# -- Build Grammar --
self.subgrammars = {}
Expand Down

0 comments on commit ca76dbd

Please sign in to comment.