PageRenderTime 206ms CodeModel.GetById 4ms app.highlight 187ms RepoModel.GetById 1ms app.codeStats 1ms

/jaspyon/rlib/parsing/pypackrat.py

https://bitbucket.org/santagada/jaspyon
Python | 3132 lines | 3125 code | 1 blank | 6 comment | 315 complexity | 122778248a578102a2c5d8c79f554b2b MD5 | raw file
   1
   2from jaspyon.rlib.parsing.tree import Nonterminal, Symbol
   3from makepackrat import PackratParser, BacktrackException, Status
   4class Parser(object):
   5    def NAME(self):
   6        return self._NAME().result
   7    def _NAME(self):
   8        _key = self._pos
   9        _status = self._dict_NAME.get(_key, None)
  10        if _status is None:
  11            _status = self._dict_NAME[_key] = Status()
  12        else:
  13            _statusstatus = _status.status
  14            if _statusstatus == _status.NORMAL:
  15                self._pos = _status.pos
  16                return _status
  17            elif _statusstatus == _status.ERROR:
  18                raise BacktrackException(_status.error)
  19        _startingpos = self._pos
  20        try:
  21            _result = None
  22            _error = None
  23            _result = self._regex1074651696()
  24            assert _status.status != _status.LEFTRECURSION
  25            _status.status = _status.NORMAL
  26            _status.pos = self._pos
  27            _status.result = _result
  28            _status.error = _error
  29            return _status
  30        except BacktrackException, _exc:
  31            _status.pos = -1
  32            _status.result = None
  33            _error = _exc.error
  34            _status.error = _error
  35            _status.status = _status.ERROR
  36            raise BacktrackException(_error)
  37    def SPACE(self):
  38        return self._SPACE().result
  39    def _SPACE(self):
  40        _key = self._pos
  41        _status = self._dict_SPACE.get(_key, None)
  42        if _status is None:
  43            _status = self._dict_SPACE[_key] = Status()
  44        else:
  45            _statusstatus = _status.status
  46            if _statusstatus == _status.NORMAL:
  47                self._pos = _status.pos
  48                return _status
  49            elif _statusstatus == _status.ERROR:
  50                raise BacktrackException(_status.error)
  51        _startingpos = self._pos
  52        try:
  53            _result = None
  54            _error = None
  55            _result = self.__chars__(' ')
  56            assert _status.status != _status.LEFTRECURSION
  57            _status.status = _status.NORMAL
  58            _status.pos = self._pos
  59            _status.result = _result
  60            _status.error = _error
  61            return _status
  62        except BacktrackException, _exc:
  63            _status.pos = -1
  64            _status.result = None
  65            _error = _exc.error
  66            _status.error = _error
  67            _status.status = _status.ERROR
  68            raise BacktrackException(_error)
  69    def COMMENT(self):
  70        return self._COMMENT().result
  71    def _COMMENT(self):
  72        _key = self._pos
  73        _status = self._dict_COMMENT.get(_key, None)
  74        if _status is None:
  75            _status = self._dict_COMMENT[_key] = Status()
  76        else:
  77            _statusstatus = _status.status
  78            if _statusstatus == _status.NORMAL:
  79                self._pos = _status.pos
  80                return _status
  81            elif _statusstatus == _status.ERROR:
  82                raise BacktrackException(_status.error)
  83        _startingpos = self._pos
  84        try:
  85            _result = None
  86            _error = None
  87            _result = self._regex528667127()
  88            assert _status.status != _status.LEFTRECURSION
  89            _status.status = _status.NORMAL
  90            _status.pos = self._pos
  91            _status.result = _result
  92            _status.error = _error
  93            return _status
  94        except BacktrackException, _exc:
  95            _status.pos = -1
  96            _status.result = None
  97            _error = _exc.error
  98            _status.error = _error
  99            _status.status = _status.ERROR
 100            raise BacktrackException(_error)
 101    def IGNORE(self):
 102        return self._IGNORE().result
 103    def _IGNORE(self):
 104        _key = self._pos
 105        _status = self._dict_IGNORE.get(_key, None)
 106        if _status is None:
 107            _status = self._dict_IGNORE[_key] = Status()
 108        else:
 109            _statusstatus = _status.status
 110            if _statusstatus == _status.NORMAL:
 111                self._pos = _status.pos
 112                return _status
 113            elif _statusstatus == _status.ERROR:
 114                raise BacktrackException(_status.error)
 115        _startingpos = self._pos
 116        try:
 117            _result = None
 118            _error = None
 119            _result = self._regex1979538501()
 120            assert _status.status != _status.LEFTRECURSION
 121            _status.status = _status.NORMAL
 122            _status.pos = self._pos
 123            _status.result = _result
 124            _status.error = _error
 125            return _status
 126        except BacktrackException, _exc:
 127            _status.pos = -1
 128            _status.result = None
 129            _error = _exc.error
 130            _status.error = _error
 131            _status.status = _status.ERROR
 132            raise BacktrackException(_error)
 133    def newline(self):
 134        return self._newline().result
 135    def _newline(self):
 136        _key = self._pos
 137        _status = self._dict_newline.get(_key, None)
 138        if _status is None:
 139            _status = self._dict_newline[_key] = Status()
 140        else:
 141            _statusstatus = _status.status
 142            if _statusstatus == _status.NORMAL:
 143                self._pos = _status.pos
 144                return _status
 145            elif _statusstatus == _status.ERROR:
 146                raise BacktrackException(_status.error)
 147            elif (_statusstatus == _status.INPROGRESS or
 148                  _statusstatus == _status.LEFTRECURSION):
 149                _status.status = _status.LEFTRECURSION
 150                if _status.result is not None:
 151                    self._pos = _status.pos
 152                    return _status
 153                else:
 154                    raise BacktrackException(None)
 155            elif _statusstatus == _status.SOMESOLUTIONS:
 156                _status.status = _status.INPROGRESS
 157        _startingpos = self._pos
 158        try:
 159            _result = None
 160            _error = None
 161            while 1:
 162                _choice0 = self._pos
 163                try:
 164                    _call_status = self._COMMENT()
 165                    _result = _call_status.result
 166                    _error = _call_status.error
 167                    break
 168                except BacktrackException, _exc:
 169                    _error = self._combine_errors(_error, _exc.error)
 170                    self._pos = _choice0
 171                _choice1 = self._pos
 172                try:
 173                    _result = self._regex299149370()
 174                    break
 175                except BacktrackException, _exc:
 176                    _error = self._combine_errors(_error, _exc.error)
 177                    self._pos = _choice1
 178                    raise BacktrackException(_error)
 179                _result = self._regex299149370()
 180                break
 181            if _status.status == _status.LEFTRECURSION:
 182                if _status.result is not None:
 183                    if _status.pos >= self._pos:
 184                        _status.status = _status.NORMAL
 185                        self._pos = _status.pos
 186                        return _status
 187                _status.pos = self._pos
 188                _status.status = _status.SOMESOLUTIONS
 189                _status.result = _result
 190                _status.error = _error
 191                self._pos = _startingpos
 192                return self._newline()
 193            _status.status = _status.NORMAL
 194            _status.pos = self._pos
 195            _status.result = _result
 196            _status.error = _error
 197            return _status
 198        except BacktrackException, _exc:
 199            _status.pos = -1
 200            _status.result = None
 201            _error = self._combine_errors(_error, _exc.error)
 202            _status.error = _error
 203            _status.status = _status.ERROR
 204            raise BacktrackException(_error)
 205    def REGEX(self):
 206        return self._REGEX().result
 207    def _REGEX(self):
 208        _key = self._pos
 209        _status = self._dict_REGEX.get(_key, None)
 210        if _status is None:
 211            _status = self._dict_REGEX[_key] = Status()
 212        else:
 213            _statusstatus = _status.status
 214            if _statusstatus == _status.NORMAL:
 215                self._pos = _status.pos
 216                return _status
 217            elif _statusstatus == _status.ERROR:
 218                raise BacktrackException(_status.error)
 219        _startingpos = self._pos
 220        try:
 221            _result = None
 222            _error = None
 223            _result = self._regex1006631623()
 224            r = _result
 225            _result = (Symbol('REGEX', r, None))
 226            assert _status.status != _status.LEFTRECURSION
 227            _status.status = _status.NORMAL
 228            _status.pos = self._pos
 229            _status.result = _result
 230            _status.error = _error
 231            return _status
 232        except BacktrackException, _exc:
 233            _status.pos = -1
 234            _status.result = None
 235            _error = _exc.error
 236            _status.error = _error
 237            _status.status = _status.ERROR
 238            raise BacktrackException(_error)
 239    def QUOTE(self):
 240        return self._QUOTE().result
 241    def _QUOTE(self):
 242        _key = self._pos
 243        _status = self._dict_QUOTE.get(_key, None)
 244        if _status is None:
 245            _status = self._dict_QUOTE[_key] = Status()
 246        else:
 247            _statusstatus = _status.status
 248            if _statusstatus == _status.NORMAL:
 249                self._pos = _status.pos
 250                return _status
 251            elif _statusstatus == _status.ERROR:
 252                raise BacktrackException(_status.error)
 253        _startingpos = self._pos
 254        try:
 255            _result = None
 256            _error = None
 257            _result = self._regex1124192327()
 258            r = _result
 259            _result = (Symbol('QUOTE', r, None))
 260            assert _status.status != _status.LEFTRECURSION
 261            _status.status = _status.NORMAL
 262            _status.pos = self._pos
 263            _status.result = _result
 264            _status.error = _error
 265            return _status
 266        except BacktrackException, _exc:
 267            _status.pos = -1
 268            _status.result = None
 269            _error = _exc.error
 270            _status.error = _error
 271            _status.status = _status.ERROR
 272            raise BacktrackException(_error)
 273    def PYTHONCODE(self):
 274        return self._PYTHONCODE().result
 275    def _PYTHONCODE(self):
 276        _key = self._pos
 277        _status = self._dict_PYTHONCODE.get(_key, None)
 278        if _status is None:
 279            _status = self._dict_PYTHONCODE[_key] = Status()
 280        else:
 281            _statusstatus = _status.status
 282            if _statusstatus == _status.NORMAL:
 283                self._pos = _status.pos
 284                return _status
 285            elif _statusstatus == _status.ERROR:
 286                raise BacktrackException(_status.error)
 287        _startingpos = self._pos
 288        try:
 289            _result = None
 290            _error = None
 291            _result = self._regex291086639()
 292            r = _result
 293            _result = (Symbol('PYTHONCODE', r, None))
 294            assert _status.status != _status.LEFTRECURSION
 295            _status.status = _status.NORMAL
 296            _status.pos = self._pos
 297            _status.result = _result
 298            _status.error = _error
 299            return _status
 300        except BacktrackException, _exc:
 301            _status.pos = -1
 302            _status.result = None
 303            _error = _exc.error
 304            _status.error = _error
 305            _status.status = _status.ERROR
 306            raise BacktrackException(_error)
 307    def EOF(self):
 308        return self._EOF().result
 309    def _EOF(self):
 310        _key = self._pos
 311        _status = self._dict_EOF.get(_key, None)
 312        if _status is None:
 313            _status = self._dict_EOF[_key] = Status()
 314        else:
 315            _statusstatus = _status.status
 316            if _statusstatus == _status.NORMAL:
 317                self._pos = _status.pos
 318                return _status
 319            elif _statusstatus == _status.ERROR:
 320                raise BacktrackException(_status.error)
 321            elif (_statusstatus == _status.INPROGRESS or
 322                  _statusstatus == _status.LEFTRECURSION):
 323                _status.status = _status.LEFTRECURSION
 324                if _status.result is not None:
 325                    self._pos = _status.pos
 326                    return _status
 327                else:
 328                    raise BacktrackException(None)
 329            elif _statusstatus == _status.SOMESOLUTIONS:
 330                _status.status = _status.INPROGRESS
 331        _startingpos = self._pos
 332        try:
 333            _result = None
 334            _error = None
 335            _choice0 = self._pos
 336            _stored_result1 = _result
 337            try:
 338                _result = self.__any__()
 339            except BacktrackException:
 340                self._pos = _choice0
 341                _result = _stored_result1
 342            else:
 343                raise BacktrackException(None)
 344            if _status.status == _status.LEFTRECURSION:
 345                if _status.result is not None:
 346                    if _status.pos >= self._pos:
 347                        _status.status = _status.NORMAL
 348                        self._pos = _status.pos
 349                        return _status
 350                _status.pos = self._pos
 351                _status.status = _status.SOMESOLUTIONS
 352                _status.result = _result
 353                _status.error = _error
 354                self._pos = _startingpos
 355                return self._EOF()
 356            _status.status = _status.NORMAL
 357            _status.pos = self._pos
 358            _status.result = _result
 359            _status.error = _error
 360            return _status
 361        except BacktrackException, _exc:
 362            _status.pos = -1
 363            _status.result = None
 364            _error = _exc.error
 365            _status.error = _error
 366            _status.status = _status.ERROR
 367            raise BacktrackException(_error)
 368    def file(self):
 369        return self._file().result
 370    def _file(self):
 371        _key = self._pos
 372        _status = self._dict_file.get(_key, None)
 373        if _status is None:
 374            _status = self._dict_file[_key] = Status()
 375        else:
 376            _statusstatus = _status.status
 377            if _statusstatus == _status.NORMAL:
 378                self._pos = _status.pos
 379                return _status
 380            elif _statusstatus == _status.ERROR:
 381                raise BacktrackException(_status.error)
 382            elif (_statusstatus == _status.INPROGRESS or
 383                  _statusstatus == _status.LEFTRECURSION):
 384                _status.status = _status.LEFTRECURSION
 385                if _status.result is not None:
 386                    self._pos = _status.pos
 387                    return _status
 388                else:
 389                    raise BacktrackException(None)
 390            elif _statusstatus == _status.SOMESOLUTIONS:
 391                _status.status = _status.INPROGRESS
 392        _startingpos = self._pos
 393        try:
 394            _result = None
 395            _error = None
 396            _all0 = []
 397            while 1:
 398                _choice1 = self._pos
 399                try:
 400                    _call_status = self._IGNORE()
 401                    _result = _call_status.result
 402                    _error = _call_status.error
 403                    _all0.append(_result)
 404                except BacktrackException, _exc:
 405                    _error = self._combine_errors(_error, _exc.error)
 406                    self._pos = _choice1
 407                    break
 408            _result = _all0
 409            _call_status = self._list()
 410            _result = _call_status.result
 411            _error = self._combine_errors(_error, _call_status.error)
 412            _before_discard2 = _result
 413            _call_status = self._EOF()
 414            _result = _call_status.result
 415            _error = self._combine_errors(_error, _call_status.error)
 416            _result = _before_discard2
 417            if _status.status == _status.LEFTRECURSION:
 418                if _status.result is not None:
 419                    if _status.pos >= self._pos:
 420                        _status.status = _status.NORMAL
 421                        self._pos = _status.pos
 422                        return _status
 423                _status.pos = self._pos
 424                _status.status = _status.SOMESOLUTIONS
 425                _status.result = _result
 426                _status.error = _error
 427                self._pos = _startingpos
 428                return self._file()
 429            _status.status = _status.NORMAL
 430            _status.pos = self._pos
 431            _status.result = _result
 432            _status.error = _error
 433            return _status
 434        except BacktrackException, _exc:
 435            _status.pos = -1
 436            _status.result = None
 437            _error = self._combine_errors(_error, _exc.error)
 438            _status.error = _error
 439            _status.status = _status.ERROR
 440            raise BacktrackException(_error)
 441    def list(self):
 442        return self._list().result
 443    def _list(self):
 444        _key = self._pos
 445        _status = self._dict_list.get(_key, None)
 446        if _status is None:
 447            _status = self._dict_list[_key] = Status()
 448        else:
 449            _statusstatus = _status.status
 450            if _statusstatus == _status.NORMAL:
 451                self._pos = _status.pos
 452                return _status
 453            elif _statusstatus == _status.ERROR:
 454                raise BacktrackException(_status.error)
 455            elif (_statusstatus == _status.INPROGRESS or
 456                  _statusstatus == _status.LEFTRECURSION):
 457                _status.status = _status.LEFTRECURSION
 458                if _status.result is not None:
 459                    self._pos = _status.pos
 460                    return _status
 461                else:
 462                    raise BacktrackException(None)
 463            elif _statusstatus == _status.SOMESOLUTIONS:
 464                _status.status = _status.INPROGRESS
 465        _startingpos = self._pos
 466        try:
 467            _result = None
 468            _error = None
 469            _all0 = []
 470            _call_status = self._production()
 471            _result = _call_status.result
 472            _error = _call_status.error
 473            _all0.append(_result)
 474            while 1:
 475                _choice1 = self._pos
 476                try:
 477                    _call_status = self._production()
 478                    _result = _call_status.result
 479                    _error = self._combine_errors(_error, _call_status.error)
 480                    _all0.append(_result)
 481                except BacktrackException, _exc:
 482                    _error = self._combine_errors(_error, _exc.error)
 483                    self._pos = _choice1
 484                    break
 485            _result = _all0
 486            content = _result
 487            _result = (Nonterminal('list', content))
 488            if _status.status == _status.LEFTRECURSION:
 489                if _status.result is not None:
 490                    if _status.pos >= self._pos:
 491                        _status.status = _status.NORMAL
 492                        self._pos = _status.pos
 493                        return _status
 494                _status.pos = self._pos
 495                _status.status = _status.SOMESOLUTIONS
 496                _status.result = _result
 497                _status.error = _error
 498                self._pos = _startingpos
 499                return self._list()
 500            _status.status = _status.NORMAL
 501            _status.pos = self._pos
 502            _status.result = _result
 503            _status.error = _error
 504            return _status
 505        except BacktrackException, _exc:
 506            _status.pos = -1
 507            _status.result = None
 508            _error = self._combine_errors(_error, _exc.error)
 509            _status.error = _error
 510            _status.status = _status.ERROR
 511            raise BacktrackException(_error)
 512    def production(self):
 513        return self._production().result
 514    def _production(self):
 515        _key = self._pos
 516        _status = self._dict_production.get(_key, None)
 517        if _status is None:
 518            _status = self._dict_production[_key] = Status()
 519        else:
 520            _statusstatus = _status.status
 521            if _statusstatus == _status.NORMAL:
 522                self._pos = _status.pos
 523                return _status
 524            elif _statusstatus == _status.ERROR:
 525                raise BacktrackException(_status.error)
 526            elif (_statusstatus == _status.INPROGRESS or
 527                  _statusstatus == _status.LEFTRECURSION):
 528                _status.status = _status.LEFTRECURSION
 529                if _status.result is not None:
 530                    self._pos = _status.pos
 531                    return _status
 532                else:
 533                    raise BacktrackException(None)
 534            elif _statusstatus == _status.SOMESOLUTIONS:
 535                _status.status = _status.INPROGRESS
 536        _startingpos = self._pos
 537        try:
 538            _result = None
 539            _error = None
 540            _call_status = self._NAME()
 541            _result = _call_status.result
 542            _error = _call_status.error
 543            name = _result
 544            _all0 = []
 545            while 1:
 546                _choice1 = self._pos
 547                try:
 548                    _call_status = self._SPACE()
 549                    _result = _call_status.result
 550                    _error = self._combine_errors(_error, _call_status.error)
 551                    _all0.append(_result)
 552                except BacktrackException, _exc:
 553                    _error = self._combine_errors(_error, _exc.error)
 554                    self._pos = _choice1
 555                    break
 556            _result = _all0
 557            _call_status = self._productionargs()
 558            _result = _call_status.result
 559            _error = self._combine_errors(_error, _call_status.error)
 560            args = _result
 561            _result = self.__chars__(':')
 562            _all2 = []
 563            while 1:
 564                _choice3 = self._pos
 565                try:
 566                    _call_status = self._IGNORE()
 567                    _result = _call_status.result
 568                    _error = self._combine_errors(_error, _call_status.error)
 569                    _all2.append(_result)
 570                except BacktrackException, _exc:
 571                    _error = self._combine_errors(_error, _exc.error)
 572                    self._pos = _choice3
 573                    break
 574            _result = _all2
 575            _call_status = self._or_()
 576            _result = _call_status.result
 577            _error = self._combine_errors(_error, _call_status.error)
 578            what = _result
 579            _all4 = []
 580            while 1:
 581                _choice5 = self._pos
 582                try:
 583                    _call_status = self._IGNORE()
 584                    _result = _call_status.result
 585                    _error = self._combine_errors(_error, _call_status.error)
 586                    _all4.append(_result)
 587                except BacktrackException, _exc:
 588                    _error = self._combine_errors(_error, _exc.error)
 589                    self._pos = _choice5
 590                    break
 591            _result = _all4
 592            _result = self.__chars__(';')
 593            _all6 = []
 594            while 1:
 595                _choice7 = self._pos
 596                try:
 597                    _call_status = self._IGNORE()
 598                    _result = _call_status.result
 599                    _error = self._combine_errors(_error, _call_status.error)
 600                    _all6.append(_result)
 601                except BacktrackException, _exc:
 602                    _error = self._combine_errors(_error, _exc.error)
 603                    self._pos = _choice7
 604                    break
 605            _result = _all6
 606            _result = (Nonterminal('production', [name, args, what]))
 607            if _status.status == _status.LEFTRECURSION:
 608                if _status.result is not None:
 609                    if _status.pos >= self._pos:
 610                        _status.status = _status.NORMAL
 611                        self._pos = _status.pos
 612                        return _status
 613                _status.pos = self._pos
 614                _status.status = _status.SOMESOLUTIONS
 615                _status.result = _result
 616                _status.error = _error
 617                self._pos = _startingpos
 618                return self._production()
 619            _status.status = _status.NORMAL
 620            _status.pos = self._pos
 621            _status.result = _result
 622            _status.error = _error
 623            return _status
 624        except BacktrackException, _exc:
 625            _status.pos = -1
 626            _status.result = None
 627            _error = self._combine_errors(_error, _exc.error)
 628            _status.error = _error
 629            _status.status = _status.ERROR
 630            raise BacktrackException(_error)
 631    def productionargs(self):
 632        return self._productionargs().result
 633    def _productionargs(self):
 634        _key = self._pos
 635        _status = self._dict_productionargs.get(_key, None)
 636        if _status is None:
 637            _status = self._dict_productionargs[_key] = Status()
 638        else:
 639            _statusstatus = _status.status
 640            if _statusstatus == _status.NORMAL:
 641                self._pos = _status.pos
 642                return _status
 643            elif _statusstatus == _status.ERROR:
 644                raise BacktrackException(_status.error)
 645            elif (_statusstatus == _status.INPROGRESS or
 646                  _statusstatus == _status.LEFTRECURSION):
 647                _status.status = _status.LEFTRECURSION
 648                if _status.result is not None:
 649                    self._pos = _status.pos
 650                    return _status
 651                else:
 652                    raise BacktrackException(None)
 653            elif _statusstatus == _status.SOMESOLUTIONS:
 654                _status.status = _status.INPROGRESS
 655        _startingpos = self._pos
 656        try:
 657            _result = None
 658            _error = None
 659            while 1:
 660                _choice0 = self._pos
 661                try:
 662                    _result = self.__chars__('(')
 663                    _all1 = []
 664                    while 1:
 665                        _choice2 = self._pos
 666                        try:
 667                            _call_status = self._IGNORE()
 668                            _result = _call_status.result
 669                            _error = _call_status.error
 670                            _all1.append(_result)
 671                        except BacktrackException, _exc:
 672                            _error = self._combine_errors(_error, _exc.error)
 673                            self._pos = _choice2
 674                            break
 675                    _result = _all1
 676                    _all3 = []
 677                    while 1:
 678                        _choice4 = self._pos
 679                        try:
 680                            _call_status = self._NAME()
 681                            _result = _call_status.result
 682                            _error = self._combine_errors(_error, _call_status.error)
 683                            _before_discard5 = _result
 684                            _all6 = []
 685                            while 1:
 686                                _choice7 = self._pos
 687                                try:
 688                                    _call_status = self._IGNORE()
 689                                    _result = _call_status.result
 690                                    _error = self._combine_errors(_error, _call_status.error)
 691                                    _all6.append(_result)
 692                                except BacktrackException, _exc:
 693                                    _error = self._combine_errors(_error, _exc.error)
 694                                    self._pos = _choice7
 695                                    break
 696                            _result = _all6
 697                            _result = self.__chars__(',')
 698                            _all8 = []
 699                            while 1:
 700                                _choice9 = self._pos
 701                                try:
 702                                    _call_status = self._IGNORE()
 703                                    _result = _call_status.result
 704                                    _error = self._combine_errors(_error, _call_status.error)
 705                                    _all8.append(_result)
 706                                except BacktrackException, _exc:
 707                                    _error = self._combine_errors(_error, _exc.error)
 708                                    self._pos = _choice9
 709                                    break
 710                            _result = _all8
 711                            _result = _before_discard5
 712                            _all3.append(_result)
 713                        except BacktrackException, _exc:
 714                            _error = self._combine_errors(_error, _exc.error)
 715                            self._pos = _choice4
 716                            break
 717                    _result = _all3
 718                    args = _result
 719                    _call_status = self._NAME()
 720                    _result = _call_status.result
 721                    _error = self._combine_errors(_error, _call_status.error)
 722                    arg = _result
 723                    _all10 = []
 724                    while 1:
 725                        _choice11 = self._pos
 726                        try:
 727                            _call_status = self._IGNORE()
 728                            _result = _call_status.result
 729                            _error = self._combine_errors(_error, _call_status.error)
 730                            _all10.append(_result)
 731                        except BacktrackException, _exc:
 732                            _error = self._combine_errors(_error, _exc.error)
 733                            self._pos = _choice11
 734                            break
 735                    _result = _all10
 736                    _result = self.__chars__(')')
 737                    _all12 = []
 738                    while 1:
 739                        _choice13 = self._pos
 740                        try:
 741                            _call_status = self._IGNORE()
 742                            _result = _call_status.result
 743                            _error = self._combine_errors(_error, _call_status.error)
 744                            _all12.append(_result)
 745                        except BacktrackException, _exc:
 746                            _error = self._combine_errors(_error, _exc.error)
 747                            self._pos = _choice13
 748                            break
 749                    _result = _all12
 750                    _result = (Nonterminal('productionargs', args + [arg]))
 751                    break
 752                except BacktrackException, _exc:
 753                    _error = self._combine_errors(_error, _exc.error)
 754                    self._pos = _choice0
 755                _choice14 = self._pos
 756                try:
 757                    _result = (Nonterminal('productionargs', []))
 758                    break
 759                except BacktrackException, _exc:
 760                    _error = self._combine_errors(_error, _exc.error)
 761                    self._pos = _choice14
 762                    raise BacktrackException(_error)
 763                _result = (Nonterminal('productionargs', []))
 764                break
 765            if _status.status == _status.LEFTRECURSION:
 766                if _status.result is not None:
 767                    if _status.pos >= self._pos:
 768                        _status.status = _status.NORMAL
 769                        self._pos = _status.pos
 770                        return _status
 771                _status.pos = self._pos
 772                _status.status = _status.SOMESOLUTIONS
 773                _status.result = _result
 774                _status.error = _error
 775                self._pos = _startingpos
 776                return self._productionargs()
 777            _status.status = _status.NORMAL
 778            _status.pos = self._pos
 779            _status.result = _result
 780            _status.error = _error
 781            return _status
 782        except BacktrackException, _exc:
 783            _status.pos = -1
 784            _status.result = None
 785            _error = self._combine_errors(_error, _exc.error)
 786            _status.error = _error
 787            _status.status = _status.ERROR
 788            raise BacktrackException(_error)
 789    def or_(self):
 790        return self._or_().result
 791    def _or_(self):
 792        _key = self._pos
 793        _status = self._dict_or_.get(_key, None)
 794        if _status is None:
 795            _status = self._dict_or_[_key] = Status()
 796        else:
 797            _statusstatus = _status.status
 798            if _statusstatus == _status.NORMAL:
 799                self._pos = _status.pos
 800                return _status
 801            elif _statusstatus == _status.ERROR:
 802                raise BacktrackException(_status.error)
 803            elif (_statusstatus == _status.INPROGRESS or
 804                  _statusstatus == _status.LEFTRECURSION):
 805                _status.status = _status.LEFTRECURSION
 806                if _status.result is not None:
 807                    self._pos = _status.pos
 808                    return _status
 809                else:
 810                    raise BacktrackException(None)
 811            elif _statusstatus == _status.SOMESOLUTIONS:
 812                _status.status = _status.INPROGRESS
 813        _startingpos = self._pos
 814        try:
 815            _result = None
 816            _error = None
 817            while 1:
 818                _choice0 = self._pos
 819                try:
 820                    _all1 = []
 821                    _call_status = self._commands()
 822                    _result = _call_status.result
 823                    _error = _call_status.error
 824                    _before_discard2 = _result
 825                    _result = self.__chars__('|')
 826                    _all3 = []
 827                    while 1:
 828                        _choice4 = self._pos
 829                        try:
 830                            _call_status = self._IGNORE()
 831                            _result = _call_status.result
 832                            _error = self._combine_errors(_error, _call_status.error)
 833                            _all3.append(_result)
 834                        except BacktrackException, _exc:
 835                            _error = self._combine_errors(_error, _exc.error)
 836                            self._pos = _choice4
 837                            break
 838                    _result = _all3
 839                    _result = _before_discard2
 840                    _all1.append(_result)
 841                    while 1:
 842                        _choice5 = self._pos
 843                        try:
 844                            _call_status = self._commands()
 845                            _result = _call_status.result
 846                            _error = self._combine_errors(_error, _call_status.error)
 847                            _before_discard6 = _result
 848                            _result = self.__chars__('|')
 849                            _all7 = []
 850                            while 1:
 851                                _choice8 = self._pos
 852                                try:
 853                                    _call_status = self._IGNORE()
 854                                    _result = _call_status.result
 855                                    _error = self._combine_errors(_error, _call_status.error)
 856                                    _all7.append(_result)
 857                                except BacktrackException, _exc:
 858                                    _error = self._combine_errors(_error, _exc.error)
 859                                    self._pos = _choice8
 860                                    break
 861                            _result = _all7
 862                            _result = _before_discard6
 863                            _all1.append(_result)
 864                        except BacktrackException, _exc:
 865                            _error = self._combine_errors(_error, _exc.error)
 866                            self._pos = _choice5
 867                            break
 868                    _result = _all1
 869                    l = _result
 870                    _call_status = self._commands()
 871                    _result = _call_status.result
 872                    _error = self._combine_errors(_error, _call_status.error)
 873                    last = _result
 874                    _result = (Nonterminal('or', l + [last]))
 875                    break
 876                except BacktrackException, _exc:
 877                    _error = self._combine_errors(_error, _exc.error)
 878                    self._pos = _choice0
 879                _choice9 = self._pos
 880                try:
 881                    _call_status = self._commands()
 882                    _result = _call_status.result
 883                    _error = self._combine_errors(_error, _call_status.error)
 884                    break
 885                except BacktrackException, _exc:
 886                    _error = self._combine_errors(_error, _exc.error)
 887                    self._pos = _choice9
 888                    raise BacktrackException(_error)
 889                _call_status = self._commands()
 890                _result = _call_status.result
 891                _error = self._combine_errors(_error, _call_status.error)
 892                break
 893            if _status.status == _status.LEFTRECURSION:
 894                if _status.result is not None:
 895                    if _status.pos >= self._pos:
 896                        _status.status = _status.NORMAL
 897                        self._pos = _status.pos
 898                        return _status
 899                _status.pos = self._pos
 900                _status.status = _status.SOMESOLUTIONS
 901                _status.result = _result
 902                _status.error = _error
 903                self._pos = _startingpos
 904                return self._or_()
 905            _status.status = _status.NORMAL
 906            _status.pos = self._pos
 907            _status.result = _result
 908            _status.error = _error
 909            return _status
 910        except BacktrackException, _exc:
 911            _status.pos = -1
 912            _status.result = None
 913            _error = self._combine_errors(_error, _exc.error)
 914            _status.error = _error
 915            _status.status = _status.ERROR
 916            raise BacktrackException(_error)
 917    def commands(self):
 918        return self._commands().result
 919    def _commands(self):
 920        _key = self._pos
 921        _status = self._dict_commands.get(_key, None)
 922        if _status is None:
 923            _status = self._dict_commands[_key] = Status()
 924        else:
 925            _statusstatus = _status.status
 926            if _statusstatus == _status.NORMAL:
 927                self._pos = _status.pos
 928                return _status
 929            elif _statusstatus == _status.ERROR:
 930                raise BacktrackException(_status.error)
 931            elif (_statusstatus == _status.INPROGRESS or
 932                  _statusstatus == _status.LEFTRECURSION):
 933                _status.status = _status.LEFTRECURSION
 934                if _status.result is not None:
 935                    self._pos = _status.pos
 936                    return _status
 937                else:
 938                    raise BacktrackException(None)
 939            elif _statusstatus == _status.SOMESOLUTIONS:
 940                _status.status = _status.INPROGRESS
 941        _startingpos = self._pos
 942        try:
 943            _result = None
 944            _error = None
 945            while 1:
 946                _choice0 = self._pos
 947                try:
 948                    _call_status = self._command()
 949                    _result = _call_status.result
 950                    _error = _call_status.error
 951                    cmd = _result
 952                    _call_status = self._newline()
 953                    _result = _call_status.result
 954                    _error = self._combine_errors(_error, _call_status.error)
 955                    _all1 = []
 956                    _call_status = self._command()
 957                    _result = _call_status.result
 958                    _error = self._combine_errors(_error, _call_status.error)
 959                    _before_discard2 = _result
 960                    _call_status = self._newline()
 961                    _result = _call_status.result
 962                    _error = self._combine_errors(_error, _call_status.error)
 963                    _result = _before_discard2
 964                    _all1.append(_result)
 965                    while 1:
 966                        _choice3 = self._pos
 967                        try:
 968                            _call_status = self._command()
 969                            _result = _call_status.result
 970                            _error = self._combine_errors(_error, _call_status.error)
 971                            _before_discard4 = _result
 972                            _call_status = self._newline()
 973                            _result = _call_status.result
 974                            _error = self._combine_errors(_error, _call_status.error)
 975                            _result = _before_discard4
 976                            _all1.append(_result)
 977                        except BacktrackException, _exc:
 978                            _error = self._combine_errors(_error, _exc.error)
 979                            self._pos = _choice3
 980                            break
 981                    _result = _all1
 982                    cmds = _result
 983                    _result = (Nonterminal('commands', [cmd] + cmds))
 984                    break
 985                except BacktrackException, _exc:
 986                    _error = self._combine_errors(_error, _exc.error)
 987                    self._pos = _choice0
 988                _choice5 = self._pos
 989                try:
 990                    _call_status = self._command()
 991                    _result = _call_status.result
 992                    _error = self._combine_errors(_error, _call_status.error)
 993                    break
 994                except BacktrackException, _exc:
 995                    _error = self._combine_errors(_error, _exc.error)
 996                    self._pos = _choice5
 997                    raise BacktrackException(_error)
 998                _call_status = self._command()
 999                _result = _call_status.result
1000                _error = self._combine_errors(_error, _call_status.error)
1001                break
1002            if _status.status == _status.LEFTRECURSION:
1003                if _status.result is not None:
1004                    if _status.pos >= self._pos:
1005                        _status.status = _status.NORMAL
1006                        self._pos = _status.pos
1007                        return _status
1008                _status.pos = self._pos
1009                _status.status = _status.SOMESOLUTIONS
1010                _status.result = _result
1011                _status.error = _error
1012                self._pos = _startingpos
1013                return self._commands()
1014            _status.status = _status.NORMAL
1015            _status.pos = self._pos
1016            _status.result = _result
1017            _status.error = _error
1018            return _status
1019        except BacktrackException, _exc:
1020            _status.pos = -1
1021            _status.result = None
1022            _error = self._combine_errors(_error, _exc.error)
1023            _status.error = _error
1024            _status.status = _status.ERROR
1025            raise BacktrackException(_error)
1026    def command(self):
1027        return self._command().result
1028    def _command(self):
1029        _key = self._pos
1030        _status = self._dict_command.get(_key, None)
1031        if _status is None:
1032            _status = self._dict_command[_key] = Status()
1033        else:
1034            _statusstatus = _status.status
1035            if _statusstatus == _status.NORMAL:
1036                self._pos = _status.pos
1037                return _status
1038            elif _statusstatus == _status.ERROR:
1039                raise BacktrackException(_status.error)
1040            elif (_statusstatus == _status.INPROGRESS or
1041                  _statusstatus == _status.LEFTRECURSION):
1042                _status.status = _status.LEFTRECURSION
1043                if _status.result is not None:
1044                    self._pos = _status.pos
1045                    return _status
1046                else:
1047                    raise BacktrackException(None)
1048            elif _statusstatus == _status.SOMESOLUTIONS:
1049                _status.status = _status.INPROGRESS
1050        _startingpos = self._pos
1051        try:
1052            _result = None
1053            _error = None
1054            _call_status = self._simplecommand()
1055            _result = _call_status.result
1056            _error = _call_status.error
1057            if _status.status == _status.LEFTRECURSION:
1058                if _status.result is not None:
1059                    if _status.pos >= self._pos:
1060                        _status.status = _status.NORMAL
1061                        self._pos = _status.pos
1062                        return _status
1063                _status.pos = self._pos
1064                _status.status = _status.SOMESOLUTIONS
1065                _status.result = _result
1066                _status.error = _error
1067                self._pos = _startingpos
1068                return self._command()
1069            _status.status = _status.NORMAL
1070            _status.pos = self._pos
1071            _status.result = _result
1072            _status.error = _error
1073            return _status
1074        except BacktrackException, _exc:
1075            _status.pos = -1
1076            _status.result = None
1077            _error = self._combine_errors(_error, _exc.error)
1078            _status.error = _error
1079            _status.status = _status.ERROR
1080            raise BacktrackException(_error)
1081    def simplecommand(self):
1082        return self._simplecommand().result
1083    def _simplecommand(self):
1084        _key = self._pos
1085        _status = self._dict_simplecommand.get(_key, None)
1086        if _status is None:
1087            _status = self._dict_simplecommand[_key] = Status()
1088        else:
1089            _statusstatus = _status.status
1090            if _statusstatus == _status.NORMAL:
1091                self._pos = _status.pos
1092                return _status
1093            elif _statusstatus == _status.ERROR:
1094                raise BacktrackException(_status.error)
1095            elif (_statusstatus == _status.INPROGRESS or
1096                  _statusstatus == _status.LEFTRECURSION):
1097                _status.status = _status.LEFTRECURSION
1098                if _status.result is not None:
1099                    self._pos = _status.pos
1100                    return _status
1101                else:
1102                    raise BacktrackException(None)
1103            elif _statusstatus == _status.SOMESOLUTIONS:
1104                _status.status = _status.INPROGRESS
1105        _startingpos = self._pos
1106        try:
1107            _result = None
1108            _error = None
1109            while 1:
1110                _choice0 = self._pos
1111                try:
1112                    _call_status = self._return_()
1113                    _result = _call_status.result
1114                    _error = _call_status.error
1115                    break
1116                except BacktrackException, _exc:
1117                    _error = self._combine_errors(_error, _exc.error)
1118                    self._pos = _choice0
1119                _choice1 = self._pos
1120                try:
1121                    _call_status = self._if_()
1122                    _result = _call_status.result
1123                    _error = self._combine_errors(_error, _call_status.error)
1124                    break
1125                except BacktrackException, _exc:
1126                    _error = self._combine_errors(_error, _exc.error)
1127                    self._pos = _choice1
1128                _choice2 = self._pos
1129                try:
1130                    _call_status = self._named_command()
1131                    _result = _call_status.result
1132                    _error = self._combine_errors(_error, _call_status.error)
1133                    break
1134                except BacktrackException, _exc:
1135                    _error = self._combine_errors(_error, _exc.error)
1136                    self._pos = _choice2
1137                _choice3 = self._pos
1138                try:
1139                    _call_status = self._repetition()
1140                    _result = _call_status.result
1141                    _error = self._combine_errors(_error, _call_status.error)
1142                    break
1143                except BacktrackException, _exc:
1144                    _error = self._combine_errors(_error, _exc.error)
1145                    self._pos = _choice3
1146                _choice4 = self._pos
1147                try:
1148                    _call_status = self._choose()
1149                    _result = _call_status.result
1150                    _error = self._combine_errors(_error, _call_status.error)
1151                    break
1152                except BacktrackException, _exc:
1153                    _error = self._combine_errors(_error, _exc.error)
1154                    self._pos = _choice4
1155                _choice5 = self._pos
1156                try:
1157                    _call_status = self._negation()
1158                    _result = _call_status.result
1159                    _error = self._combine_errors(_error, _call_status.error)
1160                    break
1161                except BacktrackException, _exc:
1162                    _error = self._combine_errors(_error, _exc.error)
1163                    self._pos = _choice5
1164                    raise BacktrackException(_error)
1165                _call_status = self._negation()
1166                _result = _call_status.result
1167                _error = self._combine_errors(_error, _call_status.error)
1168                break
1169            if _status.status == _status.LEFTRECURSION:
1170                if _status.result is not None:
1171                    if _status.pos >= self._pos:
1172                        _status.status = _status.NORMAL
1173                        self._pos = _status.pos
1174                        return _status
1175                _status.pos = self._pos
1176                _status.status = _status.SOMESOLUTIONS
1177                _status.result = _result
1178                _status.error = _error
1179                self._pos = _startingpos
1180                return self._simplecommand()
1181            _status.status = _status.NORMAL
1182            _status.pos = self._pos
1183            _status.result = _result
1184            _status.error = _error
1185            return _status
1186        except BacktrackException, _exc:
1187            _status.pos = -1
1188            _status.result = None
1189            _error = self._combine_errors(_error, _exc.error)
1190            _status.error = _error
1191            _status.status = _status.ERROR
1192            raise BacktrackException(_error)
1193    def return_(self):
1194        return self._return_().result
1195    def _return_(self):
1196        _key = self._pos
1197        _status = self._dict_return_.get(_key, None)
1198        if _status is None:
1199            _status = self._dict_return_[_key] = Status()
1200        else:
1201            _statusstatus = _status.status
1202            if _statusstatus == _status.NORMAL:
1203                self._pos = _status.pos
1204                return _status
1205            elif _statusstatus == _status.ERROR:
1206                raise BacktrackException(_status.error)
1207            elif (_statusstatus == _status.INPROGRESS or
1208                  _statusstatus == _status.LEFTRECURSION):
1209                _status.status = _status.LEFTRECURSION
1210                if _status.result is not None:
1211                    self._pos = _status.pos
1212                    return _status
1213                else:
1214                    raise BacktrackException(None)
1215            elif _statusstatus == _status.SOMESOLUTIONS:
1216                _status.status = _status.INPROGRESS
1217        _startingpos = self._pos
1218        try:
1219            _result = None
1220            _error = None
1221            _result = self.__chars__('return')
1222            _all0 = []
1223            while 1:
1224                _choice1 = self._pos
1225                try:
1226                    _call_status = self._SPACE()
1227                    _result = _call_status.result
1228                    _error = _call_status.error
1229                    _all0.append(_result)
1230                except BacktrackException, _exc:
1231                    _error = self._combine_errors(_error, _exc.error)
1232                    self._pos = _choice1
1233                    break
1234            _result = _all0
1235            _call_status = self._PYTHONCODE()
1236            _result = _call_status.result
1237            _error = self._combine_errors(_error, _call_status.error)
1238            code = _result
1239            _all2 = []
1240            while 1:
1241                _choice3 = self._pos
1242                try:
1243                    _call_status = self._IGNORE()
1244                    _result = _call_status.result
1245                    _error = self._combine_errors(_error, _call_status.error)
1246                    _all2.append(_result)
1247                except BacktrackException, _exc:
1248                    _error = self._combine_errors(_error, _exc.error)
1249                    self._pos = _choice3
1250                    break
1251            _result = _all2
1252            _result = (Nonterminal('return', [code]))
1253            if _status.status == _status.LEFTRECURSION:
1254                if _status.result is not None:
1255                    if _status.pos >= self._pos:
1256                        _status.status = _status.NORMAL
1257                        self._pos = _status.pos
1258                        return _status
1259                _status.pos = self._pos
1260                _status.status = _status.SOMESOLUTIONS
1261                _status.result = _result
1262                _status.error = _error
1263                self._pos = _startingpos
1264                return self._return_()
1265            _status.status = _status.NORMAL
1266            _status.pos = self._pos
1267            _status.result = _result
1268            _status.error = _error
1269            return _status
1270        except BacktrackException, _exc:
1271            _status.pos = -1
1272            _status.result = None
1273            _error = self._combine_errors(_error, _exc.error)
1274            _status.error = _error
1275            _status.status = _status.ERROR
1276            raise BacktrackException(_error)
1277    def if_(self):
1278        return self._if_().result
1279    def _if_(self):
1280        _key = self._pos
1281        _status = self._dict_if_.get(_key, None)
1282        if _status is None:
1283            _status = self._dict_if_[_key] = Status()
1284        else:
1285            _statusstatus = _status.status
1286            if _statusstatus == _status.NORMAL:
1287                self._pos = _status.pos
1288                return _status
1289            elif _statusstatus == _status.ERROR:
1290                raise BacktrackException(_status.error)
1291            elif (_statusstatus == _status.INPROGRESS or
1292                  _statusstatus == _status.LEFTRECURSION):
1293                _status.status = _status.LEFTRECURSION
1294                if _status.result is not None:
1295                    self._pos = _status.pos
1296                    return _status
1297                else:
1298                    raise BacktrackException(None)
1299            elif _statusstatus == _status.SOMESOLUTIONS:
1300                _status.status = _status.INPROGRESS
1301        _startingpos = self._pos
1302        try:
1303            _result = None
1304            _error = None
1305            while 1:
1306                _choice0 = self._pos
1307                try:
1308                    _result = self.__chars__('do')
1309                    _call_status = self._newline()
1310                    _result = _call_status.result
1311                    _error = _call_status.error
1312                    _call_status = self._command()
1313                    _result = _call_status.result
1314                    _error = self._combine_errors(_error, _call_status.error)
1315                    cmd = _result
1316                    _all1 = []
1317                    while 1:
1318                        _choice2 = self._pos
1319                        try:
1320                            _call_status = self._SPACE()
1321                            _result = _call_status.result
1322                            _error = self._combine_errors(_error, _call_status.error)
1323                            _all1.append(_result)
1324                        except BacktrackException, _exc:
1325                            _error = self._combine_errors(_error, _exc.error)
1326                            self._pos = _choice2
1327                            break
1328                    _result = _all1
1329                    _result = self.__chars__('if')
1330                    _all3 = []
1331                    while 1:
1332                        _choice4 = self._pos
1333                        try:
1334                            _call_status = self._SPACE()
1335                            _result = _call_status.result
1336                            _error = self._combine_errors(_error, _call_status.error)
1337                            _all3.append(_result)
1338                        except BacktrackException, _exc:
1339                            _error = self._combine_errors(_error, _exc.error)
1340                            self._pos = _choice4
1341                            break
1342                    _result = _all3
1343                    _call_status = self._PYTHONCODE()
1344                    _result = _call_status.result
1345                    _error = self._combine_errors(_error, _call_status.error)
1346                    condition = _result
1347                    _all5 = []
1348                    while 1:
1349                        _choice6 = self._pos
1350                        try:
1351                            _call_status = self._IGNORE()
1352                            _result = _call_status.result
1353                            _error = self._combine_errors(_error, _call_status.error)
1354                            _all5.append(_result)
1355                        except BacktrackException, _exc:
1356                            _error = self._combine_errors(_error, _exc.error)
1357                            self._pos = _choice6
1358                            break
1359                    _result = _all5
1360                    _result = (Nonterminal('if', [cmd, condition]))
1361                    break
1362                except BacktrackException, _exc:
1363                    _error = self._combine_errors(_error, _exc.error)
1364                    self._pos = _choice0
1365                _choice7 = self._pos
1366                try:
1367                    _result = self.__chars__('if')
1368                    _all8 = []
1369                    while 1:
1370                        _choice9 = self._pos
1371                        try:
1372                            _call_status = self._SPACE()
1373                            _result = _call_status.result
1374                            _error = self._combine_errors(_error, _call_status.error)
1375                            _all8.append(_result)
1376                        except BacktrackException, _exc:
1377                            _error = self._combine_errors(_error, _exc.error)
1378                            self._pos = _choice9
1379                            break
1380                    _result = _all8
1381                    _call_status = self._PYTHONCODE()
1382                    _result = _call_status.result
1383                    _error = self._combine_errors(_error, _call_status.error)
1384                    condition = _result
1385                    _all10 = []
1386                    while 1:
1387                        _choice11 = self._pos
1388                        try:
1389                            _call_status = self._IGNORE()
1390                            _result = _call_status.result
1391                            _error = self._combine_errors(_error, _call_status.error)
1392                            _all10.append(_result)
1393                        except BacktrackException, _exc:
1394                            _error = self._combine_errors(_error, _exc.error)
1395                            self._pos = _choice11
1396                            break
1397                    _result = _all10
1398                    _result = (Nonterminal('if', [condition]))
1399                    break
1400                except BacktrackException, _exc:
1401                    _error = self._combine_errors(_error, _exc.error)
1402                    self._pos = _choice7
1403                    raise BacktrackException(_error)
1404                _result = self.__chars__('if')
1405                _all12 = []
1406                while 1:
1407                    _choice13 = self._pos
1408                    try:
1409                        _call_status = self._SPACE()
1410                        _result = _call_status.result
1411                        _error = self._combine_errors(_error, _call_status.error)
1412                        _all12.append(_result)
1413                    except BacktrackException, _exc:
1414                        _error = self._combine_errors(_error, _exc.error)
1415                        self._pos = _choice13
1416                        break
1417                _result = _all12
1418                _call_status = self._PYTHONCODE()
1419                _result = _call_status.result
1420                _error = self._combine_errors(_error, _call_status.error)
1421                condition = _result
1422                _all14 = []
1423                while 1:
1424                    _choice15 = self._pos
1425                    try:
1426                        _call_status = self._IGNORE()
1427                        _result = _call_status.result
1428                        _error = self._combine_errors(_error, _call_status.error)
1429                        _all14.append(_result)
1430                    except BacktrackException, _exc:
1431                        _error = self._combine_errors(_error, _exc.error)
1432                        self._pos = _choice15
1433                        break
1434                _result = _all14
1435                _result = (Nonterminal('if', [condition]))
1436                break
1437            if _status.status == _status.LEFTRECURSION:
1438                if _status.result is not None:
1439                    if _status.pos >= self._pos:
1440                        _status.status = _status.NORMAL
1441                        self._pos = _status.pos
1442                        return _status
1443                _status.pos = self._pos
1444                _status.status = _status.SOMESOLUTIONS
1445                _status.result = _result
1446                _status.error = _error
1447                self._pos = _startingpos
1448                return self._if_()
1449            _status.status = _status.NORMAL
1450            _status.pos = self._pos
1451            _status.result = _result
1452            _status.error = _error
1453            return _status
1454        except BacktrackException, _exc:
1455            _status.pos = -1
1456            _status.result = None
1457            _error = self._combine_errors(_error, _exc.error)
1458            _status.error = _error
1459            _status.status = _status.ERROR
1460            raise BacktrackException(_error)
1461    def choose(self):
1462        return self._choose().result
1463    def _choose(self):
1464        _key = self._pos
1465        _status = self._dict_choose.get(_key, None)
1466        if _status is None:
1467            _status = self._dict_choose[_key] = Status()
1468        else:
1469            _statusstatus = _status.status
1470            if _statusstatus == _status.NORMAL:
1471                self._pos = _status.pos
1472                return _status
1473            elif _statusstatus == _status.ERROR:
1474                raise BacktrackException(_status.error)
1475            elif (_statusstatus == _status.INPROGRESS or
1476                  _statusstatus == _status.LEFTRECURSION):
1477                _status.status = _status.LEFTRECURSION
1478                if _status.result is not None:
1479                    self._pos = _status.pos
1480                    return _status
1481                else:
1482                    raise BacktrackException(None)
1483            elif _statusstatus == _status.SOMESOLUTIONS:
1484                _status.status = _status.INPROGRESS
1485        _startingpos = self._pos
1486        try:
1487            _result = None
1488            _error = None
1489            _result = self.__chars__('choose')
1490            _all0 = []
1491            while 1:
1492                _choice1 = self._pos
1493                try:
1494                    _call_status = self._SPACE()
1495                    _result = _call_status.result
1496                    _error = _call_status.error
1497                    _all0.append(_result)
1498                except BacktrackException, _exc:
1499                    _error = self._combine_errors(_error, _exc.error)
1500                    self._pos = _choice1
1501                    break
1502            _result = _all0
1503            _call_status = self._NAME()
1504            _result = _call_status.result
1505            _error = self._combine_errors(_error, _call_status.error)
1506            name = _result
1507            _all2 = []
1508            while 1:
1509                _choice3 = self._pos
1510                try:
1511                    _call_status = self._SPACE()
1512                    _result = _call_status.result
1513                    _error = self._combine_errors(_error, _call_status.error)
1514                    _all2.append(_result)
1515                except BacktrackException, _exc:
1516                    _error = self._combine_errors(_error, _exc.error)
1517                    self._pos = _choice3
1518                    break
1519            _result = _all2
1520            _result = self.__chars__('in')
1521            _all4 = []
1522            while 1:
1523                _choice5 = self._pos
1524                try:
1525                    _call_status = self._SPACE()
1526                    _result = _call_status.result
1527                    _error = self._combine_errors(_error, _call_status.error)
1528                    _all4.append(_result)
1529                except BacktrackException, _exc:
1530                    _error = self._combine_errors(_error, _exc.error)
1531                    self._pos = _choice5
1532                    break
1533            _result = _all4
1534            _call_status = self._PYTHONCODE()
1535            _result = _call_status.result
1536            _error = self._combine_errors(_error, _call_status.error)
1537            expr = _result
1538            _all6 = []
1539            while 1:
1540                _choice7 = self._pos
1541                try:
1542                    _call_status = self._IGNORE()
1543                    _result = _call_status.result
1544                    _error = self._combine_errors(_error, _call_status.error)
1545                    _all6.append(_result)
1546                except BacktrackException, _exc:
1547                    _error = self._combine_errors(_error, _exc.error)
1548                    self._pos = _choice7
1549                    break
1550            _result = _all6
1551            _call_status = self._commands()
1552            _result = _call_status.result
1553            _error = self._combine_errors(_error, _call_status.error)
1554            cmds = _result
1555            _result = (Nonterminal('choose', [name, expr, cmds]))
1556            if _status.status == _status.LEFTRECURSION:
1557                if _status.result is not None:
1558                    if _status.pos >= self._pos:
1559                        _status.status = _status.NORMAL
1560                        self._pos = _status.pos
1561                        return _status
1562                _status.pos = self._pos
1563                _status.status = _status.SOMESOLUTIONS
1564                _status.result = _result
1565                _status.error = _error
1566                self._pos = _startingpos
1567                return self._choose()
1568            _status.status = _status.NORMAL
1569            _status.pos = self._pos
1570            _status.result = _result
1571            _status.error = _error
1572            return _status
1573        except BacktrackException, _exc:
1574            _status.pos = -1
1575            _status.result = None
1576            _error = self._combine_errors(_error, _exc.error)
1577            _status.error = _error
1578            _status.status = _status.ERROR
1579            raise BacktrackException(_error)
1580    def commandchain(self):
1581        return self._commandchain().result
1582    def _commandchain(self):
1583        _key = self._pos
1584        _status = self._dict_commandchain.get(_key, None)
1585        if _status is None:
1586            _status = self._dict_commandchain[_key] = Status()
1587        else:
1588            _statusstatus = _status.status
1589            if _statusstatus == _status.NORMAL:
1590                self._pos = _status.pos
1591                return _status
1592            elif _statusstatus == _status.ERROR:
1593                raise BacktrackException(_status.error)
1594            elif (_statusstatus == _status.INPROGRESS or
1595                  _statusstatus == _status.LEFTRECURSION):
1596                _status.status = _status.LEFTRECURSION
1597                if _status.result is not None:
1598                    self._pos = _status.pos
1599                    return _status
1600                else:
1601                    raise BacktrackException(None)
1602            elif _statusstatus == _status.SOMESOLUTIONS:
1603                _status.status = _status.INPROGRESS
1604        _startingpos = self._pos
1605        try:
1606            _result = None
1607            _error = None
1608            _all0 = []
1609            _call_status = self._simplecommand()
1610            _result = _call_status.result
1611            _error = _call_status.error
1612            _all0.append(_result)
1613            while 1:
1614                _choice1 = self._pos
1615                try:
1616                    _call_status = self._simplecommand()
1617                    _result = _call_status.result
1618                    _error = self._combine_errors(_error, _call_status.error)
1619                    _all0.append(_result)
1620                except BacktrackException, _exc:
1621                    _error = self._combine_errors(_error, _exc.error)
1622                    self._pos = _choice1
1623                    break
1624            _result = _all0
1625            result = _result
1626            _result = (Nonterminal('commands', result))
1627            if _status.status == _status.LEFTRECURSION:
1628                if _status.result is not None:
1629                    if _status.pos >= self._pos:
1630                        _status.status = _status.NORMAL
1631                        self._pos = _status.pos
1632                        return _status
1633                _status.pos = self._pos
1634                _status.status = _status.SOMESOLUTIONS
1635                _status.result = _result
1636                _status.error = _error
1637                self._pos = _startingpos
1638                return self._commandchain()
1639            _status.status = _status.NORMAL
1640            _status.pos = self._pos
1641            _status.result = _result
1642            _status.error = _error
1643            return _status
1644        except BacktrackException, _exc:
1645            _status.pos = -1
1646            _status.result = None
1647            _error = self._combine_errors(_error, _exc.error)
1648            _status.error = _error
1649            _status.status = _status.ERROR
1650            raise BacktrackException(_error)
1651    def named_command(self):
1652        return self._named_command().result
1653    def _named_command(self):
1654        _key = self._pos
1655        _status = self._dict_named_command.get(_key, None)
1656        if _status is None:
1657            _status = self._dict_named_command[_key] = Status()
1658        else:
1659            _statusstatus = _status.status
1660            if _statusstatus == _status.NORMAL:
1661                self._pos = _status.pos
1662                return _status
1663            elif _statusstatus == _status.ERROR:
1664                raise BacktrackException(_status.error)
1665            elif (_statusstatus == _status.INPROGRESS or
1666                  _statusstatus == _status.LEFTRECURSION):
1667                _status.status = _status.LEFTRECURSION
1668                if _status.result is not None:
1669                    self._pos = _status.pos
1670                    return _status
1671                else:
1672                    raise BacktrackException(None)
1673            elif _statusstatus == _status.SOMESOLUTIONS:
1674                _status.status = _status.INPROGRESS
1675        _startingpos = self._pos
1676        try:
1677            _result = None
1678            _error = None
1679            _call_status = self._NAME()
1680            _result = _call_status.result
1681            _error = _call_status.error
1682            name = _result
1683            _all0 = []
1684            while 1:
1685                _choice1 = self._pos
1686                try:
1687                    _call_status = self._SPACE()
1688                    _result = _call_status.result
1689                    _error = self._combine_errors(_error, _call_status.error)
1690                    _all0.append(_result)
1691                except BacktrackException, _exc:
1692                    _error = self._combine_errors(_error, _exc.error)
1693                    self._pos = _choice1
1694                    break
1695            _result = _all0
1696            _result = self.__chars__('=')
1697            _all2 = []
1698            while 1:
1699                _choice3 = self._pos
1700                try:
1701                    _call_status = self._SPACE()
1702                    _result = _call_status.result
1703                    _error = self._combine_errors(_error, _call_status.error)
1704                    _all2.append(_result)
1705                except BacktrackException, _exc:
1706                    _error = self._combine_errors(_error, _exc.error)
1707                    self._pos = _choice3
1708                    break
1709            _result = _all2
1710            _call_status = self._command()
1711            _result = _call_status.result
1712            _error = self._combine_errors(_error, _call_status.error)
1713            cmd = _result
1714            _result = (Nonterminal('named_command', [name, cmd]))
1715            if _status.status == _status.LEFTRECURSION:
1716                if _status.result is not None:
1717                    if _status.pos >= self._pos:
1718                        _status.status = _status.NORMAL
1719                        self._pos = _status.pos
1720                        return _status
1721                _status.pos = self._pos
1722                _status.status = _status.SOMESOLUTIONS
1723                _status.result = _result
1724                _status.error = _error
1725                self._pos = _startingpos
1726                return self._named_command()
1727            _status.status = _status.NORMAL
1728            _status.pos = self._pos
1729            _status.result = _result
1730            _status.error = _error
1731            return _status
1732        except BacktrackException, _exc:
1733            _status.pos = -1
1734            _status.result = None
1735            _error = self._combine_errors(_error, _exc.error)
1736            _status.error = _error
1737            _status.status = _status.ERROR
1738            raise BacktrackException(_error)
1739    def repetition(self):
1740        return self._repetition().result
1741    def _repetition(self):
1742        _key = self._pos
1743        _status = self._dict_repetition.get(_key, None)
1744        if _status is None:
1745            _status = self._dict_repetition[_key] = Status()
1746        else:
1747            _statusstatus = _status.status
1748            if _statusstatus == _status.NORMAL:
1749                self._pos = _status.pos
1750                return _status
1751            elif _statusstatus == _status.ERROR:
1752                raise BacktrackException(_status.error)
1753            elif (_statusstatus == _status.INPROGRESS or
1754                  _statusstatus == _status.LEFTRECURSION):
1755                _status.status = _status.LEFTRECURSION
1756                if _status.result is not None:
1757                    self._pos = _status.pos
1758                    return _status
1759                else:
1760                    raise BacktrackException(None)
1761            elif _statusstatus == _status.SOMESOLUTIONS:
1762                _status.status = _status.INPROGRESS
1763        _startingpos = self._pos
1764        try:
1765            _result = None
1766            _error = None
1767            while 1:
1768                _choice0 = self._pos
1769                try:
1770                    _call_status = self._enclosed()
1771                    _result = _call_status.result
1772                    _error = _call_status.error
1773                    what = _result
1774                    _all1 = []
1775                    while 1:
1776                        _choice2 = self._pos
1777                        try:
1778                            _call_status = self._SPACE()
1779                            _result = _call_status.result
1780                            _error = self._combine_errors(_error, _call_status.error)
1781                            _all1.append(_result)
1782                        except BacktrackException, _exc:
1783                            _error = self._combine_errors(_error, _exc.error)
1784                            self._pos = _choice2
1785                            break
1786                    _result = _all1
1787                    _result = self.__chars__('?')
1788                    _all3 = []
1789                    while 1:
1790                        _choice4 = self._pos
1791                        try:
1792                            _call_status = self._IGNORE()
1793                            _result = _call_status.result
1794                            _error = self._combine_errors(_error, _call_status.error)
1795                            _all3.append(_result)
1796                        except BacktrackException, _exc:
1797                            _error = self._combine_errors(_error, _exc.error)
1798                            self._pos = _choice4
1799                            break
1800                    _result = _all3
1801                    _result = (Nonterminal('maybe', [what]))
1802                    break
1803                except BacktrackException, _exc:
1804                    _error = self._combine_errors(_error, _exc.error)
1805                    self._pos = _choice0
1806                _choice5 = self._pos
1807                try:
1808                    _call_status = self._enclosed()
1809                    _result = _call_status.result
1810                    _error = self._combine_errors(_error, _call_status.error)
1811                    what = _result
1812                    _all6 = []
1813                    while 1:
1814                        _choice7 = self._pos
1815                        try:
1816                            _call_status = self._SPACE()
1817                            _result = _call_status.result
1818                            _error = self._combine_errors(_error, _call_status.error)
1819                            _all6.append(_result)
1820                        except BacktrackException, _exc:
1821                            _error = self._combine_errors(_error, _exc.error)
1822                            self._pos = _choice7
1823                            break
1824                    _result = _all6
1825                    while 1:
1826                        _choice8 = self._pos
1827                        try:
1828                            _result = self.__chars__('*')
1829                            break
1830                        except BacktrackException, _exc:
1831                            _error = self._combine_errors(_error, _exc.error)
1832                            self._pos = _choice8
1833                        _choice9 = self._pos
1834                        try:
1835                            _result = self.__chars__('+')
1836                            break
1837                        except BacktrackException, _exc:
1838                            _error = self._combine_errors(_error, _exc.error)
1839                            self._pos = _choice9
1840                            raise BacktrackException(_error)
1841                        _result = self.__chars__('+')
1842                        break
1843                    repetition = _result
1844                    _all10 = []
1845                    while 1:
1846                        _choice11 = self._pos
1847                        try:
1848                            _call_status = self._IGNORE()
1849                            _result = _call_status.result
1850                            _error = self._combine_errors(_error, _call_status.error)
1851                            _all10.append(_result)
1852                        except BacktrackException, _exc:
1853                            _error = self._combine_errors(_error, _exc.error)
1854                            self._pos = _choice11
1855                            break
1856                    _result = _all10
1857                    _result = (Nonterminal('repetition', [repetition, what]))
1858                    break
1859                except BacktrackException, _exc:
1860                    _error = self._combine_errors(_error, _exc.error)
1861                    self._pos = _choice5
1862                    raise BacktrackException(_error)
1863                _call_status = self._enclosed()
1864                _result = _call_status.result
1865                _error = self._combine_errors(_error, _call_status.error)
1866                what = _result
1867                _all12 = []
1868                while 1:
1869                    _choice13 = self._pos
1870                    try:
1871                        _call_status = self._SPACE()
1872                        _result = _call_status.result
1873                        _error = self._combine_errors(_error, _call_status.error)
1874                        _all12.append(_result)
1875                    except BacktrackException, _exc:
1876                        _error = self._combine_errors(_error, _exc.error)
1877                        self._pos = _choice13
1878                        break
1879                _result = _all12
1880                while 1:
1881                    _choice14 = self._pos
1882                    try:
1883                        _result = self.__chars__('*')
1884                        break
1885                    except BacktrackException, _exc:
1886                        _error = self._combine_errors(_error, _exc.error)
1887                        self._pos = _choice14
1888                    _choice15 = self._pos
1889                    try:
1890                        _result = self.__chars__('+')
1891                        break
1892                    except BacktrackException, _exc:
1893                        _error = self._combine_errors(_error, _exc.error)
1894                        self._pos = _choice15
1895                        raise BacktrackException(_error)
1896                    _result = self.__chars__('+')
1897                    break
1898                repetition = _result
1899                _all16 = []
1900                while 1:
1901                    _choice17 = self._pos
1902                    try:
1903                        _call_status = self._IGNORE()
1904                        _result = _call_status.result
1905                        _error = self._combine_errors(_error, _call_status.error)
1906                        _all16.append(_result)
1907                    except BacktrackException, _exc:
1908                        _error = self._combine_errors(_error, _exc.error)
1909                        self._pos = _choice17
1910                        break
1911                _result = _all16
1912                _result = (Nonterminal('repetition', [repetition, what]))
1913                break
1914            if _status.status == _status.LEFTRECURSION:
1915                if _status.result is not None:
1916                    if _status.pos >= self._pos:
1917                        _status.status = _status.NORMAL
1918                        self._pos = _status.pos
1919                        return _status
1920                _status.pos = self._pos
1921                _status.status = _status.SOMESOLUTIONS
1922                _status.result = _result
1923                _status.error = _error
1924                self._pos = _startingpos
1925                return self._repetition()
1926            _status.status = _status.NORMAL
1927            _status.pos = self._pos
1928            _status.result = _result
1929            _status.error = _error
1930            return _status
1931        except BacktrackException, _exc:
1932            _status.pos = -1
1933            _status.result = None
1934            _error = self._combine_errors(_error, _exc.error)
1935            _status.error = _error
1936            _status.status = _status.ERROR
1937            raise BacktrackException(_error)
1938    def negation(self):
1939        return self._negation().result
1940    def _negation(self):
1941        _key = self._pos
1942        _status = self._dict_negation.get(_key, None)
1943        if _status is None:
1944            _status = self._dict_negation[_key] = Status()
1945        else:
1946            _statusstatus = _status.status
1947            if _statusstatus == _status.NORMAL:
1948                self._pos = _status.pos
1949                return _status
1950            elif _statusstatus == _status.ERROR:
1951                raise BacktrackException(_status.error)
1952            elif (_statusstatus == _status.INPROGRESS or
1953                  _statusstatus == _status.LEFTRECURSION):
1954                _status.status = _status.LEFTRECURSION
1955                if _status.result is not None:
1956                    self._pos = _status.pos
1957                    return _status
1958                else:
1959                    raise BacktrackException(None)
1960            elif _statusstatus == _status.SOMESOLUTIONS:
1961                _status.status = _status.INPROGRESS
1962        _startingpos = self._pos
1963        try:
1964            _result = None
1965            _error = None
1966            while 1:
1967                _choice0 = self._pos
1968                try:
1969                    _result = self.__chars__('!')
1970                    _all1 = []
1971                    while 1:
1972                        _choice2 = self._pos
1973                        try:
1974                            _call_status = self._SPACE()
1975                            _result = _call_status.result
1976                            _error = _call_status.error
1977                            _all1.append(_result)
1978                        except BacktrackException, _exc:
1979                            _error = self._combine_errors(_error, _exc.error)
1980                            self._pos = _choice2
1981                            break
1982                    _result = _all1
1983                    _call_status = self._negation()
1984                    _result = _call_status.result
1985                    _error = self._combine_errors(_error, _call_status.error)
1986                    what = _result
1987                    _all3 = []
1988                    while 1:
1989                        _choice4 = self._pos
1990                        try:
1991                            _call_status = self._IGNORE()
1992                            _result = _call_status.result
1993                            _error = self._combine_errors(_error, _call_status.error)
1994                            _all3.append(_result)
1995                        except BacktrackException, _exc:
1996                            _error = self._combine_errors(_error, _exc.error)
1997                            self._pos = _choice4
1998                            break
1999                    _result = _all3
2000                    _result = (Nonterminal('negation', [what]))
2001                    break
2002                except BacktrackException, _exc:
2003                    _error = self._combine_errors(_error, _exc.error)
2004                    self._pos = _choice0
2005                _choice5 = self._pos
2006                try:
2007                    _call_status = self._enclosed()
2008                    _result = _call_status.result
2009                    _error = self._combine_errors(_error, _call_status.error)
2010                    break
2011                except BacktrackException, _exc:
2012                    _error = self._combine_errors(_error, _exc.error)
2013                    self._pos = _choice5
2014                    raise BacktrackException(_error)
2015                _call_status = self._enclosed()
2016                _result = _call_status.result
2017                _error = self._combine_errors(_error, _call_status.error)
2018                break
2019            if _status.status == _status.LEFTRECURSION:
2020                if _status.result is not None:
2021                    if _status.pos >= self._pos:
2022                        _status.status = _status.NORMAL
2023                        self._pos = _status.pos
2024                        return _status
2025                _status.pos = self._pos
2026                _status.status = _status.SOMESOLUTIONS
2027                _status.result = _result
2028                _status.error = _error
2029                self._pos = _startingpos
2030                return self._negation()
2031            _status.status = _status.NORMAL
2032            _status.pos = self._pos
2033            _status.result = _result
2034            _status.error = _error
2035            return _status
2036        except BacktrackException, _exc:
2037            _status.pos = -1
2038            _status.result = None
2039            _error = self._combine_errors(_error, _exc.error)
2040            _status.error = _error
2041            _status.status = _status.ERROR
2042            raise BacktrackException(_error)
2043    def enclosed(self):
2044        return self._enclosed().result
2045    def _enclosed(self):
2046        _key = self._pos
2047        _status = self._dict_enclosed.get(_key, None)
2048        if _status is None:
2049            _status = self._dict_enclosed[_key] = Status()
2050        else:
2051            _statusstatus = _status.status
2052            if _statusstatus == _status.NORMAL:
2053                self._pos = _status.pos
2054                return _status
2055            elif _statusstatus == _status.ERROR:
2056                raise BacktrackException(_status.error)
2057            elif (_statusstatus == _status.INPROGRESS or
2058                  _statusstatus == _status.LEFTRECURSION):
2059                _status.status = _status.LEFTRECURSION
2060                if _status.result is not None:
2061                    self._pos = _status.pos
2062                    return _status
2063                else:
2064                    raise BacktrackException(None)
2065            elif _statusstatus == _status.SOMESOLUTIONS:
2066                _status.status = _status.INPROGRESS
2067        _startingpos = self._pos
2068        try:
2069            _result = None
2070            _error = None
2071            while 1:
2072                _choice0 = self._pos
2073                try:
2074                    _result = self.__chars__('<')
2075                    _all1 = []
2076                    while 1:
2077                        _choice2 = self._pos
2078                        try:
2079                            _call_status = self._IGNORE()
2080                            _result = _call_status.result
2081                            _error = _call_status.error
2082                            _all1.append(_result)
2083                        except BacktrackException, _exc:
2084                            _error = self._combine_errors(_error, _exc.error)
2085                            self._pos = _choice2
2086                            break
2087                    _result = _all1
2088                    _call_status = self._primary()
2089                    _result = _call_status.result
2090                    _error = self._combine_errors(_error, _call_status.error)
2091                    what = _result
2092                    _all3 = []
2093                    while 1:
2094                        _choice4 = self._pos
2095                        try:
2096                            _call_status = self._IGNORE()
2097                            _result = _call_status.result
2098                            _error = self._combine_errors(_error, _call_status.error)
2099                            _all3.append(_result)
2100                        except BacktrackException, _exc:
2101                            _error = self._combine_errors(_error, _exc.error)
2102                            self._pos = _choice4
2103                            break
2104                    _result = _all3
2105                    _result = self.__chars__('>')
2106                    _all5 = []
2107                    while 1:
2108                        _choice6 = self._pos
2109                        try:
2110                            _call_status = self._IGNORE()
2111                            _result = _call_status.result
2112                            _error = self._combine_errors(_error, _call_status.error)
2113                            _all5.append(_result)
2114                        except BacktrackException, _exc:
2115                            _error = self._combine_errors(_error, _exc.error)
2116                            self._pos = _choice6
2117                            break
2118                    _result = _all5
2119                    _result = (Nonterminal('exclusive', [what]))
2120                    break
2121                except BacktrackException, _exc:
2122                    _error = self._combine_errors(_error, _exc.error)
2123                    self._pos = _choice0
2124                _choice7 = self._pos
2125                try:
2126                    _result = self.__chars__('[')
2127                    _all8 = []
2128                    while 1:
2129                        _choice9 = self._pos
2130                        try:
2131                            _call_status = self._IGNORE()
2132                            _result = _call_status.result
2133                            _error = self._combine_errors(_error, _call_status.error)
2134                            _all8.append(_result)
2135                        except BacktrackException, _exc:
2136                            _error = self._combine_errors(_error, _exc.error)
2137                            self._pos = _choice9
2138                            break
2139                    _result = _all8
2140                    _call_status = self._or_()
2141                    _result = _call_status.result
2142                    _error = self._combine_errors(_error, _call_status.error)
2143                    what = _result
2144                    _all10 = []
2145                    while 1:
2146                        _choice11 = self._pos
2147                        try:
2148                            _call_status = self._IGNORE()
2149                            _result = _call_status.result
2150                            _error = self._combine_errors(_error, _call_status.error)
2151                            _all10.append(_result)
2152                        except BacktrackException, _exc:
2153                            _error = self._combine_errors(_error, _exc.error)
2154                            self._pos = _choice11
2155                            break
2156                    _result = _all10
2157                    _result = self.__chars__(']')
2158                    _all12 = []
2159                    while 1:
2160                        _choice13 = self._pos
2161                        try:
2162                            _call_status = self._IGNORE()
2163                            _result = _call_status.result
2164                            _error = self._combine_errors(_error, _call_status.error)
2165                            _all12.append(_result)
2166                        except BacktrackException, _exc:
2167                            _error = self._combine_errors(_error, _exc.error)
2168                            self._pos = _choice13
2169                            break
2170                    _result = _all12
2171                    _result = (Nonterminal('ignore', [what]))
2172                    break
2173                except BacktrackException, _exc:
2174                    _error = self._combine_errors(_error, _exc.error)
2175                    self._pos = _choice7
2176                _choice14 = self._pos
2177                try:
2178                    _before_discard15 = _result
2179                    _result = self.__chars__('(')
2180                    _all16 = []
2181                    while 1:
2182                        _choice17 = self._pos
2183                        try:
2184                            _call_status = self._IGNORE()
2185                            _result = _call_status.result
2186                            _error = self._combine_errors(_error, _call_status.error)
2187                            _all16.append(_result)
2188                        except BacktrackException, _exc:
2189                            _error = self._combine_errors(_error, _exc.error)
2190                            self._pos = _choice17
2191                            break
2192                    _result = _all16
2193                    _result = _before_discard15
2194                    _call_status = self._or_()
2195                    _result = _call_status.result
2196                    _error = self._combine_errors(_error, _call_status.error)
2197                    _before_discard18 = _result
2198                    _result = self.__chars__(')')
2199                    _all19 = []
2200                    while 1:
2201                        _choice20 = self._pos
2202                        try:
2203                            _call_status = self._IGNORE()
2204                            _result = _call_status.result
2205                            _error = self._combine_errors(_error, _call_status.error)
2206                            _all19.append(_result)
2207                        except BacktrackException, _exc:
2208                            _error = self._combine_errors(_error, _exc.error)
2209                            self._pos = _choice20
2210                            break
2211                    _result = _all19
2212                    _result = _before_discard18
2213                    break
2214                except BacktrackException, _exc:
2215                    _error = self._combine_errors(_error, _exc.error)
2216                    self._pos = _choice14
2217                _choice21 = self._pos
2218                try:
2219                    _call_status = self._primary()
2220                    _result = _call_status.result
2221                    _error = self._combine_errors(_error, _call_status.error)
2222                    break
2223                except BacktrackException, _exc:
2224                    _error = self._combine_errors(_error, _exc.error)
2225                    self._pos = _choice21
2226                    raise BacktrackException(_error)
2227                _call_status = self._primary()
2228                _result = _call_status.result
2229                _error = self._combine_errors(_error, _call_status.error)
2230                break
2231            if _status.status == _status.LEFTRECURSION:
2232                if _status.result is not None:
2233                    if _status.pos >= self._pos:
2234                        _status.status = _status.NORMAL
2235                        self._pos = _status.pos
2236                        return _status
2237                _status.pos = self._pos
2238                _status.status = _status.SOMESOLUTIONS
2239                _status.result = _result
2240                _status.error = _error
2241                self._pos = _startingpos
2242                return self._enclosed()
2243            _status.status = _status.NORMAL
2244            _status.pos = self._pos
2245            _status.result = _result
2246            _status.error = _error
2247            return _status
2248        except BacktrackException, _exc:
2249            _status.pos = -1
2250            _status.result = None
2251            _error = self._combine_errors(_error, _exc.error)
2252            _status.error = _error
2253            _status.status = _status.ERROR
2254            raise BacktrackException(_error)
2255    def primary(self):
2256        return self._primary().result
2257    def _primary(self):
2258        _key = self._pos
2259        _status = self._dict_primary.get(_key, None)
2260        if _status is None:
2261            _status = self._dict_primary[_key] = Status()
2262        else:
2263            _statusstatus = _status.status
2264            if _statusstatus == _status.NORMAL:
2265                self._pos = _status.pos
2266                return _status
2267            elif _statusstatus == _status.ERROR:
2268                raise BacktrackException(_status.error)
2269            elif (_statusstatus == _status.INPROGRESS or
2270                  _statusstatus == _status.LEFTRECURSION):
2271                _status.status = _status.LEFTRECURSION
2272                if _status.result is not None:
2273                    self._pos = _status.pos
2274                    return _status
2275                else:
2276                    raise BacktrackException(None)
2277            elif _statusstatus == _status.SOMESOLUTIONS:
2278                _status.status = _status.INPROGRESS
2279        _startingpos = self._pos
2280        try:
2281            _result = None
2282            _error = None
2283            while 1:
2284                _choice0 = self._pos
2285                try:
2286                    _call_status = self._call()
2287                    _result = _call_status.result
2288                    _error = _call_status.error
2289                    break
2290                except BacktrackException, _exc:
2291                    _error = self._combine_errors(_error, _exc.error)
2292                    self._pos = _choice0
2293                _choice1 = self._pos
2294                try:
2295                    _call_status = self._REGEX()
2296                    _result = _call_status.result
2297                    _error = self._combine_errors(_error, _call_status.error)
2298                    _before_discard2 = _result
2299                    _all3 = []
2300                    while 1:
2301                        _choice4 = self._pos
2302                        try:
2303                            _call_status = self._IGNORE()
2304                            _result = _call_status.result
2305                            _error = self._combine_errors(_error, _call_status.error)
2306                            _all3.append(_result)
2307                        except BacktrackException, _exc:
2308                            _error = self._combine_errors(_error, _exc.error)
2309                            self._pos = _choice4
2310                            break
2311                    _result = _all3
2312                    _result = _before_discard2
2313                    break
2314                except BacktrackException, _exc:
2315                    _error = self._combine_errors(_error, _exc.error)
2316                    self._pos = _choice1
2317                _choice5 = self._pos
2318                try:
2319                    _call_status = self._QUOTE()
2320                    _result = _call_status.result
2321                    _error = self._combine_errors(_error, _call_status.error)
2322                    _before_discard6 = _result
2323                    _all7 = []
2324                    while 1:
2325                        _choice8 = self._pos
2326                        try:
2327                            _call_status = self._IGNORE()
2328                            _result = _call_status.result
2329                            _error = self._combine_errors(_error, _call_status.error)
2330                            _all7.append(_result)
2331                        except BacktrackException, _exc:
2332                            _error = self._combine_errors(_error, _exc.error)
2333                            self._pos = _choice8
2334                            break
2335                    _result = _all7
2336                    _result = _before_discard6
2337                    break
2338                except BacktrackException, _exc:
2339                    _error = self._combine_errors(_error, _exc.error)
2340                    self._pos = _choice5
2341                    raise BacktrackException(_error)
2342                _call_status = self._QUOTE()
2343                _result = _call_status.result
2344                _error = self._combine_errors(_error, _call_status.error)
2345                _before_discard9 = _result
2346                _all10 = []
2347                while 1:
2348                    _choice11 = self._pos
2349                    try:
2350                        _call_status = self._IGNORE()
2351                        _result = _call_status.result
2352                        _error = self._combine_errors(_error, _call_status.error)
2353                        _all10.append(_result)
2354                    except BacktrackException, _exc:
2355                        _error = self._combine_errors(_error, _exc.error)
2356                        self._pos = _choice11
2357                        break
2358                _result = _all10
2359                _result = _before_discard9
2360                break
2361            if _status.status == _status.LEFTRECURSION:
2362                if _status.result is not None:
2363                    if _status.pos >= self._pos:
2364                        _status.status = _status.NORMAL
2365                        self._pos = _status.pos
2366                        return _status
2367                _status.pos = self._pos
2368                _status.status = _status.SOMESOLUTIONS
2369                _status.result = _result
2370                _status.error = _error
2371                self._pos = _startingpos
2372                return self._primary()
2373            _status.status = _status.NORMAL
2374            _status.pos = self._pos
2375            _status.result = _result
2376            _status.error = _error
2377            return _status
2378        except BacktrackException, _exc:
2379            _status.pos = -1
2380            _status.result = None
2381            _error = self._combine_errors(_error, _exc.error)
2382            _status.error = _error
2383            _status.status = _status.ERROR
2384            raise BacktrackException(_error)
2385    def call(self):
2386        return self._call().result
2387    def _call(self):
2388        _key = self._pos
2389        _status = self._dict_call.get(_key, None)
2390        if _status is None:
2391            _status = self._dict_call[_key] = Status()
2392        else:
2393            _statusstatus = _status.status
2394            if _statusstatus == _status.NORMAL:
2395                self._pos = _status.pos
2396                return _status
2397            elif _statusstatus == _status.ERROR:
2398                raise BacktrackException(_status.error)
2399            elif (_statusstatus == _status.INPROGRESS or
2400                  _statusstatus == _status.LEFTRECURSION):
2401                _status.status = _status.LEFTRECURSION
2402                if _status.result is not None:
2403                    self._pos = _status.pos
2404                    return _status
2405                else:
2406                    raise BacktrackException(None)
2407            elif _statusstatus == _status.SOMESOLUTIONS:
2408                _status.status = _status.INPROGRESS
2409        _startingpos = self._pos
2410        try:
2411            _result = None
2412            _error = None
2413            _call_status = self._NAME()
2414            _result = _call_status.result
2415            _error = _call_status.error
2416            x = _result
2417            _call_status = self._arguments()
2418            _result = _call_status.result
2419            _error = self._combine_errors(_error, _call_status.error)
2420            args = _result
2421            _all0 = []
2422            while 1:
2423                _choice1 = self._pos
2424                try:
2425                    _call_status = self._IGNORE()
2426                    _result = _call_status.result
2427                    _error = self._combine_errors(_error, _call_status.error)
2428                    _all0.append(_result)
2429                except BacktrackException, _exc:
2430                    _error = self._combine_errors(_error, _exc.error)
2431                    self._pos = _choice1
2432                    break
2433            _result = _all0
2434            _result = (Nonterminal("call", [x, args]))
2435            if _status.status == _status.LEFTRECURSION:
2436                if _status.result is not None:
2437                    if _status.pos >= self._pos:
2438                        _status.status = _status.NORMAL
2439                        self._pos = _status.pos
2440                        return _status
2441                _status.pos = self._pos
2442                _status.status = _status.SOMESOLUTIONS
2443                _status.result = _result
2444                _status.error = _error
2445                self._pos = _startingpos
2446                return self._call()
2447            _status.status = _status.NORMAL
2448            _status.pos = self._pos
2449            _status.result = _result
2450            _status.error = _error
2451            return _status
2452        except BacktrackException, _exc:
2453            _status.pos = -1
2454            _status.result = None
2455            _error = self._combine_errors(_error, _exc.error)
2456            _status.error = _error
2457            _status.status = _status.ERROR
2458            raise BacktrackException(_error)
2459    def arguments(self):
2460        return self._arguments().result
2461    def _arguments(self):
2462        _key = self._pos
2463        _status = self._dict_arguments.get(_key, None)
2464        if _status is None:
2465            _status = self._dict_arguments[_key] = Status()
2466        else:
2467            _statusstatus = _status.status
2468            if _statusstatus == _status.NORMAL:
2469                self._pos = _status.pos
2470                return _status
2471            elif _statusstatus == _status.ERROR:
2472                raise BacktrackException(_status.error)
2473            elif (_statusstatus == _status.INPROGRESS or
2474                  _statusstatus == _status.LEFTRECURSION):
2475                _status.status = _status.LEFTRECURSION
2476                if _status.result is not None:
2477                    self._pos = _status.pos
2478                    return _status
2479                else:
2480                    raise BacktrackException(None)
2481            elif _statusstatus == _status.SOMESOLUTIONS:
2482                _status.status = _status.INPROGRESS
2483        _startingpos = self._pos
2484        try:
2485            _result = None
2486            _error = None
2487            while 1:
2488                _choice0 = self._pos
2489                try:
2490                    _result = self.__chars__('(')
2491                    _all1 = []
2492                    while 1:
2493                        _choice2 = self._pos
2494                        try:
2495                            _call_status = self._IGNORE()
2496                            _result = _call_status.result
2497                            _error = _call_status.error
2498                            _all1.append(_result)
2499                        except BacktrackException, _exc:
2500                            _error = self._combine_errors(_error, _exc.error)
2501                            self._pos = _choice2
2502                            break
2503                    _result = _all1
2504                    _all3 = []
2505                    while 1:
2506                        _choice4 = self._pos
2507                        try:
2508                            _call_status = self._PYTHONCODE()
2509                            _result = _call_status.result
2510                            _error = self._combine_errors(_error, _call_status.error)
2511                            _before_discard5 = _result
2512                            _all6 = []
2513                            while 1:
2514                                _choice7 = self._pos
2515                                try:
2516                                    _call_status = self._IGNORE()
2517                                    _result = _call_status.result
2518                                    _error = self._combine_errors(_error, _call_status.error)
2519                                    _all6.append(_result)
2520                                except BacktrackException, _exc:
2521                                    _error = self._combine_errors(_error, _exc.error)
2522                                    self._pos = _choice7
2523                                    break
2524                            _result = _all6
2525                            _result = self.__chars__(',')
2526                            _all8 = []
2527                            while 1:
2528                                _choice9 = self._pos
2529                                try:
2530                                    _call_status = self._IGNORE()
2531                                    _result = _call_status.result
2532                                    _error = self._combine_errors(_error, _call_status.error)
2533                                    _all8.append(_result)
2534                                except BacktrackException, _exc:
2535                                    _error = self._combine_errors(_error, _exc.error)
2536                                    self._pos = _choice9
2537                                    break
2538                            _result = _all8
2539                            _result = _before_discard5
2540                            _all3.append(_result)
2541                        except BacktrackException, _exc:
2542                            _error = self._combine_errors(_error, _exc.error)
2543                            self._pos = _choice4
2544                            break
2545                    _result = _all3
2546                    args = _result
2547                    _call_status = self._PYTHONCODE()
2548                    _result = _call_status.result
2549                    _error = self._combine_errors(_error, _call_status.error)
2550                    last = _result
2551                    _result = self.__chars__(')')
2552                    _all10 = []
2553                    while 1:
2554                        _choice11 = self._pos
2555                        try:
2556                            _call_status = self._IGNORE()
2557                            _result = _call_status.result
2558                            _error = self._combine_errors(_error, _call_status.error)
2559                            _all10.append(_result)
2560                        except BacktrackException, _exc:
2561                            _error = self._combine_errors(_error, _exc.error)
2562                            self._pos = _choice11
2563                            break
2564                    _result = _all10
2565                    _result = (Nonterminal("args", args + [last]))
2566                    break
2567                except BacktrackException, _exc:
2568                    _error = self._combine_errors(_error, _exc.error)
2569                    self._pos = _choice0
2570                _choice12 = self._pos
2571                try:
2572                    _result = (Nonterminal("args", []))
2573                    break
2574                except BacktrackException, _exc:
2575                    _error = self._combine_errors(_error, _exc.error)
2576                    self._pos = _choice12
2577                    raise BacktrackException(_error)
2578                _result = (Nonterminal("args", []))
2579                break
2580            if _status.status == _status.LEFTRECURSION:
2581                if _status.result is not None:
2582                    if _status.pos >= self._pos:
2583                        _status.status = _status.NORMAL
2584                        self._pos = _status.pos
2585                        return _status
2586                _status.pos = self._pos
2587                _status.status = _status.SOMESOLUTIONS
2588                _status.result = _result
2589                _status.error = _error
2590                self._pos = _startingpos
2591                return self._arguments()
2592            _status.status = _status.NORMAL
2593            _status.pos = self._pos
2594            _status.result = _result
2595            _status.error = _error
2596            return _status
2597        except BacktrackException, _exc:
2598            _status.pos = -1
2599            _status.result = None
2600            _error = self._combine_errors(_error, _exc.error)
2601            _status.error = _error
2602            _status.status = _status.ERROR
2603            raise BacktrackException(_error)
2604    def __init__(self, inputstream):
2605        self._dict_NAME = {}
2606        self._dict_SPACE = {}
2607        self._dict_COMMENT = {}
2608        self._dict_IGNORE = {}
2609        self._dict_newline = {}
2610        self._dict_REGEX = {}
2611        self._dict_QUOTE = {}
2612        self._dict_PYTHONCODE = {}
2613        self._dict_EOF = {}
2614        self._dict_file = {}
2615        self._dict_list = {}
2616        self._dict_production = {}
2617        self._dict_productionargs = {}
2618        self._dict_or_ = {}
2619        self._dict_commands = {}
2620        self._dict_command = {}
2621        self._dict_simplecommand = {}
2622        self._dict_return_ = {}
2623        self._dict_if_ = {}
2624        self._dict_choose = {}
2625        self._dict_commandchain = {}
2626        self._dict_named_command = {}
2627        self._dict_repetition = {}
2628        self._dict_negation = {}
2629        self._dict_enclosed = {}
2630        self._dict_primary = {}
2631        self._dict_call = {}
2632        self._dict_arguments = {}
2633        self._pos = 0
2634        self._inputstream = inputstream
2635    def _regex299149370(self):
2636        _choice13 = self._pos
2637        _runner = self._Runner(self._inputstream, self._pos)
2638        _i = _runner.recognize_299149370(self._pos)
2639        if _runner.last_matched_state == -1:
2640            self._pos = _choice13
2641            raise BacktrackException
2642        _upto = _runner.last_matched_index + 1
2643        _pos = self._pos
2644        assert _pos >= 0
2645        assert _upto >= 0
2646        _result = self._inputstream[_pos: _upto]
2647        self._pos = _upto
2648        return _result
2649    def _regex1006631623(self):
2650        _choice14 = self._pos
2651        _runner = self._Runner(self._inputstream, self._pos)
2652        _i = _runner.recognize_1006631623(self._pos)
2653        if _runner.last_matched_state == -1:
2654            self._pos = _choice14
2655            raise BacktrackException
2656        _upto = _runner.last_matched_index + 1
2657        _pos = self._pos
2658        assert _pos >= 0
2659        assert _upto >= 0
2660        _result = self._inputstream[_pos: _upto]
2661        self._pos = _upto
2662        return _result
2663    def _regex528667127(self):
2664        _choice15 = self._pos
2665        _runner = self._Runner(self._inputstream, self._pos)
2666        _i = _runner.recognize_528667127(self._pos)
2667        if _runner.last_matched_state == -1:
2668            self._pos = _choice15
2669            raise BacktrackException
2670        _upto = _runner.last_matched_index + 1
2671        _pos = self._pos
2672        assert _pos >= 0
2673        assert _upto >= 0
2674        _result = self._inputstream[_pos: _upto]
2675        self._pos = _upto
2676        return _result
2677    def _regex291086639(self):
2678        _choice16 = self._pos
2679        _runner = self._Runner(self._inputstream, self._pos)
2680        _i = _runner.recognize_291086639(self._pos)
2681        if _runner.last_matched_state == -1:
2682            self._pos = _choice16
2683            raise BacktrackException
2684        _upto = _runner.last_matched_index + 1
2685        _pos = self._pos
2686        assert _pos >= 0
2687        assert _upto >= 0
2688        _result = self._inputstream[_pos: _upto]
2689        self._pos = _upto
2690        return _result
2691    def _regex1074651696(self):
2692        _choice17 = self._pos
2693        _runner = self._Runner(self._inputstream, self._pos)
2694        _i = _runner.recognize_1074651696(self._pos)
2695        if _runner.last_matched_state == -1:
2696            self._pos = _choice17
2697            raise BacktrackException
2698        _upto = _runner.last_matched_index + 1
2699        _pos = self._pos
2700        assert _pos >= 0
2701        assert _upto >= 0
2702        _result = self._inputstream[_pos: _upto]
2703        self._pos = _upto
2704        return _result
2705    def _regex1124192327(self):
2706        _choice18 = self._pos
2707        _runner = self._Runner(self._inputstream, self._pos)
2708        _i = _runner.recognize_1124192327(self._pos)
2709        if _runner.last_matched_state == -1:
2710            self._pos = _choice18
2711            raise BacktrackException
2712        _upto = _runner.last_matched_index + 1
2713        _pos = self._pos
2714        assert _pos >= 0
2715        assert _upto >= 0
2716        _result = self._inputstream[_pos: _upto]
2717        self._pos = _upto
2718        return _result
2719    def _regex1979538501(self):
2720        _choice19 = self._pos
2721        _runner = self._Runner(self._inputstream, self._pos)
2722        _i = _runner.recognize_1979538501(self._pos)
2723        if _runner.last_matched_state == -1:
2724            self._pos = _choice19
2725            raise BacktrackException
2726        _upto = _runner.last_matched_index + 1
2727        _pos = self._pos
2728        assert _pos >= 0
2729        assert _upto >= 0
2730        _result = self._inputstream[_pos: _upto]
2731        self._pos = _upto
2732        return _result
2733    class _Runner(object):
2734        def __init__(self, text, pos):
2735            self.text = text
2736            self.pos = pos
2737            self.last_matched_state = -1
2738            self.last_matched_index = -1
2739            self.state = -1
2740        def recognize_299149370(runner, i):
2741            #auto-generated code, don't edit
2742            assert i >= 0
2743            input = runner.text
2744            state = 0
2745            while 1:
2746                if state == 0:
2747                    runner.last_matched_index = i - 1
2748                    runner.last_matched_state = state
2749                    try:
2750                        char = input[i]
2751                        i += 1
2752                    except IndexError:
2753                        runner.state = 0
2754                        return i
2755                    if char == '\n':
2756                        state = 1
2757                    elif char == ' ':
2758                        state = 2
2759                    else:
2760                        break
2761                if state == 1:
2762                    runner.last_matched_index = i - 1
2763                    runner.last_matched_state = state
2764                    try:
2765                        char = input[i]
2766                        i += 1
2767                    except IndexError:
2768                        runner.state = 1
2769                        return i
2770                    if char == '\n':
2771                        state = 1
2772                        continue
2773                    elif char == ' ':
2774                        state = 1
2775                        continue
2776                    else:
2777                        break
2778                if state == 2:
2779                    try:
2780                        char = input[i]
2781                        i += 1
2782                    except IndexError:
2783                        runner.state = 2
2784                        return ~i
2785                    if char == '\n':
2786                        state = 1
2787                        continue
2788                    elif char == ' ':
2789                        state = 2
2790                        continue
2791                    else:
2792                        break
2793                runner.last_matched_state = state
2794                runner.last_matched_index = i - 1
2795                runner.state = state
2796                if i == len(input):
2797                    return i
2798                else:
2799                    return ~i
2800                break
2801            runner.state = state
2802            return ~i
2803        def recognize_1006631623(runner, i):
2804            #auto-generated code, don't edit
2805            assert i >= 0
2806            input = runner.text
2807            state = 0
2808            while 1:
2809                if state == 0:
2810                    try:
2811                        char = input[i]
2812                        i += 1
2813                    except IndexError:
2814                        runner.state = 0
2815                        return ~i
2816                    if char == '`':
2817                        state = 3
2818                    else:
2819                        break
2820                if state == 2:
2821                    try:
2822                        char = input[i]
2823                        i += 1
2824                    except IndexError:
2825                        runner.state = 2
2826                        return ~i
2827                    if '\x00' <= char <= '\xff':
2828                        state = 3
2829                    else:
2830                        break
2831                if state == 3:
2832                    try:
2833                        char = input[i]
2834                        i += 1
2835                    except IndexError:
2836                        runner.state = 3
2837                        return ~i
2838                    if char == '`':
2839                        state = 1
2840                    elif char == '\\':
2841                        state = 2
2842                        continue
2843                    elif ']' <= char <= '_':
2844                        state = 3
2845                        continue
2846                    elif '\x00' <= char <= '[':
2847                        state = 3
2848                        continue
2849                    elif 'a' <= char <= '\xff':
2850                        state = 3
2851                        continue
2852                    else:
2853                        break
2854                runner.last_matched_state = state
2855                runner.last_matched_index = i - 1
2856                runner.state = state
2857                if i == len(input):
2858                    return i
2859                else:
2860                    return ~i
2861                break
2862            runner.state = state
2863            return ~i
2864        def recognize_528667127(runner, i):
2865            #auto-generated code, don't edit
2866            assert i >= 0
2867            input = runner.text
2868            state = 0
2869            while 1:
2870                if state == 0:
2871                    try:
2872                        char = input[i]
2873                        i += 1
2874                    except IndexError:
2875                        runner.state = 0
2876                        return ~i
2877                    if char == ' ':
2878                        state = 0
2879                        continue
2880                    elif char == '#':
2881                        state = 2
2882                    else:
2883                        break
2884                if state == 1:
2885                    runner.last_matched_index = i - 1
2886                    runner.last_matched_state = state
2887                    try:
2888                        char = input[i]
2889                        i += 1
2890                    except IndexError:
2891                        runner.state = 1
2892                        return i
2893                    if char == ' ':
2894                        state = 0
2895                        continue
2896                    elif char == '#':
2897                        state = 2
2898                    else:
2899                        break
2900                if state == 2:
2901                    try:
2902                        char = input[i]
2903                        i += 1
2904                    except IndexError:
2905                        runner.state = 2
2906                        return ~i
2907                    if char == '\n':
2908                        state = 1
2909                        continue
2910                    elif '\x00' <= char <= '\t':
2911                        state = 2
2912                        continue
2913                    elif '\x0b' <= char <= '\xff':
2914                        state = 2
2915                        continue
2916                    else:
2917                        break
2918                runner.last_matched_state = state
2919                runner.last_matched_index = i - 1
2920                runner.state = state
2921                if i == len(input):
2922                    return i
2923                else:
2924                    return ~i
2925                break
2926            runner.state = state
2927            return ~i
2928        def recognize_291086639(runner, i):
2929            #auto-generated code, don't edit
2930            assert i >= 0
2931            input = runner.text
2932            state = 0
2933            while 1:
2934                if state == 0:
2935                    try:
2936                        char = input[i]
2937                        i += 1
2938                    except IndexError:
2939                        runner.state = 0
2940                        return ~i
2941                    if char == '{':
2942                        state = 2
2943                    else:
2944                        break
2945                if state == 2:
2946                    try:
2947                        char = input[i]
2948                        i += 1
2949                    except IndexError:
2950                        runner.state = 2
2951                        return ~i
2952                    if char == '}':
2953                        state = 1
2954                    elif '\x00' <= char <= '\t':
2955                        state = 2
2956                        continue
2957                    elif '\x0b' <= char <= '|':
2958                        state = 2
2959                        continue
2960                    elif '~' <= char <= '\xff':
2961                        state = 2
2962                        continue
2963                    else:
2964                        break
2965                runner.last_matched_state = state
2966                runner.last_matched_index = i - 1
2967                runner.state = state
2968                if i == len(input):
2969                    return i
2970                else:
2971                    return ~i
2972                break
2973            runner.state = state
2974            return ~i
2975        def recognize_1074651696(runner, i):
2976            #auto-generated code, don't edit
2977            assert i >= 0
2978            input = runner.text
2979            state = 0
2980            while 1:
2981                if state == 0:
2982                    try:
2983                        char = input[i]
2984                        i += 1
2985                    except IndexError:
2986                        runner.state = 0
2987                        return ~i
2988                    if char == '_':
2989                        state = 1
2990                    elif 'A' <= char <= 'Z':
2991                        state = 1
2992                    elif 'a' <= char <= 'z':
2993                        state = 1
2994                    else:
2995                        break
2996                if state == 1:
2997                    runner.last_matched_index = i - 1
2998                    runner.last_matched_state = state
2999                    try:
3000                        char = input[i]
3001                        i += 1
3002                    except IndexError:
3003                        runner.state = 1
3004                        return i
3005                    if char == '_':
3006                        state = 1
3007                        continue
3008                    elif '0' <= char <= '9':
3009                        state = 1
3010                        continue
3011                    elif 'A' <= char <= 'Z':
3012                        state = 1
3013                        continue
3014                    elif 'a' <= char <= 'z':
3015                        state = 1
3016                        continue
3017                    else:
3018                        break
3019                runner.last_matched_state = state
3020                runner.last_matched_index = i - 1
3021                runner.state = state
3022                if i == len(input):
3023                    return i
3024                else:
3025                    return ~i
3026                break
3027            runner.state = state
3028            return ~i
3029        def recognize_1124192327(runner, i):
3030            #auto-generated code, don't edit
3031            assert i >= 0
3032            input = runner.text
3033            state = 0
3034            while 1:
3035                if state == 0:
3036                    try:
3037                        char = input[i]
3038                        i += 1
3039                    except IndexError:
3040                        runner.state = 0
3041                        return ~i
3042                    if char == "'":
3043                        state = 1
3044                    else:
3045                        break
3046                if state == 1:
3047                    try:
3048                        char = input[i]
3049                        i += 1
3050                    except IndexError:
3051                        runner.state = 1
3052                        return ~i
3053                    if '\x00' <= char <= '&':
3054                        state = 1
3055                        continue
3056                    elif '(' <= char <= '\xff':
3057                        state = 1
3058                        continue
3059                    elif char == "'":
3060                        state = 2
3061                    else:
3062                        break
3063                runner.last_matched_state = state
3064                runner.last_matched_index = i - 1
3065                runner.state = state
3066                if i == len(input):
3067                    return i
3068                else:
3069                    return ~i
3070                break
3071            runner.state = state
3072            return ~i
3073        def recognize_1979538501(runner, i):
3074            #auto-generated code, don't edit
3075            assert i >= 0
3076            input = runner.text
3077            state = 0
3078            while 1:
3079                if state == 0:
3080                    try:
3081                        char = input[i]
3082                        i += 1
3083                    except IndexError:
3084                        runner.state = 0
3085                        return ~i
3086                    if char == '#':
3087                        state = 1
3088                    elif char == ' ':
3089                        state = 2
3090                    elif char == '\t':
3091                        state = 2
3092                    elif char == '\n':
3093                        state = 2
3094                    else:
3095                        break
3096                if state == 1:
3097                    try:
3098                        char = input[i]
3099                        i += 1
3100                    except IndexError:
3101                        runner.state = 1
3102                        return ~i
3103                    if '\x00' <= char <= '\t':
3104                        state = 1
3105                        continue
3106                    elif '\x0b' <= char <= '\xff':
3107                        state = 1
3108                        continue
3109                    elif char == '\n':
3110                        state = 2
3111                    else:
3112                        break
3113                runner.last_matched_state = state
3114                runner.last_matched_index = i - 1
3115                runner.state = state
3116                if i == len(input):
3117                    return i
3118                else:
3119                    return ~i
3120                break
3121            runner.state = state
3122            return ~i
3123class PyPackratSyntaxParser(PackratParser):
3124    def __init__(self, stream):
3125        self.init_parser(stream)
3126forbidden = dict.fromkeys(("__weakref__ __doc__ "
3127                           "__dict__ __module__").split())
3128initthere = "__init__" in PyPackratSyntaxParser.__dict__
3129for key, value in Parser.__dict__.iteritems():
3130    if key not in PyPackratSyntaxParser.__dict__ and key not in forbidden:
3131        setattr(PyPackratSyntaxParser, key, value)
3132PyPackratSyntaxParser.init_parser = Parser.__init__.im_func