├── .gitignore ├── ponyguruma ├── test_string.py ├── __init__.py ├── test_performance.py ├── constants.py ├── sre.py ├── _highlevel.py ├── _lowlevel.c └── test_unicode.py ├── setup.py └── README /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.pyc 3 | *.pyo 4 | *.so 5 | *.egg-info 6 | -------------------------------------------------------------------------------- /ponyguruma/test_string.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mitsuhiko/ponyguruma/HEAD/ponyguruma/test_string.py -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup, Extension 2 | setup( 3 | name="ponyguruma", 4 | packages=['ponyguruma'], 5 | ext_modules=[ 6 | Extension("ponyguruma._lowlevel", ['ponyguruma/_lowlevel.c'], 7 | library_dirs=['/usr/local/lib'], 8 | libraries=['onig'])]) 9 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Ponyguruma 2 | Oniguruma binding for Python 3 | 4 | Ponyguruma was written for Python a few years back but it was 5 | never uploaded to the Cheesehop. I now (2011) moved the project 6 | to github so that people can pick up on it. 7 | 8 | What is Oniguruma? 9 | It's a regular expression engine that does a lot more than 10 | regular expressions and is known for being the regexp engine 11 | of choice for Ruby, TextMate and Sublime Text. 12 | 13 | Why would I want to use it? 14 | For testing Oniguruma style regular expressions :-) 15 | 16 | Is it fast? 17 | Not particularly, but that can be improved. 18 | 19 | Who wrote it? 20 | Armin Ronacher and Georg Brandl. 21 | -------------------------------------------------------------------------------- /ponyguruma/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | ponyguruma 4 | ~~~~~~~~~~~ 5 | 6 | Ponyguruma is the code name for a Python wrapper of the `Oniguruma`_ 7 | regular expression engine, which has a richer set of operations than 8 | Python's sre and better Unicode support. 9 | 10 | .. _Oniguruma: http://www.geocities.jp/kosako3/oniguruma 11 | 12 | :copyright: Copyright 2007 by Armin Ronacher, Georg Brandl. 13 | :license: BSD. 14 | """ 15 | from ponyguruma._lowlevel import VERSION 16 | from ponyguruma._highlevel import * 17 | from ponyguruma.constants import * 18 | 19 | __all__ = ALL_OBJECTS + USEFUL_CONSTANTS + ['VERSION'] 20 | 21 | del _highlevel, _lowlevel, ALL_OBJECTS, USEFUL_CONSTANTS 22 | -------------------------------------------------------------------------------- /ponyguruma/test_performance.py: -------------------------------------------------------------------------------- 1 | """ 2 | ponyguruma.test_performance 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | Test the performance of oniguruma against sre. 6 | 7 | :copyright: Copyright 2007 by Armin Ronacher. 8 | :license: BSD. 9 | """ 10 | 11 | import time 12 | import ponyguruma 13 | import re 14 | 15 | COMPLEX = r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" \ 16 | r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' \ 17 | r')@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}$' 18 | 19 | def r(t, rep=100000): 20 | s = time.time() 21 | for x in xrange(rep): 22 | t() 23 | return time.time() - s 24 | 25 | def t_compile_sre_empty(): 26 | re.compile('') 27 | 28 | def t_compile_sre_rep(): 29 | re.compile('aaaaaaaaaaaaaaa') 30 | 31 | def t_compile_sre_complex(): 32 | return re.compile(COMPLEX, re.IGNORECASE) 33 | 34 | def t_match_sre_complex(): 35 | r = t_compile_sre_complex() 36 | r.match("foo@bar.com") 37 | 38 | def t_compile_onig_empty(): 39 | ponyguruma.Regexp('') 40 | 41 | def t_compile_onig_rep(): 42 | ponyguruma.Regexp('aaaaaaaaaaaaaaa') 43 | 44 | def t_compile_onig_complex(): 45 | return ponyguruma.Regexp(COMPLEX, ponyguruma.OPTION_IGNORECASE) 46 | 47 | def t_match_onig_complex(): 48 | r = t_compile_onig_complex() 49 | r.match("foo@bar.com") 50 | 51 | 52 | if __name__ == '__main__': 53 | for key in sorted(locals().keys()): 54 | if key.startswith('t_'): 55 | print key[2:], 56 | print r(locals()[key]) 57 | -------------------------------------------------------------------------------- /ponyguruma/constants.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | ponyguruma.constants 4 | ~~~~~~~~~~~~~~~~~~~~ 5 | 6 | All exported oniguruma constants. 7 | 8 | :copyright: Copyright 2007 by Armin Ronacher. 9 | :license: BSD. 10 | """ 11 | 12 | OPTION_NONE = 0 13 | OPTION_IGNORECASE = 1 14 | OPTION_EXTEND = (OPTION_IGNORECASE << 1) 15 | OPTION_MULTILINE = (OPTION_EXTEND << 1) 16 | OPTION_SINGLELINE = (OPTION_MULTILINE << 1) 17 | OPTION_FIND_LONGEST = (OPTION_SINGLELINE << 1) 18 | OPTION_FIND_NOT_EMPTY = (OPTION_FIND_LONGEST << 1) 19 | OPTION_NEGATE_SINGLELINE = (OPTION_FIND_NOT_EMPTY << 1) 20 | OPTION_DONT_CAPTURE_GROUP = (OPTION_NEGATE_SINGLELINE << 1) 21 | OPTION_CAPTURE_GROUP = (OPTION_DONT_CAPTURE_GROUP << 1) 22 | OPTION_NOTBOL = (OPTION_CAPTURE_GROUP << 1) 23 | OPTION_NOTEOL = (OPTION_NOTBOL << 1) 24 | OPTION_POSIX_REGION = (OPTION_NOTEOL << 1) 25 | OPTION_MAXBIT = OPTION_POSIX_REGION 26 | OPTION_DEFAULT = OPTION_NONE 27 | 28 | VERBOSE = X = OPTION_EXTEND 29 | DOTALL = S = OPTION_MULTILINE 30 | MULTILINE = M = OPTION_NEGATE_SINGLELINE 31 | IGNORECASE = I = OPTION_IGNORECASE 32 | 33 | SYNTAX_ASIS = 0 34 | SYNTAX_POSIX_BASIC = 1 35 | SYNTAX_POSIX_EXTENDED = 2 36 | SYNTAX_EMACS = 3 37 | SYNTAX_GREP = 4 38 | SYNTAX_GNU_REGEX = 5 39 | SYNTAX_JAVA = 6 40 | SYNTAX_PERL = 7 41 | SYNTAX_PERL_NG = 8 42 | SYNTAX_RUBY = 9 43 | SYNTAX_PYTHON = 10 44 | SYNTAX_DEFAULT = SYNTAX_PYTHON 45 | 46 | ENCODING_ASCII = 0 47 | ENCODING_ISO_8859_1 = 1 48 | ENCODING_ISO_8859_2 = 2 49 | ENCODING_ISO_8859_3 = 3 50 | ENCODING_ISO_8859_4 = 4 51 | ENCODING_ISO_8859_5 = 5 52 | ENCODING_ISO_8859_6 = 6 53 | ENCODING_ISO_8859_7 = 7 54 | ENCODING_ISO_8859_8 = 8 55 | ENCODING_ISO_8859_9 = 9 56 | ENCODING_ISO_8859_10 = 10 57 | ENCODING_ISO_8859_11 = 11 58 | ENCODING_ISO_8859_12 = 12 59 | ENCODING_ISO_8859_13 = 13 60 | ENCODING_ISO_8859_14 = 14 61 | ENCODING_ISO_8859_15 = 15 62 | ENCODING_ISO_8859_16 = 16 63 | ENCODING_UTF8 = 17 64 | ENCODING_UTF16_BE = 18 65 | ENCODING_UTF16_LE = 19 66 | ENCODING_UTF32_BE = 20 67 | ENCODING_UTF32_LE = 21 68 | ENCODING_EUC_JP = 22 69 | ENCODING_EUC_TW = 23 70 | ENCODING_EUC_KR = 24 71 | ENCODING_EUC_CN = 25 72 | ENCODING_SJIS = 26 73 | ENCODING_KOI8 = 27 74 | ENCODING_KOI8_R = 28 75 | ENCODING_CP1251 = 29 76 | ENCODING_BIG5 = 30 77 | ENCODING_GB18030 = 31 78 | ENCODING_UNDEF = 32 79 | 80 | 81 | USEFUL_CONSTANTS = [key for key in locals().keys() if 82 | key.startswith('SYNTAX_') or 83 | key.startswith('OPTION_')] + \ 84 | ['VERBOSE', 'X', 'DOTALL', 'S', 'MULTILINE', 'M', 'IGNORECASE', 'I'] 85 | __all__ = USEFUL_CONSTANTS + ['USEFUL_CONSTANTS'] 86 | -------------------------------------------------------------------------------- /ponyguruma/sre.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | ponyguruma.sre 4 | ~~~~~~~~~~~~~~ 5 | 6 | sre compatiblity module. 7 | 8 | TODO: 9 | 10 | - convert regular expressions if possible. 11 | - UNICODE / LOCALE / DOTALL 12 | 13 | :copyright: Copyright 2007 by Armin Ronacher. 14 | :license: BSD. 15 | """ 16 | from ponyguruma import Regexp, Match, RegexpError, escape, constants 17 | 18 | 19 | I = IGNORECASE = constants.OPTION_IGNORECASE 20 | M = MULTILINE = constants.OPTION_MULTILINE 21 | X = VERBOSE = constants.OPTION_EXTEND 22 | 23 | 24 | class SRE_Pattern(Regexp): 25 | 26 | def match(self, string, pos=0, endpos=-1): 27 | rv = Regexp.match(self, string, pos, endpos) 28 | if rv is not None: 29 | return SRE_Match(rv) 30 | 31 | def search(self, string, pos=0, endpos=-1): 32 | rv = Regexp.search(self, string, pos, endpos) 33 | if rv is not None: 34 | return SRE_Match(rv) 35 | 36 | def subn(self, repl, string, count=0, pos=0, endpos=-1): 37 | if callable(repl): 38 | def repl(m, r=repl): 39 | return r(SRE_Match(m)) 40 | return Regexp.subn(self, repl, string, count, pos, endpos) 41 | 42 | def split(self, string, maxsplit=0, pos=0, endpos=-1): 43 | return Regexp.split(self, string, maxsplit, pos, endpos, True) 44 | 45 | def finditer(self, string, pos=0, endpos=-1): 46 | for match in Regexp.find(self, string, pos, endpos): 47 | yield SRE_Match(match) 48 | 49 | def findall(self, string, pos=0, endpos=-1): 50 | return list(Regexp.findstrings(self, string, pos, endpos)) 51 | 52 | def _missing(self): 53 | raise AttributeError("'%s' object has no attribute 'find'" % 54 | self.__class__.__name__) 55 | find = property(_missing) 56 | findstrings = property(_missing) 57 | del _missing 58 | 59 | def __repr__(self): 60 | return '' % \ 61 | (id(self) & 0xffffffff) 62 | 63 | 64 | class SRE_Match(Match): 65 | 66 | def __init__(self, match): 67 | Match.__init__(self, match.state) 68 | 69 | def groups(self, default=None): 70 | rv = Match.groups.__get__(self) 71 | if default is not None: 72 | rv = list(rv) 73 | for idx, item in enumerate(rv): 74 | if item is None: 75 | rv[idx] = default 76 | rv = tuple(rv) 77 | return rv 78 | 79 | def groupdict(self, default=None): 80 | rv = Match.groupdict.__get__(self) 81 | if default is not None: 82 | for name, value in rv.iteritems(): 83 | if value is None: 84 | rv[name] = default 85 | return rv 86 | 87 | def group(self, group=0, *groups): 88 | if not groups: 89 | return Match.group(self, group) 90 | return tuple(map(Match.group, (group,) + groups)) 91 | 92 | def __repr__(self): 93 | return '' % \ 94 | (id(self) & 0xffffffff) 95 | 96 | 97 | _cache = {} 98 | _MAXCACHE = 100 99 | 100 | def _compile(pattern, flags): 101 | if isinstance(pattern, SRE_Pattern): 102 | return pattern 103 | key = (type(pattern), pattern, flags) 104 | if key in _cache: 105 | return _cache[key] 106 | if len(_cache) >= _MAXCACHE: 107 | purge() 108 | _cache[key] = rv = SRE_Pattern(pattern, flags) 109 | return rv 110 | 111 | def purge(): 112 | _cache.clear() 113 | 114 | def compile(pattern, flags=0): 115 | return SRE_Pattern(pattern, flags) 116 | 117 | def search(pattern, string, flags=0): 118 | return _compile(pattern, flags).search(string) 119 | 120 | def match(pattern, string, flags=0): 121 | return _compile(pattern, flags).search(string) 122 | 123 | def split(pattern, string, maxsplit=0): 124 | return _compile(pattern, 0).split(string, maxsplit) 125 | 126 | def findall(pattern, string, flags=0): 127 | return list(_compile(pattern, flags).findall(flags)) 128 | 129 | def finditer(pattern, string, flags=0): 130 | return _compile(pattern, flags).finditer(string) 131 | 132 | def sub(pattern, repl, string, count=0): 133 | return _compile(pattern, 0).sub(repl, string, count) 134 | 135 | def subn(pattern, repl, string, count=0): 136 | return _compile(pattern, 0).subn(repl, string, count) 137 | 138 | error = RegexpError 139 | 140 | __all__ = ['compile', 'purge', 'search', 'match', 'split', 'findall', 141 | 'finditer', 'sub', 'subn', 'escape', 'I', 'IGNORECASE', 142 | 'M', 'MULTILINE', 'X', 'VERBOSE'] 143 | -------------------------------------------------------------------------------- /ponyguruma/_highlevel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | ponyguruma._highlevel 4 | ~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | Oniguruma Bindings for Python 7 | 8 | :copyright: Copyright 2007 by Armin Ronacher, Georg Brandl. 9 | :license: BSD. 10 | """ 11 | from warnings import warn 12 | 13 | from ponyguruma.constants import OPTION_NONE, ENCODING_ASCII, SYNTAX_DEFAULT 14 | from ponyguruma._lowlevel import * 15 | 16 | 17 | class RegexpWarning(RegexpError): 18 | __module__ = 'ponyguruma' 19 | 20 | 21 | class CalculatedProperty(object): 22 | 23 | def __init__(self, func): 24 | self.func = func 25 | self.__name__ = func.func_name 26 | self.__doc__ = func.__doc__ 27 | 28 | def __get__(self, obj, type=None): 29 | if obj is None: 30 | return self 31 | value = self.func(obj) 32 | setattr(obj, self.__name__, value) 33 | return value 34 | 35 | def __repr__(self): 36 | return '<%s %r>' % ( 37 | self.__class__.__name__, 38 | self.__name__ 39 | ) 40 | 41 | 42 | class Regexp(BaseRegexp): 43 | """ 44 | Holds one pattern. 45 | """ 46 | __module__ = 'ponyguruma' 47 | 48 | # __new__ signature: 49 | # def __new__(cls, pattern, flags=OPTION_NONE, 50 | # encoding=ENCODING_ASCII, syntax=SYNTAX_DEFAULT) 51 | 52 | def factory(cls, flags=OPTION_NONE, encoding=ENCODING_ASCII, 53 | syntax=SYNTAX_DEFAULT): 54 | """ 55 | Return a factory function that creates Regexp objects with a defined 56 | set of Oniguruma flags, encoding and syntax. 57 | """ 58 | def create(pattern): 59 | return cls(pattern, flags, encoding, syntax) 60 | return create 61 | factory = classmethod(factory) 62 | 63 | def match(self, string, pos=0, endpos=-1): 64 | """ 65 | If zero or more characters at the beginning of `string` match 66 | the regular expression pattern, return a corresponding `Match` 67 | instance. Return `None` if the string does not match the pattern; 68 | note that this is different from a zero-length match. 69 | 70 | If pos is given it will start matching at exactly that position, 71 | if endpos is a positive integer it will stop matching at that 72 | position. 73 | 74 | **Note:** If you want to locate a match anywhere in `string` 75 | you should use `search` instead. 76 | """ 77 | state = regexp_match(self, string, pos, endpos, True) 78 | if state is not None: 79 | return Match(state) 80 | 81 | def search(self, string, pos=0, endpos=-1): 82 | """ 83 | Scan through `string` looking for a location where the regular 84 | expression pattern produces a match, and return a corresponding 85 | `Match` instance. Return `None` if no position in the string 86 | matches the pattern; note that this is different from finding a 87 | zero-length match at some point in the string. 88 | 89 | The pos and endpos parameters can be used to limit the search range. 90 | """ 91 | state = regexp_match(self, string, pos, endpos, False) 92 | if state is not None: 93 | return Match(state) 94 | 95 | def find(self, string, pos=0, endpos=-1): 96 | """ 97 | Return an iterator yielding `Match` instances over all 98 | non-overlapping matches for the pattern in string. Empty matches 99 | are included in the result unless they touch the beginning of 100 | another match. 101 | """ 102 | while 1: 103 | state = regexp_match(self, string, pos, endpos, False) 104 | if state is None: 105 | return 106 | m = Match(state) 107 | pos = m.end() 108 | yield m 109 | 110 | def findstrings(self, string, pos=0, endpos=-1): 111 | """ 112 | Like find but yields the string value of the matches. 113 | """ 114 | for match in self.find(string, pos, endpos): 115 | yield match.group() 116 | 117 | def subn(self, repl, string, count=0, pos=0, endpos=-1): 118 | """ 119 | Perform the same operation as `sub()`, but return a tuple 120 | ``(new_string, number_of_subs_made)``. 121 | """ 122 | new = [string[:pos]] 123 | if not callable(repl): 124 | if '\\' in repl: 125 | repl = lambda m, r=repl: m.expand(r) 126 | else: 127 | repl = lambda m, r=repl: r 128 | if endpos == -1: 129 | endpos = len(string) 130 | n = skipped = 0 131 | while 1: 132 | state = regexp_match(self, string, pos, endpos, False) 133 | if state is None: 134 | break 135 | n += 1 136 | m = Match(state) 137 | startpos = m.start() 138 | new.append(string[pos - skipped:startpos]) 139 | pos = m.end() 140 | if startpos == pos: 141 | skipped = 1 142 | else: 143 | skipped = 0 144 | new.append(repl(m)) 145 | if n == count or pos - skipped >= endpos: 146 | break 147 | pos += skipped 148 | new.append(string[pos:]) 149 | return ''.join(new), n 150 | 151 | def sub(self, repl, string, count=0, pos=0, endpos=-1): 152 | r""" 153 | Return the string obtained by replacing the leftmost 154 | non-overlapping occurrences of the pattern in string by the 155 | replacement `repl`. 156 | 157 | If `repr` is a function it will be called with the `Match` 158 | object instance and has to return a string. Otherwise `repr` 159 | must be a string that can have group references (``\1`` or 160 | ``\g``). 161 | """ 162 | return self.subn(repl, string, count, pos, endpos)[0] 163 | 164 | def split(self, string, maxsplit=0, pos=0, endpos=-1, flat=False): 165 | """ 166 | Split string by the occurrences of the pattern. If capturing 167 | parentheses are used in pattern, then the text of all groups 168 | in the pattern are also returned as part of the resulting list. 169 | If `maxsplit` is nonzero, at most maxsplit splits occur, and the 170 | remainder of the string is returned as the final element of the list. 171 | 172 | Unless there are captured groups in the pattern the delimiter is not 173 | part of the returned list. Groups will appear in the result as a 174 | tuple of the groups, even if only one group is present. If you set 175 | `flat` to `True` the tuples will be merged into the list so that all 176 | groups become part of the result as strings. 177 | """ 178 | result = [] 179 | startstring = string[:pos] 180 | n = 0 181 | push_match = (flag and result.append or result.extend) 182 | while 1: 183 | state = regexp_match(self, string, pos, endpos, False) 184 | if state is None: 185 | break 186 | n += 1 187 | m = Match(state) 188 | result.append(string[pos:m.start()]) 189 | if len(m): 190 | push_match(m.groups) 191 | pos = m.end() 192 | if n == maxsplit: 193 | break 194 | result.append(string[pos:]) 195 | result[0] = startstring + result[0] 196 | return result 197 | 198 | def __str__(self): 199 | return str(self.pattern) 200 | 201 | def __unicode__(self): 202 | return unicode(self.pattern) 203 | 204 | def __repr__(self): 205 | return 'Regexp(%r)' % (self.pattern,) 206 | 207 | 208 | # XXX: not expanding other escapes here... and do not replace \\1 209 | _repl_re = Regexp(r"\\(?:(\d+)|g<(.+?)>)") 210 | 211 | 212 | class Match(object): 213 | """ 214 | Wrapper class for the match results. 215 | """ 216 | __module__ = 'ponyguruma' 217 | 218 | def __init__(self, state): 219 | self.state = state 220 | 221 | def spans(self): 222 | """ 223 | A tuple of tuples with the start and end position of the captured 224 | groups. 225 | """ 226 | return match_get_groups(self.state) 227 | spans = CalculatedProperty(spans) 228 | 229 | def groupnames(self): 230 | """ 231 | A dict for name -> group_number. 232 | """ 233 | return match_get_group_names(self.state) 234 | groupnames = CalculatedProperty(groupnames) 235 | 236 | def groups(self): 237 | """ 238 | A tuple of the group values, ignoring the first group. Thus the 239 | regexp ``r'(.)(.)(.)'`` matched against ``abc`` will return 240 | ``('a', 'b', 'c')`` but not ``('abc', 'a', 'b', 'c')``. 241 | """ 242 | return tuple([self.group(x) for x in xrange(1, len(self.spans))]) 243 | groups = CalculatedProperty(groups) 244 | 245 | def groupdict(self): 246 | """ 247 | A dict of all named groups with their corresponding values. 248 | """ 249 | d = {} 250 | for key in self.groupnames: 251 | d[key] = self.group(key) 252 | return d 253 | groupdict = CalculatedProperty(groupdict) 254 | 255 | def lastindex(self): 256 | """ 257 | The integer index of the last matched capturing group, or `None` 258 | if no group was matched at all. For example, the expressions 259 | ``(a)b``, ``((a)(b))``, and ``((ab))`` will have ``lastindex == 1`` 260 | if applied to the string ``'ab'``, while the expression ``(a)(b)`` 261 | will have ``lastindex == 2``, if applied to the same string. 262 | """ 263 | m = (None, -1) 264 | for idx, (start, end) in enumerate(self.spans[1:]): 265 | if end > m[1]: 266 | m = (idx + 1, end) 267 | return m[0] 268 | lastindex = CalculatedProperty(lastindex) 269 | 270 | def lastgroup(self): 271 | """ 272 | The name of the last matched capturing group, or `None` if the 273 | group didn't have a name, or if no group was matched at all. 274 | """ 275 | g = self.lastindex 276 | if g is not None: 277 | for name, index in self.groupnames.iteritems(): 278 | if index == g: 279 | return name 280 | lastgroup = CalculatedProperty(lastgroup) 281 | 282 | def expand(self, template): 283 | """ 284 | Expand a template string. 285 | """ 286 | def handle(match): 287 | numeric, named = match.groups 288 | if numeric: 289 | return self.group(int(numeric)) 290 | return self.group(named) 291 | return _repl_re.sub(handle, template) 292 | 293 | def span(self, group=0): 294 | """ 295 | The span of a single group. Group can be a string if it's a 296 | named group, otherwise an integer. If you omit the value the 297 | span of the whole match is returned. 298 | """ 299 | if isinstance(group, basestring): 300 | group = self.groupnames[group] 301 | return self.spans[group] 302 | 303 | def start(self, group=0): 304 | """ 305 | Get the start position of a group or the whole match if no 306 | group is provided. 307 | """ 308 | return self.span(group)[0] 309 | 310 | def end(self, group=0): 311 | """ 312 | Get the end position of a group or the whole match if no group 313 | is provided. 314 | """ 315 | return self.span(group)[1] 316 | 317 | def group(self, group=0): 318 | """ 319 | Return the value of a single group. 320 | """ 321 | if isinstance(group, basestring): 322 | group = self.groupnames[group] 323 | return match_extract_group(self.state, group) 324 | 325 | def re(self): 326 | """ 327 | The regular expression object that created this match. 328 | """ 329 | return self.state.regexp 330 | re = property(re, doc=re.__doc__) 331 | 332 | def string(self): 333 | """ 334 | The string this match object matches on. 335 | """ 336 | return self.state.string 337 | string = property(string, doc=re.__doc__) 338 | 339 | def pos(self): 340 | """ 341 | The search start position. This is equivalent to the `pos` parameter of 342 | the `match()` / `search()` methods that created this match object. 343 | 344 | Don't mix this up with `start()` which gives you the position of the 345 | actual match begin. 346 | """ 347 | return self.state.pos 348 | pos = property(pos, doc=pos.__doc__) 349 | 350 | def endpos(self): 351 | """ 352 | The search end position. This is equivalent to the `endpos` parameter of 353 | the `match()` / `search()` methods that created this match object. 354 | 355 | Don't mix this up with `end()` which gives you the position of the actual 356 | match end. 357 | """ 358 | return self.state.endpos 359 | endpos = property(end, "The match end position.") 360 | 361 | __getitem__ = group 362 | 363 | def __len__(self): 364 | return len(self.spans) - 1 365 | 366 | def __iter__(self): 367 | return iter(self.groups) 368 | 369 | def __eq__(self, other): 370 | return self.__class__ is other.__class__ and \ 371 | self.state is other.state 372 | 373 | def __ne__(self, other): 374 | return not self.__eq__(other) 375 | 376 | def __nonzero__(self): 377 | # If this isn't defined, Python checks if __len__() != 0! 378 | return True 379 | 380 | def __unicode__(self): 381 | return unicode(self.group(0)) 382 | 383 | def __str__(self): 384 | return str(self.group(0)) 385 | 386 | def __repr__(self): 387 | return '<%s groups: %d, span: (%d, %d)>' % ( 388 | self.__class__.__name__, 389 | len(self), 390 | self.start(), 391 | self.end() 392 | ) 393 | 394 | 395 | class Scanner(object): 396 | """ 397 | Simple regular expression based scanner. This scanner keeps track 398 | of the current position and continues lexing from here. Here a 399 | small example:: 400 | 401 | >>> s = Scanner("Hello World") 402 | >>> s.scan(r'World') 403 | >>> s.scan(r'Hello') 404 | 405 | >>> s.pos 406 | 5 407 | >>> s.scan(r'World') 408 | >>> s.pos 409 | 5 410 | >>> s.scan(r'\s+') 411 | 412 | >>> s.eos 413 | False 414 | >>> s.scan('.+') 415 | 416 | >>> s.eos 417 | True 418 | """ 419 | 420 | def __init__(self, string): 421 | self.string = string 422 | self._cache = {} 423 | self.reset() 424 | 425 | def eos(self): 426 | """True if the end of the string is reached.""" 427 | return self.pos >= self.end 428 | eos = property(eos, doc=eos.__doc__) 429 | 430 | def rest(self): 431 | """The unscanned string.""" 432 | return self.string[self.pos:] 433 | rest = property(rest, doc=rest.__doc__) 434 | 435 | def scanned(self): 436 | """The string that was already scanned.""" 437 | return self.string[:self.pos] 438 | scanned = property(scanned, doc=scanned.__doc__) 439 | 440 | def reset(self): 441 | """Reset the scanner.""" 442 | self.pos = 0 443 | self.old_pos = None 444 | self.end = len(self.string) 445 | self.match = None 446 | 447 | def feed(self, string): 448 | """Add a new string to the string that is scanned.""" 449 | self.string += string 450 | self.end = len(self.string) 451 | 452 | def check(self, regexp): 453 | """ 454 | This returns the value that `match` would return, without advancing the scan 455 | pointer. Also the match register is not updated. 456 | """ 457 | if regexp in self._cache: 458 | re = self._cache[regexp] 459 | else: 460 | re = self._cache[regexp] = Regexp(regexp) 461 | return re.match(self.string, self.pos) 462 | 463 | def scan(self, regexp): 464 | """ 465 | Tries to match with pattern at the current position. If there's a match, the 466 | scanner advances the scan pointer and returns the match object. Otherwise, 467 | the return value is `None` and the position is unchanged. 468 | """ 469 | match = self.check(regexp) 470 | if match is not None: 471 | self.old_pos = self.pos 472 | self.pos = match.end() 473 | self.match = match 474 | return match 475 | 476 | def skip(self, regexp): 477 | """ 478 | Works like `scan` but the match is not returned. The return values is `True` 479 | if everything went well, otherwise `False`. 480 | """ 481 | return self.scan(regexp) is not None 482 | 483 | def search(self, regexp): 484 | """ 485 | Works like `scan` but scans not only at the beginning but it skips until the 486 | pattern matches. If the pattern does not match the return value is `None` 487 | and neither the pointer no the match register is updated. Otherwise the 488 | return value is the string skipped and the match register points to the 489 | used match object. 490 | """ 491 | if regexp in self._cache: 492 | re = self._cache[regexp] 493 | else: 494 | re = self._cache[regexp] = Regexp(regexp) 495 | match = re.search(regexp, self.pos) 496 | if match is not None: 497 | self.old_pos = start = self.pos 498 | self.pos = end = match.end() 499 | self.match = match 500 | return self.string[start:end] 501 | 502 | def getch(self): 503 | """ 504 | Get the next character as string or `None` if end is reached. 505 | """ 506 | rv = self.match(r'(?:.|\n)') 507 | if rv is not None: 508 | return rv.group() 509 | 510 | def rewind(self): 511 | """ 512 | Go one position back. Only one is allowed. 513 | """ 514 | if self.old_pos is None: 515 | if self.pos == 0: 516 | raise RuntimeError('Cannot rewind beyond start position') 517 | raise RuntimeError('Cannot rewind more than one position back') 518 | self.pos = self.old_pos 519 | self.old_pos = None 520 | 521 | def __repr__(self): 522 | return '<%s %d/%d>' % ( 523 | self.__class__.__name__, 524 | self.pos, 525 | self.end 526 | ) 527 | 528 | 529 | def warn_func(message): 530 | """ 531 | Called from the C extension on warnings. If you want to control 532 | the way warnings are handled you can override `ponyguruma.warn_func`. 533 | """ 534 | warn(RegexpWarning(message), stacklevel=2) 535 | 536 | 537 | _special_escapes = { 538 | '\r': '\\r', 539 | '\n': '\\n', 540 | '\t': '\\t', 541 | '\b': '[\\b]', 542 | '\v': '\\v', 543 | '\f': '\\f', 544 | '\0': '\\0' 545 | } 546 | 547 | 548 | def escape(pattern): 549 | """Escape all non-alphanumeric characters in pattern.""" 550 | s = list(pattern) 551 | for i, c in enumerate(s): 552 | if not ('a' <= c <= 'z' or 'A' <= c <= 'Z' or '0' <= c <= '9'): 553 | if c in _special_escapes: 554 | s[i] = _special_escapes[c] 555 | else: 556 | s[i] = '\\' + c 557 | return type(pattern)().join(s) 558 | 559 | 560 | ALL_OBJECTS = ['Regexp', 'Scanner', 'Match', 'RegexpError', 561 | 'RegexpWarning', 'warn_func', 'escape'] 562 | __all__ = ALL_OBJECTS + ['ALL_OBJECTS'] 563 | -------------------------------------------------------------------------------- /ponyguruma/_lowlevel.c: -------------------------------------------------------------------------------- 1 | /** 2 | * ponyguruma._lowlevel 3 | * ~~~~~~~~~~~~~~~~~~~~ 4 | * 5 | * low-level binding to the ongiguruma regular expression engine. 6 | * 7 | * :copyright: 2007 by Armin Ronacher, Georg Brandl. 8 | * :license: BSD. 9 | */ 10 | 11 | #include "Python.h" 12 | #include "pyconfig.h" 13 | #include "oniguruma.h" 14 | #include 15 | 16 | /* Calculate the proper encoding to use for Python Unicode strings */ 17 | #if Py_UNICODE_SIZE == 2 18 | # ifdef WORDS_BIGENDIAN 19 | # define UNICODE_ENCODING ONIG_ENCODING_UTF16_BE 20 | # else 21 | # define UNICODE_ENCODING ONIG_ENCODING_UTF16_LE 22 | # endif 23 | #elif Py_UNICODE_SIZE == 4 24 | # ifdef WORDS_BIGENDIAN 25 | # define UNICODE_ENCODING ONIG_ENCODING_UTF32_BE 26 | # else 27 | # define UNICODE_ENCODING ONIG_ENCODING_UTF32_LE 28 | # endif 29 | #else 30 | # error "unsupported Py_UNICODE_SIZE" 31 | #endif 32 | 33 | typedef struct { 34 | PyObject_HEAD 35 | regex_t *regex; 36 | PyObject *pattern; 37 | int unicode; 38 | } BaseRegexp; 39 | 40 | typedef struct { 41 | PyObject_HEAD 42 | BaseRegexp *regexp; 43 | PyObject *string; 44 | OnigRegion *region; 45 | Py_ssize_t pos; 46 | Py_ssize_t endpos; 47 | } MatchState; 48 | 49 | static PyObject *RegexpError; 50 | 51 | 52 | /** 53 | * The oniguruma syntax for python 54 | */ 55 | static OnigSyntaxType OnigSyntaxPython; 56 | 57 | 58 | /** 59 | * Get the oniguruma encoding for a given integer. Because we don't forward 60 | * oniguruma encodings to the python space, we have to use something like that. 61 | */ 62 | static OnigEncodingType * 63 | get_onig_encoding(int encoding) 64 | { 65 | switch (encoding) { 66 | case 0: return ONIG_ENCODING_ASCII; 67 | case 1: return ONIG_ENCODING_ISO_8859_1; 68 | case 2: return ONIG_ENCODING_ISO_8859_2; 69 | case 3: return ONIG_ENCODING_ISO_8859_3; 70 | case 4: return ONIG_ENCODING_ISO_8859_4; 71 | case 5: return ONIG_ENCODING_ISO_8859_5; 72 | case 6: return ONIG_ENCODING_ISO_8859_6; 73 | case 7: return ONIG_ENCODING_ISO_8859_7; 74 | case 8: return ONIG_ENCODING_ISO_8859_8; 75 | case 9: return ONIG_ENCODING_ISO_8859_9; 76 | case 10: return ONIG_ENCODING_ISO_8859_10; 77 | case 11: return ONIG_ENCODING_ISO_8859_11; 78 | case 12: return ONIG_ENCODING_ISO_8859_11; 79 | case 13: return ONIG_ENCODING_ISO_8859_13; 80 | case 14: return ONIG_ENCODING_ISO_8859_14; 81 | case 15: return ONIG_ENCODING_ISO_8859_15; 82 | case 16: return ONIG_ENCODING_ISO_8859_16; 83 | case 17: return ONIG_ENCODING_UTF8; 84 | case 18: return ONIG_ENCODING_UTF16_BE; 85 | case 19: return ONIG_ENCODING_UTF16_LE; 86 | case 20: return ONIG_ENCODING_UTF32_BE; 87 | case 21: return ONIG_ENCODING_UTF32_LE; 88 | case 22: return ONIG_ENCODING_EUC_JP; 89 | case 23: return ONIG_ENCODING_EUC_TW; 90 | case 24: return ONIG_ENCODING_EUC_KR; 91 | case 25: return ONIG_ENCODING_EUC_CN; 92 | case 26: return ONIG_ENCODING_SJIS; 93 | /* case 27: return ONIG_ENCODING_KOI8; */ 94 | case 28: return ONIG_ENCODING_KOI8_R; 95 | case 29: return ONIG_ENCODING_CP1251; 96 | case 30: return ONIG_ENCODING_BIG5; 97 | case 31: return ONIG_ENCODING_GB18030; 98 | default: return ONIG_ENCODING_UNDEF; 99 | } 100 | } 101 | 102 | /** 103 | * Like get_onig_encoding, but for the syntax. 104 | */ 105 | static OnigSyntaxType * 106 | get_onig_syntax(int syntax) 107 | { 108 | switch (syntax) { 109 | case 0: return ONIG_SYNTAX_ASIS; 110 | case 1: return ONIG_SYNTAX_POSIX_BASIC; 111 | case 2: return ONIG_SYNTAX_POSIX_EXTENDED; 112 | case 3: return ONIG_SYNTAX_EMACS; 113 | case 4: return ONIG_SYNTAX_GREP; 114 | case 5: return ONIG_SYNTAX_GNU_REGEX; 115 | case 6: return ONIG_SYNTAX_JAVA; 116 | case 7: return ONIG_SYNTAX_PERL; 117 | case 8: return ONIG_SYNTAX_PERL_NG; 118 | case 9: return ONIG_SYNTAX_RUBY; 119 | case 10: 120 | default: return &OnigSyntaxPython; 121 | } 122 | } 123 | 124 | 125 | /** 126 | * initialize the python syntax based on the ruby one 127 | */ 128 | static int 129 | init_python_syntax(void) 130 | { 131 | onig_copy_syntax(&OnigSyntaxPython, ONIG_SYNTAX_RUBY); 132 | int behavior = onig_get_syntax_behavior(&OnigSyntaxPython); 133 | 134 | /* use the ruby settings but disable the use of the same 135 | name for multiple groups, disable warnings for stupid 136 | escapes and capture named and position groups */ 137 | onig_set_syntax_behavior(&OnigSyntaxPython, behavior & ~( 138 | ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP | 139 | ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME | 140 | ONIG_SYN_WARN_CC_OP_NOT_ESCAPED | 141 | ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT 142 | )); 143 | /* sre like singleline */ 144 | onig_set_syntax_options(&OnigSyntaxPython, 145 | ONIG_OPTION_NEGATE_SINGLELINE 146 | ); 147 | return 0; 148 | } 149 | 150 | 151 | /** 152 | * Create a new Regexp object. 153 | */ 154 | static PyObject * 155 | BaseRegexp_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) 156 | { 157 | PyObject *pattern; 158 | int ienc = -1, isyn = 10, rv; 159 | OnigOptionType options = ONIG_OPTION_NONE; 160 | OnigSyntaxType *syn; 161 | OnigEncodingType *enc; 162 | UChar *pstr, *pend; 163 | OnigErrorInfo einfo; 164 | BaseRegexp *self; 165 | static char *kwlist[] = {"pattern", "flags", "encoding", "syntax", NULL}; 166 | 167 | self = (BaseRegexp *)type->tp_alloc(type, 0); 168 | if (!self) 169 | return NULL; 170 | /* Initialize them in case __new__ fails. */ 171 | self->regex = NULL; 172 | self->pattern = NULL; 173 | 174 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|iii:BaseRegexp", kwlist, 175 | &pattern, &options, &ienc, &isyn)) { 176 | Py_DECREF(self); 177 | return NULL; 178 | } 179 | if (PyUnicode_Check(pattern)) { 180 | if (ienc != -1) { 181 | PyErr_SetString(PyExc_TypeError, "an encoding can " 182 | "only be given for non-unicode patterns"); 183 | Py_DECREF(self); 184 | return NULL; 185 | } 186 | enc = UNICODE_ENCODING; 187 | pstr = (UChar *) PyUnicode_AS_UNICODE(pattern); 188 | pend = pstr + (PyUnicode_GET_SIZE(pattern) * sizeof(PY_UNICODE_TYPE)); 189 | self->unicode = 1; 190 | } 191 | else if (PyString_Check(pattern)) { 192 | if (ienc == -1) ienc = 0; 193 | enc = get_onig_encoding(ienc); 194 | pstr = (UChar *) PyString_AS_STRING(pattern); 195 | pend = pstr + PyString_GET_SIZE(pattern); 196 | self->unicode = 0; 197 | } 198 | else { 199 | PyErr_SetString(PyExc_TypeError, "pattern must be string or unicode"); 200 | Py_DECREF(self); 201 | return NULL; 202 | } 203 | /* Got to keep a reference to the pattern string */ 204 | Py_INCREF(pattern); 205 | self->pattern = pattern; 206 | 207 | /* XXX: check for invalid values? */ 208 | syn = get_onig_syntax(isyn); 209 | 210 | rv = onig_new(&(self->regex), pstr, pend, options, enc, syn, &einfo); 211 | 212 | if (rv != ONIG_NORMAL) { 213 | UChar s[ONIG_MAX_ERROR_MESSAGE_LEN]; 214 | onig_error_code_to_str(s, rv, &einfo); 215 | PyErr_SetString(RegexpError, (char *)s); 216 | Py_DECREF(self); 217 | return NULL; 218 | } 219 | 220 | return (PyObject *)self; 221 | } 222 | 223 | /** 224 | * oniguruma requires that we free the regex object. 225 | */ 226 | static void 227 | BaseRegexp_dealloc(BaseRegexp *self) 228 | { 229 | if (self->regex) 230 | onig_free(self->regex); 231 | Py_XDECREF(self->pattern); 232 | self->ob_type->tp_free((PyObject *)self); 233 | } 234 | 235 | /** 236 | * read only property for the unicode flag. 237 | */ 238 | static PyObject * 239 | BaseRegexp_getunicode(BaseRegexp *self, void *closure) 240 | { 241 | return PyBool_FromLong(self->unicode); 242 | } 243 | 244 | static PyObject * 245 | BaseRegexp_getpattern(BaseRegexp *self, void *closure) 246 | { 247 | Py_INCREF(self->pattern); 248 | return self->pattern; 249 | } 250 | 251 | static PyObject * 252 | BaseRegexp_getflags(BaseRegexp *self, void *closure) 253 | { 254 | return PyInt_FromLong(onig_get_options(self->regex)); 255 | } 256 | 257 | static PyGetSetDef BaseRegexp_getsetters[] = { 258 | {"unicode_mode", (getter)BaseRegexp_getunicode, NULL, 259 | "True if the pattern is in unicode mode.", NULL}, 260 | {"pattern", (getter)BaseRegexp_getpattern, NULL, 261 | "the pattern string the Regexp was built from.", NULL}, 262 | {"flags", (getter)BaseRegexp_getflags, NULL, 263 | "the flags the Regexp was built with.", NULL}, 264 | {NULL} 265 | }; 266 | 267 | 268 | static PyTypeObject BaseRegexpType = { 269 | PyObject_HEAD_INIT(NULL) 270 | 0, /* ob_size */ 271 | "ponyguruma._lowlevel.BaseRegexp", /* tp_name */ 272 | sizeof(BaseRegexp), /* tp_basicsize */ 273 | 0, /* tp_itemsize */ 274 | (destructor)BaseRegexp_dealloc, /* tp_dealloc */ 275 | 0, /* tp_print */ 276 | 0, /* tp_getattr */ 277 | 0, /* tp_setattr */ 278 | 0, /* tp_compare */ 279 | 0, /* tp_repr */ 280 | 0, /* tp_as_number */ 281 | 0, /* tp_as_sequence */ 282 | 0, /* tp_as_mapping */ 283 | 0, /* tp_hash */ 284 | 0, /* tp_call */ 285 | 0, /* tp_str */ 286 | 0, /* tp_getattro */ 287 | 0, /* tp_setattro */ 288 | 0, /* tp_as_buffer */ 289 | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ 290 | "", /* tp_doc */ 291 | 0, /* tp_traverse */ 292 | 0, /* tp_clear */ 293 | 0, /* tp_richcompare */ 294 | 0, /* tp_weaklistoffset */ 295 | 0, /* tp_iter */ 296 | 0, /* tp_iternext */ 297 | 0, /* tp_methods */ 298 | 0, /* tp_members */ 299 | BaseRegexp_getsetters, /* tp_getset */ 300 | 0, /* tp_base */ 301 | 0, /* tp_dict */ 302 | 0, /* tp_descr_get */ 303 | 0, /* tp_descr_set */ 304 | 0, /* tp_dictoffset */ 305 | 0, /* tp_init */ 306 | 0, /* tp_alloc */ 307 | BaseRegexp_new /* tp_new */ 308 | 309 | }; 310 | 311 | 312 | /** 313 | * oniguruma requires that we free the match state objects. 314 | */ 315 | static void 316 | MatchState_dealloc(MatchState *self) 317 | { 318 | Py_XDECREF(self->regexp); 319 | Py_XDECREF(self->string); 320 | if (self->region) 321 | onig_region_free(self->region, 1); 322 | self->ob_type->tp_free(self); 323 | } 324 | 325 | 326 | static PyObject * 327 | MatchState_getregexp(MatchState *self, void *closure) 328 | { 329 | Py_INCREF(self->regexp); 330 | return (PyObject *)self->regexp; 331 | } 332 | 333 | static PyObject * 334 | MatchState_getstring(MatchState *self, void *closure) 335 | { 336 | Py_INCREF(self->string); 337 | return self->string; 338 | } 339 | 340 | static PyObject * 341 | MatchState_getpos(MatchState *self, void *closure) 342 | { 343 | return PyInt_FromSsize_t(self->pos); 344 | } 345 | 346 | static PyObject * 347 | MatchState_getendpos(MatchState *self, void *closure) 348 | { 349 | return PyInt_FromSsize_t(self->endpos); 350 | } 351 | 352 | static PyGetSetDef MatchState_getsetters[] = { 353 | {"regexp", (getter)MatchState_getregexp, NULL, "", NULL}, 354 | {"string", (getter)MatchState_getstring, NULL, "", NULL}, 355 | {"pos", (getter)MatchState_getpos, NULL, "", NULL}, 356 | {"endpos", (getter)MatchState_getendpos, NULL, "", NULL}, 357 | {NULL} 358 | }; 359 | 360 | 361 | static PyTypeObject MatchStateType = { 362 | PyObject_HEAD_INIT(NULL) 363 | 0, /* ob_size */ 364 | "ponyguruma._lowlevel.MatchState", /* tp_name */ 365 | sizeof(MatchState), /* tp_basicsize */ 366 | 0, /* tp_itemsize */ 367 | (destructor)MatchState_dealloc, /* tp_dealloc */ 368 | 0, /* tp_print */ 369 | 0, /* tp_getattr */ 370 | 0, /* tp_setattr */ 371 | 0, /* tp_compare */ 372 | 0, /* tp_repr */ 373 | 0, /* tp_as_number */ 374 | 0, /* tp_as_sequence */ 375 | 0, /* tp_as_mapping */ 376 | 0, /* tp_hash */ 377 | 0, /* tp_call */ 378 | 0, /* tp_str */ 379 | 0, /* tp_getattro */ 380 | 0, /* tp_setattro */ 381 | 0, /* tp_as_buffer */ 382 | Py_TPFLAGS_DEFAULT, /* tp_flags */ 383 | "internal match state object", /* tp_doc */ 384 | 0, /* tp_traverse */ 385 | 0, /* tp_clear */ 386 | 0, /* tp_richcompare */ 387 | 0, /* tp_weaklistoffset */ 388 | 0, /* tp_iter */ 389 | 0, /* tp_iternext */ 390 | 0, /* tp_methods */ 391 | 0, /* tp_members */ 392 | MatchState_getsetters, /* tp_getset */ 393 | }; 394 | 395 | 396 | /** 397 | * regexp match/search function 398 | */ 399 | static PyObject * 400 | regexp_match(PyObject *self, PyObject *args) 401 | { 402 | PyObject *string, *from_start; 403 | BaseRegexp *regexp; 404 | Py_ssize_t pos, endpos; 405 | int ifrom_start; 406 | MatchState *state = NULL; 407 | UChar *str, *str_start, *str_end; 408 | 409 | if (!PyArg_ParseTuple(args, "OOiiO:match", ®exp, &string, 410 | &pos, &endpos, &from_start)) 411 | return NULL; 412 | if (!PyObject_IsInstance((PyObject *)regexp, 413 | (PyObject *)&BaseRegexpType)) { 414 | PyErr_SetString(PyExc_TypeError, "regular expression " 415 | "object required"); 416 | return NULL; 417 | } 418 | if (pos < 0) { 419 | PyErr_SetString(PyExc_ValueError, "pos must be >= 0"); 420 | return NULL; 421 | } 422 | ifrom_start = PyObject_IsTrue(from_start); 423 | if (ifrom_start < 0) 424 | return NULL; 425 | if (PyString_Check(string)) { 426 | if (regexp->unicode) { 427 | /* Encode using default encoding. */ 428 | string = PyUnicode_FromEncodedObject(string, NULL, NULL); 429 | if (!string) 430 | return NULL; 431 | } else { 432 | Py_INCREF(string); 433 | } 434 | } 435 | else if (PyUnicode_Check(string)) { 436 | if (regexp->unicode) { 437 | Py_INCREF(string); 438 | } else { 439 | /* Decode using default encoding. */ 440 | string = PyUnicode_AsEncodedString(string, NULL, NULL); 441 | if (!string) 442 | return NULL; 443 | } 444 | } 445 | else { 446 | PyErr_SetString(PyExc_TypeError, "string to match must be " 447 | "string or unicode"); 448 | return NULL; 449 | } 450 | if (endpos == -1) { 451 | endpos = (regexp->unicode ? PyUnicode_GET_SIZE(string) : 452 | PyString_GET_SIZE(string)); 453 | } 454 | if (endpos < 0) { 455 | PyErr_SetString(PyExc_ValueError, "endpos must be >= -1, where " 456 | "-1 means the length of the string to match"); 457 | Py_DECREF(string); 458 | return NULL; 459 | } 460 | 461 | if (regexp->unicode) { 462 | str = (UChar *) PyUnicode_AS_UNICODE(string); 463 | str_start = str + (sizeof(Py_UNICODE) * pos); 464 | str_end = str + (sizeof(Py_UNICODE) * endpos); 465 | } else { 466 | str = (UChar *) PyString_AS_STRING(string); 467 | str_start = str + pos; 468 | str_end = str + endpos; 469 | } 470 | 471 | if (str_start > str_end) 472 | goto nomatch; 473 | 474 | state = PyObject_New(MatchState, &MatchStateType); 475 | Py_INCREF(regexp); 476 | state->regexp = regexp; 477 | state->region = onig_region_new(); 478 | state->string = string; 479 | state->pos = pos; 480 | state->endpos = endpos; 481 | 482 | if (((ifrom_start) 483 | ? onig_match(regexp->regex, str, str_end, str_start, state->region, 484 | ONIG_OPTION_NONE) 485 | : onig_search(regexp->regex, str, str_end, str_start, str_end, 486 | state->region, ONIG_OPTION_NONE) 487 | ) >= 0) 488 | return (PyObject *) state; 489 | 490 | nomatch: 491 | Py_XDECREF(state); 492 | Py_INCREF(Py_None); 493 | return Py_None; 494 | } 495 | 496 | 497 | /** 498 | * get a tuple of groups 499 | */ 500 | static PyObject * 501 | match_get_groups(PyObject *self, PyObject *state) 502 | { 503 | OnigRegion *region; 504 | int count, i; 505 | PyObject *rv; 506 | 507 | if (!PyObject_IsInstance(state, (PyObject *)&MatchStateType)) { 508 | PyErr_SetString(PyExc_TypeError, "match state required"); 509 | return NULL; 510 | } 511 | 512 | region = ((MatchState *)state)->region; 513 | count = region->num_regs; 514 | 515 | rv = PyTuple_New(count); 516 | if (!rv) 517 | return NULL; 518 | 519 | for (i = 0; i < count; i++) { 520 | int beg = region->beg[i]; 521 | int end = region->end[i]; 522 | PyObject *pair; 523 | if (((MatchState *)state)->regexp->unicode) { 524 | beg /= sizeof(Py_UNICODE); 525 | end /= sizeof(Py_UNICODE); 526 | } 527 | pair = Py_BuildValue("(ii)", beg, end); 528 | if (!pair) { 529 | Py_DECREF(rv); 530 | return NULL; 531 | } 532 | PyTuple_SET_ITEM(rv, i, pair); 533 | } 534 | 535 | return rv; 536 | } 537 | 538 | 539 | /** 540 | * get a dict for idx -> name 541 | */ 542 | static int 543 | iterate_group_names(const UChar *name, const UChar *name_end, 544 | int ngroup_num, int *group_nums, regex_t *reg, 545 | void *arg) 546 | { 547 | int i; 548 | for (i = 0; i < ngroup_num; i++) { 549 | if (PyDict_SetItemString((PyObject *)arg, (char *)name, 550 | PyInt_FromLong(group_nums[i])) < 0) 551 | return -1; 552 | } 553 | return 0; 554 | } 555 | 556 | 557 | static PyObject * 558 | match_get_group_names(PyObject *self, PyObject *state) 559 | { 560 | PyObject *rv; 561 | regex_t *regex; 562 | 563 | if (!PyObject_IsInstance(state, (PyObject *)&MatchStateType)) { 564 | PyErr_SetString(PyExc_TypeError, "match state required"); 565 | return NULL; 566 | } 567 | 568 | rv = PyDict_New(); 569 | if (!rv) 570 | return NULL; 571 | 572 | regex = ((MatchState *)state)->regexp->regex; 573 | if (onig_number_of_names(regex)) { 574 | if (onig_foreach_name(regex, iterate_group_names, (void *)rv) < 0) { 575 | Py_DECREF(rv); 576 | return NULL; 577 | } 578 | } 579 | return rv; 580 | } 581 | 582 | 583 | /** 584 | * extract the substring of a group. 585 | */ 586 | static PyObject * 587 | match_extract_group(PyObject *self, PyObject *args) 588 | { 589 | MatchState *state; 590 | long group; 591 | Py_ssize_t len, start; 592 | 593 | if (!PyArg_ParseTuple(args, "Oi:match_extract_group", &state, &group)) 594 | return NULL; 595 | 596 | if (!PyObject_IsInstance((PyObject *)state, (PyObject *)&MatchStateType)) { 597 | PyErr_SetString(PyExc_TypeError, "match state required"); 598 | return NULL; 599 | } 600 | 601 | if (state->region->num_regs <= group) { 602 | PyErr_SetString(PyExc_IndexError, "no such group"); 603 | return NULL; 604 | } 605 | 606 | start = state->region->beg[group]; 607 | if (start < 0 && state->region->end[group] < 0) { 608 | Py_INCREF(Py_None); 609 | return Py_None; 610 | } 611 | len = state->region->end[group] - start; 612 | 613 | if (state->regexp->unicode) 614 | return PyUnicode_FromUnicode( 615 | PyUnicode_AS_UNICODE(state->string) + start / sizeof(Py_UNICODE), 616 | len / sizeof(Py_UNICODE)); 617 | else 618 | return PyString_FromStringAndSize( 619 | PyString_AS_STRING(state->string) + start, len); 620 | } 621 | 622 | 623 | /** 624 | * Forward a warning call to the _highlevel module 625 | */ 626 | static void 627 | on_regexp_warning(const char *message) 628 | { 629 | PyObject *module = NULL, *warn_func = NULL; 630 | PyObject *args = Py_BuildValue("(s)", message); 631 | if (!args) 632 | goto ret; 633 | module = PyImport_ImportModule("ponyguruma"); 634 | if (!module) 635 | goto ret; 636 | warn_func = PyObject_GetAttrString(module, "warn_func"); 637 | if (!warn_func) 638 | goto ret; 639 | PyObject_CallObject(warn_func, args); 640 | ret: 641 | /* there's no way for the error to be detected */ 642 | PyErr_Clear(); 643 | Py_XDECREF(args); 644 | Py_XDECREF(module); 645 | Py_XDECREF(warn_func); 646 | } 647 | 648 | 649 | static PyMethodDef module_methods[] = { 650 | {"regexp_match", (PyCFunction)regexp_match, METH_VARARGS, 651 | "internal matching helper function"}, 652 | {"match_get_groups", (PyCFunction)match_get_groups, METH_O, 653 | "internal matching helper function"}, 654 | {"match_get_group_names", (PyCFunction)match_get_group_names, METH_O, 655 | "internal matching helper function"}, 656 | {"match_extract_group", (PyCFunction)match_extract_group, METH_VARARGS, 657 | "internal matching helper function"}, 658 | {NULL, NULL, 0, NULL} 659 | }; 660 | 661 | 662 | #ifndef PyMODINIT_FUNC 663 | #define PyMODINIT_FUNC void 664 | #endif 665 | PyMODINIT_FUNC 666 | init_lowlevel(void) 667 | { 668 | PyObject *module; 669 | 670 | if (init_python_syntax() < 0) 671 | return; 672 | 673 | if (PyType_Ready(&BaseRegexpType) < 0 || 674 | PyType_Ready(&MatchStateType) < 0 ) 675 | return; 676 | 677 | module = Py_InitModule3("ponyguruma._lowlevel", module_methods, ""); 678 | if (!module) 679 | return; 680 | 681 | RegexpError = PyErr_NewException("ponyguruma.RegexpError", NULL, NULL); 682 | Py_INCREF(RegexpError); 683 | PyModule_AddObject(module, "RegexpError", RegexpError); 684 | 685 | Py_INCREF(&BaseRegexpType); 686 | PyModule_AddObject(module, "BaseRegexp", (PyObject *)&BaseRegexpType); 687 | 688 | Py_INCREF(&MatchStateType); 689 | PyModule_AddObject(module, "MatchState", (PyObject *)&MatchStateType); 690 | 691 | PyObject *version = Py_BuildValue("(iii)", ONIGURUMA_VERSION_MAJOR, 692 | ONIGURUMA_VERSION_MINOR, 693 | ONIGURUMA_VERSION_TEENY); 694 | PyModule_AddObject(module, "VERSION", (PyObject*)version); 695 | 696 | onig_set_warn_func(on_regexp_warning); 697 | onig_set_verb_warn_func(on_regexp_warning); 698 | } 699 | -------------------------------------------------------------------------------- /ponyguruma/test_unicode.py: -------------------------------------------------------------------------------- 1 | # -*- coding: us-ascii -*- 2 | """ 3 | ponyguruma.test_unicode 4 | ~~~~~~~~~~~~~~~~~~~~~~~ 5 | 6 | Port of the Oniguruma unicode test suite. 7 | 8 | :copyright: Copyright 2007 by Georg Brandl. 9 | :license: BSD. 10 | """ 11 | 12 | from ponyguruma import * 13 | 14 | errors = [] 15 | runs = [0] 16 | 17 | def xx(pattern, str_, from_, to, mem, not_): 18 | # convert to Unicode and strip the trailing null 19 | upattern = pattern.decode("utf-16-be")[:-1] 20 | ustr = str_.decode("utf-16-be")[:-1] 21 | # adapt the boundaries 22 | from_ /= 2 23 | to /= 2 24 | try: 25 | r = Regexp(upattern) 26 | m = r.search(ustr) 27 | runs[0] += 1 28 | if not_: 29 | if not m: 30 | return 31 | else: 32 | errors.append(u"%r should not match with %r" % (upattern, ustr)) 33 | else: 34 | if m: 35 | if m.span(mem) == (from_, to): 36 | return 37 | else: 38 | errors.append(u"%r should match with %r from %s to %s" % ( 39 | upattern, ustr, from_, to)) 40 | else: 41 | errors.append(u"%r should match with %r" % (upattern, ustr)) 42 | except Exception, err: 43 | errors.append(u"got %s exception with pattern %r and string %r: %s" % 44 | (err.__class__.__name__, upattern, ustr, err)) 45 | 46 | def x2(pattern, str_, from_, to): 47 | xx(pattern, str_, from_, to, 0, False) 48 | 49 | def x3(pattern, str_, from_, to, mem): 50 | xx(pattern, str_, from_, to, mem, False) 51 | 52 | def n(pattern, str_): 53 | xx(pattern, str_, 0, 0, 0, True) 54 | 55 | if __name__ == '__main__': 56 | # copied from testu.c from here >>> 57 | x2("\000\000", "\000\000", 0, 0); 58 | x2("\000^\000\000", "\000\000", 0, 0); 59 | x2("\000$\000\000", "\000\000", 0, 0); 60 | x2("\000\134\000G\000\000", "\000\000", 0, 0); 61 | x2("\000\134\000A\000\000", "\000\000", 0, 0); 62 | x2("\000\134\000Z\000\000", "\000\000", 0, 0); 63 | x2("\000\134\000z\000\000", "\000\000", 0, 0); 64 | x2("\000^\000$\000\000", "\000\000", 0, 0); 65 | x2("\000\134\000c\000a\000\000", "\000\001\000\000", 0, 2); 66 | x2("\000\134\000C\000-\000b\000\000", "\000\002\000\000", 0, 2); 67 | x2("\000\134\000c\000\134\000\134\000\000", "\000\034\000\000", 0, 2); 68 | x2("\000q\000[\000\134\000c\000\134\000\134\000]\000\000", "\000q\000\034\000\000", 0, 4); 69 | x2("\000\000", "\000a\000\000", 0, 0); 70 | x2("\000a\000\000", "\000a\000\000", 0, 2); 71 | x2("\000\134\000x\0000\0000\000\134\000x\0006\0001\000\000", "\000a\000\000", 0, 2); 72 | x2("\000a\000a\000\000", "\000a\000a\000\000", 0, 4); 73 | x2("\000a\000a\000a\000\000", "\000a\000a\000a\000\000", 0, 6); 74 | x2("\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000\000", "\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000\000", 0, 70); 75 | x2("\000a\000b\000\000", "\000a\000b\000\000", 0, 4); 76 | x2("\000b\000\000", "\000a\000b\000\000", 2, 4); 77 | x2("\000b\000c\000\000", "\000a\000b\000c\000\000", 2, 6); 78 | x2("\000(\000?\000i\000:\000#\000R\000E\000T\000#\000)\000\000", "\000#\000I\000N\000S\000#\000#\000R\000E\000T\000#\000\000", 10, 20); 79 | x2("\000\134\0000\0000\0000\000\134\0001\0007\000\000", "\000\017\000\000", 0, 2); 80 | x2("\000\134\000x\0000\0000\000\134\000x\0001\000f\000\000", "\000\037\000\000", 0, 2); 81 | x2("\217\372\000\000", "\217\372\000\000", 0, 2); 82 | x2("\000a\000(\000?\000#\000.\000.\000.\000.\000\134\000\134\000J\000J\000J\000J\000)\000b\000\000", "\000a\000b\000\000", 0, 4); 83 | x2("\000(\000?\000x\000)\000 \000 \000G\000 \000(\000o\000 \000O\000(\000?\000-\000x\000)\000o\000O\000)\000 \000g\000 \000L\000\000", "\000G\000o\000O\000o\000O\000g\000L\000e\000\000", 0, 14); 84 | x2("\000.\000\000", "\000a\000\000", 0, 2); 85 | n("\000.\000\000", "\000\000"); 86 | x2("\000.\000.\000\000", "\000a\000b\000\000", 0, 4); 87 | x2("\000\134\000w\000\000", "\000e\000\000", 0, 2); 88 | n("\000\134\000W\000\000", "\000e\000\000"); 89 | x2("\000\134\000s\000\000", "\000 \000\000", 0, 2); 90 | x2("\000\134\000S\000\000", "\000b\000\000", 0, 2); 91 | x2("\000\134\000d\000\000", "\0004\000\000", 0, 2); 92 | n("\000\134\000D\000\000", "\0004\000\000"); 93 | x2("\000\134\000b\000\000", "\000z\000 \000\000", 0, 0); 94 | x2("\000\134\000b\000\000", "\000 \000z\000\000", 2, 2); 95 | x2("\000\134\000B\000\000", "\000z\000z\000 \000\000", 2, 2); 96 | x2("\000\134\000B\000\000", "\000z\000 \000\000", 4, 4); 97 | x2("\000\134\000B\000\000", "\000 \000z\000\000", 0, 0); 98 | x2("\000[\000a\000b\000]\000\000", "\000b\000\000", 0, 2); 99 | n("\000[\000a\000b\000]\000\000", "\000c\000\000"); 100 | x2("\000[\000a\000-\000z\000]\000\000", "\000t\000\000", 0, 2); 101 | n("\000[\000^\000a\000]\000\000", "\000a\000\000"); 102 | x2("\000[\000^\000a\000]\000\000", "\000\012\000\000", 0, 2); 103 | x2("\000[\000]\000]\000\000", "\000]\000\000", 0, 2); 104 | n("\000[\000^\000]\000]\000\000", "\000]\000\000"); 105 | x2("\000[\000\134\000^\000]\000+\000\000", "\0000\000^\000^\0001\000\000", 2, 6); 106 | x2("\000[\000b\000-\000]\000\000", "\000b\000\000", 0, 2); 107 | x2("\000[\000b\000-\000]\000\000", "\000-\000\000", 0, 2); 108 | x2("\000[\000\134\000w\000]\000\000", "\000z\000\000", 0, 2); 109 | n("\000[\000\134\000w\000]\000\000", "\000 \000\000"); 110 | x2("\000[\000\134\000W\000]\000\000", "\000b\000$\000\000", 2, 4); 111 | x2("\000[\000\134\000d\000]\000\000", "\0005\000\000", 0, 2); 112 | n("\000[\000\134\000d\000]\000\000", "\000e\000\000"); 113 | x2("\000[\000\134\000D\000]\000\000", "\000t\000\000", 0, 2); 114 | n("\000[\000\134\000D\000]\000\000", "\0003\000\000"); 115 | x2("\000[\000\134\000s\000]\000\000", "\000 \000\000", 0, 2); 116 | n("\000[\000\134\000s\000]\000\000", "\000a\000\000"); 117 | x2("\000[\000\134\000S\000]\000\000", "\000b\000\000", 0, 2); 118 | n("\000[\000\134\000S\000]\000\000", "\000 \000\000"); 119 | x2("\000[\000\134\000w\000\134\000d\000]\000\000", "\0002\000\000", 0, 2); 120 | n("\000[\000\134\000w\000\134\000d\000]\000\000", "\000 \000\000"); 121 | x2("\000[\000[\000:\000u\000p\000p\000e\000r\000:\000]\000]\000\000", "\000B\000\000", 0, 2); 122 | x2("\000[\000*\000[\000:\000x\000d\000i\000g\000i\000t\000:\000]\000+\000]\000\000", "\000+\000\000", 0, 2); 123 | x2("\000[\000*\000[\000:\000x\000d\000i\000g\000i\000t\000:\000]\000+\000]\000\000", "\000G\000H\000I\000K\000K\000-\0009\000+\000*\000\000", 12, 14); 124 | x2("\000[\000*\000[\000:\000x\000d\000i\000g\000i\000t\000:\000]\000+\000]\000\000", "\000-\000@\000^\000+\000\000", 6, 8); 125 | n("\000[\000[\000:\000u\000p\000p\000e\000r\000]\000]\000\000", "\000A\000\000"); 126 | x2("\000[\000[\000:\000u\000p\000p\000e\000r\000]\000]\000\000", "\000:\000\000", 0, 2); 127 | x2("\000[\000\134\0000\0000\0000\000\134\0000\0004\0004\000-\000\134\0000\0000\0000\000\134\0000\0004\0007\000]\000\000", "\000&\000\000", 0, 2); 128 | x2("\000[\000\134\000x\0000\0000\000\134\000x\0005\000a\000-\000\134\000x\0000\0000\000\134\000x\0005\000c\000]\000\000", "\000[\000\000", 0, 2); 129 | x2("\000[\000\134\000x\0000\0000\000\134\000x\0006\000A\000-\000\134\000x\0000\0000\000\134\000x\0006\000D\000]\000\000", "\000l\000\000", 0, 2); 130 | n("\000[\000\134\000x\0000\0000\000\134\000x\0006\000A\000-\000\134\000x\0000\0000\000\134\000x\0006\000D\000]\000\000", "\000n\000\000"); 131 | n("\000^\000[\0000\000-\0009\000A\000-\000F\000]\000+\000 \0000\000+\000 \000U\000N\000D\000E\000F\000 \000\000", "\0007\0005\000F\000 \0000\0000\0000\0000\0000\0000\0000\0000\000 \000S\000E\000C\000T\0001\0004\000A\000 \000n\000o\000t\000y\000p\000e\000 \000(\000)\000 \000 \000 \000 \000E\000x\000t\000e\000r\000n\000a\000l\000 \000 \000 \000 \000|\000 \000_\000r\000b\000_\000a\000p\000p\000l\000y\000\000"); 132 | x2("\000[\000\134\000[\000]\000\000", "\000[\000\000", 0, 2); 133 | x2("\000[\000\134\000]\000]\000\000", "\000]\000\000", 0, 2); 134 | x2("\000[\000&\000]\000\000", "\000&\000\000", 0, 2); 135 | x2("\000[\000[\000a\000b\000]\000]\000\000", "\000b\000\000", 0, 2); 136 | x2("\000[\000[\000a\000b\000]\000c\000]\000\000", "\000c\000\000", 0, 2); 137 | n("\000[\000[\000^\000a\000]\000]\000\000", "\000a\000\000"); 138 | n("\000[\000^\000[\000a\000]\000]\000\000", "\000a\000\000"); 139 | x2("\000[\000[\000a\000b\000]\000&\000&\000b\000c\000]\000\000", "\000b\000\000", 0, 2); 140 | n("\000[\000[\000a\000b\000]\000&\000&\000b\000c\000]\000\000", "\000a\000\000"); 141 | n("\000[\000[\000a\000b\000]\000&\000&\000b\000c\000]\000\000", "\000c\000\000"); 142 | x2("\000[\000a\000-\000z\000&\000&\000b\000-\000y\000&\000&\000c\000-\000x\000]\000\000", "\000w\000\000", 0, 2); 143 | n("\000[\000^\000a\000-\000z\000&\000&\000b\000-\000y\000&\000&\000c\000-\000x\000]\000\000", "\000w\000\000"); 144 | x2("\000[\000[\000^\000a\000&\000&\000a\000]\000&\000&\000a\000-\000z\000]\000\000", "\000b\000\000", 0, 2); 145 | n("\000[\000[\000^\000a\000&\000&\000a\000]\000&\000&\000a\000-\000z\000]\000\000", "\000a\000\000"); 146 | x2("\000[\000[\000^\000a\000-\000z\000&\000&\000b\000c\000d\000e\000f\000]\000&\000&\000[\000^\000c\000-\000g\000]\000]\000\000", "\000h\000\000", 0, 2); 147 | n("\000[\000[\000^\000a\000-\000z\000&\000&\000b\000c\000d\000e\000f\000]\000&\000&\000[\000^\000c\000-\000g\000]\000]\000\000", "\000c\000\000"); 148 | x2("\000[\000^\000[\000^\000a\000b\000c\000]\000&\000&\000[\000^\000c\000d\000e\000]\000]\000\000", "\000c\000\000", 0, 2); 149 | x2("\000[\000^\000[\000^\000a\000b\000c\000]\000&\000&\000[\000^\000c\000d\000e\000]\000]\000\000", "\000e\000\000", 0, 2); 150 | n("\000[\000^\000[\000^\000a\000b\000c\000]\000&\000&\000[\000^\000c\000d\000e\000]\000]\000\000", "\000f\000\000"); 151 | x2("\000[\000a\000-\000&\000&\000-\000a\000]\000\000", "\000-\000\000", 0, 2); 152 | n("\000[\000a\000\134\000-\000&\000&\000\134\000-\000a\000]\000\000", "\000&\000\000"); 153 | n("\000\134\000w\000a\000b\000c\000\000", "\000 \000a\000b\000c\000\000"); 154 | x2("\000a\000\134\000W\000b\000c\000\000", "\000a\000 \000b\000c\000\000", 0, 8); 155 | x2("\000a\000.\000b\000.\000c\000\000", "\000a\000a\000b\000b\000c\000\000", 0, 10); 156 | x2("\000.\000\134\000w\000b\000\134\000W\000.\000.\000c\000\000", "\000a\000b\000b\000 \000b\000c\000c\000\000", 0, 14); 157 | x2("\000\134\000s\000\134\000w\000z\000z\000z\000\000", "\000 \000z\000z\000z\000z\000\000", 0, 10); 158 | x2("\000a\000a\000.\000b\000\000", "\000a\000a\000b\000b\000\000", 0, 8); 159 | n("\000.\000a\000\000", "\000a\000b\000\000"); 160 | x2("\000.\000a\000\000", "\000a\000a\000\000", 0, 4); 161 | x2("\000^\000a\000\000", "\000a\000\000", 0, 2); 162 | x2("\000^\000a\000$\000\000", "\000a\000\000", 0, 2); 163 | x2("\000^\000\134\000w\000$\000\000", "\000a\000\000", 0, 2); 164 | n("\000^\000\134\000w\000$\000\000", "\000 \000\000"); 165 | x2("\000^\000\134\000w\000a\000b\000$\000\000", "\000z\000a\000b\000\000", 0, 6); 166 | x2("\000^\000\134\000w\000a\000b\000c\000d\000e\000f\000$\000\000", "\000z\000a\000b\000c\000d\000e\000f\000\000", 0, 14); 167 | x2("\000^\000\134\000w\000.\000.\000.\000d\000e\000f\000$\000\000", "\000z\000a\000b\000c\000d\000e\000f\000\000", 0, 14); 168 | x2("\000\134\000w\000\134\000w\000\134\000s\000\134\000W\000a\000a\000a\000\134\000d\000\000", "\000a\000a\000 \000 \000a\000a\000a\0004\000\000", 0, 16); 169 | x2("\000\134\000A\000\134\000Z\000\000", "\000\000", 0, 0); 170 | x2("\000\134\000A\000x\000y\000z\000\000", "\000x\000y\000z\000\000", 0, 6); 171 | x2("\000x\000y\000z\000\134\000Z\000\000", "\000x\000y\000z\000\000", 0, 6); 172 | x2("\000x\000y\000z\000\134\000z\000\000", "\000x\000y\000z\000\000", 0, 6); 173 | x2("\000a\000\134\000Z\000\000", "\000a\000\000", 0, 2); 174 | x2("\000\134\000G\000a\000z\000\000", "\000a\000z\000\000", 0, 4); 175 | n("\000\134\000G\000z\000\000", "\000b\000z\000a\000\000"); 176 | n("\000a\000z\000\134\000G\000\000", "\000a\000z\000\000"); 177 | n("\000a\000z\000\134\000A\000\000", "\000a\000z\000\000"); 178 | n("\000a\000\134\000A\000z\000\000", "\000a\000z\000\000"); 179 | x2("\000\134\000^\000\134\000$\000\000", "\000^\000$\000\000", 0, 4); 180 | x2("\000^\000x\000?\000y\000\000", "\000x\000y\000\000", 0, 4); 181 | x2("\000^\000(\000x\000?\000y\000)\000\000", "\000x\000y\000\000", 0, 4); 182 | x2("\000\134\000w\000\000", "\000_\000\000", 0, 2); 183 | n("\000\134\000W\000\000", "\000_\000\000"); 184 | x2("\000(\000?\000=\000z\000)\000z\000\000", "\000z\000\000", 0, 2); 185 | n("\000(\000?\000=\000z\000)\000.\000\000", "\000a\000\000"); 186 | x2("\000(\000?\000!\000z\000)\000a\000\000", "\000a\000\000", 0, 2); 187 | n("\000(\000?\000!\000z\000)\000a\000\000", "\000z\000\000"); 188 | x2("\000(\000?\000i\000:\000a\000)\000\000", "\000a\000\000", 0, 2); 189 | x2("\000(\000?\000i\000:\000a\000)\000\000", "\000A\000\000", 0, 2); 190 | x2("\000(\000?\000i\000:\000A\000)\000\000", "\000a\000\000", 0, 2); 191 | n("\000(\000?\000i\000:\000A\000)\000\000", "\000b\000\000"); 192 | x2("\000(\000?\000i\000:\000[\000A\000-\000Z\000]\000)\000\000", "\000a\000\000", 0, 2); 193 | x2("\000(\000?\000i\000:\000[\000f\000-\000m\000]\000)\000\000", "\000H\000\000", 0, 2); 194 | x2("\000(\000?\000i\000:\000[\000f\000-\000m\000]\000)\000\000", "\000h\000\000", 0, 2); 195 | n("\000(\000?\000i\000:\000[\000f\000-\000m\000]\000)\000\000", "\000e\000\000"); 196 | x2("\000(\000?\000i\000:\000[\000A\000-\000c\000]\000)\000\000", "\000D\000\000", 0, 2); 197 | x2("\000(\000?\000i\000:\000[\000!\000-\000k\000]\000)\000\000", "\000Z\000\000", 0, 2); 198 | x2("\000(\000?\000i\000:\000[\000!\000-\000k\000]\000)\000\000", "\0007\000\000", 0, 2); 199 | x2("\000(\000?\000i\000:\000[\000T\000-\000}\000]\000)\000\000", "\000b\000\000", 0, 2); 200 | x2("\000(\000?\000i\000:\000[\000T\000-\000}\000]\000)\000\000", "\000{\000\000", 0, 2); 201 | x2("\000(\000?\000i\000:\000\134\000?\000a\000)\000\000", "\000?\000A\000\000", 0, 4); 202 | x2("\000(\000?\000i\000:\000\134\000*\000A\000)\000\000", "\000*\000a\000\000", 0, 4); 203 | n("\000.\000\000", "\000\012\000\000"); 204 | x2("\000(\000?\000m\000:\000.\000)\000\000", "\000\012\000\000", 0, 2); 205 | x2("\000(\000?\000m\000:\000a\000.\000)\000\000", "\000a\000\012\000\000", 0, 4); 206 | x2("\000(\000?\000m\000:\000.\000b\000)\000\000", "\000a\000\012\000b\000\000", 2, 6); 207 | x2("\000.\000*\000a\000b\000c\000\000", "\000d\000d\000d\000a\000b\000d\000d\000\012\000d\000d\000a\000b\000c\000\000", 16, 26); 208 | x2("\000(\000?\000m\000:\000.\000*\000a\000b\000c\000)\000\000", "\000d\000d\000d\000a\000b\000d\000d\000a\000b\000c\000\000", 0, 20); 209 | n("\000(\000?\000i\000)\000(\000?\000-\000i\000)\000a\000\000", "\000A\000\000"); 210 | n("\000(\000?\000i\000)\000(\000?\000-\000i\000:\000a\000)\000\000", "\000A\000\000"); 211 | x2("\000a\000?\000\000", "\000\000", 0, 0); 212 | x2("\000a\000?\000\000", "\000b\000\000", 0, 0); 213 | x2("\000a\000?\000\000", "\000a\000\000", 0, 2); 214 | x2("\000a\000*\000\000", "\000\000", 0, 0); 215 | x2("\000a\000*\000\000", "\000a\000\000", 0, 2); 216 | x2("\000a\000*\000\000", "\000a\000a\000a\000\000", 0, 6); 217 | x2("\000a\000*\000\000", "\000b\000a\000a\000a\000a\000\000", 0, 0); 218 | n("\000a\000+\000\000", "\000\000"); 219 | x2("\000a\000+\000\000", "\000a\000\000", 0, 2); 220 | x2("\000a\000+\000\000", "\000a\000a\000a\000a\000\000", 0, 8); 221 | x2("\000a\000+\000\000", "\000a\000a\000b\000b\000b\000\000", 0, 4); 222 | x2("\000a\000+\000\000", "\000b\000a\000a\000a\000a\000\000", 2, 10); 223 | x2("\000.\000?\000\000", "\000\000", 0, 0); 224 | x2("\000.\000?\000\000", "\000f\000\000", 0, 2); 225 | x2("\000.\000?\000\000", "\000\012\000\000", 0, 0); 226 | x2("\000.\000*\000\000", "\000\000", 0, 0); 227 | x2("\000.\000*\000\000", "\000a\000b\000c\000d\000e\000\000", 0, 10); 228 | x2("\000.\000+\000\000", "\000z\000\000", 0, 2); 229 | x2("\000.\000+\000\000", "\000z\000d\000s\000w\000e\000r\000\012\000\000", 0, 12); 230 | x2("\000(\000.\000*\000)\000a\000\134\0001\000f\000\000", "\000b\000a\000b\000f\000b\000a\000c\000\000", 0, 8); 231 | x2("\000(\000.\000*\000)\000a\000\134\0001\000f\000\000", "\000b\000a\000c\000b\000a\000b\000f\000\000", 6, 14); 232 | x2("\000(\000(\000.\000*\000)\000a\000\134\0002\000f\000)\000\000", "\000b\000a\000c\000b\000a\000b\000f\000\000", 6, 14); 233 | x2("\000(\000.\000*\000)\000a\000\134\0001\000f\000\000", "\000b\000a\000c\000z\000z\000z\000z\000z\000z\000\012\000b\000a\000z\000z\000\012\000z\000z\000z\000z\000b\000a\000b\000f\000\000", 38, 46); 234 | x2("\000a\000|\000b\000\000", "\000a\000\000", 0, 2); 235 | x2("\000a\000|\000b\000\000", "\000b\000\000", 0, 2); 236 | x2("\000|\000a\000\000", "\000a\000\000", 0, 0); 237 | x2("\000(\000|\000a\000)\000\000", "\000a\000\000", 0, 0); 238 | x2("\000a\000b\000|\000b\000c\000\000", "\000a\000b\000\000", 0, 4); 239 | x2("\000a\000b\000|\000b\000c\000\000", "\000b\000c\000\000", 0, 4); 240 | x2("\000z\000(\000?\000:\000a\000b\000|\000b\000c\000)\000\000", "\000z\000b\000c\000\000", 0, 6); 241 | x2("\000a\000(\000?\000:\000a\000b\000|\000b\000c\000)\000c\000\000", "\000a\000a\000b\000c\000\000", 0, 8); 242 | x2("\000a\000b\000|\000(\000?\000:\000a\000c\000|\000a\000z\000)\000\000", "\000a\000z\000\000", 0, 4); 243 | x2("\000a\000|\000b\000|\000c\000\000", "\000d\000c\000\000", 2, 4); 244 | x2("\000a\000|\000b\000|\000c\000d\000|\000e\000f\000g\000|\000h\000|\000i\000j\000k\000|\000l\000m\000n\000|\000o\000|\000p\000q\000|\000r\000s\000t\000u\000v\000w\000x\000|\000y\000z\000\000", "\000p\000q\000r\000\000", 0, 4); 245 | n("\000a\000|\000b\000|\000c\000d\000|\000e\000f\000g\000|\000h\000|\000i\000j\000k\000|\000l\000m\000n\000|\000o\000|\000p\000q\000|\000r\000s\000t\000u\000v\000w\000x\000|\000y\000z\000\000", "\000m\000n\000\000"); 246 | x2("\000a\000|\000^\000z\000\000", "\000b\000a\000\000", 2, 4); 247 | x2("\000a\000|\000^\000z\000\000", "\000z\000a\000\000", 0, 2); 248 | x2("\000a\000|\000\134\000G\000z\000\000", "\000b\000z\000a\000\000", 4, 6); 249 | x2("\000a\000|\000\134\000G\000z\000\000", "\000z\000a\000\000", 0, 2); 250 | x2("\000a\000|\000\134\000A\000z\000\000", "\000b\000z\000a\000\000", 4, 6); 251 | x2("\000a\000|\000\134\000A\000z\000\000", "\000z\000a\000\000", 0, 2); 252 | x2("\000a\000|\000b\000\134\000Z\000\000", "\000b\000a\000\000", 2, 4); 253 | x2("\000a\000|\000b\000\134\000Z\000\000", "\000b\000\000", 0, 2); 254 | x2("\000a\000|\000b\000\134\000z\000\000", "\000b\000a\000\000", 2, 4); 255 | x2("\000a\000|\000b\000\134\000z\000\000", "\000b\000\000", 0, 2); 256 | x2("\000\134\000w\000|\000\134\000s\000\000", "\000 \000\000", 0, 2); 257 | n("\000\134\000w\000|\000\134\000w\000\000", "\000 \000\000"); 258 | x2("\000\134\000w\000|\000%\000\000", "\000%\000\000", 0, 2); 259 | x2("\000\134\000w\000|\000[\000&\000$\000]\000\000", "\000&\000\000", 0, 2); 260 | x2("\000[\000b\000-\000d\000]\000|\000[\000^\000e\000-\000z\000]\000\000", "\000a\000\000", 0, 2); 261 | x2("\000(\000?\000:\000a\000|\000[\000c\000-\000f\000]\000)\000|\000b\000z\000\000", "\000d\000z\000\000", 0, 2); 262 | x2("\000(\000?\000:\000a\000|\000[\000c\000-\000f\000]\000)\000|\000b\000z\000\000", "\000b\000z\000\000", 0, 4); 263 | x2("\000a\000b\000c\000|\000(\000?\000=\000z\000z\000)\000.\000.\000f\000\000", "\000z\000z\000f\000\000", 0, 6); 264 | x2("\000a\000b\000c\000|\000(\000?\000!\000z\000z\000)\000.\000.\000f\000\000", "\000a\000b\000f\000\000", 0, 6); 265 | x2("\000(\000?\000=\000z\000a\000)\000.\000.\000a\000|\000(\000?\000=\000z\000z\000)\000.\000.\000a\000\000", "\000z\000z\000a\000\000", 0, 6); 266 | n("\000(\000?\000>\000a\000|\000a\000b\000d\000)\000c\000\000", "\000a\000b\000d\000c\000\000"); 267 | x2("\000(\000?\000>\000a\000b\000d\000|\000a\000)\000c\000\000", "\000a\000b\000d\000c\000\000", 0, 8); 268 | x2("\000a\000?\000|\000b\000\000", "\000a\000\000", 0, 2); 269 | x2("\000a\000?\000|\000b\000\000", "\000b\000\000", 0, 0); 270 | x2("\000a\000?\000|\000b\000\000", "\000\000", 0, 0); 271 | x2("\000a\000*\000|\000b\000\000", "\000a\000a\000\000", 0, 4); 272 | x2("\000a\000*\000|\000b\000*\000\000", "\000b\000a\000\000", 0, 0); 273 | x2("\000a\000*\000|\000b\000*\000\000", "\000a\000b\000\000", 0, 2); 274 | x2("\000a\000+\000|\000b\000*\000\000", "\000\000", 0, 0); 275 | x2("\000a\000+\000|\000b\000*\000\000", "\000b\000b\000b\000\000", 0, 6); 276 | x2("\000a\000+\000|\000b\000*\000\000", "\000a\000b\000b\000b\000\000", 0, 2); 277 | n("\000a\000+\000|\000b\000+\000\000", "\000\000"); 278 | x2("\000(\000a\000|\000b\000)\000?\000\000", "\000b\000\000", 0, 2); 279 | x2("\000(\000a\000|\000b\000)\000*\000\000", "\000b\000a\000\000", 0, 4); 280 | x2("\000(\000a\000|\000b\000)\000+\000\000", "\000b\000a\000b\000\000", 0, 6); 281 | x2("\000(\000a\000b\000|\000c\000a\000)\000+\000\000", "\000c\000a\000a\000b\000b\000c\000\000", 0, 8); 282 | x2("\000(\000a\000b\000|\000c\000a\000)\000+\000\000", "\000a\000a\000b\000c\000a\000\000", 2, 10); 283 | x2("\000(\000a\000b\000|\000c\000a\000)\000+\000\000", "\000a\000b\000z\000c\000a\000\000", 0, 4); 284 | x2("\000(\000a\000|\000b\000a\000b\000)\000+\000\000", "\000a\000b\000a\000b\000a\000\000", 0, 10); 285 | x2("\000(\000a\000|\000b\000a\000b\000)\000+\000\000", "\000b\000a\000\000", 2, 4); 286 | x2("\000(\000a\000|\000b\000a\000b\000)\000+\000\000", "\000b\000a\000a\000a\000b\000a\000\000", 2, 8); 287 | x2("\000(\000?\000:\000a\000|\000b\000)\000(\000?\000:\000a\000|\000b\000)\000\000", "\000a\000b\000\000", 0, 4); 288 | x2("\000(\000?\000:\000a\000*\000|\000b\000*\000)\000(\000?\000:\000a\000*\000|\000b\000*\000)\000\000", "\000a\000a\000a\000b\000b\000b\000\000", 0, 6); 289 | x2("\000(\000?\000:\000a\000*\000|\000b\000*\000)\000(\000?\000:\000a\000+\000|\000b\000+\000)\000\000", "\000a\000a\000a\000b\000b\000b\000\000", 0, 12); 290 | x2("\000(\000?\000:\000a\000+\000|\000b\000+\000)\000{\0002\000}\000\000", "\000a\000a\000a\000b\000b\000b\000\000", 0, 12); 291 | x2("\000h\000{\0000\000,\000}\000\000", "\000h\000h\000h\000h\000\000", 0, 8); 292 | x2("\000(\000?\000:\000a\000+\000|\000b\000+\000)\000{\0001\000,\0002\000}\000\000", "\000a\000a\000a\000b\000b\000b\000\000", 0, 12); 293 | n("\000a\000x\000{\0002\000}\000*\000a\000\000", "\0000\000a\000x\000x\000x\000a\0001\000\000"); 294 | n("\000a\000.\000{\0000\000,\0002\000}\000a\000\000", "\0000\000a\000X\000X\000X\000a\0000\000\000"); 295 | n("\000a\000.\000{\0000\000,\0002\000}\000?\000a\000\000", "\0000\000a\000X\000X\000X\000a\0000\000\000"); 296 | n("\000a\000.\000{\0000\000,\0002\000}\000?\000a\000\000", "\0000\000a\000X\000X\000X\000X\000a\0000\000\000"); 297 | x2("\000^\000a\000{\0002\000,\000}\000?\000a\000$\000\000", "\000a\000a\000a\000\000", 0, 6); 298 | x2("\000^\000[\000a\000-\000z\000]\000{\0002\000,\000}\000?\000$\000\000", "\000a\000a\000a\000\000", 0, 6); 299 | x2("\000(\000?\000:\000a\000+\000|\000\134\000A\000b\000*\000)\000c\000c\000\000", "\000c\000c\000\000", 0, 4); 300 | n("\000(\000?\000:\000a\000+\000|\000\134\000A\000b\000*\000)\000c\000c\000\000", "\000a\000b\000c\000c\000\000"); 301 | x2("\000(\000?\000:\000^\000a\000+\000|\000b\000+\000)\000*\000c\000\000", "\000a\000a\000b\000b\000b\000a\000b\000c\000\000", 12, 16); 302 | x2("\000(\000?\000:\000^\000a\000+\000|\000b\000+\000)\000*\000c\000\000", "\000a\000a\000b\000b\000b\000b\000c\000\000", 0, 14); 303 | x2("\000a\000|\000(\000?\000i\000)\000c\000\000", "\000C\000\000", 0, 2); 304 | x2("\000(\000?\000i\000)\000c\000|\000a\000\000", "\000C\000\000", 0, 2); 305 | x2("\000(\000?\000i\000)\000c\000|\000a\000\000", "\000A\000\000", 0, 2); 306 | x2("\000(\000?\000i\000:\000c\000)\000|\000a\000\000", "\000C\000\000", 0, 2); 307 | n("\000(\000?\000i\000:\000c\000)\000|\000a\000\000", "\000A\000\000"); 308 | x2("\000[\000a\000b\000c\000]\000?\000\000", "\000a\000b\000c\000\000", 0, 2); 309 | x2("\000[\000a\000b\000c\000]\000*\000\000", "\000a\000b\000c\000\000", 0, 6); 310 | x2("\000[\000^\000a\000b\000c\000]\000*\000\000", "\000a\000b\000c\000\000", 0, 0); 311 | n("\000[\000^\000a\000b\000c\000]\000+\000\000", "\000a\000b\000c\000\000"); 312 | x2("\000a\000?\000?\000\000", "\000a\000a\000a\000\000", 0, 0); 313 | x2("\000b\000a\000?\000?\000b\000\000", "\000b\000a\000b\000\000", 0, 6); 314 | x2("\000a\000*\000?\000\000", "\000a\000a\000a\000\000", 0, 0); 315 | x2("\000b\000a\000*\000?\000\000", "\000b\000a\000a\000\000", 0, 2); 316 | x2("\000b\000a\000*\000?\000b\000\000", "\000b\000a\000a\000b\000\000", 0, 8); 317 | x2("\000a\000+\000?\000\000", "\000a\000a\000a\000\000", 0, 2); 318 | x2("\000b\000a\000+\000?\000\000", "\000b\000a\000a\000\000", 0, 4); 319 | x2("\000b\000a\000+\000?\000b\000\000", "\000b\000a\000a\000b\000\000", 0, 8); 320 | x2("\000(\000?\000:\000a\000?\000)\000?\000?\000\000", "\000a\000\000", 0, 0); 321 | x2("\000(\000?\000:\000a\000?\000?\000)\000?\000\000", "\000a\000\000", 0, 0); 322 | x2("\000(\000?\000:\000a\000?\000)\000+\000?\000\000", "\000a\000a\000a\000\000", 0, 2); 323 | x2("\000(\000?\000:\000a\000+\000)\000?\000?\000\000", "\000a\000a\000a\000\000", 0, 0); 324 | x2("\000(\000?\000:\000a\000+\000)\000?\000?\000b\000\000", "\000a\000a\000a\000b\000\000", 0, 8); 325 | x2("\000(\000?\000:\000a\000b\000)\000?\000{\0002\000}\000\000", "\000\000", 0, 0); 326 | x2("\000(\000?\000:\000a\000b\000)\000?\000{\0002\000}\000\000", "\000a\000b\000a\000b\000a\000\000", 0, 8); 327 | x2("\000(\000?\000:\000a\000b\000)\000*\000{\0000\000}\000\000", "\000a\000b\000a\000b\000a\000\000", 0, 0); 328 | x2("\000(\000?\000:\000a\000b\000)\000{\0003\000,\000}\000\000", "\000a\000b\000a\000b\000a\000b\000a\000b\000\000", 0, 16); 329 | n("\000(\000?\000:\000a\000b\000)\000{\0003\000,\000}\000\000", "\000a\000b\000a\000b\000\000"); 330 | x2("\000(\000?\000:\000a\000b\000)\000{\0002\000,\0004\000}\000\000", "\000a\000b\000a\000b\000a\000b\000\000", 0, 12); 331 | x2("\000(\000?\000:\000a\000b\000)\000{\0002\000,\0004\000}\000\000", "\000a\000b\000a\000b\000a\000b\000a\000b\000a\000b\000\000", 0, 16); 332 | x2("\000(\000?\000:\000a\000b\000)\000{\0002\000,\0004\000}\000?\000\000", "\000a\000b\000a\000b\000a\000b\000a\000b\000a\000b\000\000", 0, 8); 333 | x2("\000(\000?\000:\000a\000b\000)\000{\000,\000}\000\000", "\000a\000b\000{\000,\000}\000\000", 0, 10); 334 | x2("\000(\000?\000:\000a\000b\000c\000)\000+\000?\000{\0002\000}\000\000", "\000a\000b\000c\000a\000b\000c\000a\000b\000c\000\000", 0, 12); 335 | x2("\000(\000?\000:\000X\000*\000)\000(\000?\000i\000:\000x\000a\000)\000\000", "\000X\000X\000X\000a\000\000", 0, 8); 336 | x2("\000(\000d\000+\000)\000(\000[\000^\000a\000b\000c\000]\000z\000)\000\000", "\000d\000d\000d\000z\000\000", 0, 8); 337 | x2("\000(\000[\000^\000a\000b\000c\000]\000*\000)\000(\000[\000^\000a\000b\000c\000]\000z\000)\000\000", "\000d\000d\000d\000z\000\000", 0, 8); 338 | x2("\000(\000\134\000w\000+\000)\000(\000\134\000w\000z\000)\000\000", "\000d\000d\000d\000z\000\000", 0, 8); 339 | x3("\000(\000a\000)\000\000", "\000a\000\000", 0, 2, 1); 340 | x3("\000(\000a\000b\000)\000\000", "\000a\000b\000\000", 0, 4, 1); 341 | x2("\000(\000(\000a\000b\000)\000)\000\000", "\000a\000b\000\000", 0, 4); 342 | x3("\000(\000(\000a\000b\000)\000)\000\000", "\000a\000b\000\000", 0, 4, 1); 343 | x3("\000(\000(\000a\000b\000)\000)\000\000", "\000a\000b\000\000", 0, 4, 2); 344 | x3("\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000a\000b\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000\000", "\000a\000b\000\000", 0, 4, 20); 345 | x3("\000(\000a\000b\000)\000(\000c\000d\000)\000\000", "\000a\000b\000c\000d\000\000", 0, 4, 1); 346 | x3("\000(\000a\000b\000)\000(\000c\000d\000)\000\000", "\000a\000b\000c\000d\000\000", 4, 8, 2); 347 | x3("\000(\000)\000(\000a\000)\000b\000c\000(\000d\000e\000f\000)\000g\000h\000i\000j\000k\000\000", "\000a\000b\000c\000d\000e\000f\000g\000h\000i\000j\000k\000\000", 6, 12, 3); 348 | x3("\000(\000(\000)\000(\000a\000)\000b\000c\000(\000d\000e\000f\000)\000g\000h\000i\000j\000k\000)\000\000", "\000a\000b\000c\000d\000e\000f\000g\000h\000i\000j\000k\000\000", 6, 12, 4); 349 | x2("\000(\000^\000a\000)\000\000", "\000a\000\000", 0, 2); 350 | x3("\000(\000a\000)\000|\000(\000a\000)\000\000", "\000b\000a\000\000", 2, 4, 1); 351 | x3("\000(\000^\000a\000)\000|\000(\000a\000)\000\000", "\000b\000a\000\000", 2, 4, 2); 352 | x3("\000(\000a\000?\000)\000\000", "\000a\000a\000a\000\000", 0, 2, 1); 353 | x3("\000(\000a\000*\000)\000\000", "\000a\000a\000a\000\000", 0, 6, 1); 354 | x3("\000(\000a\000*\000)\000\000", "\000\000", 0, 0, 1); 355 | x3("\000(\000a\000+\000)\000\000", "\000a\000a\000a\000a\000a\000a\000a\000\000", 0, 14, 1); 356 | x3("\000(\000a\000+\000|\000b\000*\000)\000\000", "\000b\000b\000b\000a\000a\000\000", 0, 6, 1); 357 | x3("\000(\000a\000+\000|\000b\000?\000)\000\000", "\000b\000b\000b\000a\000a\000\000", 0, 2, 1); 358 | x3("\000(\000a\000b\000c\000)\000?\000\000", "\000a\000b\000c\000\000", 0, 6, 1); 359 | x3("\000(\000a\000b\000c\000)\000*\000\000", "\000a\000b\000c\000\000", 0, 6, 1); 360 | x3("\000(\000a\000b\000c\000)\000+\000\000", "\000a\000b\000c\000\000", 0, 6, 1); 361 | x3("\000(\000x\000y\000z\000|\000a\000b\000c\000)\000+\000\000", "\000a\000b\000c\000\000", 0, 6, 1); 362 | x3("\000(\000[\000x\000y\000z\000]\000[\000a\000b\000c\000]\000|\000a\000b\000c\000)\000+\000\000", "\000a\000b\000c\000\000", 0, 6, 1); 363 | x3("\000(\000(\000?\000i\000:\000a\000b\000c\000)\000)\000\000", "\000A\000b\000C\000\000", 0, 6, 1); 364 | x2("\000(\000a\000b\000c\000)\000(\000?\000i\000:\000\134\0001\000)\000\000", "\000a\000b\000c\000A\000B\000C\000\000", 0, 12); 365 | x3("\000(\000(\000?\000m\000:\000a\000.\000c\000)\000)\000\000", "\000a\000\012\000c\000\000", 0, 6, 1); 366 | x3("\000(\000(\000?\000=\000a\000z\000)\000a\000)\000\000", "\000a\000z\000b\000\000", 0, 2, 1); 367 | x3("\000a\000b\000c\000|\000(\000.\000a\000b\000d\000)\000\000", "\000z\000a\000b\000d\000\000", 0, 8, 1); 368 | x2("\000(\000?\000:\000a\000b\000c\000)\000|\000(\000A\000B\000C\000)\000\000", "\000a\000b\000c\000\000", 0, 6); 369 | x3("\000(\000?\000i\000:\000(\000a\000b\000c\000)\000)\000|\000(\000z\000z\000z\000)\000\000", "\000A\000B\000C\000\000", 0, 6, 1); 370 | x3("\000a\000*\000(\000.\000)\000\000", "\000a\000a\000a\000a\000z\000\000", 8, 10, 1); 371 | x3("\000a\000*\000?\000(\000.\000)\000\000", "\000a\000a\000a\000a\000z\000\000", 0, 2, 1); 372 | x3("\000a\000*\000?\000(\000c\000)\000\000", "\000a\000a\000a\000a\000c\000\000", 8, 10, 1); 373 | x3("\000[\000b\000c\000d\000]\000a\000*\000(\000.\000)\000\000", "\000c\000a\000a\000a\000a\000z\000\000", 10, 12, 1); 374 | x3("\000(\000\134\000A\000b\000b\000)\000c\000c\000\000", "\000b\000b\000c\000c\000\000", 0, 4, 1); 375 | n("\000(\000\134\000A\000b\000b\000)\000c\000c\000\000", "\000z\000b\000b\000c\000c\000\000"); 376 | x3("\000(\000^\000b\000b\000)\000c\000c\000\000", "\000b\000b\000c\000c\000\000", 0, 4, 1); 377 | n("\000(\000^\000b\000b\000)\000c\000c\000\000", "\000z\000b\000b\000c\000c\000\000"); 378 | x3("\000c\000c\000(\000b\000b\000$\000)\000\000", "\000c\000c\000b\000b\000\000", 4, 8, 1); 379 | n("\000c\000c\000(\000b\000b\000$\000)\000\000", "\000c\000c\000b\000b\000b\000\000"); 380 | n("\000(\000\134\0001\000)\000\000", "\000\000"); 381 | n("\000\134\0001\000(\000a\000)\000\000", "\000a\000a\000\000"); 382 | n("\000(\000a\000(\000b\000)\000\134\0001\000)\000\134\0002\000+\000\000", "\000a\000b\000a\000b\000b\000\000"); 383 | n("\000(\000?\000:\000(\000?\000:\000\134\0001\000|\000z\000)\000(\000a\000)\000)\000+\000$\000\000", "\000z\000a\000a\000\000"); 384 | x2("\000(\000?\000:\000(\000?\000:\000\134\0001\000|\000z\000)\000(\000a\000)\000)\000+\000$\000\000", "\000z\000a\000a\000a\000\000", 0, 8); 385 | x2("\000(\000a\000)\000(\000?\000=\000\134\0001\000)\000\000", "\000a\000a\000\000", 0, 2); 386 | n("\000(\000a\000)\000$\000|\000\134\0001\000\000", "\000a\000z\000\000"); 387 | x2("\000(\000a\000)\000\134\0001\000\000", "\000a\000a\000\000", 0, 4); 388 | n("\000(\000a\000)\000\134\0001\000\000", "\000a\000b\000\000"); 389 | x2("\000(\000a\000?\000)\000\134\0001\000\000", "\000a\000a\000\000", 0, 4); 390 | x2("\000(\000a\000?\000?\000)\000\134\0001\000\000", "\000a\000a\000\000", 0, 0); 391 | x2("\000(\000a\000*\000)\000\134\0001\000\000", "\000a\000a\000a\000a\000a\000\000", 0, 8); 392 | x3("\000(\000a\000*\000)\000\134\0001\000\000", "\000a\000a\000a\000a\000a\000\000", 0, 4, 1); 393 | x2("\000a\000(\000b\000*\000)\000\134\0001\000\000", "\000a\000b\000b\000b\000b\000\000", 0, 10); 394 | x2("\000a\000(\000b\000*\000)\000\134\0001\000\000", "\000a\000b\000\000", 0, 2); 395 | x2("\000(\000a\000*\000)\000(\000b\000*\000)\000\134\0001\000\134\0002\000\000", "\000a\000a\000a\000b\000b\000a\000a\000a\000b\000b\000\000", 0, 20); 396 | x2("\000(\000a\000*\000)\000(\000b\000*\000)\000\134\0002\000\000", "\000a\000a\000a\000b\000b\000b\000b\000\000", 0, 14); 397 | x2("\000(\000(\000(\000(\000(\000(\000(\000a\000*\000)\000b\000)\000)\000)\000)\000)\000)\000c\000\134\0007\000\000", "\000a\000a\000a\000b\000c\000a\000a\000a\000\000", 0, 16); 398 | x3("\000(\000(\000(\000(\000(\000(\000(\000a\000*\000)\000b\000)\000)\000)\000)\000)\000)\000c\000\134\0007\000\000", "\000a\000a\000a\000b\000c\000a\000a\000a\000\000", 0, 6, 7); 399 | x2("\000(\000a\000)\000(\000b\000)\000(\000c\000)\000\134\0002\000\134\0001\000\134\0003\000\000", "\000a\000b\000c\000b\000a\000c\000\000", 0, 12); 400 | x2("\000(\000[\000a\000-\000d\000]\000)\000\134\0001\000\000", "\000c\000c\000\000", 0, 4); 401 | x2("\000(\000\134\000w\000\134\000d\000\134\000s\000)\000\134\0001\000\000", "\000f\0005\000 \000f\0005\000 \000\000", 0, 12); 402 | n("\000(\000\134\000w\000\134\000d\000\134\000s\000)\000\134\0001\000\000", "\000f\0005\000 \000f\0005\000\000"); 403 | x2("\000(\000w\000h\000o\000|\000[\000a\000-\000c\000]\000{\0003\000}\000)\000\134\0001\000\000", "\000w\000h\000o\000w\000h\000o\000\000", 0, 12); 404 | x2("\000.\000.\000.\000(\000w\000h\000o\000|\000[\000a\000-\000c\000]\000{\0003\000}\000)\000\134\0001\000\000", "\000a\000b\000c\000w\000h\000o\000w\000h\000o\000\000", 0, 18); 405 | x2("\000(\000w\000h\000o\000|\000[\000a\000-\000c\000]\000{\0003\000}\000)\000\134\0001\000\000", "\000c\000b\000c\000c\000b\000c\000\000", 0, 12); 406 | x2("\000(\000^\000a\000)\000\134\0001\000\000", "\000a\000a\000\000", 0, 4); 407 | n("\000(\000^\000a\000)\000\134\0001\000\000", "\000b\000a\000a\000\000"); 408 | n("\000(\000a\000$\000)\000\134\0001\000\000", "\000a\000a\000\000"); 409 | n("\000(\000a\000b\000\134\000Z\000)\000\134\0001\000\000", "\000a\000b\000\000"); 410 | x2("\000(\000a\000*\000\134\000Z\000)\000\134\0001\000\000", "\000a\000\000", 2, 2); 411 | x2("\000.\000(\000a\000*\000\134\000Z\000)\000\134\0001\000\000", "\000b\000a\000\000", 2, 4); 412 | x3("\000(\000.\000(\000a\000b\000c\000)\000\134\0002\000)\000\000", "\000z\000a\000b\000c\000a\000b\000c\000\000", 0, 14, 1); 413 | x3("\000(\000.\000(\000.\000.\000\134\000d\000.\000)\000\134\0002\000)\000\000", "\000z\0001\0002\0003\0004\0001\0002\0003\0004\000\000", 0, 18, 1); 414 | x2("\000(\000(\000?\000i\000:\000a\000z\000)\000)\000\134\0001\000\000", "\000A\000z\000A\000z\000\000", 0, 8); 415 | n("\000(\000(\000?\000i\000:\000a\000z\000)\000)\000\134\0001\000\000", "\000A\000z\000a\000z\000\000"); 416 | x2("\000(\000?\000<\000=\000a\000)\000b\000\000", "\000a\000b\000\000", 2, 4); 417 | n("\000(\000?\000<\000=\000a\000)\000b\000\000", "\000b\000b\000\000"); 418 | x2("\000(\000?\000<\000=\000a\000|\000b\000)\000b\000\000", "\000b\000b\000\000", 2, 4); 419 | x2("\000(\000?\000<\000=\000a\000|\000b\000c\000)\000b\000\000", "\000b\000c\000b\000\000", 4, 6); 420 | x2("\000(\000?\000<\000=\000a\000|\000b\000c\000)\000b\000\000", "\000a\000b\000\000", 2, 4); 421 | x2("\000(\000?\000<\000=\000a\000|\000b\000c\000|\000|\000d\000e\000f\000g\000h\000i\000j\000|\000k\000l\000m\000n\000o\000p\000q\000|\000r\000)\000z\000\000", "\000r\000z\000\000", 2, 4); 422 | x2("\000(\000a\000)\000\134\000g\000<\0001\000>\000\000", "\000a\000a\000\000", 0, 4); 423 | x2("\000(\000?\000<\000!\000a\000)\000b\000\000", "\000c\000b\000\000", 2, 4); 424 | n("\000(\000?\000<\000!\000a\000)\000b\000\000", "\000a\000b\000\000"); 425 | x2("\000(\000?\000<\000!\000a\000|\000b\000c\000)\000b\000\000", "\000b\000b\000b\000\000", 0, 2); 426 | n("\000(\000?\000<\000!\000a\000|\000b\000c\000)\000z\000\000", "\000b\000c\000z\000\000"); 427 | x2("\000(\000?\000<\000n\000a\000m\000e\0001\000>\000a\000)\000\000", "\000a\000\000", 0, 2); 428 | x2("\000(\000?\000<\000n\000a\000m\000e\000_\0002\000>\000a\000b\000)\000\134\000g\000<\000n\000a\000m\000e\000_\0002\000>\000\000", "\000a\000b\000a\000b\000\000", 0, 8); 429 | x2("\000(\000?\000<\000n\000a\000m\000e\000_\0003\000>\000.\000z\000v\000.\000)\000\134\000k\000<\000n\000a\000m\000e\000_\0003\000>\000\000", "\000a\000z\000v\000b\000a\000z\000v\000b\000\000", 0, 16); 430 | x2("\000(\000?\000<\000=\000\134\000g\000<\000a\000b\000>\000)\000|\000-\000\134\000z\000E\000N\000D\000 \000(\000?\000<\000a\000b\000>\000X\000y\000Z\000)\000\000", "\000X\000y\000Z\000\000", 6, 6); 431 | x2("\000(\000?\000<\000n\000>\000|\000a\000\134\000g\000<\000n\000>\000)\000+\000\000", "\000\000", 0, 0); 432 | x2("\000(\000?\000<\000n\000>\000|\000\134\000(\000\134\000g\000<\000n\000>\000\134\000)\000)\000+\000$\000\000", "\000(\000)\000(\000(\000)\000)\000\000", 0, 12); 433 | x3("\000\134\000g\000<\000n\000>\000(\000?\000<\000n\000>\000.\000)\000{\0000\000}\000\000", "\000X\000\000", 0, 2, 1); 434 | x2("\000\134\000g\000<\000n\000>\000(\000a\000b\000c\000|\000d\000f\000(\000?\000<\000n\000>\000.\000Y\000Z\000)\000{\0002\000,\0008\000}\000)\000{\0000\000}\000\000", "\000X\000Y\000Z\000\000", 0, 6); 435 | x2("\000\134\000A\000(\000?\000<\000n\000>\000(\000a\000\134\000g\000<\000n\000>\000)\000|\000)\000\134\000z\000\000", "\000a\000a\000a\000a\000\000", 0, 8); 436 | x2("\000(\000?\000<\000n\000>\000|\000\134\000g\000<\000m\000>\000\134\000g\000<\000n\000>\000)\000\134\000z\000|\000\134\000z\000E\000N\000D\000 \000(\000?\000<\000m\000>\000a\000|\000(\000b\000)\000\134\000g\000<\000m\000>\000)\000\000", "\000b\000b\000b\000b\000a\000b\000b\000a\000\000", 0, 16); 437 | x2("\000(\000?\000<\000n\000a\000m\000e\0001\0002\0004\0000\000>\000\134\000w\000+\000\134\000s\000x\000)\000a\000+\000\134\000k\000<\000n\000a\000m\000e\0001\0002\0004\0000\000>\000\000", "\000 \000 \000f\000g\000 \000x\000a\000a\000a\000a\000a\000a\000a\000a\000f\000g\000 \000x\000\000", 4, 36); 438 | x3("\000(\000z\000)\000(\000)\000(\000)\000(\000?\000<\000_\0009\000>\000a\000)\000\134\000g\000<\000_\0009\000>\000\000", "\000z\000a\000a\000\000", 4, 6, 1); 439 | x2("\000(\000.\000)\000(\000(\000(\000?\000<\000_\000>\000a\000)\000)\000)\000\134\000k\000<\000_\000>\000\000", "\000z\000a\000a\000\000", 0, 6); 440 | x2("\000(\000(\000?\000<\000n\000a\000m\000e\0001\000>\000\134\000d\000)\000|\000(\000?\000<\000n\000a\000m\000e\0002\000>\000\134\000w\000)\000)\000(\000\134\000k\000<\000n\000a\000m\000e\0001\000>\000|\000\134\000k\000<\000n\000a\000m\000e\0002\000>\000)\000\000", "\000f\000f\000\000", 0, 4); 441 | x2("\000(\000?\000:\000(\000?\000<\000x\000>\000)\000|\000(\000?\000<\000x\000>\000e\000f\000g\000)\000)\000\134\000k\000<\000x\000>\000\000", "\000\000", 0, 0); 442 | x2("\000(\000?\000:\000(\000?\000<\000x\000>\000a\000b\000c\000)\000|\000(\000?\000<\000x\000>\000e\000f\000g\000)\000)\000\134\000k\000<\000x\000>\000\000", "\000a\000b\000c\000e\000f\000g\000e\000f\000g\000\000", 6, 18); 443 | n("\000(\000?\000:\000(\000?\000<\000x\000>\000a\000b\000c\000)\000|\000(\000?\000<\000x\000>\000e\000f\000g\000)\000)\000\134\000k\000<\000x\000>\000\000", "\000a\000b\000c\000e\000f\000g\000\000"); 444 | x2("\000(\000?\000:\000(\000?\000<\000n\0001\000>\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000)\000\134\000k\000<\000n\0001\000>\000$\000\000", "\000a\000-\000p\000y\000u\000m\000p\000y\000u\000m\000\000", 4, 20); 445 | x3("\000(\000?\000:\000(\000?\000<\000n\0001\000>\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000)\000\134\000k\000<\000n\0001\000>\000$\000\000", "\000x\000x\000x\000x\000a\000b\000c\000d\000e\000f\000g\000h\000i\000j\000k\000l\000m\000n\000a\000b\000c\000d\000e\000f\000g\000h\000i\000j\000k\000l\000m\000n\000\000", 8, 36, 14); 446 | x3("\000(\000?\000<\000n\000a\000m\000e\0001\000>\000)\000(\000?\000<\000n\000a\000m\000e\0002\000>\000)\000(\000?\000<\000n\000a\000m\000e\0003\000>\000)\000(\000?\000<\000n\000a\000m\000e\0004\000>\000)\000(\000?\000<\000n\000a\000m\000e\0005\000>\000)\000(\000?\000<\000n\000a\000m\000e\0006\000>\000)\000(\000?\000<\000n\000a\000m\000e\0007\000>\000)\000(\000?\000<\000n\000a\000m\000e\0008\000>\000)\000(\000?\000<\000n\000a\000m\000e\0009\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0000\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0001\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0002\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0003\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0004\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0005\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0006\000>\000a\000a\000a\000)\000(\000?\000<\000n\000a\000m\000e\0001\0007\000>\000)\000$\000\000", "\000a\000a\000a\000\000", 0, 6, 16); 447 | x2("\000(\000?\000<\000f\000o\000o\000>\000a\000|\000\134\000(\000\134\000g\000<\000f\000o\000o\000>\000\134\000)\000)\000\000", "\000a\000\000", 0, 2); 448 | x2("\000(\000?\000<\000f\000o\000o\000>\000a\000|\000\134\000(\000\134\000g\000<\000f\000o\000o\000>\000\134\000)\000)\000\000", "\000(\000(\000(\000(\000(\000(\000a\000)\000)\000)\000)\000)\000)\000\000", 0, 26); 449 | x3("\000(\000?\000<\000f\000o\000o\000>\000a\000|\000\134\000(\000\134\000g\000<\000f\000o\000o\000>\000\134\000)\000)\000\000", "\000(\000(\000(\000(\000(\000(\000(\000(\000a\000)\000)\000)\000)\000)\000)\000)\000)\000\000", 0, 34, 1); 450 | x2("\000\134\000g\000<\000b\000a\000r\000>\000|\000\134\000z\000E\000N\000D\000(\000?\000<\000b\000a\000r\000>\000.\000*\000a\000b\000c\000$\000)\000\000", "\000a\000b\000c\000x\000x\000x\000a\000b\000c\000\000", 0, 18); 451 | x2("\000\134\000g\000<\0001\000>\000|\000\134\000z\000E\000N\000D\000(\000.\000a\000.\000)\000\000", "\000b\000a\000c\000\000", 0, 6); 452 | x3("\000\134\000g\000<\000_\000A\000>\000\134\000g\000<\000_\000A\000>\000|\000\134\000z\000E\000N\000D\000(\000.\000a\000.\000)\000(\000?\000<\000_\000A\000>\000.\000b\000.\000)\000\000", "\000x\000b\000x\000y\000b\000y\000\000", 6, 12, 1); 453 | x2("\000\134\000A\000(\000?\000:\000\134\000g\000<\000p\000o\000n\000>\000|\000\134\000g\000<\000p\000a\000n\000>\000|\000\134\000z\000E\000N\000D\000 \000 \000(\000?\000<\000p\000a\000n\000>\000a\000|\000c\000\134\000g\000<\000p\000o\000n\000>\000c\000)\000(\000?\000<\000p\000o\000n\000>\000b\000|\000d\000\134\000g\000<\000p\000a\000n\000>\000d\000)\000)\000$\000\000", "\000c\000d\000c\000b\000c\000d\000c\000\000", 0, 14); 454 | x2("\000\134\000A\000(\000?\000<\000n\000>\000|\000a\000\134\000g\000<\000m\000>\000)\000\134\000z\000|\000\134\000z\000E\000N\000D\000 \000(\000?\000<\000m\000>\000\134\000g\000<\000n\000>\000)\000\000", "\000a\000a\000a\000a\000\000", 0, 8); 455 | x2("\000(\000?\000<\000n\000>\000(\000a\000|\000b\000\134\000g\000<\000n\000>\000c\000)\000{\0003\000,\0005\000}\000)\000\000", "\000b\000a\000a\000a\000a\000c\000a\000\000", 2, 10); 456 | x2("\000(\000?\000<\000n\000>\000(\000a\000|\000b\000\134\000g\000<\000n\000>\000c\000)\000{\0003\000,\0005\000}\000)\000\000", "\000b\000a\000a\000a\000a\000c\000a\000a\000a\000a\000a\000\000", 0, 20); 457 | x2("\000(\000?\000<\000p\000a\000r\000e\000>\000\134\000(\000(\000[\000^\000\134\000(\000\134\000)\000]\000+\000+\000|\000\134\000g\000<\000p\000a\000r\000e\000>\000)\000*\000+\000\134\000)\000)\000\000", "\000(\000(\000a\000)\000)\000\000", 0, 10); 458 | x2("\000(\000)\000*\000\134\0001\000\000", "\000\000", 0, 0); 459 | x2("\000(\000?\000:\000(\000)\000|\000(\000)\000)\000*\000\134\0001\000\134\0002\000\000", "\000\000", 0, 0); 460 | x3("\000(\000?\000:\000\134\0001\000a\000|\000(\000)\000)\000*\000\000", "\000a\000\000", 0, 0, 1); 461 | x2("\000x\000(\000(\000.\000)\000*\000)\000*\000x\000\000", "\0000\000x\0001\000x\0002\000x\0003\000\000", 2, 12); 462 | x2("\000x\000(\000(\000.\000)\000*\000)\000*\000x\000(\000?\000i\000:\000\134\0001\000)\000\134\000Z\000\000", "\0000\000x\0001\000x\0002\000x\0001\000X\0002\000\000", 2, 18); 463 | x2("\000(\000?\000:\000(\000)\000|\000(\000)\000|\000(\000)\000|\000(\000)\000|\000(\000)\000|\000(\000)\000)\000*\000\134\0002\000\134\0005\000\000", "\000\000", 0, 0); 464 | x2("\000(\000?\000:\000(\000)\000|\000(\000)\000|\000(\000)\000|\000(\000x\000)\000|\000(\000)\000|\000(\000)\000)\000*\000\134\0002\000b\000\134\0005\000\000", "\000b\000\000", 0, 2); 465 | x2("\000\000", "0B\000\000", 0, 0); 466 | x2("0B\000\000", "0B\000\000", 0, 2); 467 | n("0D\000\000", "0B\000\000"); 468 | x2("0F0F\000\000", "0F0F\000\000", 0, 4); 469 | x2("0B0D0F\000\000", "0B0D0F\000\000", 0, 6); 470 | x2("0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S\000\000", "0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S\000\000", 0, 70); 471 | x2("0B\000\000", "0D0B\000\000", 2, 4); 472 | x2("0D0F\000\000", "0B0D0F\000\000", 2, 6); 473 | x2("e\207\000\000", "e\207\000\000", 0, 2); 474 | x2("\000.\000\000", "0B\000\000", 0, 2); 475 | x2("\000.\000.\000\000", "0K0M\000\000", 0, 4); 476 | x2("\000\134\000w\000\000", "0J\000\000", 0, 2); 477 | n("\000\134\000W\000\000", "0B\000\000"); 478 | x2("\000[\000\134\000W\000]\000\000", "0F\000$\000\000", 2, 4); 479 | x2("\000\134\000S\000\000", "0]\000\000", 0, 2); 480 | x2("\000\134\000S\000\000", "o\042\000\000", 0, 2); 481 | x2("\000\134\000b\000\000", "l\027\000 \000\000", 0, 0); 482 | x2("\000\134\000b\000\000", "\000 0{\000\000", 2, 2); 483 | x2("\000\134\000B\000\000", "0[0]\000 \000\000", 2, 2); 484 | x2("\000\134\000B\000\000", "0F\000 \000\000", 4, 4); 485 | x2("\000\134\000B\000\000", "\000 0D\000\000", 0, 0); 486 | x2("\000[0_0a\000]\000\000", "0a\000\000", 0, 2); 487 | n("\000[0j0k\000]\000\000", "0l\000\000"); 488 | x2("\000[0F\000-0J\000]\000\000", "0H\000\000", 0, 2); 489 | n("\000[\000^0Q\000]\000\000", "0Q\000\000"); 490 | x2("\000[\000\134\000w\000]\000\000", "0m\000\000", 0, 2); 491 | n("\000[\000\134\000d\000]\000\000", "0u\000\000"); 492 | x2("\000[\000\134\000D\000]\000\000", "0o\000\000", 0, 2); 493 | n("\000[\000\134\000s\000]\000\000", "0O\000\000"); 494 | x2("\000[\000\134\000S\000]\000\000", "0x\000\000", 0, 2); 495 | x2("\000[\000\134\000w\000\134\000d\000]\000\000", "0\210\000\000", 0, 2); 496 | x2("\000[\000\134\000w\000\134\000d\000]\000\000", "\000 \000 \000 0\210\000\000", 6, 8); 497 | n("\000\134\000w\233<\216\312\000\000", "\000 \233<\216\312\000\000"); 498 | x2("\233<\000\134\000W\216\312\000\000", "\233<\000 \216\312\000\000", 0, 6); 499 | x2("0B\000.0D\000.0F\000\000", "0B0B0D0D0F\000\000", 0, 10); 500 | x2("\000.\000\134\000w0F\000\134\000W\000.\000.0^\000\000", "0H0F0F\000 0F0^0^\000\000", 0, 14); 501 | x2("\000\134\000s\000\134\000w0S0S0S\000\000", "\000 0S0S0S0S\000\000", 0, 10); 502 | x2("0B0B\000.0Q\000\000", "0B0B0Q0Q\000\000", 0, 8); 503 | n("\000.0D\000\000", "0D0H\000\000"); 504 | x2("\000.0J\000\000", "0J0J\000\000", 0, 4); 505 | x2("\000^0B\000\000", "0B\000\000", 0, 2); 506 | x2("\000^0\200\000$\000\000", "0\200\000\000", 0, 2); 507 | x2("\000^\000\134\000w\000$\000\000", "0k\000\000", 0, 2); 508 | x2("\000^\000\134\000w0K0M0O0Q0S\000$\000\000", "\000z0K0M0O0Q0S\000\000", 0, 12); 509 | x2("\000^\000\134\000w\000.\000.\000.0F0H0J\000$\000\000", "\000z0B0D0F0F0H0J\000\000", 0, 14); 510 | x2("\000\134\000w\000\134\000w\000\134\000s\000\134\000W0J0J0J\000\134\000d\000\000", "\000a0J\000 \000 0J0J0J\0004\000\000", 0, 16); 511 | x2("\000\134\000A0_0a0d\000\000", "0_0a0d\000\000", 0, 6); 512 | x2("0\2000\2010\202\000\134\000Z\000\000", "0\2000\2010\202\000\000", 0, 6); 513 | x2("0K0M0O\000\134\000z\000\000", "0K0M0O\000\000", 0, 6); 514 | x2("0K0M0O\000\134\000Z\000\000", "0K0M0O\000\012\000\000", 0, 6); 515 | x2("\000\134\000G0}0t\000\000", "0}0t\000\000", 0, 4); 516 | n("\000\134\000G0H\000\000", "0F0H0J\000\000"); 517 | n("0h0f\000\134\000G\000\000", "0h0f\000\000"); 518 | n("0~0\177\000\134\000A\000\000", "0~0\177\000\000"); 519 | n("0~\000\134\000A0\177\000\000", "0~0\177\000\000"); 520 | x2("\000(\000?\000=0[\000)0[\000\000", "0[\000\000", 0, 2); 521 | n("\000(\000?\000=0F\000)\000.\000\000", "0D\000\000"); 522 | x2("\000(\000?\000!0F\000)0K\000\000", "0K\000\000", 0, 2); 523 | n("\000(\000?\000!0h\000)0B\000\000", "0h\000\000"); 524 | x2("\000(\000?\000i\000:0B\000)\000\000", "0B\000\000", 0, 2); 525 | x2("\000(\000?\000i\000:0v0y\000)\000\000", "0v0y\000\000", 0, 4); 526 | n("\000(\000?\000i\000:0D\000)\000\000", "0F\000\000"); 527 | x2("\000(\000?\000m\000:0\210\000.\000)\000\000", "0\210\000\012\000\000", 0, 4); 528 | x2("\000(\000?\000m\000:\000.0\201\000)\000\000", "0~\000\0120\201\000\000", 2, 6); 529 | x2("0B\000?\000\000", "\000\000", 0, 0); 530 | x2("Y\011\000?\000\000", "S\026\000\000", 0, 0); 531 | x2("Y\011\000?\000\000", "Y\011\000\000", 0, 2); 532 | x2("\221\317\000*\000\000", "\000\000", 0, 0); 533 | x2("\221\317\000*\000\000", "\221\317\000\000", 0, 2); 534 | x2("[P\000*\000\000", "[P[P[P\000\000", 0, 6); 535 | x2("\231\254\000*\000\000", "\236\177\231\254\231\254\231\254\231\254\000\000", 0, 0); 536 | n("\134q\000+\000\000", "\000\000"); 537 | x2("l\263\000+\000\000", "l\263\000\000", 0, 2); 538 | x2("fB\000+\000\000", "fBfBfBfB\000\000", 0, 8); 539 | x2("0H\000+\000\000", "0H0H0F0F0F\000\000", 0, 4); 540 | x2("0F\000+\000\000", "0J0F0F0F0F\000\000", 2, 10); 541 | x2("\000.\000?\000\000", "0_\000\000", 0, 2); 542 | x2("\000.\000*\000\000", "0q0t0w0z\000\000", 0, 8); 543 | x2("\000.\000+\000\000", "0\215\000\000", 0, 2); 544 | x2("\000.\000+\000\000", "0D0F0H0K\000\012\000\000", 0, 8); 545 | x2("0B\000|0D\000\000", "0B\000\000", 0, 2); 546 | x2("0B\000|0D\000\000", "0D\000\000", 0, 2); 547 | x2("0B0D\000|0D0F\000\000", "0B0D\000\000", 0, 4); 548 | x2("0B0D\000|0D0F\000\000", "0D0F\000\000", 0, 4); 549 | x2("0\222\000(\000?\000:0K0M\000|0M0O\000)\000\000", "0\2220K0M\000\000", 0, 6); 550 | x2("0\222\000(\000?\000:0K0M\000|0M0O\000)0Q\000\000", "0\2220M0O0Q\000\000", 0, 8); 551 | x2("0B0D\000|\000(\000?\000:0B0F\000|0B0\222\000)\000\000", "0B0\222\000\000", 0, 4); 552 | x2("0B\000|0D\000|0F\000\000", "0H0F\000\000", 2, 4); 553 | x2("0B\000|0D\000|0F0H\000|0J0K0M\000|0O\000|0Q0S0U\000|0W0Y0[\000|0]\000|0_0a\000|0d0f0h0j0k\000|0l0m\000\000", "0W0Y0[\000\000", 0, 6); 554 | n("0B\000|0D\000|0F0H\000|0J0K0M\000|0O\000|0Q0S0U\000|0W0Y0[\000|0]\000|0_0a\000|0d0f0h0j0k\000|0l0m\000\000", "0Y0[\000\000"); 555 | x2("0B\000|\000^0\217\000\000", "0v0B\000\000", 2, 4); 556 | x2("0B\000|\000^0\222\000\000", "0\2220B\000\000", 0, 2); 557 | x2("\233<\000|\000\134\000G\216\312\000\000", "0Q\216\312\233<\000\000", 4, 6); 558 | x2("\233<\000|\000\134\000G\216\312\000\000", "\216\312\233<\000\000", 0, 2); 559 | x2("\233<\000|\000\134\000A\216\312\000\000", "\000b\216\312\233<\000\000", 4, 6); 560 | x2("\233<\000|\000\134\000A\216\312\000\000", "\216\312\000\000", 0, 2); 561 | x2("\233<\000|\216\312\000\134\000Z\000\000", "\216\312\233<\000\000", 2, 4); 562 | x2("\233<\000|\216\312\000\134\000Z\000\000", "\216\312\000\000", 0, 2); 563 | x2("\233<\000|\216\312\000\134\000Z\000\000", "\216\312\000\012\000\000", 0, 2); 564 | x2("\233<\000|\216\312\000\134\000z\000\000", "\216\312\233<\000\000", 2, 4); 565 | x2("\233<\000|\216\312\000\134\000z\000\000", "\216\312\000\000", 0, 2); 566 | x2("\000\134\000w\000|\000\134\000s\000\000", "0J\000\000", 0, 2); 567 | x2("\000\134\000w\000|\000%\000\000", "\000%0J\000\000", 0, 2); 568 | x2("\000\134\000w\000|\000[\000&\000$\000]\000\000", "0F\000&\000\000", 0, 2); 569 | x2("\000[0D\000-0Q\000]\000\000", "0F\000\000", 0, 2); 570 | x2("\000[0D\000-0Q\000]\000|\000[\000^0K\000-0S\000]\000\000", "0B\000\000", 0, 2); 571 | x2("\000[0D\000-0Q\000]\000|\000[\000^0K\000-0S\000]\000\000", "0K\000\000", 0, 2); 572 | x2("\000[\000^0B\000]\000\000", "\000\012\000\000", 0, 2); 573 | x2("\000(\000?\000:0B\000|\000[0F\000-0M\000]\000)\000|0D0\222\000\000", "0F0\222\000\000", 0, 2); 574 | x2("\000(\000?\000:0B\000|\000[0F\000-0M\000]\000)\000|0D0\222\000\000", "0D0\222\000\000", 0, 4); 575 | x2("0B0D0F\000|\000(\000?\000=0Q0Q\000)\000.\000.0{\000\000", "0Q0Q0{\000\000", 0, 6); 576 | x2("0B0D0F\000|\000(\000?\000!0Q0Q\000)\000.\000.0{\000\000", "0B0D0{\000\000", 0, 6); 577 | x2("\000(\000?\000=0\2220B\000)\000.\000.0B\000|\000(\000?\000=0\2220\222\000)\000.\000.0B\000\000", "0\2220\2220B\000\000", 0, 6); 578 | x2("\000(\000?\000<\000=0B\000|0D0F\000)0D\000\000", "0D0F0D\000\000", 4, 6); 579 | n("\000(\000?\000>0B\000|0B0D0H\000)0F\000\000", "0B0D0H0F\000\000"); 580 | x2("\000(\000?\000>0B0D0H\000|0B\000)0F\000\000", "0B0D0H0F\000\000", 0, 8); 581 | x2("0B\000?\000|0D\000\000", "0B\000\000", 0, 2); 582 | x2("0B\000?\000|0D\000\000", "0D\000\000", 0, 0); 583 | x2("0B\000?\000|0D\000\000", "\000\000", 0, 0); 584 | x2("0B\000*\000|0D\000\000", "0B0B\000\000", 0, 4); 585 | x2("0B\000*\000|0D\000*\000\000", "0D0B\000\000", 0, 0); 586 | x2("0B\000*\000|0D\000*\000\000", "0B0D\000\000", 0, 2); 587 | x2("\000[\000a0B\000]\000*\000|0D\000*\000\000", "\000a0B0D0D0D\000\000", 0, 4); 588 | x2("0B\000+\000|0D\000*\000\000", "\000\000", 0, 0); 589 | x2("0B\000+\000|0D\000*\000\000", "0D0D0D\000\000", 0, 6); 590 | x2("0B\000+\000|0D\000*\000\000", "0B0D0D0D\000\000", 0, 2); 591 | x2("0B\000+\000|0D\000*\000\000", "\000a0B0D0D0D\000\000", 0, 0); 592 | n("0B\000+\000|0D\000+\000\000", "\000\000"); 593 | x2("\000(0B\000|0D\000)\000?\000\000", "0D\000\000", 0, 2); 594 | x2("\000(0B\000|0D\000)\000*\000\000", "0D0B\000\000", 0, 4); 595 | x2("\000(0B\000|0D\000)\000+\000\000", "0D0B0D\000\000", 0, 6); 596 | x2("\000(0B0D\000|0F0B\000)\000+\000\000", "0F0B0B0D0F0H\000\000", 0, 8); 597 | x2("\000(0B0D\000|0F0H\000)\000+\000\000", "0F0B0B0D0F0H\000\000", 4, 12); 598 | x2("\000(0B0D\000|0F0B\000)\000+\000\000", "0B0B0D0F0B\000\000", 2, 10); 599 | x2("\000(0B0D\000|0F0B\000)\000+\000\000", "0B0D0\2220F0B\000\000", 0, 4); 600 | x2("\000(0B0D\000|0F0B\000)\000+\000\000", "\000$\000$\000z\000z\000z\000z0B0D0\2220F0B\000\000", 12, 16); 601 | x2("\000(0B\000|0D0B0D\000)\000+\000\000", "0B0D0B0D0B\000\000", 0, 10); 602 | x2("\000(0B\000|0D0B0D\000)\000+\000\000", "0D0B\000\000", 2, 4); 603 | x2("\000(0B\000|0D0B0D\000)\000+\000\000", "0D0B0B0B0D0B\000\000", 2, 8); 604 | x2("\000(\000?\000:0B\000|0D\000)\000(\000?\000:0B\000|0D\000)\000\000", "0B0D\000\000", 0, 4); 605 | x2("\000(\000?\000:0B\000*\000|0D\000*\000)\000(\000?\000:0B\000*\000|0D\000*\000)\000\000", "0B0B0B0D0D0D\000\000", 0, 6); 606 | x2("\000(\000?\000:0B\000*\000|0D\000*\000)\000(\000?\000:0B\000+\000|0D\000+\000)\000\000", "0B0B0B0D0D0D\000\000", 0, 12); 607 | x2("\000(\000?\000:0B\000+\000|0D\000+\000)\000{\0002\000}\000\000", "0B0B0B0D0D0D\000\000", 0, 12); 608 | x2("\000(\000?\000:0B\000+\000|0D\000+\000)\000{\0001\000,\0002\000}\000\000", "0B0B0B0D0D0D\000\000", 0, 12); 609 | x2("\000(\000?\000:0B\000+\000|\000\134\000A0D\000*\000)0F0F\000\000", "0F0F\000\000", 0, 4); 610 | n("\000(\000?\000:0B\000+\000|\000\134\000A0D\000*\000)0F0F\000\000", "0B0D0F0F\000\000"); 611 | x2("\000(\000?\000:\000^0B\000+\000|0D\000+\000)\000*0F\000\000", "0B0B0D0D0D0B0D0F\000\000", 12, 16); 612 | x2("\000(\000?\000:\000^0B\000+\000|0D\000+\000)\000*0F\000\000", "0B0B0D0D0D0D0F\000\000", 0, 14); 613 | x2("0F\000{\0000\000,\000}\000\000", "0F0F0F0F\000\000", 0, 8); 614 | x2("0B\000|\000(\000?\000i\000)\000c\000\000", "\000C\000\000", 0, 2); 615 | x2("\000(\000?\000i\000)\000c\000|0B\000\000", "\000C\000\000", 0, 2); 616 | x2("\000(\000?\000i\000:0B\000)\000|\000a\000\000", "\000a\000\000", 0, 2); 617 | n("\000(\000?\000i\000:0B\000)\000|\000a\000\000", "\000A\000\000"); 618 | x2("\000[0B0D0F\000]\000?\000\000", "0B0D0F\000\000", 0, 2); 619 | x2("\000[0B0D0F\000]\000*\000\000", "0B0D0F\000\000", 0, 6); 620 | x2("\000[\000^0B0D0F\000]\000*\000\000", "0B0D0F\000\000", 0, 0); 621 | n("\000[\000^0B0D0F\000]\000+\000\000", "0B0D0F\000\000"); 622 | x2("0B\000?\000?\000\000", "0B0B0B\000\000", 0, 0); 623 | x2("0D0B\000?\000?0D\000\000", "0D0B0D\000\000", 0, 6); 624 | x2("0B\000*\000?\000\000", "0B0B0B\000\000", 0, 0); 625 | x2("0D0B\000*\000?\000\000", "0D0B0B\000\000", 0, 2); 626 | x2("0D0B\000*\000?0D\000\000", "0D0B0B0D\000\000", 0, 8); 627 | x2("0B\000+\000?\000\000", "0B0B0B\000\000", 0, 2); 628 | x2("0D0B\000+\000?\000\000", "0D0B0B\000\000", 0, 4); 629 | x2("0D0B\000+\000?0D\000\000", "0D0B0B0D\000\000", 0, 8); 630 | x2("\000(\000?\000:Y)\000?\000)\000?\000?\000\000", "Y)\000\000", 0, 0); 631 | x2("\000(\000?\000:Y)\000?\000?\000)\000?\000\000", "Y)\000\000", 0, 0); 632 | x2("\000(\000?\000:Y\042\000?\000)\000+\000?\000\000", "Y\042Y\042Y\042\000\000", 0, 2); 633 | x2("\000(\000?\000:\230\250\000+\000)\000?\000?\000\000", "\230\250\230\250\230\250\000\000", 0, 0); 634 | x2("\000(\000?\000:\226\352\000+\000)\000?\000?\227\034\000\000", "\226\352\226\352\226\352\227\034\000\000", 0, 8); 635 | x2("\000(\000?\000:0B0D\000)\000?\000{\0002\000}\000\000", "\000\000", 0, 0); 636 | x2("\000(\000?\000:\233<\216\312\000)\000?\000{\0002\000}\000\000", "\233<\216\312\233<\216\312\233<\000\000", 0, 8); 637 | x2("\000(\000?\000:\233<\216\312\000)\000*\000{\0000\000}\000\000", "\233<\216\312\233<\216\312\233<\000\000", 0, 0); 638 | x2("\000(\000?\000:\233<\216\312\000)\000{\0003\000,\000}\000\000", "\233<\216\312\233<\216\312\233<\216\312\233<\216\312\000\000", 0, 16); 639 | n("\000(\000?\000:\233<\216\312\000)\000{\0003\000,\000}\000\000", "\233<\216\312\233<\216\312\000\000"); 640 | x2("\000(\000?\000:\233<\216\312\000)\000{\0002\000,\0004\000}\000\000", "\233<\216\312\233<\216\312\233<\216\312\000\000", 0, 12); 641 | x2("\000(\000?\000:\233<\216\312\000)\000{\0002\000,\0004\000}\000\000", "\233<\216\312\233<\216\312\233<\216\312\233<\216\312\233<\216\312\000\000", 0, 16); 642 | x2("\000(\000?\000:\233<\216\312\000)\000{\0002\000,\0004\000}\000?\000\000", "\233<\216\312\233<\216\312\233<\216\312\233<\216\312\233<\216\312\000\000", 0, 8); 643 | x2("\000(\000?\000:\233<\216\312\000)\000{\000,\000}\000\000", "\233<\216\312\000{\000,\000}\000\000", 0, 10); 644 | x2("\000(\000?\000:0K0M0O\000)\000+\000?\000{\0002\000}\000\000", "0K0M0O0K0M0O0K0M0O\000\000", 0, 12); 645 | x3("\000(pk\000)\000\000", "pk\000\000", 0, 2, 1); 646 | x3("\000(pkl4\000)\000\000", "pkl4\000\000", 0, 4, 1); 647 | x2("\000(\000(fB\225\223\000)\000)\000\000", "fB\225\223\000\000", 0, 4); 648 | x3("\000(\000(\230\250l4\000)\000)\000\000", "\230\250l4\000\000", 0, 4, 1); 649 | x3("\000(\000(f(e\345\000)\000)\000\000", "f(e\345\000\000", 0, 4, 2); 650 | x3("\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\221\317[P\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000\000", "\221\317[P\000\000", 0, 4, 20); 651 | x3("\000(0B0D\000)\000(0F0H\000)\000\000", "0B0D0F0H\000\000", 0, 4, 1); 652 | x3("\000(0B0D\000)\000(0F0H\000)\000\000", "0B0D0F0H\000\000", 4, 8, 2); 653 | x3("\000(\000)\000(0B\000)0D0F\000(0H0J0K\000)0M0O0Q0S\000\000", "0B0D0F0H0J0K0M0O0Q0S\000\000", 6, 12, 3); 654 | x3("\000(\000(\000)\000(0B\000)0D0F\000(0H0J0K\000)0M0O0Q0S\000)\000\000", "0B0D0F0H0J0K0M0O0Q0S\000\000", 6, 12, 4); 655 | x3("\000.\000*\000(0\3250\251\000)0\3630\3730\336\000(0\363\000(\000)0\2670\3450\277\000)0\2440\363\000\000", "0\3250\2510\3630\3730\3360\3630\2670\3450\2770\2440\363\000\000", 10, 18, 2); 656 | x2("\000(\000^0B\000)\000\000", "0B\000\000", 0, 2); 657 | x3("\000(0B\000)\000|\000(0B\000)\000\000", "0D0B\000\000", 2, 4, 1); 658 | x3("\000(\000^0B\000)\000|\000(0B\000)\000\000", "0D0B\000\000", 2, 4, 2); 659 | x3("\000(0B\000?\000)\000\000", "0B0B0B\000\000", 0, 2, 1); 660 | x3("\000(0~\000*\000)\000\000", "0~0~0~\000\000", 0, 6, 1); 661 | x3("\000(0h\000*\000)\000\000", "\000\000", 0, 0, 1); 662 | x3("\000(0\213\000+\000)\000\000", "0\2130\2130\2130\2130\2130\2130\213\000\000", 0, 14, 1); 663 | x3("\000(0u\000+\000|0x\000*\000)\000\000", "0u0u0u0x0x\000\000", 0, 6, 1); 664 | x3("\000(0B\000+\000|0D\000?\000)\000\000", "0D0D0D0B0B\000\000", 0, 2, 1); 665 | x3("\000(0B0D0F\000)\000?\000\000", "0B0D0F\000\000", 0, 6, 1); 666 | x3("\000(0B0D0F\000)\000*\000\000", "0B0D0F\000\000", 0, 6, 1); 667 | x3("\000(0B0D0F\000)\000+\000\000", "0B0D0F\000\000", 0, 6, 1); 668 | x3("\000(0U0W0Y\000|0B0D0F\000)\000+\000\000", "0B0D0F\000\000", 0, 6, 1); 669 | x3("\000(\000[0j0k0l\000]\000[0K0M0O\000]\000|0K0M0O\000)\000+\000\000", "0K0M0O\000\000", 0, 6, 1); 670 | x3("\000(\000(\000?\000i\000:0B0D0F\000)\000)\000\000", "0B0D0F\000\000", 0, 6, 1); 671 | x3("\000(\000(\000?\000m\000:0B\000.0F\000)\000)\000\000", "0B\000\0120F\000\000", 0, 6, 1); 672 | x3("\000(\000(\000?\000=0B0\223\000)0B\000)\000\000", "0B0\2230D\000\000", 0, 2, 1); 673 | x3("0B0D0F\000|\000(\000.0B0D0H\000)\000\000", "0\2230B0D0H\000\000", 0, 8, 1); 674 | x3("0B\000*\000(\000.\000)\000\000", "0B0B0B0B0\223\000\000", 8, 10, 1); 675 | x3("0B\000*\000?\000(\000.\000)\000\000", "0B0B0B0B0\223\000\000", 0, 2, 1); 676 | x3("0B\000*\000?\000(0\223\000)\000\000", "0B0B0B0B0\223\000\000", 8, 10, 1); 677 | x3("\000[0D0F0H\000]0B\000*\000(\000.\000)\000\000", "0H0B0B0B0B0\223\000\000", 10, 12, 1); 678 | x3("\000(\000\134\000A0D0D\000)0F0F\000\000", "0D0D0F0F\000\000", 0, 4, 1); 679 | n("\000(\000\134\000A0D0D\000)0F0F\000\000", "0\2230D0D0F0F\000\000"); 680 | x3("\000(\000^0D0D\000)0F0F\000\000", "0D0D0F0F\000\000", 0, 4, 1); 681 | n("\000(\000^0D0D\000)0F0F\000\000", "0\2230D0D0F0F\000\000"); 682 | x3("0\2150\215\000(0\2130\213\000$\000)\000\000", "0\2150\2150\2130\213\000\000", 4, 8, 1); 683 | n("0\2150\215\000(0\2130\213\000$\000)\000\000", "0\2150\2150\2130\2130\213\000\000"); 684 | x2("\000(q!\000)\000\134\0001\000\000", "q!q!\000\000", 0, 4); 685 | n("\000(q!\000)\000\134\0001\000\000", "q!kf\000\000"); 686 | x2("\000(zz\000?\000)\000\134\0001\000\000", "zzzz\000\000", 0, 4); 687 | x2("\000(zz\000?\000?\000)\000\134\0001\000\000", "zzzz\000\000", 0, 0); 688 | x2("\000(zz\000*\000)\000\134\0001\000\000", "zzzzzzzzzz\000\000", 0, 8); 689 | x3("\000(zz\000*\000)\000\134\0001\000\000", "zzzzzzzzzz\000\000", 0, 4, 1); 690 | x2("0B\000(0D\000*\000)\000\134\0001\000\000", "0B0D0D0D0D\000\000", 0, 10); 691 | x2("0B\000(0D\000*\000)\000\134\0001\000\000", "0B0D\000\000", 0, 2); 692 | x2("\000(0B\000*\000)\000(0D\000*\000)\000\134\0001\000\134\0002\000\000", "0B0B0B0D0D0B0B0B0D0D\000\000", 0, 20); 693 | x2("\000(0B\000*\000)\000(0D\000*\000)\000\134\0002\000\000", "0B0B0B0D0D0D0D\000\000", 0, 14); 694 | x3("\000(0B\000*\000)\000(0D\000*\000)\000\134\0002\000\000", "0B0B0B0D0D0D0D\000\000", 6, 10, 2); 695 | x2("\000(\000(\000(\000(\000(\000(\000(0}\000*\000)0z\000)\000)\000)\000)\000)\000)0t\000\134\0007\000\000", "0}0}0}0z0t0}0}0}\000\000", 0, 16); 696 | x3("\000(\000(\000(\000(\000(\000(\000(0}\000*\000)0z\000)\000)\000)\000)\000)\000)0t\000\134\0007\000\000", "0}0}0}0z0t0}0}0}\000\000", 0, 6, 7); 697 | x2("\000(0o\000)\000(0r\000)\000(0u\000)\000\134\0002\000\134\0001\000\134\0003\000\000", "0o0r0u0r0o0u\000\000", 0, 12); 698 | x2("\000(\000[0M\000-0Q\000]\000)\000\134\0001\000\000", "0O0O\000\000", 0, 4); 699 | x2("\000(\000\134\000w\000\134\000d\000\134\000s\000)\000\134\0001\000\000", "0B\0005\000 0B\0005\000 \000\000", 0, 12); 700 | n("\000(\000\134\000w\000\134\000d\000\134\000s\000)\000\134\0001\000\000", "0B\0005\000 0B\0005\000\000"); 701 | x2("\000(\212\260\377\037\000|\000[0B\000-0F\000]\000{\0003\000}\000)\000\134\0001\000\000", "\212\260\377\037\212\260\377\037\000\000", 0, 8); 702 | x2("\000.\000.\000.\000(\212\260\377\037\000|\000[0B\000-0F\000]\000{\0003\000}\000)\000\134\0001\000\000", "0B\000a0B\212\260\377\037\212\260\377\037\000\000", 0, 14); 703 | x2("\000(\212\260\377\037\000|\000[0B\000-0F\000]\000{\0003\000}\000)\000\134\0001\000\000", "0F0D0F0F0D0F\000\000", 0, 12); 704 | x2("\000(\000^0S\000)\000\134\0001\000\000", "0S0S\000\000", 0, 4); 705 | n("\000(\000^0\200\000)\000\134\0001\000\000", "0\2010\2000\200\000\000"); 706 | n("\000(0B\000$\000)\000\134\0001\000\000", "0B0B\000\000"); 707 | n("\000(0B0D\000\134\000Z\000)\000\134\0001\000\000", "0B0D\000\000"); 708 | x2("\000(0B\000*\000\134\000Z\000)\000\134\0001\000\000", "0B\000\000", 2, 2); 709 | x2("\000.\000(0B\000*\000\134\000Z\000)\000\134\0001\000\000", "0D0B\000\000", 2, 4); 710 | x3("\000(\000.\000(0\2040D0\206\000)\000\134\0002\000)\000\000", "\000z0\2040D0\2060\2040D0\206\000\000", 0, 14, 1); 711 | x3("\000(\000.\000(\000.\000.\000\134\000d\000.\000)\000\134\0002\000)\000\000", "0B\0001\0002\0003\0004\0001\0002\0003\0004\000\000", 0, 18, 1); 712 | x2("\000(\000(\000?\000i\000:0B\000v0Z\000)\000)\000\134\0001\000\000", "0B\000v0Z0B\000v0Z\000\000", 0, 12); 713 | x2("\000(\000?\000Y\011\000|\000\134\000(\000\134\000g\000\000\134\000)\000)\000\000", "\000(\000(\000(\000(\000(\000(Y\011\000)\000)\000)\000)\000)\000)\000\000", 0, 26); 714 | x2("\000\134\000A\000(\000?\000:\000\134\000g\000<\226?\000_\0001\000>\000|\000\134\000g\000\000|\000\134\000z}BN\206\000 \000 \000(\000?\000<\226?\000_\0001\000>\211\263\000|\201\352\000\134\000g\000\201\352\000)\000(\000?\000W(\000|\203\351\205\251\000\134\000g\000<\226?\000_\0001\000>\203\351\205\251\000)\000)\000$\000\000", "\203\351\205\251\201\352\203\351\205\251\201\352W(\201\352\203\351\205\251\201\352\203\351\205\251\000\000", 0, 26); 715 | x2("\000[\000[0r0u\000]\000]\000\000", "0u\000\000", 0, 2); 716 | x2("\000[\000[0D0J0F\000]0K\000]\000\000", "0K\000\000", 0, 2); 717 | n("\000[\000[\000^0B\000]\000]\000\000", "0B\000\000"); 718 | n("\000[\000^\000[0B\000]\000]\000\000", "0B\000\000"); 719 | x2("\000[\000^\000[\000^0B\000]\000]\000\000", "0B\000\000", 0, 2); 720 | x2("\000[\000[0K0M0O\000]\000&\000&0M0O\000]\000\000", "0O\000\000", 0, 2); 721 | n("\000[\000[0K0M0O\000]\000&\000&0M0O\000]\000\000", "0K\000\000"); 722 | n("\000[\000[0K0M0O\000]\000&\000&0M0O\000]\000\000", "0Q\000\000"); 723 | x2("\000[0B\000-0\223\000&\000&0D\000-0\222\000&\000&0F\000-0\221\000]\000\000", "0\221\000\000", 0, 2); 724 | n("\000[\000^0B\000-0\223\000&\000&0D\000-0\222\000&\000&0F\000-0\221\000]\000\000", "0\221\000\000"); 725 | x2("\000[\000[\000^0B\000&\000&0B\000]\000&\000&0B\000-0\223\000]\000\000", "0D\000\000", 0, 2); 726 | n("\000[\000[\000^0B\000&\000&0B\000]\000&\000&0B\000-0\223\000]\000\000", "0B\000\000"); 727 | x2("\000[\000[\000^0B\000-0\223\000&\000&0D0F0H0J\000]\000&\000&\000[\000^0F\000-0K\000]\000]\000\000", "0M\000\000", 0, 2); 728 | n("\000[\000[\000^0B\000-0\223\000&\000&0D0F0H0J\000]\000&\000&\000[\000^0F\000-0K\000]\000]\000\000", "0D\000\000"); 729 | x2("\000[\000^\000[\000^0B0D0F\000]\000&\000&\000[\000^0F0H0J\000]\000]\000\000", "0F\000\000", 0, 2); 730 | x2("\000[\000^\000[\000^0B0D0F\000]\000&\000&\000[\000^0F0H0J\000]\000]\000\000", "0H\000\000", 0, 2); 731 | n("\000[\000^\000[\000^0B0D0F\000]\000&\000&\000[\000^0F0H0J\000]\000]\000\000", "0K\000\000"); 732 | x2("\000[0B\000-\000&\000&\000-0B\000]\000\000", "\000-\000\000", 0, 2); 733 | x2("\000[\000^\000[\000^\000a\000-\000z0B0D0F\000]\000&\000&\000[\000^\000b\000c\000d\000e\000f\000g0F0H0J\000]\000q\000-\000w\000]\000\000", "0H\000\000", 0, 2); 734 | x2("\000[\000^\000[\000^\000a\000-\000z0B0D0F\000]\000&\000&\000[\000^\000b\000c\000d\000e\000f\000g0F0H0J\000]\000g\000-\000w\000]\000\000", "\000f\000\000", 0, 2); 735 | x2("\000[\000^\000[\000^\000a\000-\000z0B0D0F\000]\000&\000&\000[\000^\000b\000c\000d\000e\000f\000g0F0H0J\000]\000g\000-\000w\000]\000\000", "\000g\000\000", 0, 2); 736 | n("\000[\000^\000[\000^\000a\000-\000z0B0D0F\000]\000&\000&\000[\000^\000b\000c\000d\000e\000f\000g0F0H0J\000]\000g\000-\000w\000]\000\000", "\0002\000\000"); 737 | x2("\000a\000<\000b\000>0\3200\3740\2700\3470\3630n0\3000\2460\3630\3550\3740\311\000<\000\134\000/\000b\000>\000\000", "\000a\000<\000b\000>0\3200\3740\2700\3470\3630n0\3000\2460\3630\3550\3740\311\000<\000/\000b\000>\000\000", 0, 40); 738 | x2("\000.\000<\000b\000>0\3200\3740\2700\3470\3630n0\3000\2460\3630\3550\3740\311\000<\000\134\000/\000b\000>\000\000", "\000a\000<\000b\000>0\3200\3740\2700\3470\3630n0\3000\2460\3630\3550\3740\311\000<\000/\000b\000>\000\000", 0, 40); 739 | # <<< copied until here 740 | 741 | for entry in errors: 742 | print entry 743 | print 744 | print "RESULTS:" 745 | print "%d tests, %d failed." % (runs[0], len(errors)) 746 | --------------------------------------------------------------------------------