Best Python code snippet using gherkin-python
parser.py
Source:parser.py  
...63            token_scanner,64            token_matcher,65            deque(),66            [])67        self.start_rule(context, 'GherkinDocument')68        state = 069        token = None70        while True:71            token = self.read_token(context)72            state = self.match_token(state, token, context)73            if token.eof():74                break75        self.end_rule(context, 'GherkinDocument')76        if context.errors:77            raise CompositeParserException(context.errors)78        return self.get_result()79    def build(self, context, token):80        self.handle_ast_error(context, token, self.ast_builder.build)81    def add_error(self, context, error):82        context.errors.append(error)83        if len(context.errors) > 10:84            raise CompositeParserException(context.errors)85    def start_rule(self, context, rule_type):86        self.handle_ast_error(context, rule_type, self.ast_builder.start_rule)87    def end_rule(self, context, rule_type):88        self.handle_ast_error(context, rule_type, self.ast_builder.end_rule)89    def get_result(self):90        return self.ast_builder.get_result()91    def read_token(self, context):92        if context.token_queue:93            return context.token_queue.popleft()94        else:95            return context.token_scanner.read()96    def match_EOF(self, context, token):97        return self.handle_external_error(context, False, token, context.token_matcher.match_EOF)98    def match_Empty(self, context, token):99        if token.eof():100            return False101        return self.handle_external_error(context, False, token, context.token_matcher.match_Empty)102    def match_Comment(self, context, token):103        if token.eof():104            return False105        return self.handle_external_error(context, False, token, context.token_matcher.match_Comment)106    def match_TagLine(self, context, token):107        if token.eof():108            return False109        return self.handle_external_error(context, False, token, context.token_matcher.match_TagLine)110    def match_FeatureLine(self, context, token):111        if token.eof():112            return False113        return self.handle_external_error(context, False, token, context.token_matcher.match_FeatureLine)114    def match_BackgroundLine(self, context, token):115        if token.eof():116            return False117        return self.handle_external_error(context, False, token, context.token_matcher.match_BackgroundLine)118    def match_ScenarioLine(self, context, token):119        if token.eof():120            return False121        return self.handle_external_error(context, False, token, context.token_matcher.match_ScenarioLine)122    def match_ScenarioOutlineLine(self, context, token):123        if token.eof():124            return False125        return self.handle_external_error(context, False, token, context.token_matcher.match_ScenarioOutlineLine)126    def match_ExamplesLine(self, context, token):127        if token.eof():128            return False129        return self.handle_external_error(context, False, token, context.token_matcher.match_ExamplesLine)130    def match_StepLine(self, context, token):131        if token.eof():132            return False133        return self.handle_external_error(context, False, token, context.token_matcher.match_StepLine)134    def match_DocStringSeparator(self, context, token):135        if token.eof():136            return False137        return self.handle_external_error(context, False, token, context.token_matcher.match_DocStringSeparator)138    def match_TableRow(self, context, token):139        if token.eof():140            return False141        return self.handle_external_error(context, False, token, context.token_matcher.match_TableRow)142    def match_Language(self, context, token):143        if token.eof():144            return False145        return self.handle_external_error(context, False, token, context.token_matcher.match_Language)146    def match_Other(self, context, token):147        if token.eof():148            return False149        return self.handle_external_error(context, False, token, context.token_matcher.match_Other)150    def match_token(self, state, token, context):151        state_map = {152            0: self.match_token_at_0,153            1: self.match_token_at_1,154            2: self.match_token_at_2,155            3: self.match_token_at_3,156            4: self.match_token_at_4,157            5: self.match_token_at_5,158            6: self.match_token_at_6,159            7: self.match_token_at_7,160            8: self.match_token_at_8,161            9: self.match_token_at_9,162            10: self.match_token_at_10,163            11: self.match_token_at_11,164            12: self.match_token_at_12,165            13: self.match_token_at_13,166            14: self.match_token_at_14,167            15: self.match_token_at_15,168            16: self.match_token_at_16,169            17: self.match_token_at_17,170            18: self.match_token_at_18,171            19: self.match_token_at_19,172            20: self.match_token_at_20,173            21: self.match_token_at_21,174            22: self.match_token_at_22,175            23: self.match_token_at_23,176            24: self.match_token_at_24,177            25: self.match_token_at_25,178            26: self.match_token_at_26,179            28: self.match_token_at_28,180            29: self.match_token_at_29,181            30: self.match_token_at_30,182            31: self.match_token_at_31,183            32: self.match_token_at_32,184            33: self.match_token_at_33,185        }186        if state in state_map:187            return state_map[state](token, context)188        else:189            raise RuntimeError("Unknown state: " + str(state))190    # Start191    def match_token_at_0(self, token, context):192        if self.match_EOF(context, token):193                self.build(context, token)194                return 27195        if self.match_Language(context, token):196                self.start_rule(context, 'Feature')197                self.start_rule(context, 'Feature_Header')198                self.build(context, token)199                return 1200        if self.match_TagLine(context, token):201                self.start_rule(context, 'Feature')202                self.start_rule(context, 'Feature_Header')203                self.start_rule(context, 'Tags')204                self.build(context, token)205                return 2206        if self.match_FeatureLine(context, token):207                self.start_rule(context, 'Feature')208                self.start_rule(context, 'Feature_Header')209                self.build(context, token)210                return 3211        if self.match_Comment(context, token):212                self.build(context, token)213                return 0214        if self.match_Empty(context, token):215                self.build(context, token)216                return 0217        state_comment = "State: 0 - Start"218        token.detach219        expected_tokens = ["#EOF", "#Language", "#TagLine", "#FeatureLine", "#Comment", "#Empty"]220        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)221        if (self.stop_at_first_error):222            raise error223        self.add_error(context, error)224        return 0225    # GherkinDocument:0>Feature:0>Feature_Header:0>#Language:0226    def match_token_at_1(self, token, context):227        if self.match_TagLine(context, token):228                self.start_rule(context, 'Tags')229                self.build(context, token)230                return 2231        if self.match_FeatureLine(context, token):232                self.build(context, token)233                return 3234        if self.match_Comment(context, token):235                self.build(context, token)236                return 1237        if self.match_Empty(context, token):238                self.build(context, token)239                return 1240        state_comment = "State: 1 - GherkinDocument:0>Feature:0>Feature_Header:0>#Language:0"241        token.detach242        expected_tokens = ["#TagLine", "#FeatureLine", "#Comment", "#Empty"]243        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)244        if (self.stop_at_first_error):245            raise error246        self.add_error(context, error)247        return 1248    # GherkinDocument:0>Feature:0>Feature_Header:1>Tags:0>#TagLine:0249    def match_token_at_2(self, token, context):250        if self.match_TagLine(context, token):251                self.build(context, token)252                return 2253        if self.match_FeatureLine(context, token):254                self.end_rule(context, 'Tags')255                self.build(context, token)256                return 3257        if self.match_Comment(context, token):258                self.build(context, token)259                return 2260        if self.match_Empty(context, token):261                self.build(context, token)262                return 2263        state_comment = "State: 2 - GherkinDocument:0>Feature:0>Feature_Header:1>Tags:0>#TagLine:0"264        token.detach265        expected_tokens = ["#TagLine", "#FeatureLine", "#Comment", "#Empty"]266        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)267        if (self.stop_at_first_error):268            raise error269        self.add_error(context, error)270        return 2271    # GherkinDocument:0>Feature:0>Feature_Header:2>#FeatureLine:0272    def match_token_at_3(self, token, context):273        if self.match_EOF(context, token):274                self.end_rule(context, 'Feature_Header')275                self.end_rule(context, 'Feature')276                self.build(context, token)277                return 27278        if self.match_Empty(context, token):279                self.build(context, token)280                return 3281        if self.match_Comment(context, token):282                self.build(context, token)283                return 5284        if self.match_BackgroundLine(context, token):285                self.end_rule(context, 'Feature_Header')286                self.start_rule(context, 'Background')287                self.build(context, token)288                return 6289        if self.match_TagLine(context, token):290                self.end_rule(context, 'Feature_Header')291                self.start_rule(context, 'Scenario_Definition')292                self.start_rule(context, 'Tags')293                self.build(context, token)294                return 11295        if self.match_ScenarioLine(context, token):296                self.end_rule(context, 'Feature_Header')297                self.start_rule(context, 'Scenario_Definition')298                self.start_rule(context, 'Scenario')299                self.build(context, token)300                return 12301        if self.match_ScenarioOutlineLine(context, token):302                self.end_rule(context, 'Feature_Header')303                self.start_rule(context, 'Scenario_Definition')304                self.start_rule(context, 'ScenarioOutline')305                self.build(context, token)306                return 17307        if self.match_Other(context, token):308                self.start_rule(context, 'Description')309                self.build(context, token)310                return 4311        state_comment = "State: 3 - GherkinDocument:0>Feature:0>Feature_Header:2>#FeatureLine:0"312        token.detach313        expected_tokens = ["#EOF", "#Empty", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]314        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)315        if (self.stop_at_first_error):316            raise error317        self.add_error(context, error)318        return 3319    # GherkinDocument:0>Feature:0>Feature_Header:3>Feature_Description:0>Description_Helper:1>Description:0>#Other:0320    def match_token_at_4(self, token, context):321        if self.match_EOF(context, token):322                self.end_rule(context, 'Description')323                self.end_rule(context, 'Feature_Header')324                self.end_rule(context, 'Feature')325                self.build(context, token)326                return 27327        if self.match_Comment(context, token):328                self.end_rule(context, 'Description')329                self.build(context, token)330                return 5331        if self.match_BackgroundLine(context, token):332                self.end_rule(context, 'Description')333                self.end_rule(context, 'Feature_Header')334                self.start_rule(context, 'Background')335                self.build(context, token)336                return 6337        if self.match_TagLine(context, token):338                self.end_rule(context, 'Description')339                self.end_rule(context, 'Feature_Header')340                self.start_rule(context, 'Scenario_Definition')341                self.start_rule(context, 'Tags')342                self.build(context, token)343                return 11344        if self.match_ScenarioLine(context, token):345                self.end_rule(context, 'Description')346                self.end_rule(context, 'Feature_Header')347                self.start_rule(context, 'Scenario_Definition')348                self.start_rule(context, 'Scenario')349                self.build(context, token)350                return 12351        if self.match_ScenarioOutlineLine(context, token):352                self.end_rule(context, 'Description')353                self.end_rule(context, 'Feature_Header')354                self.start_rule(context, 'Scenario_Definition')355                self.start_rule(context, 'ScenarioOutline')356                self.build(context, token)357                return 17358        if self.match_Other(context, token):359                self.build(context, token)360                return 4361        state_comment = "State: 4 - GherkinDocument:0>Feature:0>Feature_Header:3>Feature_Description:0>Description_Helper:1>Description:0>#Other:0"362        token.detach363        expected_tokens = ["#EOF", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]364        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)365        if (self.stop_at_first_error):366            raise error367        self.add_error(context, error)368        return 4369    # GherkinDocument:0>Feature:0>Feature_Header:3>Feature_Description:0>Description_Helper:2>#Comment:0370    def match_token_at_5(self, token, context):371        if self.match_EOF(context, token):372                self.end_rule(context, 'Feature_Header')373                self.end_rule(context, 'Feature')374                self.build(context, token)375                return 27376        if self.match_Comment(context, token):377                self.build(context, token)378                return 5379        if self.match_BackgroundLine(context, token):380                self.end_rule(context, 'Feature_Header')381                self.start_rule(context, 'Background')382                self.build(context, token)383                return 6384        if self.match_TagLine(context, token):385                self.end_rule(context, 'Feature_Header')386                self.start_rule(context, 'Scenario_Definition')387                self.start_rule(context, 'Tags')388                self.build(context, token)389                return 11390        if self.match_ScenarioLine(context, token):391                self.end_rule(context, 'Feature_Header')392                self.start_rule(context, 'Scenario_Definition')393                self.start_rule(context, 'Scenario')394                self.build(context, token)395                return 12396        if self.match_ScenarioOutlineLine(context, token):397                self.end_rule(context, 'Feature_Header')398                self.start_rule(context, 'Scenario_Definition')399                self.start_rule(context, 'ScenarioOutline')400                self.build(context, token)401                return 17402        if self.match_Empty(context, token):403                self.build(context, token)404                return 5405        state_comment = "State: 5 - GherkinDocument:0>Feature:0>Feature_Header:3>Feature_Description:0>Description_Helper:2>#Comment:0"406        token.detach407        expected_tokens = ["#EOF", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]408        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)409        if (self.stop_at_first_error):410            raise error411        self.add_error(context, error)412        return 5413    # GherkinDocument:0>Feature:1>Background:0>#BackgroundLine:0414    def match_token_at_6(self, token, context):415        if self.match_EOF(context, token):416                self.end_rule(context, 'Background')417                self.end_rule(context, 'Feature')418                self.build(context, token)419                return 27420        if self.match_Empty(context, token):421                self.build(context, token)422                return 6423        if self.match_Comment(context, token):424                self.build(context, token)425                return 8426        if self.match_StepLine(context, token):427                self.start_rule(context, 'Step')428                self.build(context, token)429                return 9430        if self.match_TagLine(context, token):431                self.end_rule(context, 'Background')432                self.start_rule(context, 'Scenario_Definition')433                self.start_rule(context, 'Tags')434                self.build(context, token)435                return 11436        if self.match_ScenarioLine(context, token):437                self.end_rule(context, 'Background')438                self.start_rule(context, 'Scenario_Definition')439                self.start_rule(context, 'Scenario')440                self.build(context, token)441                return 12442        if self.match_ScenarioOutlineLine(context, token):443                self.end_rule(context, 'Background')444                self.start_rule(context, 'Scenario_Definition')445                self.start_rule(context, 'ScenarioOutline')446                self.build(context, token)447                return 17448        if self.match_Other(context, token):449                self.start_rule(context, 'Description')450                self.build(context, token)451                return 7452        state_comment = "State: 6 - GherkinDocument:0>Feature:1>Background:0>#BackgroundLine:0"453        token.detach454        expected_tokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]455        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)456        if (self.stop_at_first_error):457            raise error458        self.add_error(context, error)459        return 6460    # GherkinDocument:0>Feature:1>Background:1>Background_Description:0>Description_Helper:1>Description:0>#Other:0461    def match_token_at_7(self, token, context):462        if self.match_EOF(context, token):463                self.end_rule(context, 'Description')464                self.end_rule(context, 'Background')465                self.end_rule(context, 'Feature')466                self.build(context, token)467                return 27468        if self.match_Comment(context, token):469                self.end_rule(context, 'Description')470                self.build(context, token)471                return 8472        if self.match_StepLine(context, token):473                self.end_rule(context, 'Description')474                self.start_rule(context, 'Step')475                self.build(context, token)476                return 9477        if self.match_TagLine(context, token):478                self.end_rule(context, 'Description')479                self.end_rule(context, 'Background')480                self.start_rule(context, 'Scenario_Definition')481                self.start_rule(context, 'Tags')482                self.build(context, token)483                return 11484        if self.match_ScenarioLine(context, token):485                self.end_rule(context, 'Description')486                self.end_rule(context, 'Background')487                self.start_rule(context, 'Scenario_Definition')488                self.start_rule(context, 'Scenario')489                self.build(context, token)490                return 12491        if self.match_ScenarioOutlineLine(context, token):492                self.end_rule(context, 'Description')493                self.end_rule(context, 'Background')494                self.start_rule(context, 'Scenario_Definition')495                self.start_rule(context, 'ScenarioOutline')496                self.build(context, token)497                return 17498        if self.match_Other(context, token):499                self.build(context, token)500                return 7501        state_comment = "State: 7 - GherkinDocument:0>Feature:1>Background:1>Background_Description:0>Description_Helper:1>Description:0>#Other:0"502        token.detach503        expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]504        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)505        if (self.stop_at_first_error):506            raise error507        self.add_error(context, error)508        return 7509    # GherkinDocument:0>Feature:1>Background:1>Background_Description:0>Description_Helper:2>#Comment:0510    def match_token_at_8(self, token, context):511        if self.match_EOF(context, token):512                self.end_rule(context, 'Background')513                self.end_rule(context, 'Feature')514                self.build(context, token)515                return 27516        if self.match_Comment(context, token):517                self.build(context, token)518                return 8519        if self.match_StepLine(context, token):520                self.start_rule(context, 'Step')521                self.build(context, token)522                return 9523        if self.match_TagLine(context, token):524                self.end_rule(context, 'Background')525                self.start_rule(context, 'Scenario_Definition')526                self.start_rule(context, 'Tags')527                self.build(context, token)528                return 11529        if self.match_ScenarioLine(context, token):530                self.end_rule(context, 'Background')531                self.start_rule(context, 'Scenario_Definition')532                self.start_rule(context, 'Scenario')533                self.build(context, token)534                return 12535        if self.match_ScenarioOutlineLine(context, token):536                self.end_rule(context, 'Background')537                self.start_rule(context, 'Scenario_Definition')538                self.start_rule(context, 'ScenarioOutline')539                self.build(context, token)540                return 17541        if self.match_Empty(context, token):542                self.build(context, token)543                return 8544        state_comment = "State: 8 - GherkinDocument:0>Feature:1>Background:1>Background_Description:0>Description_Helper:2>#Comment:0"545        token.detach546        expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]547        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)548        if (self.stop_at_first_error):549            raise error550        self.add_error(context, error)551        return 8552    # GherkinDocument:0>Feature:1>Background:2>Scenario_Step:0>Step:0>#StepLine:0553    def match_token_at_9(self, token, context):554        if self.match_EOF(context, token):555                self.end_rule(context, 'Step')556                self.end_rule(context, 'Background')557                self.end_rule(context, 'Feature')558                self.build(context, token)559                return 27560        if self.match_TableRow(context, token):561                self.start_rule(context, 'DataTable')562                self.build(context, token)563                return 10564        if self.match_DocStringSeparator(context, token):565                self.start_rule(context, 'DocString')566                self.build(context, token)567                return 32568        if self.match_StepLine(context, token):569                self.end_rule(context, 'Step')570                self.start_rule(context, 'Step')571                self.build(context, token)572                return 9573        if self.match_TagLine(context, token):574                self.end_rule(context, 'Step')575                self.end_rule(context, 'Background')576                self.start_rule(context, 'Scenario_Definition')577                self.start_rule(context, 'Tags')578                self.build(context, token)579                return 11580        if self.match_ScenarioLine(context, token):581                self.end_rule(context, 'Step')582                self.end_rule(context, 'Background')583                self.start_rule(context, 'Scenario_Definition')584                self.start_rule(context, 'Scenario')585                self.build(context, token)586                return 12587        if self.match_ScenarioOutlineLine(context, token):588                self.end_rule(context, 'Step')589                self.end_rule(context, 'Background')590                self.start_rule(context, 'Scenario_Definition')591                self.start_rule(context, 'ScenarioOutline')592                self.build(context, token)593                return 17594        if self.match_Comment(context, token):595                self.build(context, token)596                return 9597        if self.match_Empty(context, token):598                self.build(context, token)599                return 9600        state_comment = "State: 9 - GherkinDocument:0>Feature:1>Background:2>Scenario_Step:0>Step:0>#StepLine:0"601        token.detach602        expected_tokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]603        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)604        if (self.stop_at_first_error):605            raise error606        self.add_error(context, error)607        return 9608    # GherkinDocument:0>Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0609    def match_token_at_10(self, token, context):610        if self.match_EOF(context, token):611                self.end_rule(context, 'DataTable')612                self.end_rule(context, 'Step')613                self.end_rule(context, 'Background')614                self.end_rule(context, 'Feature')615                self.build(context, token)616                return 27617        if self.match_TableRow(context, token):618                self.build(context, token)619                return 10620        if self.match_StepLine(context, token):621                self.end_rule(context, 'DataTable')622                self.end_rule(context, 'Step')623                self.start_rule(context, 'Step')624                self.build(context, token)625                return 9626        if self.match_TagLine(context, token):627                self.end_rule(context, 'DataTable')628                self.end_rule(context, 'Step')629                self.end_rule(context, 'Background')630                self.start_rule(context, 'Scenario_Definition')631                self.start_rule(context, 'Tags')632                self.build(context, token)633                return 11634        if self.match_ScenarioLine(context, token):635                self.end_rule(context, 'DataTable')636                self.end_rule(context, 'Step')637                self.end_rule(context, 'Background')638                self.start_rule(context, 'Scenario_Definition')639                self.start_rule(context, 'Scenario')640                self.build(context, token)641                return 12642        if self.match_ScenarioOutlineLine(context, token):643                self.end_rule(context, 'DataTable')644                self.end_rule(context, 'Step')645                self.end_rule(context, 'Background')646                self.start_rule(context, 'Scenario_Definition')647                self.start_rule(context, 'ScenarioOutline')648                self.build(context, token)649                return 17650        if self.match_Comment(context, token):651                self.build(context, token)652                return 10653        if self.match_Empty(context, token):654                self.build(context, token)655                return 10656        state_comment = "State: 10 - GherkinDocument:0>Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"657        token.detach658        expected_tokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]659        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)660        if (self.stop_at_first_error):661            raise error662        self.add_error(context, error)663        return 10664    # GherkinDocument:0>Feature:2>Scenario_Definition:0>Tags:0>#TagLine:0665    def match_token_at_11(self, token, context):666        if self.match_TagLine(context, token):667                self.build(context, token)668                return 11669        if self.match_ScenarioLine(context, token):670                self.end_rule(context, 'Tags')671                self.start_rule(context, 'Scenario')672                self.build(context, token)673                return 12674        if self.match_ScenarioOutlineLine(context, token):675                self.end_rule(context, 'Tags')676                self.start_rule(context, 'ScenarioOutline')677                self.build(context, token)678                return 17679        if self.match_Comment(context, token):680                self.build(context, token)681                return 11682        if self.match_Empty(context, token):683                self.build(context, token)684                return 11685        state_comment = "State: 11 - GherkinDocument:0>Feature:2>Scenario_Definition:0>Tags:0>#TagLine:0"686        token.detach687        expected_tokens = ["#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]688        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)689        if (self.stop_at_first_error):690            raise error691        self.add_error(context, error)692        return 11693    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:0>#ScenarioLine:0694    def match_token_at_12(self, token, context):695        if self.match_EOF(context, token):696                self.end_rule(context, 'Scenario')697                self.end_rule(context, 'Scenario_Definition')698                self.end_rule(context, 'Feature')699                self.build(context, token)700                return 27701        if self.match_Empty(context, token):702                self.build(context, token)703                return 12704        if self.match_Comment(context, token):705                self.build(context, token)706                return 14707        if self.match_StepLine(context, token):708                self.start_rule(context, 'Step')709                self.build(context, token)710                return 15711        if self.match_TagLine(context, token):712                self.end_rule(context, 'Scenario')713                self.end_rule(context, 'Scenario_Definition')714                self.start_rule(context, 'Scenario_Definition')715                self.start_rule(context, 'Tags')716                self.build(context, token)717                return 11718        if self.match_ScenarioLine(context, token):719                self.end_rule(context, 'Scenario')720                self.end_rule(context, 'Scenario_Definition')721                self.start_rule(context, 'Scenario_Definition')722                self.start_rule(context, 'Scenario')723                self.build(context, token)724                return 12725        if self.match_ScenarioOutlineLine(context, token):726                self.end_rule(context, 'Scenario')727                self.end_rule(context, 'Scenario_Definition')728                self.start_rule(context, 'Scenario_Definition')729                self.start_rule(context, 'ScenarioOutline')730                self.build(context, token)731                return 17732        if self.match_Other(context, token):733                self.start_rule(context, 'Description')734                self.build(context, token)735                return 13736        state_comment = "State: 12 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:0>#ScenarioLine:0"737        token.detach738        expected_tokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]739        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)740        if (self.stop_at_first_error):741            raise error742        self.add_error(context, error)743        return 12744    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Scenario_Description:0>Description_Helper:1>Description:0>#Other:0745    def match_token_at_13(self, token, context):746        if self.match_EOF(context, token):747                self.end_rule(context, 'Description')748                self.end_rule(context, 'Scenario')749                self.end_rule(context, 'Scenario_Definition')750                self.end_rule(context, 'Feature')751                self.build(context, token)752                return 27753        if self.match_Comment(context, token):754                self.end_rule(context, 'Description')755                self.build(context, token)756                return 14757        if self.match_StepLine(context, token):758                self.end_rule(context, 'Description')759                self.start_rule(context, 'Step')760                self.build(context, token)761                return 15762        if self.match_TagLine(context, token):763                self.end_rule(context, 'Description')764                self.end_rule(context, 'Scenario')765                self.end_rule(context, 'Scenario_Definition')766                self.start_rule(context, 'Scenario_Definition')767                self.start_rule(context, 'Tags')768                self.build(context, token)769                return 11770        if self.match_ScenarioLine(context, token):771                self.end_rule(context, 'Description')772                self.end_rule(context, 'Scenario')773                self.end_rule(context, 'Scenario_Definition')774                self.start_rule(context, 'Scenario_Definition')775                self.start_rule(context, 'Scenario')776                self.build(context, token)777                return 12778        if self.match_ScenarioOutlineLine(context, token):779                self.end_rule(context, 'Description')780                self.end_rule(context, 'Scenario')781                self.end_rule(context, 'Scenario_Definition')782                self.start_rule(context, 'Scenario_Definition')783                self.start_rule(context, 'ScenarioOutline')784                self.build(context, token)785                return 17786        if self.match_Other(context, token):787                self.build(context, token)788                return 13789        state_comment = "State: 13 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Scenario_Description:0>Description_Helper:1>Description:0>#Other:0"790        token.detach791        expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]792        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)793        if (self.stop_at_first_error):794            raise error795        self.add_error(context, error)796        return 13797    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Scenario_Description:0>Description_Helper:2>#Comment:0798    def match_token_at_14(self, token, context):799        if self.match_EOF(context, token):800                self.end_rule(context, 'Scenario')801                self.end_rule(context, 'Scenario_Definition')802                self.end_rule(context, 'Feature')803                self.build(context, token)804                return 27805        if self.match_Comment(context, token):806                self.build(context, token)807                return 14808        if self.match_StepLine(context, token):809                self.start_rule(context, 'Step')810                self.build(context, token)811                return 15812        if self.match_TagLine(context, token):813                self.end_rule(context, 'Scenario')814                self.end_rule(context, 'Scenario_Definition')815                self.start_rule(context, 'Scenario_Definition')816                self.start_rule(context, 'Tags')817                self.build(context, token)818                return 11819        if self.match_ScenarioLine(context, token):820                self.end_rule(context, 'Scenario')821                self.end_rule(context, 'Scenario_Definition')822                self.start_rule(context, 'Scenario_Definition')823                self.start_rule(context, 'Scenario')824                self.build(context, token)825                return 12826        if self.match_ScenarioOutlineLine(context, token):827                self.end_rule(context, 'Scenario')828                self.end_rule(context, 'Scenario_Definition')829                self.start_rule(context, 'Scenario_Definition')830                self.start_rule(context, 'ScenarioOutline')831                self.build(context, token)832                return 17833        if self.match_Empty(context, token):834                self.build(context, token)835                return 14836        state_comment = "State: 14 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Scenario_Description:0>Description_Helper:2>#Comment:0"837        token.detach838        expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]839        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)840        if (self.stop_at_first_error):841            raise error842        self.add_error(context, error)843        return 14844    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:0>#StepLine:0845    def match_token_at_15(self, token, context):846        if self.match_EOF(context, token):847                self.end_rule(context, 'Step')848                self.end_rule(context, 'Scenario')849                self.end_rule(context, 'Scenario_Definition')850                self.end_rule(context, 'Feature')851                self.build(context, token)852                return 27853        if self.match_TableRow(context, token):854                self.start_rule(context, 'DataTable')855                self.build(context, token)856                return 16857        if self.match_DocStringSeparator(context, token):858                self.start_rule(context, 'DocString')859                self.build(context, token)860                return 30861        if self.match_StepLine(context, token):862                self.end_rule(context, 'Step')863                self.start_rule(context, 'Step')864                self.build(context, token)865                return 15866        if self.match_TagLine(context, token):867                self.end_rule(context, 'Step')868                self.end_rule(context, 'Scenario')869                self.end_rule(context, 'Scenario_Definition')870                self.start_rule(context, 'Scenario_Definition')871                self.start_rule(context, 'Tags')872                self.build(context, token)873                return 11874        if self.match_ScenarioLine(context, token):875                self.end_rule(context, 'Step')876                self.end_rule(context, 'Scenario')877                self.end_rule(context, 'Scenario_Definition')878                self.start_rule(context, 'Scenario_Definition')879                self.start_rule(context, 'Scenario')880                self.build(context, token)881                return 12882        if self.match_ScenarioOutlineLine(context, token):883                self.end_rule(context, 'Step')884                self.end_rule(context, 'Scenario')885                self.end_rule(context, 'Scenario_Definition')886                self.start_rule(context, 'Scenario_Definition')887                self.start_rule(context, 'ScenarioOutline')888                self.build(context, token)889                return 17890        if self.match_Comment(context, token):891                self.build(context, token)892                return 15893        if self.match_Empty(context, token):894                self.build(context, token)895                return 15896        state_comment = "State: 15 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:0>#StepLine:0"897        token.detach898        expected_tokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]899        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)900        if (self.stop_at_first_error):901            raise error902        self.add_error(context, error)903        return 15904    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0905    def match_token_at_16(self, token, context):906        if self.match_EOF(context, token):907                self.end_rule(context, 'DataTable')908                self.end_rule(context, 'Step')909                self.end_rule(context, 'Scenario')910                self.end_rule(context, 'Scenario_Definition')911                self.end_rule(context, 'Feature')912                self.build(context, token)913                return 27914        if self.match_TableRow(context, token):915                self.build(context, token)916                return 16917        if self.match_StepLine(context, token):918                self.end_rule(context, 'DataTable')919                self.end_rule(context, 'Step')920                self.start_rule(context, 'Step')921                self.build(context, token)922                return 15923        if self.match_TagLine(context, token):924                self.end_rule(context, 'DataTable')925                self.end_rule(context, 'Step')926                self.end_rule(context, 'Scenario')927                self.end_rule(context, 'Scenario_Definition')928                self.start_rule(context, 'Scenario_Definition')929                self.start_rule(context, 'Tags')930                self.build(context, token)931                return 11932        if self.match_ScenarioLine(context, token):933                self.end_rule(context, 'DataTable')934                self.end_rule(context, 'Step')935                self.end_rule(context, 'Scenario')936                self.end_rule(context, 'Scenario_Definition')937                self.start_rule(context, 'Scenario_Definition')938                self.start_rule(context, 'Scenario')939                self.build(context, token)940                return 12941        if self.match_ScenarioOutlineLine(context, token):942                self.end_rule(context, 'DataTable')943                self.end_rule(context, 'Step')944                self.end_rule(context, 'Scenario')945                self.end_rule(context, 'Scenario_Definition')946                self.start_rule(context, 'Scenario_Definition')947                self.start_rule(context, 'ScenarioOutline')948                self.build(context, token)949                return 17950        if self.match_Comment(context, token):951                self.build(context, token)952                return 16953        if self.match_Empty(context, token):954                self.build(context, token)955                return 16956        state_comment = "State: 16 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"957        token.detach958        expected_tokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]959        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)960        if (self.stop_at_first_error):961            raise error962        self.add_error(context, error)963        return 16964    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:0>#ScenarioOutlineLine:0965    def match_token_at_17(self, token, context):966        if self.match_EOF(context, token):967                self.end_rule(context, 'ScenarioOutline')968                self.end_rule(context, 'Scenario_Definition')969                self.end_rule(context, 'Feature')970                self.build(context, token)971                return 27972        if self.match_Empty(context, token):973                self.build(context, token)974                return 17975        if self.match_Comment(context, token):976                self.build(context, token)977                return 19978        if self.match_StepLine(context, token):979                self.start_rule(context, 'Step')980                self.build(context, token)981                return 20982        if self.match_TagLine(context, token):983            if self.lookahead_0(context, token):984                self.start_rule(context, 'Examples_Definition')985                self.start_rule(context, 'Tags')986                self.build(context, token)987                return 22988        if self.match_TagLine(context, token):989                self.end_rule(context, 'ScenarioOutline')990                self.end_rule(context, 'Scenario_Definition')991                self.start_rule(context, 'Scenario_Definition')992                self.start_rule(context, 'Tags')993                self.build(context, token)994                return 11995        if self.match_ExamplesLine(context, token):996                self.start_rule(context, 'Examples_Definition')997                self.start_rule(context, 'Examples')998                self.build(context, token)999                return 231000        if self.match_ScenarioLine(context, token):1001                self.end_rule(context, 'ScenarioOutline')1002                self.end_rule(context, 'Scenario_Definition')1003                self.start_rule(context, 'Scenario_Definition')1004                self.start_rule(context, 'Scenario')1005                self.build(context, token)1006                return 121007        if self.match_ScenarioOutlineLine(context, token):1008                self.end_rule(context, 'ScenarioOutline')1009                self.end_rule(context, 'Scenario_Definition')1010                self.start_rule(context, 'Scenario_Definition')1011                self.start_rule(context, 'ScenarioOutline')1012                self.build(context, token)1013                return 171014        if self.match_Other(context, token):1015                self.start_rule(context, 'Description')1016                self.build(context, token)1017                return 181018        state_comment = "State: 17 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:0>#ScenarioOutlineLine:0"1019        token.detach1020        expected_tokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]1021        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1022        if (self.stop_at_first_error):1023            raise error1024        self.add_error(context, error)1025        return 171026    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>ScenarioOutline_Description:0>Description_Helper:1>Description:0>#Other:01027    def match_token_at_18(self, token, context):1028        if self.match_EOF(context, token):1029                self.end_rule(context, 'Description')1030                self.end_rule(context, 'ScenarioOutline')1031                self.end_rule(context, 'Scenario_Definition')1032                self.end_rule(context, 'Feature')1033                self.build(context, token)1034                return 271035        if self.match_Comment(context, token):1036                self.end_rule(context, 'Description')1037                self.build(context, token)1038                return 191039        if self.match_StepLine(context, token):1040                self.end_rule(context, 'Description')1041                self.start_rule(context, 'Step')1042                self.build(context, token)1043                return 201044        if self.match_TagLine(context, token):1045            if self.lookahead_0(context, token):1046                self.end_rule(context, 'Description')1047                self.start_rule(context, 'Examples_Definition')1048                self.start_rule(context, 'Tags')1049                self.build(context, token)1050                return 221051        if self.match_TagLine(context, token):1052                self.end_rule(context, 'Description')1053                self.end_rule(context, 'ScenarioOutline')1054                self.end_rule(context, 'Scenario_Definition')1055                self.start_rule(context, 'Scenario_Definition')1056                self.start_rule(context, 'Tags')1057                self.build(context, token)1058                return 111059        if self.match_ExamplesLine(context, token):1060                self.end_rule(context, 'Description')1061                self.start_rule(context, 'Examples_Definition')1062                self.start_rule(context, 'Examples')1063                self.build(context, token)1064                return 231065        if self.match_ScenarioLine(context, token):1066                self.end_rule(context, 'Description')1067                self.end_rule(context, 'ScenarioOutline')1068                self.end_rule(context, 'Scenario_Definition')1069                self.start_rule(context, 'Scenario_Definition')1070                self.start_rule(context, 'Scenario')1071                self.build(context, token)1072                return 121073        if self.match_ScenarioOutlineLine(context, token):1074                self.end_rule(context, 'Description')1075                self.end_rule(context, 'ScenarioOutline')1076                self.end_rule(context, 'Scenario_Definition')1077                self.start_rule(context, 'Scenario_Definition')1078                self.start_rule(context, 'ScenarioOutline')1079                self.build(context, token)1080                return 171081        if self.match_Other(context, token):1082                self.build(context, token)1083                return 181084        state_comment = "State: 18 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>ScenarioOutline_Description:0>Description_Helper:1>Description:0>#Other:0"1085        token.detach1086        expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]1087        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1088        if (self.stop_at_first_error):1089            raise error1090        self.add_error(context, error)1091        return 181092    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>ScenarioOutline_Description:0>Description_Helper:2>#Comment:01093    def match_token_at_19(self, token, context):1094        if self.match_EOF(context, token):1095                self.end_rule(context, 'ScenarioOutline')1096                self.end_rule(context, 'Scenario_Definition')1097                self.end_rule(context, 'Feature')1098                self.build(context, token)1099                return 271100        if self.match_Comment(context, token):1101                self.build(context, token)1102                return 191103        if self.match_StepLine(context, token):1104                self.start_rule(context, 'Step')1105                self.build(context, token)1106                return 201107        if self.match_TagLine(context, token):1108            if self.lookahead_0(context, token):1109                self.start_rule(context, 'Examples_Definition')1110                self.start_rule(context, 'Tags')1111                self.build(context, token)1112                return 221113        if self.match_TagLine(context, token):1114                self.end_rule(context, 'ScenarioOutline')1115                self.end_rule(context, 'Scenario_Definition')1116                self.start_rule(context, 'Scenario_Definition')1117                self.start_rule(context, 'Tags')1118                self.build(context, token)1119                return 111120        if self.match_ExamplesLine(context, token):1121                self.start_rule(context, 'Examples_Definition')1122                self.start_rule(context, 'Examples')1123                self.build(context, token)1124                return 231125        if self.match_ScenarioLine(context, token):1126                self.end_rule(context, 'ScenarioOutline')1127                self.end_rule(context, 'Scenario_Definition')1128                self.start_rule(context, 'Scenario_Definition')1129                self.start_rule(context, 'Scenario')1130                self.build(context, token)1131                return 121132        if self.match_ScenarioOutlineLine(context, token):1133                self.end_rule(context, 'ScenarioOutline')1134                self.end_rule(context, 'Scenario_Definition')1135                self.start_rule(context, 'Scenario_Definition')1136                self.start_rule(context, 'ScenarioOutline')1137                self.build(context, token)1138                return 171139        if self.match_Empty(context, token):1140                self.build(context, token)1141                return 191142        state_comment = "State: 19 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>ScenarioOutline_Description:0>Description_Helper:2>#Comment:0"1143        token.detach1144        expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]1145        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1146        if (self.stop_at_first_error):1147            raise error1148        self.add_error(context, error)1149        return 191150    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:0>#StepLine:01151    def match_token_at_20(self, token, context):1152        if self.match_EOF(context, token):1153                self.end_rule(context, 'Step')1154                self.end_rule(context, 'ScenarioOutline')1155                self.end_rule(context, 'Scenario_Definition')1156                self.end_rule(context, 'Feature')1157                self.build(context, token)1158                return 271159        if self.match_TableRow(context, token):1160                self.start_rule(context, 'DataTable')1161                self.build(context, token)1162                return 211163        if self.match_DocStringSeparator(context, token):1164                self.start_rule(context, 'DocString')1165                self.build(context, token)1166                return 281167        if self.match_StepLine(context, token):1168                self.end_rule(context, 'Step')1169                self.start_rule(context, 'Step')1170                self.build(context, token)1171                return 201172        if self.match_TagLine(context, token):1173            if self.lookahead_0(context, token):1174                self.end_rule(context, 'Step')1175                self.start_rule(context, 'Examples_Definition')1176                self.start_rule(context, 'Tags')1177                self.build(context, token)1178                return 221179        if self.match_TagLine(context, token):1180                self.end_rule(context, 'Step')1181                self.end_rule(context, 'ScenarioOutline')1182                self.end_rule(context, 'Scenario_Definition')1183                self.start_rule(context, 'Scenario_Definition')1184                self.start_rule(context, 'Tags')1185                self.build(context, token)1186                return 111187        if self.match_ExamplesLine(context, token):1188                self.end_rule(context, 'Step')1189                self.start_rule(context, 'Examples_Definition')1190                self.start_rule(context, 'Examples')1191                self.build(context, token)1192                return 231193        if self.match_ScenarioLine(context, token):1194                self.end_rule(context, 'Step')1195                self.end_rule(context, 'ScenarioOutline')1196                self.end_rule(context, 'Scenario_Definition')1197                self.start_rule(context, 'Scenario_Definition')1198                self.start_rule(context, 'Scenario')1199                self.build(context, token)1200                return 121201        if self.match_ScenarioOutlineLine(context, token):1202                self.end_rule(context, 'Step')1203                self.end_rule(context, 'ScenarioOutline')1204                self.end_rule(context, 'Scenario_Definition')1205                self.start_rule(context, 'Scenario_Definition')1206                self.start_rule(context, 'ScenarioOutline')1207                self.build(context, token)1208                return 171209        if self.match_Comment(context, token):1210                self.build(context, token)1211                return 201212        if self.match_Empty(context, token):1213                self.build(context, token)1214                return 201215        state_comment = "State: 20 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:0>#StepLine:0"1216        token.detach1217        expected_tokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1218        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1219        if (self.stop_at_first_error):1220            raise error1221        self.add_error(context, error)1222        return 201223    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:01224    def match_token_at_21(self, token, context):1225        if self.match_EOF(context, token):1226                self.end_rule(context, 'DataTable')1227                self.end_rule(context, 'Step')1228                self.end_rule(context, 'ScenarioOutline')1229                self.end_rule(context, 'Scenario_Definition')1230                self.end_rule(context, 'Feature')1231                self.build(context, token)1232                return 271233        if self.match_TableRow(context, token):1234                self.build(context, token)1235                return 211236        if self.match_StepLine(context, token):1237                self.end_rule(context, 'DataTable')1238                self.end_rule(context, 'Step')1239                self.start_rule(context, 'Step')1240                self.build(context, token)1241                return 201242        if self.match_TagLine(context, token):1243            if self.lookahead_0(context, token):1244                self.end_rule(context, 'DataTable')1245                self.end_rule(context, 'Step')1246                self.start_rule(context, 'Examples_Definition')1247                self.start_rule(context, 'Tags')1248                self.build(context, token)1249                return 221250        if self.match_TagLine(context, token):1251                self.end_rule(context, 'DataTable')1252                self.end_rule(context, 'Step')1253                self.end_rule(context, 'ScenarioOutline')1254                self.end_rule(context, 'Scenario_Definition')1255                self.start_rule(context, 'Scenario_Definition')1256                self.start_rule(context, 'Tags')1257                self.build(context, token)1258                return 111259        if self.match_ExamplesLine(context, token):1260                self.end_rule(context, 'DataTable')1261                self.end_rule(context, 'Step')1262                self.start_rule(context, 'Examples_Definition')1263                self.start_rule(context, 'Examples')1264                self.build(context, token)1265                return 231266        if self.match_ScenarioLine(context, token):1267                self.end_rule(context, 'DataTable')1268                self.end_rule(context, 'Step')1269                self.end_rule(context, 'ScenarioOutline')1270                self.end_rule(context, 'Scenario_Definition')1271                self.start_rule(context, 'Scenario_Definition')1272                self.start_rule(context, 'Scenario')1273                self.build(context, token)1274                return 121275        if self.match_ScenarioOutlineLine(context, token):1276                self.end_rule(context, 'DataTable')1277                self.end_rule(context, 'Step')1278                self.end_rule(context, 'ScenarioOutline')1279                self.end_rule(context, 'Scenario_Definition')1280                self.start_rule(context, 'Scenario_Definition')1281                self.start_rule(context, 'ScenarioOutline')1282                self.build(context, token)1283                return 171284        if self.match_Comment(context, token):1285                self.build(context, token)1286                return 211287        if self.match_Empty(context, token):1288                self.build(context, token)1289                return 211290        state_comment = "State: 21 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"1291        token.detach1292        expected_tokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1293        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1294        if (self.stop_at_first_error):1295            raise error1296        self.add_error(context, error)1297        return 211298    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:0>Tags:0>#TagLine:01299    def match_token_at_22(self, token, context):1300        if self.match_TagLine(context, token):1301                self.build(context, token)1302                return 221303        if self.match_ExamplesLine(context, token):1304                self.end_rule(context, 'Tags')1305                self.start_rule(context, 'Examples')1306                self.build(context, token)1307                return 231308        if self.match_Comment(context, token):1309                self.build(context, token)1310                return 221311        if self.match_Empty(context, token):1312                self.build(context, token)1313                return 221314        state_comment = "State: 22 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:0>Tags:0>#TagLine:0"1315        token.detach1316        expected_tokens = ["#TagLine", "#ExamplesLine", "#Comment", "#Empty"]1317        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1318        if (self.stop_at_first_error):1319            raise error1320        self.add_error(context, error)1321        return 221322    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:0>#ExamplesLine:01323    def match_token_at_23(self, token, context):1324        if self.match_EOF(context, token):1325                self.end_rule(context, 'Examples')1326                self.end_rule(context, 'Examples_Definition')1327                self.end_rule(context, 'ScenarioOutline')1328                self.end_rule(context, 'Scenario_Definition')1329                self.end_rule(context, 'Feature')1330                self.build(context, token)1331                return 271332        if self.match_Empty(context, token):1333                self.build(context, token)1334                return 231335        if self.match_Comment(context, token):1336                self.build(context, token)1337                return 251338        if self.match_TableRow(context, token):1339                self.start_rule(context, 'Examples_Table')1340                self.build(context, token)1341                return 261342        if self.match_TagLine(context, token):1343            if self.lookahead_0(context, token):1344                self.end_rule(context, 'Examples')1345                self.end_rule(context, 'Examples_Definition')1346                self.start_rule(context, 'Examples_Definition')1347                self.start_rule(context, 'Tags')1348                self.build(context, token)1349                return 221350        if self.match_TagLine(context, token):1351                self.end_rule(context, 'Examples')1352                self.end_rule(context, 'Examples_Definition')1353                self.end_rule(context, 'ScenarioOutline')1354                self.end_rule(context, 'Scenario_Definition')1355                self.start_rule(context, 'Scenario_Definition')1356                self.start_rule(context, 'Tags')1357                self.build(context, token)1358                return 111359        if self.match_ExamplesLine(context, token):1360                self.end_rule(context, 'Examples')1361                self.end_rule(context, 'Examples_Definition')1362                self.start_rule(context, 'Examples_Definition')1363                self.start_rule(context, 'Examples')1364                self.build(context, token)1365                return 231366        if self.match_ScenarioLine(context, token):1367                self.end_rule(context, 'Examples')1368                self.end_rule(context, 'Examples_Definition')1369                self.end_rule(context, 'ScenarioOutline')1370                self.end_rule(context, 'Scenario_Definition')1371                self.start_rule(context, 'Scenario_Definition')1372                self.start_rule(context, 'Scenario')1373                self.build(context, token)1374                return 121375        if self.match_ScenarioOutlineLine(context, token):1376                self.end_rule(context, 'Examples')1377                self.end_rule(context, 'Examples_Definition')1378                self.end_rule(context, 'ScenarioOutline')1379                self.end_rule(context, 'Scenario_Definition')1380                self.start_rule(context, 'Scenario_Definition')1381                self.start_rule(context, 'ScenarioOutline')1382                self.build(context, token)1383                return 171384        if self.match_Other(context, token):1385                self.start_rule(context, 'Description')1386                self.build(context, token)1387                return 241388        state_comment = "State: 23 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:0>#ExamplesLine:0"1389        token.detach1390        expected_tokens = ["#EOF", "#Empty", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]1391        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1392        if (self.stop_at_first_error):1393            raise error1394        self.add_error(context, error)1395        return 231396    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Examples_Description:0>Description_Helper:1>Description:0>#Other:01397    def match_token_at_24(self, token, context):1398        if self.match_EOF(context, token):1399                self.end_rule(context, 'Description')1400                self.end_rule(context, 'Examples')1401                self.end_rule(context, 'Examples_Definition')1402                self.end_rule(context, 'ScenarioOutline')1403                self.end_rule(context, 'Scenario_Definition')1404                self.end_rule(context, 'Feature')1405                self.build(context, token)1406                return 271407        if self.match_Comment(context, token):1408                self.end_rule(context, 'Description')1409                self.build(context, token)1410                return 251411        if self.match_TableRow(context, token):1412                self.end_rule(context, 'Description')1413                self.start_rule(context, 'Examples_Table')1414                self.build(context, token)1415                return 261416        if self.match_TagLine(context, token):1417            if self.lookahead_0(context, token):1418                self.end_rule(context, 'Description')1419                self.end_rule(context, 'Examples')1420                self.end_rule(context, 'Examples_Definition')1421                self.start_rule(context, 'Examples_Definition')1422                self.start_rule(context, 'Tags')1423                self.build(context, token)1424                return 221425        if self.match_TagLine(context, token):1426                self.end_rule(context, 'Description')1427                self.end_rule(context, 'Examples')1428                self.end_rule(context, 'Examples_Definition')1429                self.end_rule(context, 'ScenarioOutline')1430                self.end_rule(context, 'Scenario_Definition')1431                self.start_rule(context, 'Scenario_Definition')1432                self.start_rule(context, 'Tags')1433                self.build(context, token)1434                return 111435        if self.match_ExamplesLine(context, token):1436                self.end_rule(context, 'Description')1437                self.end_rule(context, 'Examples')1438                self.end_rule(context, 'Examples_Definition')1439                self.start_rule(context, 'Examples_Definition')1440                self.start_rule(context, 'Examples')1441                self.build(context, token)1442                return 231443        if self.match_ScenarioLine(context, token):1444                self.end_rule(context, 'Description')1445                self.end_rule(context, 'Examples')1446                self.end_rule(context, 'Examples_Definition')1447                self.end_rule(context, 'ScenarioOutline')1448                self.end_rule(context, 'Scenario_Definition')1449                self.start_rule(context, 'Scenario_Definition')1450                self.start_rule(context, 'Scenario')1451                self.build(context, token)1452                return 121453        if self.match_ScenarioOutlineLine(context, token):1454                self.end_rule(context, 'Description')1455                self.end_rule(context, 'Examples')1456                self.end_rule(context, 'Examples_Definition')1457                self.end_rule(context, 'ScenarioOutline')1458                self.end_rule(context, 'Scenario_Definition')1459                self.start_rule(context, 'Scenario_Definition')1460                self.start_rule(context, 'ScenarioOutline')1461                self.build(context, token)1462                return 171463        if self.match_Other(context, token):1464                self.build(context, token)1465                return 241466        state_comment = "State: 24 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Examples_Description:0>Description_Helper:1>Description:0>#Other:0"1467        token.detach1468        expected_tokens = ["#EOF", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]1469        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1470        if (self.stop_at_first_error):1471            raise error1472        self.add_error(context, error)1473        return 241474    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Examples_Description:0>Description_Helper:2>#Comment:01475    def match_token_at_25(self, token, context):1476        if self.match_EOF(context, token):1477                self.end_rule(context, 'Examples')1478                self.end_rule(context, 'Examples_Definition')1479                self.end_rule(context, 'ScenarioOutline')1480                self.end_rule(context, 'Scenario_Definition')1481                self.end_rule(context, 'Feature')1482                self.build(context, token)1483                return 271484        if self.match_Comment(context, token):1485                self.build(context, token)1486                return 251487        if self.match_TableRow(context, token):1488                self.start_rule(context, 'Examples_Table')1489                self.build(context, token)1490                return 261491        if self.match_TagLine(context, token):1492            if self.lookahead_0(context, token):1493                self.end_rule(context, 'Examples')1494                self.end_rule(context, 'Examples_Definition')1495                self.start_rule(context, 'Examples_Definition')1496                self.start_rule(context, 'Tags')1497                self.build(context, token)1498                return 221499        if self.match_TagLine(context, token):1500                self.end_rule(context, 'Examples')1501                self.end_rule(context, 'Examples_Definition')1502                self.end_rule(context, 'ScenarioOutline')1503                self.end_rule(context, 'Scenario_Definition')1504                self.start_rule(context, 'Scenario_Definition')1505                self.start_rule(context, 'Tags')1506                self.build(context, token)1507                return 111508        if self.match_ExamplesLine(context, token):1509                self.end_rule(context, 'Examples')1510                self.end_rule(context, 'Examples_Definition')1511                self.start_rule(context, 'Examples_Definition')1512                self.start_rule(context, 'Examples')1513                self.build(context, token)1514                return 231515        if self.match_ScenarioLine(context, token):1516                self.end_rule(context, 'Examples')1517                self.end_rule(context, 'Examples_Definition')1518                self.end_rule(context, 'ScenarioOutline')1519                self.end_rule(context, 'Scenario_Definition')1520                self.start_rule(context, 'Scenario_Definition')1521                self.start_rule(context, 'Scenario')1522                self.build(context, token)1523                return 121524        if self.match_ScenarioOutlineLine(context, token):1525                self.end_rule(context, 'Examples')1526                self.end_rule(context, 'Examples_Definition')1527                self.end_rule(context, 'ScenarioOutline')1528                self.end_rule(context, 'Scenario_Definition')1529                self.start_rule(context, 'Scenario_Definition')1530                self.start_rule(context, 'ScenarioOutline')1531                self.build(context, token)1532                return 171533        if self.match_Empty(context, token):1534                self.build(context, token)1535                return 251536        state_comment = "State: 25 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Examples_Description:0>Description_Helper:2>#Comment:0"1537        token.detach1538        expected_tokens = ["#EOF", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]1539        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1540        if (self.stop_at_first_error):1541            raise error1542        self.add_error(context, error)1543        return 251544    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:2>Examples_Table:0>#TableRow:01545    def match_token_at_26(self, token, context):1546        if self.match_EOF(context, token):1547                self.end_rule(context, 'Examples_Table')1548                self.end_rule(context, 'Examples')1549                self.end_rule(context, 'Examples_Definition')1550                self.end_rule(context, 'ScenarioOutline')1551                self.end_rule(context, 'Scenario_Definition')1552                self.end_rule(context, 'Feature')1553                self.build(context, token)1554                return 271555        if self.match_TableRow(context, token):1556                self.build(context, token)1557                return 261558        if self.match_TagLine(context, token):1559            if self.lookahead_0(context, token):1560                self.end_rule(context, 'Examples_Table')1561                self.end_rule(context, 'Examples')1562                self.end_rule(context, 'Examples_Definition')1563                self.start_rule(context, 'Examples_Definition')1564                self.start_rule(context, 'Tags')1565                self.build(context, token)1566                return 221567        if self.match_TagLine(context, token):1568                self.end_rule(context, 'Examples_Table')1569                self.end_rule(context, 'Examples')1570                self.end_rule(context, 'Examples_Definition')1571                self.end_rule(context, 'ScenarioOutline')1572                self.end_rule(context, 'Scenario_Definition')1573                self.start_rule(context, 'Scenario_Definition')1574                self.start_rule(context, 'Tags')1575                self.build(context, token)1576                return 111577        if self.match_ExamplesLine(context, token):1578                self.end_rule(context, 'Examples_Table')1579                self.end_rule(context, 'Examples')1580                self.end_rule(context, 'Examples_Definition')1581                self.start_rule(context, 'Examples_Definition')1582                self.start_rule(context, 'Examples')1583                self.build(context, token)1584                return 231585        if self.match_ScenarioLine(context, token):1586                self.end_rule(context, 'Examples_Table')1587                self.end_rule(context, 'Examples')1588                self.end_rule(context, 'Examples_Definition')1589                self.end_rule(context, 'ScenarioOutline')1590                self.end_rule(context, 'Scenario_Definition')1591                self.start_rule(context, 'Scenario_Definition')1592                self.start_rule(context, 'Scenario')1593                self.build(context, token)1594                return 121595        if self.match_ScenarioOutlineLine(context, token):1596                self.end_rule(context, 'Examples_Table')1597                self.end_rule(context, 'Examples')1598                self.end_rule(context, 'Examples_Definition')1599                self.end_rule(context, 'ScenarioOutline')1600                self.end_rule(context, 'Scenario_Definition')1601                self.start_rule(context, 'Scenario_Definition')1602                self.start_rule(context, 'ScenarioOutline')1603                self.build(context, token)1604                return 171605        if self.match_Comment(context, token):1606                self.build(context, token)1607                return 261608        if self.match_Empty(context, token):1609                self.build(context, token)1610                return 261611        state_comment = "State: 26 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:2>Examples_Table:0>#TableRow:0"1612        token.detach1613        expected_tokens = ["#EOF", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1614        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1615        if (self.stop_at_first_error):1616            raise error1617        self.add_error(context, error)1618        return 261619    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:01620    def match_token_at_28(self, token, context):1621        if self.match_DocStringSeparator(context, token):1622                self.build(context, token)1623                return 291624        if self.match_Other(context, token):1625                self.build(context, token)1626                return 281627        state_comment = "State: 28 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"1628        token.detach1629        expected_tokens = ["#DocStringSeparator", "#Other"]1630        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1631        if (self.stop_at_first_error):1632            raise error1633        self.add_error(context, error)1634        return 281635    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:01636    def match_token_at_29(self, token, context):1637        if self.match_EOF(context, token):1638                self.end_rule(context, 'DocString')1639                self.end_rule(context, 'Step')1640                self.end_rule(context, 'ScenarioOutline')1641                self.end_rule(context, 'Scenario_Definition')1642                self.end_rule(context, 'Feature')1643                self.build(context, token)1644                return 271645        if self.match_StepLine(context, token):1646                self.end_rule(context, 'DocString')1647                self.end_rule(context, 'Step')1648                self.start_rule(context, 'Step')1649                self.build(context, token)1650                return 201651        if self.match_TagLine(context, token):1652            if self.lookahead_0(context, token):1653                self.end_rule(context, 'DocString')1654                self.end_rule(context, 'Step')1655                self.start_rule(context, 'Examples_Definition')1656                self.start_rule(context, 'Tags')1657                self.build(context, token)1658                return 221659        if self.match_TagLine(context, token):1660                self.end_rule(context, 'DocString')1661                self.end_rule(context, 'Step')1662                self.end_rule(context, 'ScenarioOutline')1663                self.end_rule(context, 'Scenario_Definition')1664                self.start_rule(context, 'Scenario_Definition')1665                self.start_rule(context, 'Tags')1666                self.build(context, token)1667                return 111668        if self.match_ExamplesLine(context, token):1669                self.end_rule(context, 'DocString')1670                self.end_rule(context, 'Step')1671                self.start_rule(context, 'Examples_Definition')1672                self.start_rule(context, 'Examples')1673                self.build(context, token)1674                return 231675        if self.match_ScenarioLine(context, token):1676                self.end_rule(context, 'DocString')1677                self.end_rule(context, 'Step')1678                self.end_rule(context, 'ScenarioOutline')1679                self.end_rule(context, 'Scenario_Definition')1680                self.start_rule(context, 'Scenario_Definition')1681                self.start_rule(context, 'Scenario')1682                self.build(context, token)1683                return 121684        if self.match_ScenarioOutlineLine(context, token):1685                self.end_rule(context, 'DocString')1686                self.end_rule(context, 'Step')1687                self.end_rule(context, 'ScenarioOutline')1688                self.end_rule(context, 'Scenario_Definition')1689                self.start_rule(context, 'Scenario_Definition')1690                self.start_rule(context, 'ScenarioOutline')1691                self.build(context, token)1692                return 171693        if self.match_Comment(context, token):1694                self.build(context, token)1695                return 291696        if self.match_Empty(context, token):1697                self.build(context, token)1698                return 291699        state_comment = "State: 29 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0"1700        token.detach1701        expected_tokens = ["#EOF", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1702        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1703        if (self.stop_at_first_error):1704            raise error1705        self.add_error(context, error)1706        return 291707    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:01708    def match_token_at_30(self, token, context):1709        if self.match_DocStringSeparator(context, token):1710                self.build(context, token)1711                return 311712        if self.match_Other(context, token):1713                self.build(context, token)1714                return 301715        state_comment = "State: 30 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"1716        token.detach1717        expected_tokens = ["#DocStringSeparator", "#Other"]1718        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1719        if (self.stop_at_first_error):1720            raise error1721        self.add_error(context, error)1722        return 301723    # GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:01724    def match_token_at_31(self, token, context):1725        if self.match_EOF(context, token):1726                self.end_rule(context, 'DocString')1727                self.end_rule(context, 'Step')1728                self.end_rule(context, 'Scenario')1729                self.end_rule(context, 'Scenario_Definition')1730                self.end_rule(context, 'Feature')1731                self.build(context, token)1732                return 271733        if self.match_StepLine(context, token):1734                self.end_rule(context, 'DocString')1735                self.end_rule(context, 'Step')1736                self.start_rule(context, 'Step')1737                self.build(context, token)1738                return 151739        if self.match_TagLine(context, token):1740                self.end_rule(context, 'DocString')1741                self.end_rule(context, 'Step')1742                self.end_rule(context, 'Scenario')1743                self.end_rule(context, 'Scenario_Definition')1744                self.start_rule(context, 'Scenario_Definition')1745                self.start_rule(context, 'Tags')1746                self.build(context, token)1747                return 111748        if self.match_ScenarioLine(context, token):1749                self.end_rule(context, 'DocString')1750                self.end_rule(context, 'Step')1751                self.end_rule(context, 'Scenario')1752                self.end_rule(context, 'Scenario_Definition')1753                self.start_rule(context, 'Scenario_Definition')1754                self.start_rule(context, 'Scenario')1755                self.build(context, token)1756                return 121757        if self.match_ScenarioOutlineLine(context, token):1758                self.end_rule(context, 'DocString')1759                self.end_rule(context, 'Step')1760                self.end_rule(context, 'Scenario')1761                self.end_rule(context, 'Scenario_Definition')1762                self.start_rule(context, 'Scenario_Definition')1763                self.start_rule(context, 'ScenarioOutline')1764                self.build(context, token)1765                return 171766        if self.match_Comment(context, token):1767                self.build(context, token)1768                return 311769        if self.match_Empty(context, token):1770                self.build(context, token)1771                return 311772        state_comment = "State: 31 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0"1773        token.detach1774        expected_tokens = ["#EOF", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1775        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1776        if (self.stop_at_first_error):1777            raise error1778        self.add_error(context, error)1779        return 311780    # GherkinDocument:0>Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:01781    def match_token_at_32(self, token, context):1782        if self.match_DocStringSeparator(context, token):1783                self.build(context, token)1784                return 331785        if self.match_Other(context, token):1786                self.build(context, token)1787                return 321788        state_comment = "State: 32 - GherkinDocument:0>Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"1789        token.detach1790        expected_tokens = ["#DocStringSeparator", "#Other"]1791        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1792        if (self.stop_at_first_error):1793            raise error1794        self.add_error(context, error)1795        return 321796    # GherkinDocument:0>Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:01797    def match_token_at_33(self, token, context):1798        if self.match_EOF(context, token):1799                self.end_rule(context, 'DocString')1800                self.end_rule(context, 'Step')1801                self.end_rule(context, 'Background')1802                self.end_rule(context, 'Feature')1803                self.build(context, token)1804                return 271805        if self.match_StepLine(context, token):1806                self.end_rule(context, 'DocString')1807                self.end_rule(context, 'Step')1808                self.start_rule(context, 'Step')1809                self.build(context, token)1810                return 91811        if self.match_TagLine(context, token):1812                self.end_rule(context, 'DocString')1813                self.end_rule(context, 'Step')1814                self.end_rule(context, 'Background')1815                self.start_rule(context, 'Scenario_Definition')1816                self.start_rule(context, 'Tags')1817                self.build(context, token)1818                return 111819        if self.match_ScenarioLine(context, token):1820                self.end_rule(context, 'DocString')1821                self.end_rule(context, 'Step')1822                self.end_rule(context, 'Background')1823                self.start_rule(context, 'Scenario_Definition')1824                self.start_rule(context, 'Scenario')1825                self.build(context, token)1826                return 121827        if self.match_ScenarioOutlineLine(context, token):1828                self.end_rule(context, 'DocString')1829                self.end_rule(context, 'Step')1830                self.end_rule(context, 'Background')1831                self.start_rule(context, 'Scenario_Definition')1832                self.start_rule(context, 'ScenarioOutline')1833                self.build(context, token)1834                return 171835        if self.match_Comment(context, token):1836                self.build(context, token)1837                return 331838        if self.match_Empty(context, token):1839                self.build(context, token)1840                return 331841        state_comment = "State: 33 - GherkinDocument:0>Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0"1842        token.detach1843        expected_tokens = ["#EOF", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1844        error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1845        if (self.stop_at_first_error):1846            raise error...get_traffic_policy_document.py
Source:get_traffic_policy_document.py  
...75    def start_endpoint(self) -> Optional[str]:76        return pulumi.get(self, "start_endpoint")77    @property78    @pulumi.getter(name="startRule")79    def start_rule(self) -> Optional[str]:80        return pulumi.get(self, "start_rule")81    @property82    @pulumi.getter83    def version(self) -> Optional[str]:84        return pulumi.get(self, "version")85class AwaitableGetTrafficPolicyDocumentResult(GetTrafficPolicyDocumentResult):86    # pylint: disable=using-constant-test87    def __await__(self):88        if False:89            yield self90        return GetTrafficPolicyDocumentResult(91            endpoints=self.endpoints,92            id=self.id,93            json=self.json,...Node.py
Source:Node.py  
1import threading2from threading import currentThread3import time4from actions.Action import Action5from utils.Constants import EventType6class Node(object):7    def run(self, scenario_engine):8        raise NotImplementedError("Should have implemented this")9    def start_rule_passed(self, common_obj):10        raise NotImplementedError("Should have implemented this")11    def end_rule_passed(self, common_obj):12        raise NotImplementedError("Should have implemented this")13    def on_event(self, type):14        raise NotImplementedError("Should have implemented this")15    @staticmethod16    def of(node_json):17        if node_json is None:18            return EmptyNode()19        if node_json["type"] == "sync":20            return SyncNode(node_json["start_rule"], node_json["end_rule"],  node_json["actions"], node_json["events"])21        if node_json["type"] == "loop":22            return LoopNode(node_json["start_rule"], node_json["end_rule"],  node_json["actions"], node_json["events"] )23        if node_json["type"] == "parallel":24            return ParallelNode(node_json["start_rule"], node_json["end_rule"],  node_json["actions"], node_json["name"], node_json["events"] )25class EmptyNode(Node):26    def run(self, nao_client):27        pass28def parse_actions(actions):29    stages = []30    for stage in actions:31        action = Action.of(stage['Action'])32        stages.append(action)33    return stages34def parse_events(events):35    stages = []36    for stage in events:37        event = Event.of(stage['Event'])38        stages.append(event)39    return stages40class SyncNode(Node):41    def __init__(self, start_rule, end_rule, actions, events):42        self.start_rule = start_rule43        self.end_rule = end_rule44        self.actions = parse_actions(actions)45        self.events = parse_events(events)46        self.common_obj = None47        self.lock = threading.Lock()48    def end_rule_passed(self, common_obj):49        return eval(self.end_rule,  {"common_obj": common_obj, "options": common_obj["options"].get, "always": always, "child_ready": child_ready})50    def start_rule_passed(self, common_obj):51        return eval(self.start_rule, {"common_obj": common_obj, "options": common_obj["options"].get, "always": always, "child_ready": child_ready})52    def on_event(self, data):53        print "event"54        print type55        print self.events56        for e in self.events:57            if e.data == data:58                self.lock.acquire()59                e.run(self.common_obj)60                self.lock.release()61                print "event"62                time.sleep(0.1)63    def run(self, scenario_engine):64        print self.events65        self.common_obj = scenario_engine.common_obj66        self.common_obj["options"]["interrupt_lock"] = self.lock67        if self.common_obj.get("Analyser", None):68            for e in self.events:69                self.common_obj["Analyser"].add_event_to_lissen(e.data)70        for action in self.actions:71            self.lock.acquire()72            action.run(scenario_engine.common_obj)73            self.lock.release()74            time.sleep(0.01)75        if self.common_obj.get("Analyser", None):76            for e in self.events:77                self.common_obj["Analyser"].remove_event_to_lissen(e.data)78class LoopNode(Node):79    def __init__(self, start_rule, end_rule, actions, events):80        self.start_rule = start_rule81        self.end_rule = end_rule82        self.actions = parse_actions(actions)83        self.events = parse_events(events)84        self.common_obj = None85        self.lock = threading.Lock()86    def end_rule_passed(self, common_obj):87        return eval(self.end_rule,  {"common_obj": common_obj,88                                     "options": common_obj["options"].get,89                                     "always": always,90                                     "child_ready": child_ready,91                                     "now": time.time(),92                                     "start": self.start,93                                     "clicked": common_obj["click"].is_clicked()})94    def start_rule_passed(self, common_obj):95        return eval(self.start_rule, {"common_obj": common_obj,96                                      "options": common_obj["options"].get,97                                      "always": always,98                                      "child_ready": child_ready})99    def on_event(self, type):100        for e in self.events:101            if e.type == type:102                self.lock.acquire()103                e.run()104                self.lock.release()105    def run(self, scenario_engine):106        print self.actions107        self.common_obj = scenario_engine.common_obj108        self.start = time.time()109        while not self.end_rule_passed(scenario_engine.common_obj):110            for action in self.actions:111                self.lock.acquire()112                action.run(scenario_engine.common_obj)113                self.lock.release()114                time.sleep(0.01)115class ParallelNode(Node):116    def __init__(self, start_rule, end_rule, actions, name, events):117        self.start_rule = start_rule118        self.end_rule = end_rule119        self.actions = parse_actions(actions)120        self.name = name121        self.events = parse_events(events)122        self.common_obj = None123        self.lock = threading.Lock()124    def end_rule_passed(self, common_obj):125        return eval(self.end_rule,  {"common_obj": common_obj, "options": common_obj["options"].get, "always": always, "child_ready": child_ready})126    def start_rule_passed(self, common_obj):127        return eval(self.start_rule,  {"common_obj": common_obj, "options": common_obj["options"].get, "always": always, "child_ready": child_ready})128    def on_event(self, type):129        for e in self.events:130            if e.type == type:131                self.lock.acquire()132                e.run()133                self.lock.release()134    def run(self, scenario_engine):135        print self.actions136        self.common_obj = scenario_engine.common_obj137        t = currentThread()138        while getattr(t, "do_run", True):139            for action in self.actions:140                self.lock.acquire()141                action.run(scenario_engine.common_obj)142                self.lock.release()143                time.sleep(0.01)144def always():145    return True146def child_ready():147    return True148def options(val):149    global common_obj150    return common_obj["options"].get(val, False)151class Event(object):152    def run(self, common_obj):153        raise NotImplementedError("Should have implemented this")154    @staticmethod155    def of(event_json):156        if event_json is None:157            return EmptyEvent()158        if event_json["type"] == EventType.GAZE_AVERTING.value:159            return SimpleEvent(EventType.GAZE_AVERTING, event_json["separation"], event_json["value"], event_json["actions"])160        if event_json["type"] == EventType.Emotion_OCCURRED.value:161            return SimpleEvent(EventType.Emotion_OCCURRED, event_json["separation"], event_json["value"], event_json["actions"])162        if event_json["type"] == EventType.QUESTION_DETECTED.value:163            return SimpleEvent(EventType.QUESTION_DETECTED, event_json["separation"], event_json["value"], event_json["actions"])164        if event_json["type"] == EventType.SILENCE_DETECTED.value:165            return SimpleEvent(EventType.SILENCE_DETECTED, event_json["separation"], event_json["value"], event_json["actions"])166class EmptyEvent(Event):167    def run(self, common_obj):168        pass169class SimpleEvent(Event):170    def __init__(self, type, separation, value,  actions):171        self.type = type172        self.data = {"type": type, "separation": separation, "value": value}173        self.actions = parse_actions(actions)174    def run(self, common_obj):175        print self.actions176        for action in self.actions:...ps3_p4.py
Source:ps3_p4.py  
1# Infinite Mind Reading2#3# Just as a context-free grammar may be 'empty', it may also have an4# infinite language. We say that the language for a grammar is infinite if5# the grammar accepts an infinite number of different strings (each of6# which is of finite length). Most interesting (and creative!) languages7# are infinite.8#9# For example, the language of this grammar is infinite:10#11# grammar1 = [12#       ("S", [ "S", "a" ] ),        # S -> S a13#       ("S", [ "b", ]) ,            # S -> b14#       ]15#16# Because it accepts the strings b, ba, baa, baaa, baaaa, etc.17#18# However, this similar grammar does _not_ have an infinite language:19#20# grammar2 = [21#       ("S", [ "S", ]),             # S -> S22#       ("S", [ "b", ]) ,            # S -> b23#       ]24#25# Because it only accepts one string: b.26#27# For this problem you will write a procedure cfginfinite(grammar)28# that returns True (the value True, not the string "True") if the grammar29# accepts an infinite number of strings (starting from any symbol). Your30# procedure should return False otherwise.31#32# Consider this example:33#34# grammar3 = [35#       ("S", [ "Q", ] ),        # S -> Q36#       ("Q", [ "b", ]) ,        # Q -> b37#       ("Q", [ "R", "a" ]),     # Q -> R a38#       ("R", [ "Q"]),           # R -> Q39#       ]40#41# The language of this grammar is infinite (b, ba, baa, etc.) because it is42# possible to "loop" or "travel" from Q back to Q, picking up an "a" each43# time. Since we can travel around the loop as often as we like, we can44# generate infinite strings. By contrast, in grammar2 it is possible to45# travel from S to S, but we do not pick up any symbols by doing so.46#47# Important Assumption: For this problem, you may assume that for every48# non-terminal in the grammar, that non-terminal derives at least one49# non-empty finite string.  (You could just call cfgempty() from before to50# determine this, so we'll assume it.)51#52# Hint 1: Determine if "Q" can be re-written to "x Q y", where either x53# or y is non-empty.54#55# Hint 2: The "Important Assumption" above is more important than it looks:56# it means that any rewrite rule "bigger" than ("P", ["Q"]) adds at least57# one token.58#59# Hint 3: While cfginfinite(grammar) is not recursive, you may want to60# write a helper procedure (that determines if Q can be re-written to "x Q61# y" with |x+y| > 0 ) that _is_ recursive. Watch out for infinite loops:62# keep track of what you have already visited.63import pprint64def get_nonterminals_and_terminals(grammar):65    allsymbols = set()66    nonterminals = set()67    for (production_lhs, production_rhs) in grammar:68        nonterminals.add(production_lhs)69        allsymbols.add(production_lhs)70        allsymbols.update(production_rhs)71    terminals = allsymbols - nonterminals72    return (nonterminals, terminals)73def cfginfinite(grammar):74    (nonterminals, terminals) = get_nonterminals_and_terminals(grammar)75    if any(is_infinite_loop(grammar,76                            rule,77                            nonterminals,78                            terminals) == True79           for rule in grammar):80        return True81    else:82        return False83def is_infinite_loop(grammar,84                     start_rule,85                     nonterminals,86                     terminals,87                     current_rule = None,88                     visited = None):89    print "is_infinite_loop() entry. start_rule: '%s', current_rule: '%s', visited:\n'%s'" % (start_rule, current_rule, pprint.pformat(visited))90    # ------------------------------------------------------------------------91    #   Initialize variables.92    # ------------------------------------------------------------------------93    if visited is None:94        visited = []95    if current_rule is None:96        current_rule = start_rule97    # ------------------------------------------------------------------------98    # ------------------------------------------------------------------------99    #   Base-case: if the start rule's LHS symbol is in the current rule's100    #   RHS and the current rule _or_ the starting rule has any terminals101    #   we're infinite.102    # ------------------------------------------------------------------------103    if (start_rule[0] in current_rule[1]) and \104       (any(elem in terminals for elem in start_rule[1] + current_rule[1])):105           print "start_rule: '%s'. base-case infinite loop found." % (start_rule, )106           return True107    # ------------------------------------------------------------------------108    unvisited_rules = [rule for rule in grammar109                       if rule not in visited and110                          any(elem in rule[1] for elem in current_rule[1])]111    for rule in unvisited_rules:112        print "unvisited rule: '%s'" % (rule, )113        visited.append(rule)114        (rule_lhs, rule_rhs) = rule115        any_terminals = any(elem in terminals for elem in rule_rhs)116        rewrites_to_ourself = any(elem == start_rule[0] for elem in rule_rhs)117        if rewrites_to_ourself and any_terminals:118            print "start_rule: '%s'. rewrites_to_ourself and any_terminals True." % (start_rule, )119            return True120        for rhs_nonterminal in [elem for elem in rule_rhs if elem in nonterminals]:121            print "start_rule: '%s'. rhs_nonterminal: '%s'" % (start_rule, rhs_nonterminal)122            matching_rules = [rule for rule in grammar if rule[0] == rhs_nonterminal]123            any_rhs_is_infinite =  any(is_infinite_loop(grammar,124                                                        start_rule,125                                                        nonterminals,126                                                        terminals,127                                                        matching_rule,128                                                        visited)129                                       for matching_rule in matching_rules)130            print "start_rule: '%s'. returning any_rhs_is_infinite: %s" % (start_rule, any_rhs_is_infinite)131            return any_rhs_is_infinite132    print "end of function, return False."133    return False134# We have provided a few test cases. You will likely want to write your own135# as well.136grammar1 = [137      ("S", [ "S", "a" ]), # S -> S a138      ("S", [ "b", ]) , # S -> b139      ]140print '-' * 20 + ' 1 ' + '-' * 20141print cfginfinite(grammar1) == True142grammar2 = [143      ("S", [ "S", ]), # S -> S144      ("S", [ "b", ]) , # S -> b145      ]146print '-' * 20 + ' 2 ' + '-' * 20147print cfginfinite(grammar2) == False148grammar3 = [149      ("S", [ "Q", ]), # S -> Q150      ("Q", [ "b", ]) , # Q -> b151      ("Q", [ "R", "a" ]), # Q -> R a152      ("R", [ "Q"]), # R -> Q153      ]154print '-' * 20 + ' 3 ' + '-' * 20155print cfginfinite(grammar3) == True156grammar4 = [  # Nobel Peace Prizes, 1990-1993157      ("S", [ "Q", ]),158      ("Q", [ "Mikhail Gorbachev", ]) ,159      ("Q", [ "P", "Aung San Suu Kyi" ]),160      ("R", [ "Q"]),161      ("R", [ "Rigoberta Tum"]),162      ("P", [ "Mandela and de Klerk"]),163      ]164print '-' * 20 + ' 4 ' + '-' * 20...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
