def parse(self, buf, buf_offset=0, initial_skip_space_fn=None, syntax_error_fn=my_syntax_error_func, ambiguity_fn=my_ambiguity_func, make_token=None, dont_fixup_internal_productions=0, fixup_EBNF_productions=0, dont_merge_epsilon_trees=0, commit_actions_interval=100, error_recovery=0, print_debug_info=0, partial_parses=0, dont_compare_stacks=0, dont_use_greediness_for_disambiguation=0, dont_use_height_for_disambiguation=0, start_symbol=''): if not isinstance(buf, basestring): raise ParsingException("Message to parse is not a string: %r" % buf) parser = dparser_swigc.make_parser( self.tables.getTables(), self, Reject, make_token, d_loc_t, D_ParseNode, self.actions, initial_skip_space_fn, syntax_error_fn, ambiguity_fn, dont_fixup_internal_productions, fixup_EBNF_productions, dont_merge_epsilon_trees, commit_actions_interval, error_recovery, print_debug_info, partial_parses, dont_compare_stacks, dont_use_greediness_for_disambiguation, dont_use_height_for_disambiguation, start_symbol, self.takes_strings, self.takes_globals) result = dparser_swigc.run_parser(parser, buf, buf_offset) return ParsedStructure(result)
def parse(self, buf, buf_offset=0, initial_skip_space_fn=None, syntax_error_fn=my_syntax_error_func, ambiguity_fn=my_ambiguity_func, make_token=None, dont_fixup_internal_productions=False, fixup_EBNF_productions=False, dont_merge_epsilon_trees=False, commit_actions_interval=100, error_recovery=False, print_debug_info=False, partial_parses=False, dont_compare_stacks=False, dont_use_greediness_for_disambiguation=False, dont_use_height_for_disambiguation=False, start_symbol=''): if not isinstance(buf, basestring): raise ParsingException("Message to parse is not a string: %r" % buf) parser = dparser_swigc.make_parser( self.tables.getTables(), self, Reject, make_token, d_loc_t, D_ParseNode, self.actions, initial_skip_space_fn, syntax_error_fn, ambiguity_fn, dont_fixup_internal_productions, fixup_EBNF_productions, dont_merge_epsilon_trees, commit_actions_interval, error_recovery, print_debug_info, partial_parses, dont_compare_stacks, dont_use_greediness_for_disambiguation, dont_use_height_for_disambiguation, start_symbol, self.takes_strings, self.takes_globals ) result = dparser_swigc.run_parser(parser, buf, buf_offset) return ParsedStructure(result)
def parse(self, buf, buf_offset=0, initial_skip_space_fn=None, syntax_error_fn=my_syntax_error_func, ambiguity_fn=my_ambiguity_func, make_token=None, dont_fixup_internal_productions=0, dont_merge_epsilon_trees=0, commit_actions_interval=0, error_recovery=0, print_debug_info=0, partial_parses=0, dont_compare_stacks=0, dont_use_eagerness_for_disambiguation=0, dont_use_height_for_disambiguation=0, start_symbol=''): parser = dparser_swigc.make_parser( self.tables, self, Reject, make_token, d_loc_t, D_ParseNode, self.actions, initial_skip_space_fn, syntax_error_fn, ambiguity_fn, dont_fixup_internal_productions, dont_merge_epsilon_trees, commit_actions_interval, error_recovery, print_debug_info, partial_parses, dont_compare_stacks, dont_use_eagerness_for_disambiguation, dont_use_height_for_disambiguation, start_symbol) result = dparser_swigc.run_parser(parser, buf, buf_offset) if result == None: return None if len(result) == 3: self.s = result[2] self.top_node = result[1] return result[0]
def parse(self, buf, buf_offset=0, initial_skip_space_fn=None, syntax_error_fn=my_syntax_error_func, ambiguity_fn=my_ambiguity_func, make_token=None, dont_fixup_internal_productions=False, fixup_EBNF_productions=False, dont_merge_epsilon_trees=False, commit_actions_interval=100, error_recovery=False, print_debug_info=False, partial_parses=False, dont_compare_stacks=False, dont_use_greediness_for_disambiguation=False, dont_use_height_for_disambiguation=False, start_symbol=''): # workaround python3/2 t = str try: t = basestring except NameError: pass if not isinstance(buf, t): raise ParsingException("Message to parse is not a string: %r" % buf) # dparser works with bytes buf = buf.encode('utf-8') parser = dparser_swigc.make_parser( self.tables.getTables(), self, Reject, make_token, d_loc_t, D_ParseNode, self.actions, initial_skip_space_fn, syntax_error_fn, ambiguity_fn, dont_fixup_internal_productions, fixup_EBNF_productions, dont_merge_epsilon_trees, commit_actions_interval, error_recovery, print_debug_info, partial_parses, dont_compare_stacks, dont_use_greediness_for_disambiguation, dont_use_height_for_disambiguation, start_symbol.encode('utf-8'), self.takes_strings, self.takes_globals) result = dparser_swigc.run_parser(parser, buf, buf_offset) return ParsedStructure(result)