PageRenderTime 8ms CodeModel.GetById 4ms app.highlight 102ms 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

Large files files are truncated, but you can click here to view the full 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 Backtra

Large files files are truncated, but you can click here to view the full file