Mercurial > hg > Members > shinya > pyrect
changeset 78:240475723cd8
add option "--filter=[bmh,quick,none]".
author | Ryoma SHINYA <shinya@firefly.cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Nov 2010 05:14:06 +0900 |
parents | c50511498bcf |
children | 623eccb93ca1 |
files | pyrect/jitgrep.py pyrect/translator/grep_translator.py |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pyrect/jitgrep.py Mon Nov 08 05:07:08 2010 +0900 +++ b/pyrect/jitgrep.py Mon Nov 08 05:14:06 2010 +0900 @@ -28,7 +28,7 @@ psr.add_option("--time", action="store_true", dest="time", default=False, help="Print compile/matching time.") psr.add_option("--thread", action="store", type="string", dest="thread", default="0", metavar="FILE", help="number of thread.") psr.add_option("--disable-booster", action="store_true", dest="no_boost", default=False, help="disable boosetr (default: use booster).") - psr.add_option("--filter", action="store", type="string", dest="filter", default="bmh", help="chose filtering-algorithm bmh(default), quick, or none.") + psr.add_option("--filter", action="store", type="string", dest="filter", default="", help="chose filtering-algorithm bmh(default), quick, or none.") psr.add_option("--debug", action="store_true", dest="debug", default=False, help="Dump commands, not evalute matching (except interactive mode).") psr.add_option("--label", action="store_true", dest="label", default=False, help="label implimentation in C.") psr.add_option("--dump", action="store_true", dest="dump", default=False, help="Dump generated grep-source.") @@ -75,7 +75,7 @@ grept = GoToGREPTranslator(reg) else: grept = GREPTranslator(reg) - grept.filter = opts.filter + if opts.filter: grept.filter = opts.filter grept.skip_boost = not opts.no_boost grept.thread_line = int(opts.thread)
--- a/pyrect/translator/grep_translator.py Mon Nov 08 05:07:08 2010 +0900 +++ b/pyrect/translator/grep_translator.py Mon Nov 08 05:14:06 2010 +0900 @@ -26,7 +26,7 @@ self.__bufsize = 1024 * 1024 self.thread_dfa = 1 self.thread_line = 1 - self.filter = "bmh" + self.filter = "quick" self.filter_only = False self.filter_prefix = False self.skip_boost = True @@ -170,7 +170,7 @@ self.emit("UCHARP tmp1, *tmp2, *end_ = end - %d;" % (l-1), 2) self.emiti("while (buf < end_) {") - self.emiti( "if (*buf == %d /* %s */) {" % ord(key[0], Character.ascii(key[0]))) + self.emiti( "if (*buf == %d /* %s */) {" % (ord(key[0]), Character.ascii(key[0]))) self.emit( "tmp1 = buf, tmp2 = (UCHARP)key;") self.emiti( "while (*(++tmp1) == *(++tmp2)){") self.emit( "if (tmp2 == key+%d) goto next;" % (l-1))