Execute a parse or match on the default grammar, followed by a
        visitation.

        Raise RuntimeError if there is no default grammar specified.
507148
def _parse_or_match(self, text, pos, method_name):
        
        if not self.grammar:
            raise RuntimeError(
                "The {cls}.{method}() shortcut won't work because {cls} was "
                "never associated with a specific " "grammar. Fill out its "
                "`grammar` attribute, and try again.".format(
                    cls=self.__class__.__name__,
                    method=method_name))
        return self.visit(getattr(self.grammar, method_name)(text, pos=pos))
891850
def method_missing(sym, *args, &block) # :nodoc:\
      matchers = natural_language.keywords['matchers']
      be_word = matchers['be'] if matchers
      sym = be_to_english(sym, be_word)
      return Matchers::BePredicate.new(sym, *args, &block) if be_predicate?(sym)
      return Matchers::Has.new(sym, *args, &block) if have_predicate?(sym)
    end
1340794
def _exprparser(
        expr, scope, lang=None, conf=None, configurable=None,
        safe=DEFAULT_SAFE, besteffort=DEFAULT_BESTEFFORT, tostr=False
):
    """"""

    if scope is None:
        scope = {}

    scope.update({
        'configurable': configurable,
        'conf': conf
    })

    expr = REGEX_EXPR_R.sub(
        _refrepl(
            configurable=configurable, conf=conf, safe=safe, scope=scope,
            besteffort=besteffort
        ), expr
    )

    result = resolve(
        expr=expr, name=lang, safe=safe, scope=scope, tostr=tostr,
        besteffort=besteffort
    )

    return result
967872
def parse(scanner, rules, scope = ParserScope.empty)
      (rule = rules[rule_name]) && rule.parse(scanner, rules, scope)
    end
166606
def _maybe_run_matchers(self, text, run_matchers):
        

        if run_matchers is True or \
           (run_matchers is not False and text not in self._overlayed_already):
            text.overlay(self.matchers)
            self._overlayed_already.append(text)
1173162
def p_parse(cls, input, methodname=None, parse_all=True):
        
        if methodname is None:
            methodname = cls.__default__
        p = cls(input)
        result = getattr(p, methodname)()
        if result is cls.NoMatch or parse_all and p.p_peek() is not None:
            p.p_raise()
        return result
789305
def default_match_error_handler(exc):
    
    if isinstance(exc, NotFound):
        return http.NotFound()
    elif isinstance(exc, MethodNotAllowed):
        return http.MethodNotAllowed()
    elif isinstance(exc, RequestRedirect):
        return redirect(exc.new_url)
    else:
        raise exc
1123136
def all_matches(grammar, text):
    """"""
    for tokens, start, stop in grammar.parseWithTabs().scanString(text):
        yield unpack(tokens), start, stop
402999
def parse(self, argv, tokenizer=DefaultTokenizer):
    
    args = tokenizer.tokenize(argv)
    _lang = tokenizer.language_definition()

    #
    # for param in self.__args:
    #   if self._is_default_arg(param):
    #     self.__out_tree[self.__default_arg_tag].append(param.strip())
    #   else:
    #     param = param.lstrip("-").partition('=')
    #     if len(param) == 3:
    #       self.__parse_one_param(param)
    pass
212080
def _handle_match(client, channel, nick, message, matches):
    
    generate_interrogative = _CHANNEL_GENERATE_REGEX.match(message)
    if generate_interrogative:
        return generate(_DEFAULT_TOPIC, _ADD_PUNCTUATION)
    current_topic = db.markovify.find_one({'topic': _DEFAULT_TOPIC})
    if current_topic:
        message = punctuate(current_topic['text'], message, _ADD_PUNCTUATION)
    try:
        ingest(_DEFAULT_TOPIC, message)
    except ValueError as e:
        # not good, but this is done every message so just move along
        print str(e)
531396
def parse(scanner, rules, scope = ParserScope.empty)
      pos = scanner.pos
      result = (child.parse(scanner, rules, scope) && true)
      scanner.pos = pos
      result
    end
617758
public static void ensure(boolean condition, String errorMessageFormat, Object... errorMessageArgs) {
        if (!condition) {
            throw new GrammarException(errorMessageFormat, errorMessageArgs);
        }
    }
45855
function(opts, argv, error)
    {
        var parser = new Parser(opts, argv, error);
        return parser.parse();
    }
775716
def satisfy_custom_matcher(self, args, kwargs):
        
        if not self._custom_matcher:
            return False
        try:
            return self._custom_matcher(*args, **kwargs)
        except Exception:
            return False
913678
def on_grammar(node, compiled_grammar)
      # Create the prototypes for all rules since rules can be referenced before
      # they are defined.
      node.children.each do |child|
        if child.type == :rule
          on_rule_prototype(child, compiled_grammar)
        end
      end

      node.children.each do |child|
        process(child, compiled_grammar)
      end
    end
1062707
def on_rule(node, compiled_grammar)
      name = process(node.children[0], compiled_grammar)

      if compiled_grammar.has_terminal?(name)
        compiled_grammar.add_error(
          "the rule name #{name.inspect} is already used as a terminal name",
          node.source_line
        )
      end

      if compiled_grammar.has_rule_with_branches?(name)
        compiled_grammar.add_error(
          "the rule #{name.inspect} has already been defined",
          node.source_line
        )

        return
      end

      branches = node.children[1..-1].map do |child|
        process(child, compiled_grammar)
      end

      rule = compiled_grammar.lookup_rule(name)

      rule.branches.concat(branches)
    end
827316
def search(pattern, sentence, *args, **kwargs):
    
    return compile(pattern, *args, **kwargs).search(sentence)