How to use match_StepLine method in Gherkin-python

Best Python code snippet using gherkin-python

gherkin.js

Source:gherkin.js Github

copy

Full Screen

...4229 if(match_Comment(context, token)) {4230 build(context, token);4231 return 8;4232 }4233 if(match_StepLine(context, token)) {4234 startRule(context, 'Step');4235 build(context, token);4236 return 9;4237 }4238 if(match_TagLine(context, token)) {4239 endRule(context, 'Background');4240 startRule(context, 'Scenario_Definition');4241 startRule(context, 'Tags');4242 build(context, token);4243 return 11;4244 }4245 if(match_ScenarioLine(context, token)) {4246 endRule(context, 'Background');4247 startRule(context, 'Scenario_Definition');4248 startRule(context, 'Scenario');4249 build(context, token);4250 return 12;4251 }4252 if(match_ScenarioOutlineLine(context, token)) {4253 endRule(context, 'Background');4254 startRule(context, 'Scenario_Definition');4255 startRule(context, 'ScenarioOutline');4256 build(context, token);4257 return 17;4258 }4259 if(match_Other(context, token)) {4260 startRule(context, 'Description');4261 build(context, token);4262 return 7;4263 }4264 4265 var stateComment = "State: 6 - GherkinDocument:0>Feature:1>Background:0>#BackgroundLine:0";4266 token.detach();4267 var expectedTokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"];4268 var error = token.isEof ?4269 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4270 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4271 if (self.stopAtFirstError) throw error;4272 addError(context, error);4273 return 6;4274 }4275 // GherkinDocument:0>Feature:1>Background:1>Description_Helper:1>Description:0>#Other:04276 function matchTokenAt_7(token, context) {4277 if(match_EOF(context, token)) {4278 endRule(context, 'Description');4279 endRule(context, 'Background');4280 endRule(context, 'Feature');4281 build(context, token);4282 return 27;4283 }4284 if(match_Comment(context, token)) {4285 endRule(context, 'Description');4286 build(context, token);4287 return 8;4288 }4289 if(match_StepLine(context, token)) {4290 endRule(context, 'Description');4291 startRule(context, 'Step');4292 build(context, token);4293 return 9;4294 }4295 if(match_TagLine(context, token)) {4296 endRule(context, 'Description');4297 endRule(context, 'Background');4298 startRule(context, 'Scenario_Definition');4299 startRule(context, 'Tags');4300 build(context, token);4301 return 11;4302 }4303 if(match_ScenarioLine(context, token)) {4304 endRule(context, 'Description');4305 endRule(context, 'Background');4306 startRule(context, 'Scenario_Definition');4307 startRule(context, 'Scenario');4308 build(context, token);4309 return 12;4310 }4311 if(match_ScenarioOutlineLine(context, token)) {4312 endRule(context, 'Description');4313 endRule(context, 'Background');4314 startRule(context, 'Scenario_Definition');4315 startRule(context, 'ScenarioOutline');4316 build(context, token);4317 return 17;4318 }4319 if(match_Other(context, token)) {4320 build(context, token);4321 return 7;4322 }4323 4324 var stateComment = "State: 7 - GherkinDocument:0>Feature:1>Background:1>Description_Helper:1>Description:0>#Other:0";4325 token.detach();4326 var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"];4327 var error = token.isEof ?4328 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4329 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4330 if (self.stopAtFirstError) throw error;4331 addError(context, error);4332 return 7;4333 }4334 // GherkinDocument:0>Feature:1>Background:1>Description_Helper:2>#Comment:04335 function matchTokenAt_8(token, context) {4336 if(match_EOF(context, token)) {4337 endRule(context, 'Background');4338 endRule(context, 'Feature');4339 build(context, token);4340 return 27;4341 }4342 if(match_Comment(context, token)) {4343 build(context, token);4344 return 8;4345 }4346 if(match_StepLine(context, token)) {4347 startRule(context, 'Step');4348 build(context, token);4349 return 9;4350 }4351 if(match_TagLine(context, token)) {4352 endRule(context, 'Background');4353 startRule(context, 'Scenario_Definition');4354 startRule(context, 'Tags');4355 build(context, token);4356 return 11;4357 }4358 if(match_ScenarioLine(context, token)) {4359 endRule(context, 'Background');4360 startRule(context, 'Scenario_Definition');4361 startRule(context, 'Scenario');4362 build(context, token);4363 return 12;4364 }4365 if(match_ScenarioOutlineLine(context, token)) {4366 endRule(context, 'Background');4367 startRule(context, 'Scenario_Definition');4368 startRule(context, 'ScenarioOutline');4369 build(context, token);4370 return 17;4371 }4372 if(match_Empty(context, token)) {4373 build(context, token);4374 return 8;4375 }4376 4377 var stateComment = "State: 8 - GherkinDocument:0>Feature:1>Background:1>Description_Helper:2>#Comment:0";4378 token.detach();4379 var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"];4380 var error = token.isEof ?4381 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4382 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4383 if (self.stopAtFirstError) throw error;4384 addError(context, error);4385 return 8;4386 }4387 // GherkinDocument:0>Feature:1>Background:2>Step:0>#StepLine:04388 function matchTokenAt_9(token, context) {4389 if(match_EOF(context, token)) {4390 endRule(context, 'Step');4391 endRule(context, 'Background');4392 endRule(context, 'Feature');4393 build(context, token);4394 return 27;4395 }4396 if(match_TableRow(context, token)) {4397 startRule(context, 'DataTable');4398 build(context, token);4399 return 10;4400 }4401 if(match_DocStringSeparator(context, token)) {4402 startRule(context, 'DocString');4403 build(context, token);4404 return 32;4405 }4406 if(match_StepLine(context, token)) {4407 endRule(context, 'Step');4408 startRule(context, 'Step');4409 build(context, token);4410 return 9;4411 }4412 if(match_TagLine(context, token)) {4413 endRule(context, 'Step');4414 endRule(context, 'Background');4415 startRule(context, 'Scenario_Definition');4416 startRule(context, 'Tags');4417 build(context, token);4418 return 11;4419 }4420 if(match_ScenarioLine(context, token)) {4421 endRule(context, 'Step');4422 endRule(context, 'Background');4423 startRule(context, 'Scenario_Definition');4424 startRule(context, 'Scenario');4425 build(context, token);4426 return 12;4427 }4428 if(match_ScenarioOutlineLine(context, token)) {4429 endRule(context, 'Step');4430 endRule(context, 'Background');4431 startRule(context, 'Scenario_Definition');4432 startRule(context, 'ScenarioOutline');4433 build(context, token);4434 return 17;4435 }4436 if(match_Comment(context, token)) {4437 build(context, token);4438 return 9;4439 }4440 if(match_Empty(context, token)) {4441 build(context, token);4442 return 9;4443 }4444 4445 var stateComment = "State: 9 - GherkinDocument:0>Feature:1>Background:2>Step:0>#StepLine:0";4446 token.detach();4447 var expectedTokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];4448 var error = token.isEof ?4449 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4450 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4451 if (self.stopAtFirstError) throw error;4452 addError(context, error);4453 return 9;4454 }4455 // GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:04456 function matchTokenAt_10(token, context) {4457 if(match_EOF(context, token)) {4458 endRule(context, 'DataTable');4459 endRule(context, 'Step');4460 endRule(context, 'Background');4461 endRule(context, 'Feature');4462 build(context, token);4463 return 27;4464 }4465 if(match_TableRow(context, token)) {4466 build(context, token);4467 return 10;4468 }4469 if(match_StepLine(context, token)) {4470 endRule(context, 'DataTable');4471 endRule(context, 'Step');4472 startRule(context, 'Step');4473 build(context, token);4474 return 9;4475 }4476 if(match_TagLine(context, token)) {4477 endRule(context, 'DataTable');4478 endRule(context, 'Step');4479 endRule(context, 'Background');4480 startRule(context, 'Scenario_Definition');4481 startRule(context, 'Tags');4482 build(context, token);4483 return 11;4484 }4485 if(match_ScenarioLine(context, token)) {4486 endRule(context, 'DataTable');4487 endRule(context, 'Step');4488 endRule(context, 'Background');4489 startRule(context, 'Scenario_Definition');4490 startRule(context, 'Scenario');4491 build(context, token);4492 return 12;4493 }4494 if(match_ScenarioOutlineLine(context, token)) {4495 endRule(context, 'DataTable');4496 endRule(context, 'Step');4497 endRule(context, 'Background');4498 startRule(context, 'Scenario_Definition');4499 startRule(context, 'ScenarioOutline');4500 build(context, token);4501 return 17;4502 }4503 if(match_Comment(context, token)) {4504 build(context, token);4505 return 10;4506 }4507 if(match_Empty(context, token)) {4508 build(context, token);4509 return 10;4510 }4511 4512 var stateComment = "State: 10 - GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0";4513 token.detach();4514 var expectedTokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];4515 var error = token.isEof ?4516 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4517 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4518 if (self.stopAtFirstError) throw error;4519 addError(context, error);4520 return 10;4521 }4522 // GherkinDocument:0>Feature:2>Scenario_Definition:0>Tags:0>#TagLine:04523 function matchTokenAt_11(token, context) {4524 if(match_TagLine(context, token)) {4525 build(context, token);4526 return 11;4527 }4528 if(match_ScenarioLine(context, token)) {4529 endRule(context, 'Tags');4530 startRule(context, 'Scenario');4531 build(context, token);4532 return 12;4533 }4534 if(match_ScenarioOutlineLine(context, token)) {4535 endRule(context, 'Tags');4536 startRule(context, 'ScenarioOutline');4537 build(context, token);4538 return 17;4539 }4540 if(match_Comment(context, token)) {4541 build(context, token);4542 return 11;4543 }4544 if(match_Empty(context, token)) {4545 build(context, token);4546 return 11;4547 }4548 4549 var stateComment = "State: 11 - GherkinDocument:0>Feature:2>Scenario_Definition:0>Tags:0>#TagLine:0";4550 token.detach();4551 var expectedTokens = ["#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];4552 var error = token.isEof ?4553 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4554 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4555 if (self.stopAtFirstError) throw error;4556 addError(context, error);4557 return 11;4558 }4559 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:0>#ScenarioLine:04560 function matchTokenAt_12(token, context) {4561 if(match_EOF(context, token)) {4562 endRule(context, 'Scenario');4563 endRule(context, 'Scenario_Definition');4564 endRule(context, 'Feature');4565 build(context, token);4566 return 27;4567 }4568 if(match_Empty(context, token)) {4569 build(context, token);4570 return 12;4571 }4572 if(match_Comment(context, token)) {4573 build(context, token);4574 return 14;4575 }4576 if(match_StepLine(context, token)) {4577 startRule(context, 'Step');4578 build(context, token);4579 return 15;4580 }4581 if(match_TagLine(context, token)) {4582 endRule(context, 'Scenario');4583 endRule(context, 'Scenario_Definition');4584 startRule(context, 'Scenario_Definition');4585 startRule(context, 'Tags');4586 build(context, token);4587 return 11;4588 }4589 if(match_ScenarioLine(context, token)) {4590 endRule(context, 'Scenario');4591 endRule(context, 'Scenario_Definition');4592 startRule(context, 'Scenario_Definition');4593 startRule(context, 'Scenario');4594 build(context, token);4595 return 12;4596 }4597 if(match_ScenarioOutlineLine(context, token)) {4598 endRule(context, 'Scenario');4599 endRule(context, 'Scenario_Definition');4600 startRule(context, 'Scenario_Definition');4601 startRule(context, 'ScenarioOutline');4602 build(context, token);4603 return 17;4604 }4605 if(match_Other(context, token)) {4606 startRule(context, 'Description');4607 build(context, token);4608 return 13;4609 }4610 4611 var stateComment = "State: 12 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:0>#ScenarioLine:0";4612 token.detach();4613 var expectedTokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"];4614 var error = token.isEof ?4615 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4616 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4617 if (self.stopAtFirstError) throw error;4618 addError(context, error);4619 return 12;4620 }4621 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Description_Helper:1>Description:0>#Other:04622 function matchTokenAt_13(token, context) {4623 if(match_EOF(context, token)) {4624 endRule(context, 'Description');4625 endRule(context, 'Scenario');4626 endRule(context, 'Scenario_Definition');4627 endRule(context, 'Feature');4628 build(context, token);4629 return 27;4630 }4631 if(match_Comment(context, token)) {4632 endRule(context, 'Description');4633 build(context, token);4634 return 14;4635 }4636 if(match_StepLine(context, token)) {4637 endRule(context, 'Description');4638 startRule(context, 'Step');4639 build(context, token);4640 return 15;4641 }4642 if(match_TagLine(context, token)) {4643 endRule(context, 'Description');4644 endRule(context, 'Scenario');4645 endRule(context, 'Scenario_Definition');4646 startRule(context, 'Scenario_Definition');4647 startRule(context, 'Tags');4648 build(context, token);4649 return 11;4650 }4651 if(match_ScenarioLine(context, token)) {4652 endRule(context, 'Description');4653 endRule(context, 'Scenario');4654 endRule(context, 'Scenario_Definition');4655 startRule(context, 'Scenario_Definition');4656 startRule(context, 'Scenario');4657 build(context, token);4658 return 12;4659 }4660 if(match_ScenarioOutlineLine(context, token)) {4661 endRule(context, 'Description');4662 endRule(context, 'Scenario');4663 endRule(context, 'Scenario_Definition');4664 startRule(context, 'Scenario_Definition');4665 startRule(context, 'ScenarioOutline');4666 build(context, token);4667 return 17;4668 }4669 if(match_Other(context, token)) {4670 build(context, token);4671 return 13;4672 }4673 4674 var stateComment = "State: 13 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Description_Helper:1>Description:0>#Other:0";4675 token.detach();4676 var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"];4677 var error = token.isEof ?4678 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4679 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4680 if (self.stopAtFirstError) throw error;4681 addError(context, error);4682 return 13;4683 }4684 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Description_Helper:2>#Comment:04685 function matchTokenAt_14(token, context) {4686 if(match_EOF(context, token)) {4687 endRule(context, 'Scenario');4688 endRule(context, 'Scenario_Definition');4689 endRule(context, 'Feature');4690 build(context, token);4691 return 27;4692 }4693 if(match_Comment(context, token)) {4694 build(context, token);4695 return 14;4696 }4697 if(match_StepLine(context, token)) {4698 startRule(context, 'Step');4699 build(context, token);4700 return 15;4701 }4702 if(match_TagLine(context, token)) {4703 endRule(context, 'Scenario');4704 endRule(context, 'Scenario_Definition');4705 startRule(context, 'Scenario_Definition');4706 startRule(context, 'Tags');4707 build(context, token);4708 return 11;4709 }4710 if(match_ScenarioLine(context, token)) {4711 endRule(context, 'Scenario');4712 endRule(context, 'Scenario_Definition');4713 startRule(context, 'Scenario_Definition');4714 startRule(context, 'Scenario');4715 build(context, token);4716 return 12;4717 }4718 if(match_ScenarioOutlineLine(context, token)) {4719 endRule(context, 'Scenario');4720 endRule(context, 'Scenario_Definition');4721 startRule(context, 'Scenario_Definition');4722 startRule(context, 'ScenarioOutline');4723 build(context, token);4724 return 17;4725 }4726 if(match_Empty(context, token)) {4727 build(context, token);4728 return 14;4729 }4730 4731 var stateComment = "State: 14 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Description_Helper:2>#Comment:0";4732 token.detach();4733 var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"];4734 var error = token.isEof ?4735 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4736 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4737 if (self.stopAtFirstError) throw error;4738 addError(context, error);4739 return 14;4740 }4741 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:0>#StepLine:04742 function matchTokenAt_15(token, context) {4743 if(match_EOF(context, token)) {4744 endRule(context, 'Step');4745 endRule(context, 'Scenario');4746 endRule(context, 'Scenario_Definition');4747 endRule(context, 'Feature');4748 build(context, token);4749 return 27;4750 }4751 if(match_TableRow(context, token)) {4752 startRule(context, 'DataTable');4753 build(context, token);4754 return 16;4755 }4756 if(match_DocStringSeparator(context, token)) {4757 startRule(context, 'DocString');4758 build(context, token);4759 return 30;4760 }4761 if(match_StepLine(context, token)) {4762 endRule(context, 'Step');4763 startRule(context, 'Step');4764 build(context, token);4765 return 15;4766 }4767 if(match_TagLine(context, token)) {4768 endRule(context, 'Step');4769 endRule(context, 'Scenario');4770 endRule(context, 'Scenario_Definition');4771 startRule(context, 'Scenario_Definition');4772 startRule(context, 'Tags');4773 build(context, token);4774 return 11;4775 }4776 if(match_ScenarioLine(context, token)) {4777 endRule(context, 'Step');4778 endRule(context, 'Scenario');4779 endRule(context, 'Scenario_Definition');4780 startRule(context, 'Scenario_Definition');4781 startRule(context, 'Scenario');4782 build(context, token);4783 return 12;4784 }4785 if(match_ScenarioOutlineLine(context, token)) {4786 endRule(context, 'Step');4787 endRule(context, 'Scenario');4788 endRule(context, 'Scenario_Definition');4789 startRule(context, 'Scenario_Definition');4790 startRule(context, 'ScenarioOutline');4791 build(context, token);4792 return 17;4793 }4794 if(match_Comment(context, token)) {4795 build(context, token);4796 return 15;4797 }4798 if(match_Empty(context, token)) {4799 build(context, token);4800 return 15;4801 }4802 4803 var stateComment = "State: 15 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:0>#StepLine:0";4804 token.detach();4805 var expectedTokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];4806 var error = token.isEof ?4807 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4808 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4809 if (self.stopAtFirstError) throw error;4810 addError(context, error);4811 return 15;4812 }4813 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:04814 function matchTokenAt_16(token, context) {4815 if(match_EOF(context, token)) {4816 endRule(context, 'DataTable');4817 endRule(context, 'Step');4818 endRule(context, 'Scenario');4819 endRule(context, 'Scenario_Definition');4820 endRule(context, 'Feature');4821 build(context, token);4822 return 27;4823 }4824 if(match_TableRow(context, token)) {4825 build(context, token);4826 return 16;4827 }4828 if(match_StepLine(context, token)) {4829 endRule(context, 'DataTable');4830 endRule(context, 'Step');4831 startRule(context, 'Step');4832 build(context, token);4833 return 15;4834 }4835 if(match_TagLine(context, token)) {4836 endRule(context, 'DataTable');4837 endRule(context, 'Step');4838 endRule(context, 'Scenario');4839 endRule(context, 'Scenario_Definition');4840 startRule(context, 'Scenario_Definition');4841 startRule(context, 'Tags');4842 build(context, token);4843 return 11;4844 }4845 if(match_ScenarioLine(context, token)) {4846 endRule(context, 'DataTable');4847 endRule(context, 'Step');4848 endRule(context, 'Scenario');4849 endRule(context, 'Scenario_Definition');4850 startRule(context, 'Scenario_Definition');4851 startRule(context, 'Scenario');4852 build(context, token);4853 return 12;4854 }4855 if(match_ScenarioOutlineLine(context, token)) {4856 endRule(context, 'DataTable');4857 endRule(context, 'Step');4858 endRule(context, 'Scenario');4859 endRule(context, 'Scenario_Definition');4860 startRule(context, 'Scenario_Definition');4861 startRule(context, 'ScenarioOutline');4862 build(context, token);4863 return 17;4864 }4865 if(match_Comment(context, token)) {4866 build(context, token);4867 return 16;4868 }4869 if(match_Empty(context, token)) {4870 build(context, token);4871 return 16;4872 }4873 4874 var stateComment = "State: 16 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0";4875 token.detach();4876 var expectedTokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];4877 var error = token.isEof ?4878 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4879 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4880 if (self.stopAtFirstError) throw error;4881 addError(context, error);4882 return 16;4883 }4884 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:0>#ScenarioOutlineLine:04885 function matchTokenAt_17(token, context) {4886 if(match_EOF(context, token)) {4887 endRule(context, 'ScenarioOutline');4888 endRule(context, 'Scenario_Definition');4889 endRule(context, 'Feature');4890 build(context, token);4891 return 27;4892 }4893 if(match_Empty(context, token)) {4894 build(context, token);4895 return 17;4896 }4897 if(match_Comment(context, token)) {4898 build(context, token);4899 return 19;4900 }4901 if(match_StepLine(context, token)) {4902 startRule(context, 'Step');4903 build(context, token);4904 return 20;4905 }4906 if(match_TagLine(context, token)) {4907 if(lookahead_0(context, token)) {4908 startRule(context, 'Examples_Definition');4909 startRule(context, 'Tags');4910 build(context, token);4911 return 22;4912 }4913 }4914 if(match_TagLine(context, token)) {4915 endRule(context, 'ScenarioOutline');4916 endRule(context, 'Scenario_Definition');4917 startRule(context, 'Scenario_Definition');4918 startRule(context, 'Tags');4919 build(context, token);4920 return 11;4921 }4922 if(match_ExamplesLine(context, token)) {4923 startRule(context, 'Examples_Definition');4924 startRule(context, 'Examples');4925 build(context, token);4926 return 23;4927 }4928 if(match_ScenarioLine(context, token)) {4929 endRule(context, 'ScenarioOutline');4930 endRule(context, 'Scenario_Definition');4931 startRule(context, 'Scenario_Definition');4932 startRule(context, 'Scenario');4933 build(context, token);4934 return 12;4935 }4936 if(match_ScenarioOutlineLine(context, token)) {4937 endRule(context, 'ScenarioOutline');4938 endRule(context, 'Scenario_Definition');4939 startRule(context, 'Scenario_Definition');4940 startRule(context, 'ScenarioOutline');4941 build(context, token);4942 return 17;4943 }4944 if(match_Other(context, token)) {4945 startRule(context, 'Description');4946 build(context, token);4947 return 18;4948 }4949 4950 var stateComment = "State: 17 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:0>#ScenarioOutlineLine:0";4951 token.detach();4952 var expectedTokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"];4953 var error = token.isEof ?4954 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :4955 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);4956 if (self.stopAtFirstError) throw error;4957 addError(context, error);4958 return 17;4959 }4960 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>Description_Helper:1>Description:0>#Other:04961 function matchTokenAt_18(token, context) {4962 if(match_EOF(context, token)) {4963 endRule(context, 'Description');4964 endRule(context, 'ScenarioOutline');4965 endRule(context, 'Scenario_Definition');4966 endRule(context, 'Feature');4967 build(context, token);4968 return 27;4969 }4970 if(match_Comment(context, token)) {4971 endRule(context, 'Description');4972 build(context, token);4973 return 19;4974 }4975 if(match_StepLine(context, token)) {4976 endRule(context, 'Description');4977 startRule(context, 'Step');4978 build(context, token);4979 return 20;4980 }4981 if(match_TagLine(context, token)) {4982 if(lookahead_0(context, token)) {4983 endRule(context, 'Description');4984 startRule(context, 'Examples_Definition');4985 startRule(context, 'Tags');4986 build(context, token);4987 return 22;4988 }4989 }4990 if(match_TagLine(context, token)) {4991 endRule(context, 'Description');4992 endRule(context, 'ScenarioOutline');4993 endRule(context, 'Scenario_Definition');4994 startRule(context, 'Scenario_Definition');4995 startRule(context, 'Tags');4996 build(context, token);4997 return 11;4998 }4999 if(match_ExamplesLine(context, token)) {5000 endRule(context, 'Description');5001 startRule(context, 'Examples_Definition');5002 startRule(context, 'Examples');5003 build(context, token);5004 return 23;5005 }5006 if(match_ScenarioLine(context, token)) {5007 endRule(context, 'Description');5008 endRule(context, 'ScenarioOutline');5009 endRule(context, 'Scenario_Definition');5010 startRule(context, 'Scenario_Definition');5011 startRule(context, 'Scenario');5012 build(context, token);5013 return 12;5014 }5015 if(match_ScenarioOutlineLine(context, token)) {5016 endRule(context, 'Description');5017 endRule(context, 'ScenarioOutline');5018 endRule(context, 'Scenario_Definition');5019 startRule(context, 'Scenario_Definition');5020 startRule(context, 'ScenarioOutline');5021 build(context, token);5022 return 17;5023 }5024 if(match_Other(context, token)) {5025 build(context, token);5026 return 18;5027 }5028 5029 var stateComment = "State: 18 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>Description_Helper:1>Description:0>#Other:0";5030 token.detach();5031 var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"];5032 var error = token.isEof ?5033 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5034 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5035 if (self.stopAtFirstError) throw error;5036 addError(context, error);5037 return 18;5038 }5039 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>Description_Helper:2>#Comment:05040 function matchTokenAt_19(token, context) {5041 if(match_EOF(context, token)) {5042 endRule(context, 'ScenarioOutline');5043 endRule(context, 'Scenario_Definition');5044 endRule(context, 'Feature');5045 build(context, token);5046 return 27;5047 }5048 if(match_Comment(context, token)) {5049 build(context, token);5050 return 19;5051 }5052 if(match_StepLine(context, token)) {5053 startRule(context, 'Step');5054 build(context, token);5055 return 20;5056 }5057 if(match_TagLine(context, token)) {5058 if(lookahead_0(context, token)) {5059 startRule(context, 'Examples_Definition');5060 startRule(context, 'Tags');5061 build(context, token);5062 return 22;5063 }5064 }5065 if(match_TagLine(context, token)) {5066 endRule(context, 'ScenarioOutline');5067 endRule(context, 'Scenario_Definition');5068 startRule(context, 'Scenario_Definition');5069 startRule(context, 'Tags');5070 build(context, token);5071 return 11;5072 }5073 if(match_ExamplesLine(context, token)) {5074 startRule(context, 'Examples_Definition');5075 startRule(context, 'Examples');5076 build(context, token);5077 return 23;5078 }5079 if(match_ScenarioLine(context, token)) {5080 endRule(context, 'ScenarioOutline');5081 endRule(context, 'Scenario_Definition');5082 startRule(context, 'Scenario_Definition');5083 startRule(context, 'Scenario');5084 build(context, token);5085 return 12;5086 }5087 if(match_ScenarioOutlineLine(context, token)) {5088 endRule(context, 'ScenarioOutline');5089 endRule(context, 'Scenario_Definition');5090 startRule(context, 'Scenario_Definition');5091 startRule(context, 'ScenarioOutline');5092 build(context, token);5093 return 17;5094 }5095 if(match_Empty(context, token)) {5096 build(context, token);5097 return 19;5098 }5099 5100 var stateComment = "State: 19 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>Description_Helper:2>#Comment:0";5101 token.detach();5102 var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"];5103 var error = token.isEof ?5104 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5105 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5106 if (self.stopAtFirstError) throw error;5107 addError(context, error);5108 return 19;5109 }5110 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:0>#StepLine:05111 function matchTokenAt_20(token, context) {5112 if(match_EOF(context, token)) {5113 endRule(context, 'Step');5114 endRule(context, 'ScenarioOutline');5115 endRule(context, 'Scenario_Definition');5116 endRule(context, 'Feature');5117 build(context, token);5118 return 27;5119 }5120 if(match_TableRow(context, token)) {5121 startRule(context, 'DataTable');5122 build(context, token);5123 return 21;5124 }5125 if(match_DocStringSeparator(context, token)) {5126 startRule(context, 'DocString');5127 build(context, token);5128 return 28;5129 }5130 if(match_StepLine(context, token)) {5131 endRule(context, 'Step');5132 startRule(context, 'Step');5133 build(context, token);5134 return 20;5135 }5136 if(match_TagLine(context, token)) {5137 if(lookahead_0(context, token)) {5138 endRule(context, 'Step');5139 startRule(context, 'Examples_Definition');5140 startRule(context, 'Tags');5141 build(context, token);5142 return 22;5143 }5144 }5145 if(match_TagLine(context, token)) {5146 endRule(context, 'Step');5147 endRule(context, 'ScenarioOutline');5148 endRule(context, 'Scenario_Definition');5149 startRule(context, 'Scenario_Definition');5150 startRule(context, 'Tags');5151 build(context, token);5152 return 11;5153 }5154 if(match_ExamplesLine(context, token)) {5155 endRule(context, 'Step');5156 startRule(context, 'Examples_Definition');5157 startRule(context, 'Examples');5158 build(context, token);5159 return 23;5160 }5161 if(match_ScenarioLine(context, token)) {5162 endRule(context, 'Step');5163 endRule(context, 'ScenarioOutline');5164 endRule(context, 'Scenario_Definition');5165 startRule(context, 'Scenario_Definition');5166 startRule(context, 'Scenario');5167 build(context, token);5168 return 12;5169 }5170 if(match_ScenarioOutlineLine(context, token)) {5171 endRule(context, 'Step');5172 endRule(context, 'ScenarioOutline');5173 endRule(context, 'Scenario_Definition');5174 startRule(context, 'Scenario_Definition');5175 startRule(context, 'ScenarioOutline');5176 build(context, token);5177 return 17;5178 }5179 if(match_Comment(context, token)) {5180 build(context, token);5181 return 20;5182 }5183 if(match_Empty(context, token)) {5184 build(context, token);5185 return 20;5186 }5187 5188 var stateComment = "State: 20 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:0>#StepLine:0";5189 token.detach();5190 var expectedTokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];5191 var error = token.isEof ?5192 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5193 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5194 if (self.stopAtFirstError) throw error;5195 addError(context, error);5196 return 20;5197 }5198 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:05199 function matchTokenAt_21(token, context) {5200 if(match_EOF(context, token)) {5201 endRule(context, 'DataTable');5202 endRule(context, 'Step');5203 endRule(context, 'ScenarioOutline');5204 endRule(context, 'Scenario_Definition');5205 endRule(context, 'Feature');5206 build(context, token);5207 return 27;5208 }5209 if(match_TableRow(context, token)) {5210 build(context, token);5211 return 21;5212 }5213 if(match_StepLine(context, token)) {5214 endRule(context, 'DataTable');5215 endRule(context, 'Step');5216 startRule(context, 'Step');5217 build(context, token);5218 return 20;5219 }5220 if(match_TagLine(context, token)) {5221 if(lookahead_0(context, token)) {5222 endRule(context, 'DataTable');5223 endRule(context, 'Step');5224 startRule(context, 'Examples_Definition');5225 startRule(context, 'Tags');5226 build(context, token);5227 return 22;5228 }5229 }5230 if(match_TagLine(context, token)) {5231 endRule(context, 'DataTable');5232 endRule(context, 'Step');5233 endRule(context, 'ScenarioOutline');5234 endRule(context, 'Scenario_Definition');5235 startRule(context, 'Scenario_Definition');5236 startRule(context, 'Tags');5237 build(context, token);5238 return 11;5239 }5240 if(match_ExamplesLine(context, token)) {5241 endRule(context, 'DataTable');5242 endRule(context, 'Step');5243 startRule(context, 'Examples_Definition');5244 startRule(context, 'Examples');5245 build(context, token);5246 return 23;5247 }5248 if(match_ScenarioLine(context, token)) {5249 endRule(context, 'DataTable');5250 endRule(context, 'Step');5251 endRule(context, 'ScenarioOutline');5252 endRule(context, 'Scenario_Definition');5253 startRule(context, 'Scenario_Definition');5254 startRule(context, 'Scenario');5255 build(context, token);5256 return 12;5257 }5258 if(match_ScenarioOutlineLine(context, token)) {5259 endRule(context, 'DataTable');5260 endRule(context, 'Step');5261 endRule(context, 'ScenarioOutline');5262 endRule(context, 'Scenario_Definition');5263 startRule(context, 'Scenario_Definition');5264 startRule(context, 'ScenarioOutline');5265 build(context, token);5266 return 17;5267 }5268 if(match_Comment(context, token)) {5269 build(context, token);5270 return 21;5271 }5272 if(match_Empty(context, token)) {5273 build(context, token);5274 return 21;5275 }5276 5277 var stateComment = "State: 21 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0";5278 token.detach();5279 var expectedTokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];5280 var error = token.isEof ?5281 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5282 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5283 if (self.stopAtFirstError) throw error;5284 addError(context, error);5285 return 21;5286 }5287 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:0>Tags:0>#TagLine:05288 function matchTokenAt_22(token, context) {5289 if(match_TagLine(context, token)) {5290 build(context, token);5291 return 22;5292 }5293 if(match_ExamplesLine(context, token)) {5294 endRule(context, 'Tags');5295 startRule(context, 'Examples');5296 build(context, token);5297 return 23;5298 }5299 if(match_Comment(context, token)) {5300 build(context, token);5301 return 22;5302 }5303 if(match_Empty(context, token)) {5304 build(context, token);5305 return 22;5306 }5307 5308 var stateComment = "State: 22 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:0>Tags:0>#TagLine:0";5309 token.detach();5310 var expectedTokens = ["#TagLine", "#ExamplesLine", "#Comment", "#Empty"];5311 var error = token.isEof ?5312 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5313 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5314 if (self.stopAtFirstError) throw error;5315 addError(context, error);5316 return 22;5317 }5318 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:0>#ExamplesLine:05319 function matchTokenAt_23(token, context) {5320 if(match_EOF(context, token)) {5321 endRule(context, 'Examples');5322 endRule(context, 'Examples_Definition');5323 endRule(context, 'ScenarioOutline');5324 endRule(context, 'Scenario_Definition');5325 endRule(context, 'Feature');5326 build(context, token);5327 return 27;5328 }5329 if(match_Empty(context, token)) {5330 build(context, token);5331 return 23;5332 }5333 if(match_Comment(context, token)) {5334 build(context, token);5335 return 25;5336 }5337 if(match_TableRow(context, token)) {5338 startRule(context, 'Examples_Table');5339 build(context, token);5340 return 26;5341 }5342 if(match_TagLine(context, token)) {5343 if(lookahead_0(context, token)) {5344 endRule(context, 'Examples');5345 endRule(context, 'Examples_Definition');5346 startRule(context, 'Examples_Definition');5347 startRule(context, 'Tags');5348 build(context, token);5349 return 22;5350 }5351 }5352 if(match_TagLine(context, token)) {5353 endRule(context, 'Examples');5354 endRule(context, 'Examples_Definition');5355 endRule(context, 'ScenarioOutline');5356 endRule(context, 'Scenario_Definition');5357 startRule(context, 'Scenario_Definition');5358 startRule(context, 'Tags');5359 build(context, token);5360 return 11;5361 }5362 if(match_ExamplesLine(context, token)) {5363 endRule(context, 'Examples');5364 endRule(context, 'Examples_Definition');5365 startRule(context, 'Examples_Definition');5366 startRule(context, 'Examples');5367 build(context, token);5368 return 23;5369 }5370 if(match_ScenarioLine(context, token)) {5371 endRule(context, 'Examples');5372 endRule(context, 'Examples_Definition');5373 endRule(context, 'ScenarioOutline');5374 endRule(context, 'Scenario_Definition');5375 startRule(context, 'Scenario_Definition');5376 startRule(context, 'Scenario');5377 build(context, token);5378 return 12;5379 }5380 if(match_ScenarioOutlineLine(context, token)) {5381 endRule(context, 'Examples');5382 endRule(context, 'Examples_Definition');5383 endRule(context, 'ScenarioOutline');5384 endRule(context, 'Scenario_Definition');5385 startRule(context, 'Scenario_Definition');5386 startRule(context, 'ScenarioOutline');5387 build(context, token);5388 return 17;5389 }5390 if(match_Other(context, token)) {5391 startRule(context, 'Description');5392 build(context, token);5393 return 24;5394 }5395 5396 var stateComment = "State: 23 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:0>#ExamplesLine:0";5397 token.detach();5398 var expectedTokens = ["#EOF", "#Empty", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"];5399 var error = token.isEof ?5400 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5401 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5402 if (self.stopAtFirstError) throw error;5403 addError(context, error);5404 return 23;5405 }5406 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Description_Helper:1>Description:0>#Other:05407 function matchTokenAt_24(token, context) {5408 if(match_EOF(context, token)) {5409 endRule(context, 'Description');5410 endRule(context, 'Examples');5411 endRule(context, 'Examples_Definition');5412 endRule(context, 'ScenarioOutline');5413 endRule(context, 'Scenario_Definition');5414 endRule(context, 'Feature');5415 build(context, token);5416 return 27;5417 }5418 if(match_Comment(context, token)) {5419 endRule(context, 'Description');5420 build(context, token);5421 return 25;5422 }5423 if(match_TableRow(context, token)) {5424 endRule(context, 'Description');5425 startRule(context, 'Examples_Table');5426 build(context, token);5427 return 26;5428 }5429 if(match_TagLine(context, token)) {5430 if(lookahead_0(context, token)) {5431 endRule(context, 'Description');5432 endRule(context, 'Examples');5433 endRule(context, 'Examples_Definition');5434 startRule(context, 'Examples_Definition');5435 startRule(context, 'Tags');5436 build(context, token);5437 return 22;5438 }5439 }5440 if(match_TagLine(context, token)) {5441 endRule(context, 'Description');5442 endRule(context, 'Examples');5443 endRule(context, 'Examples_Definition');5444 endRule(context, 'ScenarioOutline');5445 endRule(context, 'Scenario_Definition');5446 startRule(context, 'Scenario_Definition');5447 startRule(context, 'Tags');5448 build(context, token);5449 return 11;5450 }5451 if(match_ExamplesLine(context, token)) {5452 endRule(context, 'Description');5453 endRule(context, 'Examples');5454 endRule(context, 'Examples_Definition');5455 startRule(context, 'Examples_Definition');5456 startRule(context, 'Examples');5457 build(context, token);5458 return 23;5459 }5460 if(match_ScenarioLine(context, token)) {5461 endRule(context, 'Description');5462 endRule(context, 'Examples');5463 endRule(context, 'Examples_Definition');5464 endRule(context, 'ScenarioOutline');5465 endRule(context, 'Scenario_Definition');5466 startRule(context, 'Scenario_Definition');5467 startRule(context, 'Scenario');5468 build(context, token);5469 return 12;5470 }5471 if(match_ScenarioOutlineLine(context, token)) {5472 endRule(context, 'Description');5473 endRule(context, 'Examples');5474 endRule(context, 'Examples_Definition');5475 endRule(context, 'ScenarioOutline');5476 endRule(context, 'Scenario_Definition');5477 startRule(context, 'Scenario_Definition');5478 startRule(context, 'ScenarioOutline');5479 build(context, token);5480 return 17;5481 }5482 if(match_Other(context, token)) {5483 build(context, token);5484 return 24;5485 }5486 5487 var stateComment = "State: 24 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Description_Helper:1>Description:0>#Other:0";5488 token.detach();5489 var expectedTokens = ["#EOF", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"];5490 var error = token.isEof ?5491 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5492 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5493 if (self.stopAtFirstError) throw error;5494 addError(context, error);5495 return 24;5496 }5497 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Description_Helper:2>#Comment:05498 function matchTokenAt_25(token, context) {5499 if(match_EOF(context, token)) {5500 endRule(context, 'Examples');5501 endRule(context, 'Examples_Definition');5502 endRule(context, 'ScenarioOutline');5503 endRule(context, 'Scenario_Definition');5504 endRule(context, 'Feature');5505 build(context, token);5506 return 27;5507 }5508 if(match_Comment(context, token)) {5509 build(context, token);5510 return 25;5511 }5512 if(match_TableRow(context, token)) {5513 startRule(context, 'Examples_Table');5514 build(context, token);5515 return 26;5516 }5517 if(match_TagLine(context, token)) {5518 if(lookahead_0(context, token)) {5519 endRule(context, 'Examples');5520 endRule(context, 'Examples_Definition');5521 startRule(context, 'Examples_Definition');5522 startRule(context, 'Tags');5523 build(context, token);5524 return 22;5525 }5526 }5527 if(match_TagLine(context, token)) {5528 endRule(context, 'Examples');5529 endRule(context, 'Examples_Definition');5530 endRule(context, 'ScenarioOutline');5531 endRule(context, 'Scenario_Definition');5532 startRule(context, 'Scenario_Definition');5533 startRule(context, 'Tags');5534 build(context, token);5535 return 11;5536 }5537 if(match_ExamplesLine(context, token)) {5538 endRule(context, 'Examples');5539 endRule(context, 'Examples_Definition');5540 startRule(context, 'Examples_Definition');5541 startRule(context, 'Examples');5542 build(context, token);5543 return 23;5544 }5545 if(match_ScenarioLine(context, token)) {5546 endRule(context, 'Examples');5547 endRule(context, 'Examples_Definition');5548 endRule(context, 'ScenarioOutline');5549 endRule(context, 'Scenario_Definition');5550 startRule(context, 'Scenario_Definition');5551 startRule(context, 'Scenario');5552 build(context, token);5553 return 12;5554 }5555 if(match_ScenarioOutlineLine(context, token)) {5556 endRule(context, 'Examples');5557 endRule(context, 'Examples_Definition');5558 endRule(context, 'ScenarioOutline');5559 endRule(context, 'Scenario_Definition');5560 startRule(context, 'Scenario_Definition');5561 startRule(context, 'ScenarioOutline');5562 build(context, token);5563 return 17;5564 }5565 if(match_Empty(context, token)) {5566 build(context, token);5567 return 25;5568 }5569 5570 var stateComment = "State: 25 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Description_Helper:2>#Comment:0";5571 token.detach();5572 var expectedTokens = ["#EOF", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"];5573 var error = token.isEof ?5574 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5575 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5576 if (self.stopAtFirstError) throw error;5577 addError(context, error);5578 return 25;5579 }5580 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:2>Examples_Table:0>#TableRow:05581 function matchTokenAt_26(token, context) {5582 if(match_EOF(context, token)) {5583 endRule(context, 'Examples_Table');5584 endRule(context, 'Examples');5585 endRule(context, 'Examples_Definition');5586 endRule(context, 'ScenarioOutline');5587 endRule(context, 'Scenario_Definition');5588 endRule(context, 'Feature');5589 build(context, token);5590 return 27;5591 }5592 if(match_TableRow(context, token)) {5593 build(context, token);5594 return 26;5595 }5596 if(match_TagLine(context, token)) {5597 if(lookahead_0(context, token)) {5598 endRule(context, 'Examples_Table');5599 endRule(context, 'Examples');5600 endRule(context, 'Examples_Definition');5601 startRule(context, 'Examples_Definition');5602 startRule(context, 'Tags');5603 build(context, token);5604 return 22;5605 }5606 }5607 if(match_TagLine(context, token)) {5608 endRule(context, 'Examples_Table');5609 endRule(context, 'Examples');5610 endRule(context, 'Examples_Definition');5611 endRule(context, 'ScenarioOutline');5612 endRule(context, 'Scenario_Definition');5613 startRule(context, 'Scenario_Definition');5614 startRule(context, 'Tags');5615 build(context, token);5616 return 11;5617 }5618 if(match_ExamplesLine(context, token)) {5619 endRule(context, 'Examples_Table');5620 endRule(context, 'Examples');5621 endRule(context, 'Examples_Definition');5622 startRule(context, 'Examples_Definition');5623 startRule(context, 'Examples');5624 build(context, token);5625 return 23;5626 }5627 if(match_ScenarioLine(context, token)) {5628 endRule(context, 'Examples_Table');5629 endRule(context, 'Examples');5630 endRule(context, 'Examples_Definition');5631 endRule(context, 'ScenarioOutline');5632 endRule(context, 'Scenario_Definition');5633 startRule(context, 'Scenario_Definition');5634 startRule(context, 'Scenario');5635 build(context, token);5636 return 12;5637 }5638 if(match_ScenarioOutlineLine(context, token)) {5639 endRule(context, 'Examples_Table');5640 endRule(context, 'Examples');5641 endRule(context, 'Examples_Definition');5642 endRule(context, 'ScenarioOutline');5643 endRule(context, 'Scenario_Definition');5644 startRule(context, 'Scenario_Definition');5645 startRule(context, 'ScenarioOutline');5646 build(context, token);5647 return 17;5648 }5649 if(match_Comment(context, token)) {5650 build(context, token);5651 return 26;5652 }5653 if(match_Empty(context, token)) {5654 build(context, token);5655 return 26;5656 }5657 5658 var stateComment = "State: 26 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:2>Examples_Table:0>#TableRow:0";5659 token.detach();5660 var expectedTokens = ["#EOF", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];5661 var error = token.isEof ?5662 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5663 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5664 if (self.stopAtFirstError) throw error;5665 addError(context, error);5666 return 26;5667 }5668 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:05669 function matchTokenAt_28(token, context) {5670 if(match_DocStringSeparator(context, token)) {5671 build(context, token);5672 return 29;5673 }5674 if(match_Other(context, token)) {5675 build(context, token);5676 return 28;5677 }5678 5679 var stateComment = "State: 28 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0";5680 token.detach();5681 var expectedTokens = ["#DocStringSeparator", "#Other"];5682 var error = token.isEof ?5683 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5684 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5685 if (self.stopAtFirstError) throw error;5686 addError(context, error);5687 return 28;5688 }5689 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:05690 function matchTokenAt_29(token, context) {5691 if(match_EOF(context, token)) {5692 endRule(context, 'DocString');5693 endRule(context, 'Step');5694 endRule(context, 'ScenarioOutline');5695 endRule(context, 'Scenario_Definition');5696 endRule(context, 'Feature');5697 build(context, token);5698 return 27;5699 }5700 if(match_StepLine(context, token)) {5701 endRule(context, 'DocString');5702 endRule(context, 'Step');5703 startRule(context, 'Step');5704 build(context, token);5705 return 20;5706 }5707 if(match_TagLine(context, token)) {5708 if(lookahead_0(context, token)) {5709 endRule(context, 'DocString');5710 endRule(context, 'Step');5711 startRule(context, 'Examples_Definition');5712 startRule(context, 'Tags');5713 build(context, token);5714 return 22;5715 }5716 }5717 if(match_TagLine(context, token)) {5718 endRule(context, 'DocString');5719 endRule(context, 'Step');5720 endRule(context, 'ScenarioOutline');5721 endRule(context, 'Scenario_Definition');5722 startRule(context, 'Scenario_Definition');5723 startRule(context, 'Tags');5724 build(context, token);5725 return 11;5726 }5727 if(match_ExamplesLine(context, token)) {5728 endRule(context, 'DocString');5729 endRule(context, 'Step');5730 startRule(context, 'Examples_Definition');5731 startRule(context, 'Examples');5732 build(context, token);5733 return 23;5734 }5735 if(match_ScenarioLine(context, token)) {5736 endRule(context, 'DocString');5737 endRule(context, 'Step');5738 endRule(context, 'ScenarioOutline');5739 endRule(context, 'Scenario_Definition');5740 startRule(context, 'Scenario_Definition');5741 startRule(context, 'Scenario');5742 build(context, token);5743 return 12;5744 }5745 if(match_ScenarioOutlineLine(context, token)) {5746 endRule(context, 'DocString');5747 endRule(context, 'Step');5748 endRule(context, 'ScenarioOutline');5749 endRule(context, 'Scenario_Definition');5750 startRule(context, 'Scenario_Definition');5751 startRule(context, 'ScenarioOutline');5752 build(context, token);5753 return 17;5754 }5755 if(match_Comment(context, token)) {5756 build(context, token);5757 return 29;5758 }5759 if(match_Empty(context, token)) {5760 build(context, token);5761 return 29;5762 }5763 5764 var stateComment = "State: 29 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0";5765 token.detach();5766 var expectedTokens = ["#EOF", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];5767 var error = token.isEof ?5768 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5769 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5770 if (self.stopAtFirstError) throw error;5771 addError(context, error);5772 return 29;5773 }5774 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:05775 function matchTokenAt_30(token, context) {5776 if(match_DocStringSeparator(context, token)) {5777 build(context, token);5778 return 31;5779 }5780 if(match_Other(context, token)) {5781 build(context, token);5782 return 30;5783 }5784 5785 var stateComment = "State: 30 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0";5786 token.detach();5787 var expectedTokens = ["#DocStringSeparator", "#Other"];5788 var error = token.isEof ?5789 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5790 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5791 if (self.stopAtFirstError) throw error;5792 addError(context, error);5793 return 30;5794 }5795 // GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:05796 function matchTokenAt_31(token, context) {5797 if(match_EOF(context, token)) {5798 endRule(context, 'DocString');5799 endRule(context, 'Step');5800 endRule(context, 'Scenario');5801 endRule(context, 'Scenario_Definition');5802 endRule(context, 'Feature');5803 build(context, token);5804 return 27;5805 }5806 if(match_StepLine(context, token)) {5807 endRule(context, 'DocString');5808 endRule(context, 'Step');5809 startRule(context, 'Step');5810 build(context, token);5811 return 15;5812 }5813 if(match_TagLine(context, token)) {5814 endRule(context, 'DocString');5815 endRule(context, 'Step');5816 endRule(context, 'Scenario');5817 endRule(context, 'Scenario_Definition');5818 startRule(context, 'Scenario_Definition');5819 startRule(context, 'Tags');5820 build(context, token);5821 return 11;5822 }5823 if(match_ScenarioLine(context, token)) {5824 endRule(context, 'DocString');5825 endRule(context, 'Step');5826 endRule(context, 'Scenario');5827 endRule(context, 'Scenario_Definition');5828 startRule(context, 'Scenario_Definition');5829 startRule(context, 'Scenario');5830 build(context, token);5831 return 12;5832 }5833 if(match_ScenarioOutlineLine(context, token)) {5834 endRule(context, 'DocString');5835 endRule(context, 'Step');5836 endRule(context, 'Scenario');5837 endRule(context, 'Scenario_Definition');5838 startRule(context, 'Scenario_Definition');5839 startRule(context, 'ScenarioOutline');5840 build(context, token);5841 return 17;5842 }5843 if(match_Comment(context, token)) {5844 build(context, token);5845 return 31;5846 }5847 if(match_Empty(context, token)) {5848 build(context, token);5849 return 31;5850 }5851 5852 var stateComment = "State: 31 - GherkinDocument:0>Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0";5853 token.detach();5854 var expectedTokens = ["#EOF", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];5855 var error = token.isEof ?5856 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5857 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5858 if (self.stopAtFirstError) throw error;5859 addError(context, error);5860 return 31;5861 }5862 // GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:05863 function matchTokenAt_32(token, context) {5864 if(match_DocStringSeparator(context, token)) {5865 build(context, token);5866 return 33;5867 }5868 if(match_Other(context, token)) {5869 build(context, token);5870 return 32;5871 }5872 5873 var stateComment = "State: 32 - GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0";5874 token.detach();5875 var expectedTokens = ["#DocStringSeparator", "#Other"];5876 var error = token.isEof ?5877 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5878 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5879 if (self.stopAtFirstError) throw error;5880 addError(context, error);5881 return 32;5882 }5883 // GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:05884 function matchTokenAt_33(token, context) {5885 if(match_EOF(context, token)) {5886 endRule(context, 'DocString');5887 endRule(context, 'Step');5888 endRule(context, 'Background');5889 endRule(context, 'Feature');5890 build(context, token);5891 return 27;5892 }5893 if(match_StepLine(context, token)) {5894 endRule(context, 'DocString');5895 endRule(context, 'Step');5896 startRule(context, 'Step');5897 build(context, token);5898 return 9;5899 }5900 if(match_TagLine(context, token)) {5901 endRule(context, 'DocString');5902 endRule(context, 'Step');5903 endRule(context, 'Background');5904 startRule(context, 'Scenario_Definition');5905 startRule(context, 'Tags');5906 build(context, token);5907 return 11;5908 }5909 if(match_ScenarioLine(context, token)) {5910 endRule(context, 'DocString');5911 endRule(context, 'Step');5912 endRule(context, 'Background');5913 startRule(context, 'Scenario_Definition');5914 startRule(context, 'Scenario');5915 build(context, token);5916 return 12;5917 }5918 if(match_ScenarioOutlineLine(context, token)) {5919 endRule(context, 'DocString');5920 endRule(context, 'Step');5921 endRule(context, 'Background');5922 startRule(context, 'Scenario_Definition');5923 startRule(context, 'ScenarioOutline');5924 build(context, token);5925 return 17;5926 }5927 if(match_Comment(context, token)) {5928 build(context, token);5929 return 33;5930 }5931 if(match_Empty(context, token)) {5932 build(context, token);5933 return 33;5934 }5935 5936 var stateComment = "State: 33 - GherkinDocument:0>Feature:1>Background:2>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0";5937 token.detach();5938 var expectedTokens = ["#EOF", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"];5939 var error = token.isEof ?5940 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :5941 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);5942 if (self.stopAtFirstError) throw error;5943 addError(context, error);5944 return 33;5945 }5946 function match_EOF(context, token) {5947 return handleExternalError(context, false, function () {5948 return context.tokenMatcher.match_EOF(token);5949 });5950 }5951 function match_Empty(context, token) {5952 if(token.isEof) return false;5953 return handleExternalError(context, false, function () {5954 return context.tokenMatcher.match_Empty(token);5955 });5956 }5957 function match_Comment(context, token) {5958 if(token.isEof) return false;5959 return handleExternalError(context, false, function () {5960 return context.tokenMatcher.match_Comment(token);5961 });5962 }5963 function match_TagLine(context, token) {5964 if(token.isEof) return false;5965 return handleExternalError(context, false, function () {5966 return context.tokenMatcher.match_TagLine(token);5967 });5968 }5969 function match_FeatureLine(context, token) {5970 if(token.isEof) return false;5971 return handleExternalError(context, false, function () {5972 return context.tokenMatcher.match_FeatureLine(token);5973 });5974 }5975 function match_BackgroundLine(context, token) {5976 if(token.isEof) return false;5977 return handleExternalError(context, false, function () {5978 return context.tokenMatcher.match_BackgroundLine(token);5979 });5980 }5981 function match_ScenarioLine(context, token) {5982 if(token.isEof) return false;5983 return handleExternalError(context, false, function () {5984 return context.tokenMatcher.match_ScenarioLine(token);5985 });5986 }5987 function match_ScenarioOutlineLine(context, token) {5988 if(token.isEof) return false;5989 return handleExternalError(context, false, function () {5990 return context.tokenMatcher.match_ScenarioOutlineLine(token);5991 });5992 }5993 function match_ExamplesLine(context, token) {5994 if(token.isEof) return false;5995 return handleExternalError(context, false, function () {5996 return context.tokenMatcher.match_ExamplesLine(token);5997 });5998 }5999 function match_StepLine(context, token) {6000 if(token.isEof) return false;6001 return handleExternalError(context, false, function () {6002 return context.tokenMatcher.match_StepLine(token);6003 });6004 }6005 function match_DocStringSeparator(context, token) {6006 if(token.isEof) return false;6007 return handleExternalError(context, false, function () {6008 return context.tokenMatcher.match_DocStringSeparator(token);6009 });6010 }6011 function match_TableRow(context, token) {6012 if(token.isEof) return false;6013 return handleExternalError(context, false, function () {6014 return context.tokenMatcher.match_TableRow(token);6015 });6016 }6017 function match_Language(context, token) {6018 if(token.isEof) return false;6019 return handleExternalError(context, false, function () {6020 return context.tokenMatcher.match_Language(token);6021 });6022 }6023 function match_Other(context, token) {6024 if(token.isEof) return false;6025 return handleExternalError(context, false, function () {6026 return context.tokenMatcher.match_Other(token);6027 });6028 }6029 function lookahead_0(context, currentToken) {6030 currentToken.detach();6031 var token;6032 var queue = [];6033 var match = false;6034 do {6035 token = readToken(context);6036 token.detach();6037 queue.push(token);6038 if (false || match_ExamplesLine(context, token)) {6039 match = true;6040 break;6041 }6042 } while(false || match_Empty(context, token) || match_Comment(context, token) || match_TagLine(context, token));6043 context.tokenQueue = context.tokenQueue.concat(queue);6044 return match;6045 }6046}6047},{"./ast_builder":2,"./errors":6,"./token_matcher":13,"./token_scanner":14}],11:[function(require,module,exports){6048var countSymbols = require('../count_symbols');6049function Compiler() {6050 this.compile = function (gherkin_document) {6051 var pickles = [];6052 if (gherkin_document.feature == null) return pickles;6053 var feature = gherkin_document.feature;6054 var language = feature.language;6055 var featureTags = feature.tags;6056 var backgroundSteps = [];6057 feature.children.forEach(function (scenarioDefinition) {6058 if(scenarioDefinition.type === 'Background') {6059 backgroundSteps = pickleSteps(scenarioDefinition);6060 } else if(scenarioDefinition.type === 'Scenario') {6061 compileScenario(featureTags, backgroundSteps, scenarioDefinition, language, pickles);6062 } else {6063 compileScenarioOutline(featureTags, backgroundSteps, scenarioDefinition, language, pickles);6064 }6065 });6066 return pickles;6067 };6068 function compileScenario(featureTags, backgroundSteps, scenario, language, pickles) {6069 var steps = scenario.steps.length == 0 ? [] : [].concat(backgroundSteps);6070 var tags = [].concat(featureTags).concat(scenario.tags);6071 scenario.steps.forEach(function (step) {6072 steps.push(pickleStep(step));6073 });6074 var pickle = {6075 tags: pickleTags(tags),6076 name: scenario.name,6077 language: language,6078 locations: [pickleLocation(scenario.location)],6079 steps: steps6080 };6081 pickles.push(pickle);6082 }6083 function compileScenarioOutline(featureTags, backgroundSteps, scenarioOutline, language, pickles) {6084 scenarioOutline.examples.filter(function(e) { return e.tableHeader != undefined; }).forEach(function (examples) {6085 var variableCells = examples.tableHeader.cells;6086 examples.tableBody.forEach(function (values) {6087 var valueCells = values.cells;6088 var steps = scenarioOutline.steps.length == 0 ? [] : [].concat(backgroundSteps);6089 var tags = [].concat(featureTags).concat(scenarioOutline.tags).concat(examples.tags);6090 scenarioOutline.steps.forEach(function (scenarioOutlineStep) {6091 var stepText = interpolate(scenarioOutlineStep.text, variableCells, valueCells);6092 var args = createPickleArguments(scenarioOutlineStep.argument, variableCells, valueCells);6093 var pickleStep = {6094 text: stepText,6095 arguments: args,6096 locations: [6097 pickleLocation(values.location),6098 pickleStepLocation(scenarioOutlineStep)6099 ]6100 };6101 steps.push(pickleStep);6102 });6103 var pickle = {6104 name: interpolate(scenarioOutline.name, variableCells, valueCells),6105 language: language,6106 steps: steps,6107 tags: pickleTags(tags),6108 locations: [6109 pickleLocation(values.location),6110 pickleLocation(scenarioOutline.location)6111 ]6112 };6113 pickles.push(pickle);6114 });6115 });6116 }6117 function createPickleArguments(argument, variableCells, valueCells) {6118 var result = [];6119 if (!argument) return result;6120 if (argument.type === 'DataTable') {6121 var table = {6122 rows: argument.rows.map(function (row) {6123 return {6124 cells: row.cells.map(function (cell) {6125 return {6126 location: pickleLocation(cell.location),6127 value: interpolate(cell.value, variableCells, valueCells)6128 };6129 })6130 };6131 })6132 };6133 result.push(table);6134 } else if (argument.type === 'DocString') {6135 var docString = {6136 location: pickleLocation(argument.location),6137 content: interpolate(argument.content, variableCells, valueCells),6138 };6139 if(argument.contentType) {6140 docString.contentType = interpolate(argument.contentType, variableCells, valueCells);6141 }6142 result.push(docString);6143 } else {6144 throw Error('Internal error');6145 }6146 return result;6147 }6148 function interpolate(name, variableCells, valueCells) {6149 variableCells.forEach(function (variableCell, n) {6150 var valueCell = valueCells[n];6151 var search = new RegExp('<' + variableCell.value + '>', 'g');6152 // JS Specific - dollar sign needs to be escaped with another dollar sign6153 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter6154 var replacement = valueCell.value.replace(new RegExp('\\$', 'g'), '$$$$')6155 name = name.replace(search, replacement);6156 });6157 return name;6158 }6159 function pickleSteps(scenarioDefinition) {6160 return scenarioDefinition.steps.map(function (step) {6161 return pickleStep(step);6162 });6163 }6164 function pickleStep(step) {6165 return {6166 text: step.text,6167 arguments: createPickleArguments(step.argument, [], []),6168 locations: [pickleStepLocation(step)]6169 }6170 }6171 function pickleStepLocation(step) {6172 return {6173 line: step.location.line,6174 column: step.location.column + (step.keyword ? countSymbols(step.keyword) : 0)6175 };6176 }6177 function pickleLocation(location) {6178 return {6179 line: location.line,6180 column: location.column6181 }6182 }6183 function pickleTags(tags) {6184 return tags.map(function (tag) {6185 return pickleTag(tag);6186 });6187 }6188 function pickleTag(tag) {6189 return {6190 name: tag.name,6191 location: pickleLocation(tag.location)6192 };6193 }6194}6195module.exports = Compiler;6196},{"../count_symbols":4}],12:[function(require,module,exports){6197function Token(line, location) {6198 this.line = line;6199 this.location = location;6200 this.isEof = line == null;6201};6202Token.prototype.getTokenValue = function () {6203 return this.isEof ? "EOF" : this.line.getLineText(-1);6204};6205Token.prototype.detach = function () {6206 // TODO: Detach line, but is this really needed?6207};6208module.exports = Token;6209},{}],13:[function(require,module,exports){6210var DIALECTS = require('./dialects');6211var Errors = require('./errors');6212var LANGUAGE_PATTERN = /^\s*#\s*language\s*:\s*([a-zA-Z\-_]+)\s*$/;6213module.exports = function TokenMatcher(defaultDialectName) {6214 defaultDialectName = defaultDialectName || 'en';6215 var dialect;6216 var dialectName;6217 var activeDocStringSeparator;6218 var indentToRemove;6219 function changeDialect(newDialectName, location) {6220 var newDialect = DIALECTS[newDialectName];6221 if(!newDialect) {6222 throw Errors.NoSuchLanguageException.create(newDialectName, location);6223 }6224 dialectName = newDialectName;6225 dialect = newDialect;6226 }6227 this.reset = function () {6228 if(dialectName != defaultDialectName) changeDialect(defaultDialectName);6229 activeDocStringSeparator = null;6230 indentToRemove = 0;6231 };6232 this.reset();6233 this.match_TagLine = function match_TagLine(token) {6234 if(token.line.startsWith('@')) {6235 setTokenMatched(token, 'TagLine', null, null, null, token.line.getTags());6236 return true;6237 }6238 return false;6239 };6240 this.match_FeatureLine = function match_FeatureLine(token) {6241 return matchTitleLine(token, 'FeatureLine', dialect.feature);6242 };6243 this.match_ScenarioLine = function match_ScenarioLine(token) {6244 return matchTitleLine(token, 'ScenarioLine', dialect.scenario);6245 };6246 this.match_ScenarioOutlineLine = function match_ScenarioOutlineLine(token) {6247 return matchTitleLine(token, 'ScenarioOutlineLine', dialect.scenarioOutline);6248 };6249 this.match_BackgroundLine = function match_BackgroundLine(token) {6250 return matchTitleLine(token, 'BackgroundLine', dialect.background);6251 };6252 this.match_ExamplesLine = function match_ExamplesLine(token) {6253 return matchTitleLine(token, 'ExamplesLine', dialect.examples);6254 };6255 this.match_TableRow = function match_TableRow(token) {6256 if (token.line.startsWith('|')) {6257 // TODO: indent6258 setTokenMatched(token, 'TableRow', null, null, null, token.line.getTableCells());6259 return true;6260 }6261 return false;6262 };6263 this.match_Empty = function match_Empty(token) {6264 if (token.line.isEmpty) {6265 setTokenMatched(token, 'Empty', null, null, 0);6266 return true;6267 }6268 return false;6269 };6270 this.match_Comment = function match_Comment(token) {6271 if(token.line.startsWith('#')) {6272 var text = token.line.getLineText(0); //take the entire line, including leading space6273 setTokenMatched(token, 'Comment', text, null, 0);6274 return true;6275 }6276 return false;6277 };6278 this.match_Language = function match_Language(token) {6279 var match;6280 if(match = token.line.trimmedLineText.match(LANGUAGE_PATTERN)) {6281 var newDialectName = match[1];6282 setTokenMatched(token, 'Language', newDialectName);6283 changeDialect(newDialectName, token.location);6284 return true;6285 }6286 return false;6287 };6288 this.match_DocStringSeparator = function match_DocStringSeparator(token) {6289 return activeDocStringSeparator == null6290 ?6291 // open6292 _match_DocStringSeparator(token, '"""', true) ||6293 _match_DocStringSeparator(token, '```', true)6294 :6295 // close6296 _match_DocStringSeparator(token, activeDocStringSeparator, false);6297 };6298 function _match_DocStringSeparator(token, separator, isOpen) {6299 if (token.line.startsWith(separator)) {6300 var contentType = null;6301 if (isOpen) {6302 contentType = token.line.getRestTrimmed(separator.length);6303 activeDocStringSeparator = separator;6304 indentToRemove = token.line.indent;6305 } else {6306 activeDocStringSeparator = null;6307 indentToRemove = 0;6308 }6309 // TODO: Use the separator as keyword. That's needed for pretty printing.6310 setTokenMatched(token, 'DocStringSeparator', contentType);6311 return true;6312 }6313 return false;6314 }6315 this.match_EOF = function match_EOF(token) {6316 if(token.isEof) {6317 setTokenMatched(token, 'EOF');6318 return true;6319 }6320 return false;6321 };6322 this.match_StepLine = function match_StepLine(token) {6323 var keywords = []6324 .concat(dialect.given)6325 .concat(dialect.when)6326 .concat(dialect.then)6327 .concat(dialect.and)6328 .concat(dialect.but);6329 var length = keywords.length;6330 for(var i = 0, keyword; i < length; i++) {6331 var keyword = keywords[i];6332 if (token.line.startsWith(keyword)) {6333 var title = token.line.getRestTrimmed(keyword.length);6334 setTokenMatched(token, 'StepLine', title, keyword);6335 return true;6336 }...

Full Screen

Full Screen

parser.py

Source:parser.py Github

copy

Full Screen

...131 def match_ExamplesLine(self, context, token):132 if token.eof():133 return False134 return self.handle_external_error(context, False, token, context.token_matcher.match_ExamplesLine)135 def match_StepLine(self, context, token):136 if token.eof():137 return False138 return self.handle_external_error(context, False, token, context.token_matcher.match_StepLine)139 def match_DocStringSeparator(self, context, token):140 if token.eof():141 return False142 return self.handle_external_error(context, False, token, context.token_matcher.match_DocStringSeparator)143 def match_TableRow(self, context, token):144 if token.eof():145 return False146 return self.handle_external_error(context, False, token, context.token_matcher.match_TableRow)147 def match_Language(self, context, token):148 if token.eof():149 return False150 return self.handle_external_error(context, False, token, context.token_matcher.match_Language)151 def match_Other(self, context, token):152 if token.eof():153 return False154 return self.handle_external_error(context, False, token, context.token_matcher.match_Other)155 def match_token(self, state, token, context):156 state_map = {157 0: self.match_token_at_0,158 1: self.match_token_at_1,159 2: self.match_token_at_2,160 3: self.match_token_at_3,161 4: self.match_token_at_4,162 5: self.match_token_at_5,163 6: self.match_token_at_6,164 7: self.match_token_at_7,165 8: self.match_token_at_8,166 9: self.match_token_at_9,167 10: self.match_token_at_10,168 11: self.match_token_at_11,169 12: self.match_token_at_12,170 13: self.match_token_at_13,171 14: self.match_token_at_14,172 15: self.match_token_at_15,173 16: self.match_token_at_16,174 17: self.match_token_at_17,175 18: self.match_token_at_18,176 19: self.match_token_at_19,177 20: self.match_token_at_20,178 21: self.match_token_at_21,179 22: self.match_token_at_22,180 23: self.match_token_at_23,181 24: self.match_token_at_24,182 25: self.match_token_at_25,183 26: self.match_token_at_26,184 28: self.match_token_at_28,185 29: self.match_token_at_29,186 30: self.match_token_at_30,187 31: self.match_token_at_31,188 32: self.match_token_at_32,189 33: self.match_token_at_33,190 }191 if state in state_map:192 return state_map[state](token, context)193 else:194 raise RuntimeError("Unknown state: " + str(state))195 # Start196 def match_token_at_0(self, token, context):197 if self.match_Language(context, token):198 self.start_rule(context, 'Feature_Header')199 self.build(context, token)200 return 1201 if self.match_TagLine(context, token):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_Header')208 self.build(context, token)209 return 3210 if self.match_Comment(context, token):211 self.build(context, token)212 return 0213 if self.match_Empty(context, token):214 self.build(context, token)215 return 0216 state_comment = "State: 0 - Start"217 token.detach218 expected_tokens = ["#Language", "#TagLine", "#FeatureLine", "#Comment", "#Empty"]219 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)220 if (self.stop_at_first_error):221 raise error222 self.add_error(context, error)223 return 0224 # Feature:0>Feature_Header:0>#Language:0225 def match_token_at_1(self, token, context):226 if self.match_TagLine(context, token):227 self.start_rule(context, 'Tags')228 self.build(context, token)229 return 2230 if self.match_FeatureLine(context, token):231 self.build(context, token)232 return 3233 if self.match_Comment(context, token):234 self.build(context, token)235 return 1236 if self.match_Empty(context, token):237 self.build(context, token)238 return 1239 state_comment = "State: 1 - Feature:0>Feature_Header:0>#Language:0"240 token.detach241 expected_tokens = ["#TagLine", "#FeatureLine", "#Comment", "#Empty"]242 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)243 if (self.stop_at_first_error):244 raise error245 self.add_error(context, error)246 return 1247 # Feature:0>Feature_Header:1>Tags:0>#TagLine:0248 def match_token_at_2(self, token, context):249 if self.match_TagLine(context, token):250 self.build(context, token)251 return 2252 if self.match_FeatureLine(context, token):253 self.end_rule(context, 'Tags')254 self.build(context, token)255 return 3256 if self.match_Comment(context, token):257 self.build(context, token)258 return 2259 if self.match_Empty(context, token):260 self.build(context, token)261 return 2262 state_comment = "State: 2 - Feature:0>Feature_Header:1>Tags:0>#TagLine:0"263 token.detach264 expected_tokens = ["#TagLine", "#FeatureLine", "#Comment", "#Empty"]265 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)266 if (self.stop_at_first_error):267 raise error268 self.add_error(context, error)269 return 2270 # Feature:0>Feature_Header:2>#FeatureLine:0271 def match_token_at_3(self, token, context):272 if self.match_EOF(context, token):273 self.end_rule(context, 'Feature_Header')274 self.build(context, token)275 return 27276 if self.match_Empty(context, token):277 self.build(context, token)278 return 3279 if self.match_Comment(context, token):280 self.build(context, token)281 return 5282 if self.match_BackgroundLine(context, token):283 self.end_rule(context, 'Feature_Header')284 self.start_rule(context, 'Background')285 self.build(context, token)286 return 6287 if self.match_TagLine(context, token):288 self.end_rule(context, 'Feature_Header')289 self.start_rule(context, 'Scenario_Definition')290 self.start_rule(context, 'Tags')291 self.build(context, token)292 return 11293 if self.match_ScenarioLine(context, token):294 self.end_rule(context, 'Feature_Header')295 self.start_rule(context, 'Scenario_Definition')296 self.start_rule(context, 'Scenario')297 self.build(context, token)298 return 12299 if self.match_ScenarioOutlineLine(context, token):300 self.end_rule(context, 'Feature_Header')301 self.start_rule(context, 'Scenario_Definition')302 self.start_rule(context, 'ScenarioOutline')303 self.build(context, token)304 return 17305 if self.match_Other(context, token):306 self.start_rule(context, 'Description')307 self.build(context, token)308 return 4309 state_comment = "State: 3 - Feature:0>Feature_Header:2>#FeatureLine:0"310 token.detach311 expected_tokens = ["#EOF", "#Empty", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]312 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)313 if (self.stop_at_first_error):314 raise error315 self.add_error(context, error)316 return 3317 # Feature:0>Feature_Header:3>Feature_Description:0>Description_Helper:1>Description:0>#Other:0318 def match_token_at_4(self, token, context):319 if self.match_EOF(context, token):320 self.end_rule(context, 'Description')321 self.end_rule(context, 'Feature_Header')322 self.build(context, token)323 return 27324 if self.match_Comment(context, token):325 self.end_rule(context, 'Description')326 self.build(context, token)327 return 5328 if self.match_BackgroundLine(context, token):329 self.end_rule(context, 'Description')330 self.end_rule(context, 'Feature_Header')331 self.start_rule(context, 'Background')332 self.build(context, token)333 return 6334 if self.match_TagLine(context, token):335 self.end_rule(context, 'Description')336 self.end_rule(context, 'Feature_Header')337 self.start_rule(context, 'Scenario_Definition')338 self.start_rule(context, 'Tags')339 self.build(context, token)340 return 11341 if self.match_ScenarioLine(context, token):342 self.end_rule(context, 'Description')343 self.end_rule(context, 'Feature_Header')344 self.start_rule(context, 'Scenario_Definition')345 self.start_rule(context, 'Scenario')346 self.build(context, token)347 return 12348 if self.match_ScenarioOutlineLine(context, token):349 self.end_rule(context, 'Description')350 self.end_rule(context, 'Feature_Header')351 self.start_rule(context, 'Scenario_Definition')352 self.start_rule(context, 'ScenarioOutline')353 self.build(context, token)354 return 17355 if self.match_Other(context, token):356 self.build(context, token)357 return 4358 state_comment = "State: 4 - Feature:0>Feature_Header:3>Feature_Description:0>Description_Helper:1>Description:0>#Other:0"359 token.detach360 expected_tokens = ["#EOF", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]361 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)362 if (self.stop_at_first_error):363 raise error364 self.add_error(context, error)365 return 4366 # Feature:0>Feature_Header:3>Feature_Description:0>Description_Helper:2>#Comment:0367 def match_token_at_5(self, token, context):368 if self.match_EOF(context, token):369 self.end_rule(context, 'Feature_Header')370 self.build(context, token)371 return 27372 if self.match_Comment(context, token):373 self.build(context, token)374 return 5375 if self.match_BackgroundLine(context, token):376 self.end_rule(context, 'Feature_Header')377 self.start_rule(context, 'Background')378 self.build(context, token)379 return 6380 if self.match_TagLine(context, token):381 self.end_rule(context, 'Feature_Header')382 self.start_rule(context, 'Scenario_Definition')383 self.start_rule(context, 'Tags')384 self.build(context, token)385 return 11386 if self.match_ScenarioLine(context, token):387 self.end_rule(context, 'Feature_Header')388 self.start_rule(context, 'Scenario_Definition')389 self.start_rule(context, 'Scenario')390 self.build(context, token)391 return 12392 if self.match_ScenarioOutlineLine(context, token):393 self.end_rule(context, 'Feature_Header')394 self.start_rule(context, 'Scenario_Definition')395 self.start_rule(context, 'ScenarioOutline')396 self.build(context, token)397 return 17398 if self.match_Empty(context, token):399 self.build(context, token)400 return 5401 state_comment = "State: 5 - Feature:0>Feature_Header:3>Feature_Description:0>Description_Helper:2>#Comment:0"402 token.detach403 expected_tokens = ["#EOF", "#Comment", "#BackgroundLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]404 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)405 if (self.stop_at_first_error):406 raise error407 self.add_error(context, error)408 return 5409 # Feature:1>Background:0>#BackgroundLine:0410 def match_token_at_6(self, token, context):411 if self.match_EOF(context, token):412 self.end_rule(context, 'Background')413 self.build(context, token)414 return 27415 if self.match_Empty(context, token):416 self.build(context, token)417 return 6418 if self.match_Comment(context, token):419 self.build(context, token)420 return 8421 if self.match_StepLine(context, token):422 self.start_rule(context, 'Step')423 self.build(context, token)424 return 9425 if self.match_TagLine(context, token):426 self.end_rule(context, 'Background')427 self.start_rule(context, 'Scenario_Definition')428 self.start_rule(context, 'Tags')429 self.build(context, token)430 return 11431 if self.match_ScenarioLine(context, token):432 self.end_rule(context, 'Background')433 self.start_rule(context, 'Scenario_Definition')434 self.start_rule(context, 'Scenario')435 self.build(context, token)436 return 12437 if self.match_ScenarioOutlineLine(context, token):438 self.end_rule(context, 'Background')439 self.start_rule(context, 'Scenario_Definition')440 self.start_rule(context, 'ScenarioOutline')441 self.build(context, token)442 return 17443 if self.match_Other(context, token):444 self.start_rule(context, 'Description')445 self.build(context, token)446 return 7447 state_comment = "State: 6 - Feature:1>Background:0>#BackgroundLine:0"448 token.detach449 expected_tokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]450 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)451 if (self.stop_at_first_error):452 raise error453 self.add_error(context, error)454 return 6455 # Feature:1>Background:1>Background_Description:0>Description_Helper:1>Description:0>#Other:0456 def match_token_at_7(self, token, context):457 if self.match_EOF(context, token):458 self.end_rule(context, 'Description')459 self.end_rule(context, 'Background')460 self.build(context, token)461 return 27462 if self.match_Comment(context, token):463 self.end_rule(context, 'Description')464 self.build(context, token)465 return 8466 if self.match_StepLine(context, token):467 self.end_rule(context, 'Description')468 self.start_rule(context, 'Step')469 self.build(context, token)470 return 9471 if self.match_TagLine(context, token):472 self.end_rule(context, 'Description')473 self.end_rule(context, 'Background')474 self.start_rule(context, 'Scenario_Definition')475 self.start_rule(context, 'Tags')476 self.build(context, token)477 return 11478 if self.match_ScenarioLine(context, token):479 self.end_rule(context, 'Description')480 self.end_rule(context, 'Background')481 self.start_rule(context, 'Scenario_Definition')482 self.start_rule(context, 'Scenario')483 self.build(context, token)484 return 12485 if self.match_ScenarioOutlineLine(context, token):486 self.end_rule(context, 'Description')487 self.end_rule(context, 'Background')488 self.start_rule(context, 'Scenario_Definition')489 self.start_rule(context, 'ScenarioOutline')490 self.build(context, token)491 return 17492 if self.match_Other(context, token):493 self.build(context, token)494 return 7495 state_comment = "State: 7 - Feature:1>Background:1>Background_Description:0>Description_Helper:1>Description:0>#Other:0"496 token.detach497 expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]498 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)499 if (self.stop_at_first_error):500 raise error501 self.add_error(context, error)502 return 7503 # Feature:1>Background:1>Background_Description:0>Description_Helper:2>#Comment:0504 def match_token_at_8(self, token, context):505 if self.match_EOF(context, token):506 self.end_rule(context, 'Background')507 self.build(context, token)508 return 27509 if self.match_Comment(context, token):510 self.build(context, token)511 return 8512 if self.match_StepLine(context, token):513 self.start_rule(context, 'Step')514 self.build(context, token)515 return 9516 if self.match_TagLine(context, token):517 self.end_rule(context, 'Background')518 self.start_rule(context, 'Scenario_Definition')519 self.start_rule(context, 'Tags')520 self.build(context, token)521 return 11522 if self.match_ScenarioLine(context, token):523 self.end_rule(context, 'Background')524 self.start_rule(context, 'Scenario_Definition')525 self.start_rule(context, 'Scenario')526 self.build(context, token)527 return 12528 if self.match_ScenarioOutlineLine(context, token):529 self.end_rule(context, 'Background')530 self.start_rule(context, 'Scenario_Definition')531 self.start_rule(context, 'ScenarioOutline')532 self.build(context, token)533 return 17534 if self.match_Empty(context, token):535 self.build(context, token)536 return 8537 state_comment = "State: 8 - Feature:1>Background:1>Background_Description:0>Description_Helper:2>#Comment:0"538 token.detach539 expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]540 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)541 if (self.stop_at_first_error):542 raise error543 self.add_error(context, error)544 return 8545 # Feature:1>Background:2>Scenario_Step:0>Step:0>#StepLine:0546 def match_token_at_9(self, token, context):547 if self.match_EOF(context, token):548 self.end_rule(context, 'Step')549 self.end_rule(context, 'Background')550 self.build(context, token)551 return 27552 if self.match_TableRow(context, token):553 self.start_rule(context, 'DataTable')554 self.build(context, token)555 return 10556 if self.match_DocStringSeparator(context, token):557 self.start_rule(context, 'DocString')558 self.build(context, token)559 return 32560 if self.match_StepLine(context, token):561 self.end_rule(context, 'Step')562 self.start_rule(context, 'Step')563 self.build(context, token)564 return 9565 if self.match_TagLine(context, token):566 self.end_rule(context, 'Step')567 self.end_rule(context, 'Background')568 self.start_rule(context, 'Scenario_Definition')569 self.start_rule(context, 'Tags')570 self.build(context, token)571 return 11572 if self.match_ScenarioLine(context, token):573 self.end_rule(context, 'Step')574 self.end_rule(context, 'Background')575 self.start_rule(context, 'Scenario_Definition')576 self.start_rule(context, 'Scenario')577 self.build(context, token)578 return 12579 if self.match_ScenarioOutlineLine(context, token):580 self.end_rule(context, 'Step')581 self.end_rule(context, 'Background')582 self.start_rule(context, 'Scenario_Definition')583 self.start_rule(context, 'ScenarioOutline')584 self.build(context, token)585 return 17586 if self.match_Comment(context, token):587 self.build(context, token)588 return 9589 if self.match_Empty(context, token):590 self.build(context, token)591 return 9592 state_comment = "State: 9 - Feature:1>Background:2>Scenario_Step:0>Step:0>#StepLine:0"593 token.detach594 expected_tokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]595 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)596 if (self.stop_at_first_error):597 raise error598 self.add_error(context, error)599 return 9600 # Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0601 def match_token_at_10(self, token, context):602 if self.match_EOF(context, token):603 self.end_rule(context, 'DataTable')604 self.end_rule(context, 'Step')605 self.end_rule(context, 'Background')606 self.build(context, token)607 return 27608 if self.match_TableRow(context, token):609 self.build(context, token)610 return 10611 if self.match_StepLine(context, token):612 self.end_rule(context, 'DataTable')613 self.end_rule(context, 'Step')614 self.start_rule(context, 'Step')615 self.build(context, token)616 return 9617 if self.match_TagLine(context, token):618 self.end_rule(context, 'DataTable')619 self.end_rule(context, 'Step')620 self.end_rule(context, 'Background')621 self.start_rule(context, 'Scenario_Definition')622 self.start_rule(context, 'Tags')623 self.build(context, token)624 return 11625 if self.match_ScenarioLine(context, token):626 self.end_rule(context, 'DataTable')627 self.end_rule(context, 'Step')628 self.end_rule(context, 'Background')629 self.start_rule(context, 'Scenario_Definition')630 self.start_rule(context, 'Scenario')631 self.build(context, token)632 return 12633 if self.match_ScenarioOutlineLine(context, token):634 self.end_rule(context, 'DataTable')635 self.end_rule(context, 'Step')636 self.end_rule(context, 'Background')637 self.start_rule(context, 'Scenario_Definition')638 self.start_rule(context, 'ScenarioOutline')639 self.build(context, token)640 return 17641 if self.match_Comment(context, token):642 self.build(context, token)643 return 10644 if self.match_Empty(context, token):645 self.build(context, token)646 return 10647 state_comment = "State: 10 - Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"648 token.detach649 expected_tokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]650 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)651 if (self.stop_at_first_error):652 raise error653 self.add_error(context, error)654 return 10655 # Feature:2>Scenario_Definition:0>Tags:0>#TagLine:0656 def match_token_at_11(self, token, context):657 if self.match_TagLine(context, token):658 self.build(context, token)659 return 11660 if self.match_ScenarioLine(context, token):661 self.end_rule(context, 'Tags')662 self.start_rule(context, 'Scenario')663 self.build(context, token)664 return 12665 if self.match_ScenarioOutlineLine(context, token):666 self.end_rule(context, 'Tags')667 self.start_rule(context, 'ScenarioOutline')668 self.build(context, token)669 return 17670 if self.match_Comment(context, token):671 self.build(context, token)672 return 11673 if self.match_Empty(context, token):674 self.build(context, token)675 return 11676 state_comment = "State: 11 - Feature:2>Scenario_Definition:0>Tags:0>#TagLine:0"677 token.detach678 expected_tokens = ["#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]679 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)680 if (self.stop_at_first_error):681 raise error682 self.add_error(context, error)683 return 11684 # Feature:2>Scenario_Definition:1>__alt0:0>Scenario:0>#ScenarioLine:0685 def match_token_at_12(self, token, context):686 if self.match_EOF(context, token):687 self.end_rule(context, 'Scenario')688 self.end_rule(context, 'Scenario_Definition')689 self.build(context, token)690 return 27691 if self.match_Empty(context, token):692 self.build(context, token)693 return 12694 if self.match_Comment(context, token):695 self.build(context, token)696 return 14697 if self.match_StepLine(context, token):698 self.start_rule(context, 'Step')699 self.build(context, token)700 return 15701 if self.match_TagLine(context, token):702 self.end_rule(context, 'Scenario')703 self.end_rule(context, 'Scenario_Definition')704 self.start_rule(context, 'Scenario_Definition')705 self.start_rule(context, 'Tags')706 self.build(context, token)707 return 11708 if self.match_ScenarioLine(context, token):709 self.end_rule(context, 'Scenario')710 self.end_rule(context, 'Scenario_Definition')711 self.start_rule(context, 'Scenario_Definition')712 self.start_rule(context, 'Scenario')713 self.build(context, token)714 return 12715 if self.match_ScenarioOutlineLine(context, token):716 self.end_rule(context, 'Scenario')717 self.end_rule(context, 'Scenario_Definition')718 self.start_rule(context, 'Scenario_Definition')719 self.start_rule(context, 'ScenarioOutline')720 self.build(context, token)721 return 17722 if self.match_Other(context, token):723 self.start_rule(context, 'Description')724 self.build(context, token)725 return 13726 state_comment = "State: 12 - Feature:2>Scenario_Definition:1>__alt0:0>Scenario:0>#ScenarioLine:0"727 token.detach728 expected_tokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]729 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)730 if (self.stop_at_first_error):731 raise error732 self.add_error(context, error)733 return 12734 # Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Scenario_Description:0>Description_Helper:1>Description:0>#Other:0735 def match_token_at_13(self, token, context):736 if self.match_EOF(context, token):737 self.end_rule(context, 'Description')738 self.end_rule(context, 'Scenario')739 self.end_rule(context, 'Scenario_Definition')740 self.build(context, token)741 return 27742 if self.match_Comment(context, token):743 self.end_rule(context, 'Description')744 self.build(context, token)745 return 14746 if self.match_StepLine(context, token):747 self.end_rule(context, 'Description')748 self.start_rule(context, 'Step')749 self.build(context, token)750 return 15751 if self.match_TagLine(context, token):752 self.end_rule(context, 'Description')753 self.end_rule(context, 'Scenario')754 self.end_rule(context, 'Scenario_Definition')755 self.start_rule(context, 'Scenario_Definition')756 self.start_rule(context, 'Tags')757 self.build(context, token)758 return 11759 if self.match_ScenarioLine(context, token):760 self.end_rule(context, 'Description')761 self.end_rule(context, 'Scenario')762 self.end_rule(context, 'Scenario_Definition')763 self.start_rule(context, 'Scenario_Definition')764 self.start_rule(context, 'Scenario')765 self.build(context, token)766 return 12767 if self.match_ScenarioOutlineLine(context, token):768 self.end_rule(context, 'Description')769 self.end_rule(context, 'Scenario')770 self.end_rule(context, 'Scenario_Definition')771 self.start_rule(context, 'Scenario_Definition')772 self.start_rule(context, 'ScenarioOutline')773 self.build(context, token)774 return 17775 if self.match_Other(context, token):776 self.build(context, token)777 return 13778 state_comment = "State: 13 - Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Scenario_Description:0>Description_Helper:1>Description:0>#Other:0"779 token.detach780 expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]781 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)782 if (self.stop_at_first_error):783 raise error784 self.add_error(context, error)785 return 13786 # Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Scenario_Description:0>Description_Helper:2>#Comment:0787 def match_token_at_14(self, token, context):788 if self.match_EOF(context, token):789 self.end_rule(context, 'Scenario')790 self.end_rule(context, 'Scenario_Definition')791 self.build(context, token)792 return 27793 if self.match_Comment(context, token):794 self.build(context, token)795 return 14796 if self.match_StepLine(context, token):797 self.start_rule(context, 'Step')798 self.build(context, token)799 return 15800 if self.match_TagLine(context, token):801 self.end_rule(context, 'Scenario')802 self.end_rule(context, 'Scenario_Definition')803 self.start_rule(context, 'Scenario_Definition')804 self.start_rule(context, 'Tags')805 self.build(context, token)806 return 11807 if self.match_ScenarioLine(context, token):808 self.end_rule(context, 'Scenario')809 self.end_rule(context, 'Scenario_Definition')810 self.start_rule(context, 'Scenario_Definition')811 self.start_rule(context, 'Scenario')812 self.build(context, token)813 return 12814 if self.match_ScenarioOutlineLine(context, token):815 self.end_rule(context, 'Scenario')816 self.end_rule(context, 'Scenario_Definition')817 self.start_rule(context, 'Scenario_Definition')818 self.start_rule(context, 'ScenarioOutline')819 self.build(context, token)820 return 17821 if self.match_Empty(context, token):822 self.build(context, token)823 return 14824 state_comment = "State: 14 - Feature:2>Scenario_Definition:1>__alt0:0>Scenario:1>Scenario_Description:0>Description_Helper:2>#Comment:0"825 token.detach826 expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]827 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)828 if (self.stop_at_first_error):829 raise error830 self.add_error(context, error)831 return 14832 # Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:0>#StepLine:0833 def match_token_at_15(self, token, context):834 if self.match_EOF(context, token):835 self.end_rule(context, 'Step')836 self.end_rule(context, 'Scenario')837 self.end_rule(context, 'Scenario_Definition')838 self.build(context, token)839 return 27840 if self.match_TableRow(context, token):841 self.start_rule(context, 'DataTable')842 self.build(context, token)843 return 16844 if self.match_DocStringSeparator(context, token):845 self.start_rule(context, 'DocString')846 self.build(context, token)847 return 30848 if self.match_StepLine(context, token):849 self.end_rule(context, 'Step')850 self.start_rule(context, 'Step')851 self.build(context, token)852 return 15853 if self.match_TagLine(context, token):854 self.end_rule(context, 'Step')855 self.end_rule(context, 'Scenario')856 self.end_rule(context, 'Scenario_Definition')857 self.start_rule(context, 'Scenario_Definition')858 self.start_rule(context, 'Tags')859 self.build(context, token)860 return 11861 if self.match_ScenarioLine(context, token):862 self.end_rule(context, 'Step')863 self.end_rule(context, 'Scenario')864 self.end_rule(context, 'Scenario_Definition')865 self.start_rule(context, 'Scenario_Definition')866 self.start_rule(context, 'Scenario')867 self.build(context, token)868 return 12869 if self.match_ScenarioOutlineLine(context, token):870 self.end_rule(context, 'Step')871 self.end_rule(context, 'Scenario')872 self.end_rule(context, 'Scenario_Definition')873 self.start_rule(context, 'Scenario_Definition')874 self.start_rule(context, 'ScenarioOutline')875 self.build(context, token)876 return 17877 if self.match_Comment(context, token):878 self.build(context, token)879 return 15880 if self.match_Empty(context, token):881 self.build(context, token)882 return 15883 state_comment = "State: 15 - Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:0>#StepLine:0"884 token.detach885 expected_tokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]886 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)887 if (self.stop_at_first_error):888 raise error889 self.add_error(context, error)890 return 15891 # Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0892 def match_token_at_16(self, token, context):893 if self.match_EOF(context, token):894 self.end_rule(context, 'DataTable')895 self.end_rule(context, 'Step')896 self.end_rule(context, 'Scenario')897 self.end_rule(context, 'Scenario_Definition')898 self.build(context, token)899 return 27900 if self.match_TableRow(context, token):901 self.build(context, token)902 return 16903 if self.match_StepLine(context, token):904 self.end_rule(context, 'DataTable')905 self.end_rule(context, 'Step')906 self.start_rule(context, 'Step')907 self.build(context, token)908 return 15909 if self.match_TagLine(context, token):910 self.end_rule(context, 'DataTable')911 self.end_rule(context, 'Step')912 self.end_rule(context, 'Scenario')913 self.end_rule(context, 'Scenario_Definition')914 self.start_rule(context, 'Scenario_Definition')915 self.start_rule(context, 'Tags')916 self.build(context, token)917 return 11918 if self.match_ScenarioLine(context, token):919 self.end_rule(context, 'DataTable')920 self.end_rule(context, 'Step')921 self.end_rule(context, 'Scenario')922 self.end_rule(context, 'Scenario_Definition')923 self.start_rule(context, 'Scenario_Definition')924 self.start_rule(context, 'Scenario')925 self.build(context, token)926 return 12927 if self.match_ScenarioOutlineLine(context, token):928 self.end_rule(context, 'DataTable')929 self.end_rule(context, 'Step')930 self.end_rule(context, 'Scenario')931 self.end_rule(context, 'Scenario_Definition')932 self.start_rule(context, 'Scenario_Definition')933 self.start_rule(context, 'ScenarioOutline')934 self.build(context, token)935 return 17936 if self.match_Comment(context, token):937 self.build(context, token)938 return 16939 if self.match_Empty(context, token):940 self.build(context, token)941 return 16942 state_comment = "State: 16 - Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"943 token.detach944 expected_tokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]945 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)946 if (self.stop_at_first_error):947 raise error948 self.add_error(context, error)949 return 16950 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:0>#ScenarioOutlineLine:0951 def match_token_at_17(self, token, context):952 if self.match_EOF(context, token):953 self.end_rule(context, 'ScenarioOutline')954 self.end_rule(context, 'Scenario_Definition')955 self.build(context, token)956 return 27957 if self.match_Empty(context, token):958 self.build(context, token)959 return 17960 if self.match_Comment(context, token):961 self.build(context, token)962 return 19963 if self.match_StepLine(context, token):964 self.start_rule(context, 'Step')965 self.build(context, token)966 return 20967 if self.match_TagLine(context, token):968 if self.lookahead_0(context, token):969 self.start_rule(context, 'Examples_Definition')970 self.start_rule(context, 'Tags')971 self.build(context, token)972 return 22973 if self.match_TagLine(context, token):974 self.end_rule(context, 'ScenarioOutline')975 self.end_rule(context, 'Scenario_Definition')976 self.start_rule(context, 'Scenario_Definition')977 self.start_rule(context, 'Tags')978 self.build(context, token)979 return 11980 if self.match_ExamplesLine(context, token):981 self.start_rule(context, 'Examples_Definition')982 self.start_rule(context, 'Examples')983 self.build(context, token)984 return 23985 if self.match_ScenarioLine(context, token):986 self.end_rule(context, 'ScenarioOutline')987 self.end_rule(context, 'Scenario_Definition')988 self.start_rule(context, 'Scenario_Definition')989 self.start_rule(context, 'Scenario')990 self.build(context, token)991 return 12992 if self.match_ScenarioOutlineLine(context, token):993 self.end_rule(context, 'ScenarioOutline')994 self.end_rule(context, 'Scenario_Definition')995 self.start_rule(context, 'Scenario_Definition')996 self.start_rule(context, 'ScenarioOutline')997 self.build(context, token)998 return 17999 if self.match_Other(context, token):1000 self.start_rule(context, 'Description')1001 self.build(context, token)1002 return 181003 state_comment = "State: 17 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:0>#ScenarioOutlineLine:0"1004 token.detach1005 expected_tokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]1006 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1007 if (self.stop_at_first_error):1008 raise error1009 self.add_error(context, error)1010 return 171011 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>ScenarioOutline_Description:0>Description_Helper:1>Description:0>#Other:01012 def match_token_at_18(self, token, context):1013 if self.match_EOF(context, token):1014 self.end_rule(context, 'Description')1015 self.end_rule(context, 'ScenarioOutline')1016 self.end_rule(context, 'Scenario_Definition')1017 self.build(context, token)1018 return 271019 if self.match_Comment(context, token):1020 self.end_rule(context, 'Description')1021 self.build(context, token)1022 return 191023 if self.match_StepLine(context, token):1024 self.end_rule(context, 'Description')1025 self.start_rule(context, 'Step')1026 self.build(context, token)1027 return 201028 if self.match_TagLine(context, token):1029 if self.lookahead_0(context, token):1030 self.end_rule(context, 'Description')1031 self.start_rule(context, 'Examples_Definition')1032 self.start_rule(context, 'Tags')1033 self.build(context, token)1034 return 221035 if self.match_TagLine(context, token):1036 self.end_rule(context, 'Description')1037 self.end_rule(context, 'ScenarioOutline')1038 self.end_rule(context, 'Scenario_Definition')1039 self.start_rule(context, 'Scenario_Definition')1040 self.start_rule(context, 'Tags')1041 self.build(context, token)1042 return 111043 if self.match_ExamplesLine(context, token):1044 self.end_rule(context, 'Description')1045 self.start_rule(context, 'Examples_Definition')1046 self.start_rule(context, 'Examples')1047 self.build(context, token)1048 return 231049 if self.match_ScenarioLine(context, token):1050 self.end_rule(context, 'Description')1051 self.end_rule(context, 'ScenarioOutline')1052 self.end_rule(context, 'Scenario_Definition')1053 self.start_rule(context, 'Scenario_Definition')1054 self.start_rule(context, 'Scenario')1055 self.build(context, token)1056 return 121057 if self.match_ScenarioOutlineLine(context, token):1058 self.end_rule(context, 'Description')1059 self.end_rule(context, 'ScenarioOutline')1060 self.end_rule(context, 'Scenario_Definition')1061 self.start_rule(context, 'Scenario_Definition')1062 self.start_rule(context, 'ScenarioOutline')1063 self.build(context, token)1064 return 171065 if self.match_Other(context, token):1066 self.build(context, token)1067 return 181068 state_comment = "State: 18 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>ScenarioOutline_Description:0>Description_Helper:1>Description:0>#Other:0"1069 token.detach1070 expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]1071 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1072 if (self.stop_at_first_error):1073 raise error1074 self.add_error(context, error)1075 return 181076 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>ScenarioOutline_Description:0>Description_Helper:2>#Comment:01077 def match_token_at_19(self, token, context):1078 if self.match_EOF(context, token):1079 self.end_rule(context, 'ScenarioOutline')1080 self.end_rule(context, 'Scenario_Definition')1081 self.build(context, token)1082 return 271083 if self.match_Comment(context, token):1084 self.build(context, token)1085 return 191086 if self.match_StepLine(context, token):1087 self.start_rule(context, 'Step')1088 self.build(context, token)1089 return 201090 if self.match_TagLine(context, token):1091 if self.lookahead_0(context, token):1092 self.start_rule(context, 'Examples_Definition')1093 self.start_rule(context, 'Tags')1094 self.build(context, token)1095 return 221096 if self.match_TagLine(context, token):1097 self.end_rule(context, 'ScenarioOutline')1098 self.end_rule(context, 'Scenario_Definition')1099 self.start_rule(context, 'Scenario_Definition')1100 self.start_rule(context, 'Tags')1101 self.build(context, token)1102 return 111103 if self.match_ExamplesLine(context, token):1104 self.start_rule(context, 'Examples_Definition')1105 self.start_rule(context, 'Examples')1106 self.build(context, token)1107 return 231108 if self.match_ScenarioLine(context, token):1109 self.end_rule(context, 'ScenarioOutline')1110 self.end_rule(context, 'Scenario_Definition')1111 self.start_rule(context, 'Scenario_Definition')1112 self.start_rule(context, 'Scenario')1113 self.build(context, token)1114 return 121115 if self.match_ScenarioOutlineLine(context, token):1116 self.end_rule(context, 'ScenarioOutline')1117 self.end_rule(context, 'Scenario_Definition')1118 self.start_rule(context, 'Scenario_Definition')1119 self.start_rule(context, 'ScenarioOutline')1120 self.build(context, token)1121 return 171122 if self.match_Empty(context, token):1123 self.build(context, token)1124 return 191125 state_comment = "State: 19 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:1>ScenarioOutline_Description:0>Description_Helper:2>#Comment:0"1126 token.detach1127 expected_tokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]1128 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1129 if (self.stop_at_first_error):1130 raise error1131 self.add_error(context, error)1132 return 191133 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:0>#StepLine:01134 def match_token_at_20(self, token, context):1135 if self.match_EOF(context, token):1136 self.end_rule(context, 'Step')1137 self.end_rule(context, 'ScenarioOutline')1138 self.end_rule(context, 'Scenario_Definition')1139 self.build(context, token)1140 return 271141 if self.match_TableRow(context, token):1142 self.start_rule(context, 'DataTable')1143 self.build(context, token)1144 return 211145 if self.match_DocStringSeparator(context, token):1146 self.start_rule(context, 'DocString')1147 self.build(context, token)1148 return 281149 if self.match_StepLine(context, token):1150 self.end_rule(context, 'Step')1151 self.start_rule(context, 'Step')1152 self.build(context, token)1153 return 201154 if self.match_TagLine(context, token):1155 if self.lookahead_0(context, token):1156 self.end_rule(context, 'Step')1157 self.start_rule(context, 'Examples_Definition')1158 self.start_rule(context, 'Tags')1159 self.build(context, token)1160 return 221161 if self.match_TagLine(context, token):1162 self.end_rule(context, 'Step')1163 self.end_rule(context, 'ScenarioOutline')1164 self.end_rule(context, 'Scenario_Definition')1165 self.start_rule(context, 'Scenario_Definition')1166 self.start_rule(context, 'Tags')1167 self.build(context, token)1168 return 111169 if self.match_ExamplesLine(context, token):1170 self.end_rule(context, 'Step')1171 self.start_rule(context, 'Examples_Definition')1172 self.start_rule(context, 'Examples')1173 self.build(context, token)1174 return 231175 if self.match_ScenarioLine(context, token):1176 self.end_rule(context, 'Step')1177 self.end_rule(context, 'ScenarioOutline')1178 self.end_rule(context, 'Scenario_Definition')1179 self.start_rule(context, 'Scenario_Definition')1180 self.start_rule(context, 'Scenario')1181 self.build(context, token)1182 return 121183 if self.match_ScenarioOutlineLine(context, token):1184 self.end_rule(context, 'Step')1185 self.end_rule(context, 'ScenarioOutline')1186 self.end_rule(context, 'Scenario_Definition')1187 self.start_rule(context, 'Scenario_Definition')1188 self.start_rule(context, 'ScenarioOutline')1189 self.build(context, token)1190 return 171191 if self.match_Comment(context, token):1192 self.build(context, token)1193 return 201194 if self.match_Empty(context, token):1195 self.build(context, token)1196 return 201197 state_comment = "State: 20 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:0>#StepLine:0"1198 token.detach1199 expected_tokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1200 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1201 if (self.stop_at_first_error):1202 raise error1203 self.add_error(context, error)1204 return 201205 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:01206 def match_token_at_21(self, token, context):1207 if self.match_EOF(context, token):1208 self.end_rule(context, 'DataTable')1209 self.end_rule(context, 'Step')1210 self.end_rule(context, 'ScenarioOutline')1211 self.end_rule(context, 'Scenario_Definition')1212 self.build(context, token)1213 return 271214 if self.match_TableRow(context, token):1215 self.build(context, token)1216 return 211217 if self.match_StepLine(context, token):1218 self.end_rule(context, 'DataTable')1219 self.end_rule(context, 'Step')1220 self.start_rule(context, 'Step')1221 self.build(context, token)1222 return 201223 if self.match_TagLine(context, token):1224 if self.lookahead_0(context, token):1225 self.end_rule(context, 'DataTable')1226 self.end_rule(context, 'Step')1227 self.start_rule(context, 'Examples_Definition')1228 self.start_rule(context, 'Tags')1229 self.build(context, token)1230 return 221231 if self.match_TagLine(context, token):1232 self.end_rule(context, 'DataTable')1233 self.end_rule(context, 'Step')1234 self.end_rule(context, 'ScenarioOutline')1235 self.end_rule(context, 'Scenario_Definition')1236 self.start_rule(context, 'Scenario_Definition')1237 self.start_rule(context, 'Tags')1238 self.build(context, token)1239 return 111240 if self.match_ExamplesLine(context, token):1241 self.end_rule(context, 'DataTable')1242 self.end_rule(context, 'Step')1243 self.start_rule(context, 'Examples_Definition')1244 self.start_rule(context, 'Examples')1245 self.build(context, token)1246 return 231247 if self.match_ScenarioLine(context, token):1248 self.end_rule(context, 'DataTable')1249 self.end_rule(context, 'Step')1250 self.end_rule(context, 'ScenarioOutline')1251 self.end_rule(context, 'Scenario_Definition')1252 self.start_rule(context, 'Scenario_Definition')1253 self.start_rule(context, 'Scenario')1254 self.build(context, token)1255 return 121256 if self.match_ScenarioOutlineLine(context, token):1257 self.end_rule(context, 'DataTable')1258 self.end_rule(context, 'Step')1259 self.end_rule(context, 'ScenarioOutline')1260 self.end_rule(context, 'Scenario_Definition')1261 self.start_rule(context, 'Scenario_Definition')1262 self.start_rule(context, 'ScenarioOutline')1263 self.build(context, token)1264 return 171265 if self.match_Comment(context, token):1266 self.build(context, token)1267 return 211268 if self.match_Empty(context, token):1269 self.build(context, token)1270 return 211271 state_comment = "State: 21 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:0>DataTable:0>#TableRow:0"1272 token.detach1273 expected_tokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1274 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1275 if (self.stop_at_first_error):1276 raise error1277 self.add_error(context, error)1278 return 211279 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:0>Tags:0>#TagLine:01280 def match_token_at_22(self, token, context):1281 if self.match_TagLine(context, token):1282 self.build(context, token)1283 return 221284 if self.match_ExamplesLine(context, token):1285 self.end_rule(context, 'Tags')1286 self.start_rule(context, 'Examples')1287 self.build(context, token)1288 return 231289 if self.match_Comment(context, token):1290 self.build(context, token)1291 return 221292 if self.match_Empty(context, token):1293 self.build(context, token)1294 return 221295 state_comment = "State: 22 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:0>Tags:0>#TagLine:0"1296 token.detach1297 expected_tokens = ["#TagLine", "#ExamplesLine", "#Comment", "#Empty"]1298 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1299 if (self.stop_at_first_error):1300 raise error1301 self.add_error(context, error)1302 return 221303 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:0>#ExamplesLine:01304 def match_token_at_23(self, token, context):1305 if self.match_EOF(context, token):1306 self.end_rule(context, 'Examples')1307 self.end_rule(context, 'Examples_Definition')1308 self.end_rule(context, 'ScenarioOutline')1309 self.end_rule(context, 'Scenario_Definition')1310 self.build(context, token)1311 return 271312 if self.match_Empty(context, token):1313 self.build(context, token)1314 return 231315 if self.match_Comment(context, token):1316 self.build(context, token)1317 return 251318 if self.match_TableRow(context, token):1319 self.start_rule(context, 'Examples_Table')1320 self.build(context, token)1321 return 261322 if self.match_TagLine(context, token):1323 if self.lookahead_0(context, token):1324 self.end_rule(context, 'Examples')1325 self.end_rule(context, 'Examples_Definition')1326 self.start_rule(context, 'Examples_Definition')1327 self.start_rule(context, 'Tags')1328 self.build(context, token)1329 return 221330 if self.match_TagLine(context, token):1331 self.end_rule(context, 'Examples')1332 self.end_rule(context, 'Examples_Definition')1333 self.end_rule(context, 'ScenarioOutline')1334 self.end_rule(context, 'Scenario_Definition')1335 self.start_rule(context, 'Scenario_Definition')1336 self.start_rule(context, 'Tags')1337 self.build(context, token)1338 return 111339 if self.match_ExamplesLine(context, token):1340 self.end_rule(context, 'Examples')1341 self.end_rule(context, 'Examples_Definition')1342 self.start_rule(context, 'Examples_Definition')1343 self.start_rule(context, 'Examples')1344 self.build(context, token)1345 return 231346 if self.match_ScenarioLine(context, token):1347 self.end_rule(context, 'Examples')1348 self.end_rule(context, 'Examples_Definition')1349 self.end_rule(context, 'ScenarioOutline')1350 self.end_rule(context, 'Scenario_Definition')1351 self.start_rule(context, 'Scenario_Definition')1352 self.start_rule(context, 'Scenario')1353 self.build(context, token)1354 return 121355 if self.match_ScenarioOutlineLine(context, token):1356 self.end_rule(context, 'Examples')1357 self.end_rule(context, 'Examples_Definition')1358 self.end_rule(context, 'ScenarioOutline')1359 self.end_rule(context, 'Scenario_Definition')1360 self.start_rule(context, 'Scenario_Definition')1361 self.start_rule(context, 'ScenarioOutline')1362 self.build(context, token)1363 return 171364 if self.match_Other(context, token):1365 self.start_rule(context, 'Description')1366 self.build(context, token)1367 return 241368 state_comment = "State: 23 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:0>#ExamplesLine:0"1369 token.detach1370 expected_tokens = ["#EOF", "#Empty", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]1371 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1372 if (self.stop_at_first_error):1373 raise error1374 self.add_error(context, error)1375 return 231376 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Examples_Description:0>Description_Helper:1>Description:0>#Other:01377 def match_token_at_24(self, token, context):1378 if self.match_EOF(context, token):1379 self.end_rule(context, 'Description')1380 self.end_rule(context, 'Examples')1381 self.end_rule(context, 'Examples_Definition')1382 self.end_rule(context, 'ScenarioOutline')1383 self.end_rule(context, 'Scenario_Definition')1384 self.build(context, token)1385 return 271386 if self.match_Comment(context, token):1387 self.end_rule(context, 'Description')1388 self.build(context, token)1389 return 251390 if self.match_TableRow(context, token):1391 self.end_rule(context, 'Description')1392 self.start_rule(context, 'Examples_Table')1393 self.build(context, token)1394 return 261395 if self.match_TagLine(context, token):1396 if self.lookahead_0(context, token):1397 self.end_rule(context, 'Description')1398 self.end_rule(context, 'Examples')1399 self.end_rule(context, 'Examples_Definition')1400 self.start_rule(context, 'Examples_Definition')1401 self.start_rule(context, 'Tags')1402 self.build(context, token)1403 return 221404 if self.match_TagLine(context, token):1405 self.end_rule(context, 'Description')1406 self.end_rule(context, 'Examples')1407 self.end_rule(context, 'Examples_Definition')1408 self.end_rule(context, 'ScenarioOutline')1409 self.end_rule(context, 'Scenario_Definition')1410 self.start_rule(context, 'Scenario_Definition')1411 self.start_rule(context, 'Tags')1412 self.build(context, token)1413 return 111414 if self.match_ExamplesLine(context, token):1415 self.end_rule(context, 'Description')1416 self.end_rule(context, 'Examples')1417 self.end_rule(context, 'Examples_Definition')1418 self.start_rule(context, 'Examples_Definition')1419 self.start_rule(context, 'Examples')1420 self.build(context, token)1421 return 231422 if self.match_ScenarioLine(context, token):1423 self.end_rule(context, 'Description')1424 self.end_rule(context, 'Examples')1425 self.end_rule(context, 'Examples_Definition')1426 self.end_rule(context, 'ScenarioOutline')1427 self.end_rule(context, 'Scenario_Definition')1428 self.start_rule(context, 'Scenario_Definition')1429 self.start_rule(context, 'Scenario')1430 self.build(context, token)1431 return 121432 if self.match_ScenarioOutlineLine(context, token):1433 self.end_rule(context, 'Description')1434 self.end_rule(context, 'Examples')1435 self.end_rule(context, 'Examples_Definition')1436 self.end_rule(context, 'ScenarioOutline')1437 self.end_rule(context, 'Scenario_Definition')1438 self.start_rule(context, 'Scenario_Definition')1439 self.start_rule(context, 'ScenarioOutline')1440 self.build(context, token)1441 return 171442 if self.match_Other(context, token):1443 self.build(context, token)1444 return 241445 state_comment = "State: 24 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Examples_Description:0>Description_Helper:1>Description:0>#Other:0"1446 token.detach1447 expected_tokens = ["#EOF", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Other"]1448 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1449 if (self.stop_at_first_error):1450 raise error1451 self.add_error(context, error)1452 return 241453 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Examples_Description:0>Description_Helper:2>#Comment:01454 def match_token_at_25(self, token, context):1455 if self.match_EOF(context, token):1456 self.end_rule(context, 'Examples')1457 self.end_rule(context, 'Examples_Definition')1458 self.end_rule(context, 'ScenarioOutline')1459 self.end_rule(context, 'Scenario_Definition')1460 self.build(context, token)1461 return 271462 if self.match_Comment(context, token):1463 self.build(context, token)1464 return 251465 if self.match_TableRow(context, token):1466 self.start_rule(context, 'Examples_Table')1467 self.build(context, token)1468 return 261469 if self.match_TagLine(context, token):1470 if self.lookahead_0(context, token):1471 self.end_rule(context, 'Examples')1472 self.end_rule(context, 'Examples_Definition')1473 self.start_rule(context, 'Examples_Definition')1474 self.start_rule(context, 'Tags')1475 self.build(context, token)1476 return 221477 if self.match_TagLine(context, token):1478 self.end_rule(context, 'Examples')1479 self.end_rule(context, 'Examples_Definition')1480 self.end_rule(context, 'ScenarioOutline')1481 self.end_rule(context, 'Scenario_Definition')1482 self.start_rule(context, 'Scenario_Definition')1483 self.start_rule(context, 'Tags')1484 self.build(context, token)1485 return 111486 if self.match_ExamplesLine(context, token):1487 self.end_rule(context, 'Examples')1488 self.end_rule(context, 'Examples_Definition')1489 self.start_rule(context, 'Examples_Definition')1490 self.start_rule(context, 'Examples')1491 self.build(context, token)1492 return 231493 if self.match_ScenarioLine(context, token):1494 self.end_rule(context, 'Examples')1495 self.end_rule(context, 'Examples_Definition')1496 self.end_rule(context, 'ScenarioOutline')1497 self.end_rule(context, 'Scenario_Definition')1498 self.start_rule(context, 'Scenario_Definition')1499 self.start_rule(context, 'Scenario')1500 self.build(context, token)1501 return 121502 if self.match_ScenarioOutlineLine(context, token):1503 self.end_rule(context, 'Examples')1504 self.end_rule(context, 'Examples_Definition')1505 self.end_rule(context, 'ScenarioOutline')1506 self.end_rule(context, 'Scenario_Definition')1507 self.start_rule(context, 'Scenario_Definition')1508 self.start_rule(context, 'ScenarioOutline')1509 self.build(context, token)1510 return 171511 if self.match_Empty(context, token):1512 self.build(context, token)1513 return 251514 state_comment = "State: 25 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:1>Examples_Description:0>Description_Helper:2>#Comment:0"1515 token.detach1516 expected_tokens = ["#EOF", "#Comment", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Empty"]1517 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1518 if (self.stop_at_first_error):1519 raise error1520 self.add_error(context, error)1521 return 251522 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:2>Examples_Table:0>#TableRow:01523 def match_token_at_26(self, token, context):1524 if self.match_EOF(context, token):1525 self.end_rule(context, 'Examples_Table')1526 self.end_rule(context, 'Examples')1527 self.end_rule(context, 'Examples_Definition')1528 self.end_rule(context, 'ScenarioOutline')1529 self.end_rule(context, 'Scenario_Definition')1530 self.build(context, token)1531 return 271532 if self.match_TableRow(context, token):1533 self.build(context, token)1534 return 261535 if self.match_TagLine(context, token):1536 if self.lookahead_0(context, token):1537 self.end_rule(context, 'Examples_Table')1538 self.end_rule(context, 'Examples')1539 self.end_rule(context, 'Examples_Definition')1540 self.start_rule(context, 'Examples_Definition')1541 self.start_rule(context, 'Tags')1542 self.build(context, token)1543 return 221544 if self.match_TagLine(context, token):1545 self.end_rule(context, 'Examples_Table')1546 self.end_rule(context, 'Examples')1547 self.end_rule(context, 'Examples_Definition')1548 self.end_rule(context, 'ScenarioOutline')1549 self.end_rule(context, 'Scenario_Definition')1550 self.start_rule(context, 'Scenario_Definition')1551 self.start_rule(context, 'Tags')1552 self.build(context, token)1553 return 111554 if self.match_ExamplesLine(context, token):1555 self.end_rule(context, 'Examples_Table')1556 self.end_rule(context, 'Examples')1557 self.end_rule(context, 'Examples_Definition')1558 self.start_rule(context, 'Examples_Definition')1559 self.start_rule(context, 'Examples')1560 self.build(context, token)1561 return 231562 if self.match_ScenarioLine(context, token):1563 self.end_rule(context, 'Examples_Table')1564 self.end_rule(context, 'Examples')1565 self.end_rule(context, 'Examples_Definition')1566 self.end_rule(context, 'ScenarioOutline')1567 self.end_rule(context, 'Scenario_Definition')1568 self.start_rule(context, 'Scenario_Definition')1569 self.start_rule(context, 'Scenario')1570 self.build(context, token)1571 return 121572 if self.match_ScenarioOutlineLine(context, token):1573 self.end_rule(context, 'Examples_Table')1574 self.end_rule(context, 'Examples')1575 self.end_rule(context, 'Examples_Definition')1576 self.end_rule(context, 'ScenarioOutline')1577 self.end_rule(context, 'Scenario_Definition')1578 self.start_rule(context, 'Scenario_Definition')1579 self.start_rule(context, 'ScenarioOutline')1580 self.build(context, token)1581 return 171582 if self.match_Comment(context, token):1583 self.build(context, token)1584 return 261585 if self.match_Empty(context, token):1586 self.build(context, token)1587 return 261588 state_comment = "State: 26 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:3>Examples_Definition:1>Examples:2>Examples_Table:0>#TableRow:0"1589 token.detach1590 expected_tokens = ["#EOF", "#TableRow", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1591 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1592 if (self.stop_at_first_error):1593 raise error1594 self.add_error(context, error)1595 return 261596 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:01597 def match_token_at_28(self, token, context):1598 if self.match_DocStringSeparator(context, token):1599 self.build(context, token)1600 return 291601 if self.match_Other(context, token):1602 self.build(context, token)1603 return 281604 state_comment = "State: 28 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"1605 token.detach1606 expected_tokens = ["#DocStringSeparator", "#Other"]1607 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1608 if (self.stop_at_first_error):1609 raise error1610 self.add_error(context, error)1611 return 281612 # Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:01613 def match_token_at_29(self, token, context):1614 if self.match_EOF(context, token):1615 self.end_rule(context, 'DocString')1616 self.end_rule(context, 'Step')1617 self.end_rule(context, 'ScenarioOutline')1618 self.end_rule(context, 'Scenario_Definition')1619 self.build(context, token)1620 return 271621 if self.match_StepLine(context, token):1622 self.end_rule(context, 'DocString')1623 self.end_rule(context, 'Step')1624 self.start_rule(context, 'Step')1625 self.build(context, token)1626 return 201627 if self.match_TagLine(context, token):1628 if self.lookahead_0(context, token):1629 self.end_rule(context, 'DocString')1630 self.end_rule(context, 'Step')1631 self.start_rule(context, 'Examples_Definition')1632 self.start_rule(context, 'Tags')1633 self.build(context, token)1634 return 221635 if self.match_TagLine(context, token):1636 self.end_rule(context, 'DocString')1637 self.end_rule(context, 'Step')1638 self.end_rule(context, 'ScenarioOutline')1639 self.end_rule(context, 'Scenario_Definition')1640 self.start_rule(context, 'Scenario_Definition')1641 self.start_rule(context, 'Tags')1642 self.build(context, token)1643 return 111644 if self.match_ExamplesLine(context, token):1645 self.end_rule(context, 'DocString')1646 self.end_rule(context, 'Step')1647 self.start_rule(context, 'Examples_Definition')1648 self.start_rule(context, 'Examples')1649 self.build(context, token)1650 return 231651 if self.match_ScenarioLine(context, token):1652 self.end_rule(context, 'DocString')1653 self.end_rule(context, 'Step')1654 self.end_rule(context, 'ScenarioOutline')1655 self.end_rule(context, 'Scenario_Definition')1656 self.start_rule(context, 'Scenario_Definition')1657 self.start_rule(context, 'Scenario')1658 self.build(context, token)1659 return 121660 if self.match_ScenarioOutlineLine(context, token):1661 self.end_rule(context, 'DocString')1662 self.end_rule(context, 'Step')1663 self.end_rule(context, 'ScenarioOutline')1664 self.end_rule(context, 'Scenario_Definition')1665 self.start_rule(context, 'Scenario_Definition')1666 self.start_rule(context, 'ScenarioOutline')1667 self.build(context, token)1668 return 171669 if self.match_Comment(context, token):1670 self.build(context, token)1671 return 291672 if self.match_Empty(context, token):1673 self.build(context, token)1674 return 291675 state_comment = "State: 29 - Feature:2>Scenario_Definition:1>__alt0:1>ScenarioOutline:2>ScenarioOutline_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0"1676 token.detach1677 expected_tokens = ["#EOF", "#StepLine", "#TagLine", "#ExamplesLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1678 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1679 if (self.stop_at_first_error):1680 raise error1681 self.add_error(context, error)1682 return 291683 # Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:01684 def match_token_at_30(self, token, context):1685 if self.match_DocStringSeparator(context, token):1686 self.build(context, token)1687 return 311688 if self.match_Other(context, token):1689 self.build(context, token)1690 return 301691 state_comment = "State: 30 - Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"1692 token.detach1693 expected_tokens = ["#DocStringSeparator", "#Other"]1694 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1695 if (self.stop_at_first_error):1696 raise error1697 self.add_error(context, error)1698 return 301699 # Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:01700 def match_token_at_31(self, token, context):1701 if self.match_EOF(context, token):1702 self.end_rule(context, 'DocString')1703 self.end_rule(context, 'Step')1704 self.end_rule(context, 'Scenario')1705 self.end_rule(context, 'Scenario_Definition')1706 self.build(context, token)1707 return 271708 if self.match_StepLine(context, token):1709 self.end_rule(context, 'DocString')1710 self.end_rule(context, 'Step')1711 self.start_rule(context, 'Step')1712 self.build(context, token)1713 return 151714 if self.match_TagLine(context, token):1715 self.end_rule(context, 'DocString')1716 self.end_rule(context, 'Step')1717 self.end_rule(context, 'Scenario')1718 self.end_rule(context, 'Scenario_Definition')1719 self.start_rule(context, 'Scenario_Definition')1720 self.start_rule(context, 'Tags')1721 self.build(context, token)1722 return 111723 if self.match_ScenarioLine(context, token):1724 self.end_rule(context, 'DocString')1725 self.end_rule(context, 'Step')1726 self.end_rule(context, 'Scenario')1727 self.end_rule(context, 'Scenario_Definition')1728 self.start_rule(context, 'Scenario_Definition')1729 self.start_rule(context, 'Scenario')1730 self.build(context, token)1731 return 121732 if self.match_ScenarioOutlineLine(context, token):1733 self.end_rule(context, 'DocString')1734 self.end_rule(context, 'Step')1735 self.end_rule(context, 'Scenario')1736 self.end_rule(context, 'Scenario_Definition')1737 self.start_rule(context, 'Scenario_Definition')1738 self.start_rule(context, 'ScenarioOutline')1739 self.build(context, token)1740 return 171741 if self.match_Comment(context, token):1742 self.build(context, token)1743 return 311744 if self.match_Empty(context, token):1745 self.build(context, token)1746 return 311747 state_comment = "State: 31 - Feature:2>Scenario_Definition:1>__alt0:0>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:0"1748 token.detach1749 expected_tokens = ["#EOF", "#StepLine", "#TagLine", "#ScenarioLine", "#ScenarioOutlineLine", "#Comment", "#Empty"]1750 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1751 if (self.stop_at_first_error):1752 raise error1753 self.add_error(context, error)1754 return 311755 # Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:01756 def match_token_at_32(self, token, context):1757 if self.match_DocStringSeparator(context, token):1758 self.build(context, token)1759 return 331760 if self.match_Other(context, token):1761 self.build(context, token)1762 return 321763 state_comment = "State: 32 - Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:0>#DocStringSeparator:0"1764 token.detach1765 expected_tokens = ["#DocStringSeparator", "#Other"]1766 error = UnexpectedEOFException(token, expected_tokens, state_comment) if token.eof() else UnexpectedTokenException(token, expected_tokens, state_comment)1767 if (self.stop_at_first_error):1768 raise error1769 self.add_error(context, error)1770 return 321771 # Feature:1>Background:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt1:1>DocString:2>#DocStringSeparator:01772 def match_token_at_33(self, token, context):1773 if self.match_EOF(context, token):1774 self.end_rule(context, 'DocString')1775 self.end_rule(context, 'Step')1776 self.end_rule(context, 'Background')1777 self.build(context, token)1778 return 271779 if self.match_StepLine(context, token):1780 self.end_rule(context, 'DocString')1781 self.end_rule(context, 'Step')1782 self.start_rule(context, 'Step')1783 self.build(context, token)1784 return 91785 if self.match_TagLine(context, token):1786 self.end_rule(context, 'DocString')1787 self.end_rule(context, 'Step')1788 self.end_rule(context, 'Background')1789 self.start_rule(context, 'Scenario_Definition')1790 self.start_rule(context, 'Tags')1791 self.build(context, token)1792 return 111793 if self.match_ScenarioLine(context, token):...

Full Screen

Full Screen

parser.js

Source:parser.js Github

copy

Full Screen

...220 if(match_Comment(context, token)) {221 build(context, token);222 return 4;223 }224 if(match_StepLine(context, token)) {225 startRule(context, 'Step');226 build(context, token);227 return 5;228 }229 if(match_TagLine(context, token)) {230 endRule(context, 'Scenario');231 endRule(context, 'Scenario_Definition');232 startRule(context, 'Scenario_Definition');233 startRule(context, 'Tags');234 build(context, token);235 return 1;236 }237 if(match_ScenarioLine(context, token)) {238 endRule(context, 'Scenario');239 endRule(context, 'Scenario_Definition');240 startRule(context, 'Scenario_Definition');241 startRule(context, 'Scenario');242 build(context, token);243 return 2;244 }245 if(match_Other(context, token)) {246 startRule(context, 'Description');247 build(context, token);248 return 3;249 }250 251 var stateComment = "State: 2 - GherkinDocument:0>Scenario_Definition:1>Scenario:0>#ScenarioLine:0";252 token.detach();253 var expectedTokens = ["#EOF", "#Empty", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#Other"];254 var error = token.isEof ?255 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :256 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);257 if (self.stopAtFirstError) throw error;258 addError(context, error);259 return 2;260 }261 // GherkinDocument:0>Scenario_Definition:1>Scenario:1>Scenario_Description:0>Description_Helper:1>Description:0>#Other:0262 function matchTokenAt_3(token, context) {263 if(match_EOF(context, token)) {264 endRule(context, 'Description');265 endRule(context, 'Scenario');266 endRule(context, 'Scenario_Definition');267 build(context, token);268 return 7;269 }270 if(match_Comment(context, token)) {271 endRule(context, 'Description');272 build(context, token);273 return 4;274 }275 if(match_StepLine(context, token)) {276 endRule(context, 'Description');277 startRule(context, 'Step');278 build(context, token);279 return 5;280 }281 if(match_TagLine(context, token)) {282 endRule(context, 'Description');283 endRule(context, 'Scenario');284 endRule(context, 'Scenario_Definition');285 startRule(context, 'Scenario_Definition');286 startRule(context, 'Tags');287 build(context, token);288 return 1;289 }290 if(match_ScenarioLine(context, token)) {291 endRule(context, 'Description');292 endRule(context, 'Scenario');293 endRule(context, 'Scenario_Definition');294 startRule(context, 'Scenario_Definition');295 startRule(context, 'Scenario');296 build(context, token);297 return 2;298 }299 if(match_Other(context, token)) {300 build(context, token);301 return 3;302 }303 304 var stateComment = "State: 3 - GherkinDocument:0>Scenario_Definition:1>Scenario:1>Scenario_Description:0>Description_Helper:1>Description:0>#Other:0";305 token.detach();306 var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#Other"];307 var error = token.isEof ?308 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :309 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);310 if (self.stopAtFirstError) throw error;311 addError(context, error);312 return 3;313 }314 // GherkinDocument:0>Scenario_Definition:1>Scenario:1>Scenario_Description:0>Description_Helper:2>#Comment:0315 function matchTokenAt_4(token, context) {316 if(match_EOF(context, token)) {317 endRule(context, 'Scenario');318 endRule(context, 'Scenario_Definition');319 build(context, token);320 return 7;321 }322 if(match_Comment(context, token)) {323 build(context, token);324 return 4;325 }326 if(match_StepLine(context, token)) {327 startRule(context, 'Step');328 build(context, token);329 return 5;330 }331 if(match_TagLine(context, token)) {332 endRule(context, 'Scenario');333 endRule(context, 'Scenario_Definition');334 startRule(context, 'Scenario_Definition');335 startRule(context, 'Tags');336 build(context, token);337 return 1;338 }339 if(match_ScenarioLine(context, token)) {340 endRule(context, 'Scenario');341 endRule(context, 'Scenario_Definition');342 startRule(context, 'Scenario_Definition');343 startRule(context, 'Scenario');344 build(context, token);345 return 2;346 }347 if(match_Empty(context, token)) {348 build(context, token);349 return 4;350 }351 352 var stateComment = "State: 4 - GherkinDocument:0>Scenario_Definition:1>Scenario:1>Scenario_Description:0>Description_Helper:2>#Comment:0";353 token.detach();354 var expectedTokens = ["#EOF", "#Comment", "#StepLine", "#TagLine", "#ScenarioLine", "#Empty"];355 var error = token.isEof ?356 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :357 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);358 if (self.stopAtFirstError) throw error;359 addError(context, error);360 return 4;361 }362 // GherkinDocument:0>Scenario_Definition:1>Scenario:2>Scenario_Step:0>Step:0>#StepLine:0363 function matchTokenAt_5(token, context) {364 if(match_EOF(context, token)) {365 endRule(context, 'Step');366 endRule(context, 'Scenario');367 endRule(context, 'Scenario_Definition');368 build(context, token);369 return 7;370 }371 if(match_TableRow(context, token)) {372 startRule(context, 'DataTable');373 build(context, token);374 return 6;375 }376 if(match_DocStringSeparator(context, token)) {377 startRule(context, 'DocString');378 build(context, token);379 return 8;380 }381 if(match_StepLine(context, token)) {382 endRule(context, 'Step');383 startRule(context, 'Step');384 build(context, token);385 return 5;386 }387 if(match_TagLine(context, token)) {388 endRule(context, 'Step');389 endRule(context, 'Scenario');390 endRule(context, 'Scenario_Definition');391 startRule(context, 'Scenario_Definition');392 startRule(context, 'Tags');393 build(context, token);394 return 1;395 }396 if(match_ScenarioLine(context, token)) {397 endRule(context, 'Step');398 endRule(context, 'Scenario');399 endRule(context, 'Scenario_Definition');400 startRule(context, 'Scenario_Definition');401 startRule(context, 'Scenario');402 build(context, token);403 return 2;404 }405 if(match_Comment(context, token)) {406 build(context, token);407 return 5;408 }409 if(match_Empty(context, token)) {410 build(context, token);411 return 5;412 }413 414 var stateComment = "State: 5 - GherkinDocument:0>Scenario_Definition:1>Scenario:2>Scenario_Step:0>Step:0>#StepLine:0";415 token.detach();416 var expectedTokens = ["#EOF", "#TableRow", "#DocStringSeparator", "#StepLine", "#TagLine", "#ScenarioLine", "#Comment", "#Empty"];417 var error = token.isEof ?418 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :419 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);420 if (self.stopAtFirstError) throw error;421 addError(context, error);422 return 5;423 }424 // GherkinDocument:0>Scenario_Definition:1>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt0:0>DataTable:0>#TableRow:0425 function matchTokenAt_6(token, context) {426 if(match_EOF(context, token)) {427 endRule(context, 'DataTable');428 endRule(context, 'Step');429 endRule(context, 'Scenario');430 endRule(context, 'Scenario_Definition');431 build(context, token);432 return 7;433 }434 if(match_TableRow(context, token)) {435 build(context, token);436 return 6;437 }438 if(match_StepLine(context, token)) {439 endRule(context, 'DataTable');440 endRule(context, 'Step');441 startRule(context, 'Step');442 build(context, token);443 return 5;444 }445 if(match_TagLine(context, token)) {446 endRule(context, 'DataTable');447 endRule(context, 'Step');448 endRule(context, 'Scenario');449 endRule(context, 'Scenario_Definition');450 startRule(context, 'Scenario_Definition');451 startRule(context, 'Tags');452 build(context, token);453 return 1;454 }455 if(match_ScenarioLine(context, token)) {456 endRule(context, 'DataTable');457 endRule(context, 'Step');458 endRule(context, 'Scenario');459 endRule(context, 'Scenario_Definition');460 startRule(context, 'Scenario_Definition');461 startRule(context, 'Scenario');462 build(context, token);463 return 2;464 }465 if(match_Comment(context, token)) {466 build(context, token);467 return 6;468 }469 if(match_Empty(context, token)) {470 build(context, token);471 return 6;472 }473 474 var stateComment = "State: 6 - GherkinDocument:0>Scenario_Definition:1>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt0:0>DataTable:0>#TableRow:0";475 token.detach();476 var expectedTokens = ["#EOF", "#TableRow", "#StepLine", "#TagLine", "#ScenarioLine", "#Comment", "#Empty"];477 var error = token.isEof ?478 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :479 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);480 if (self.stopAtFirstError) throw error;481 addError(context, error);482 return 6;483 }484 // GherkinDocument:0>Scenario_Definition:1>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt0:1>DocString:0>#DocStringSeparator:0485 function matchTokenAt_8(token, context) {486 if(match_DocStringSeparator(context, token)) {487 build(context, token);488 return 9;489 }490 if(match_Other(context, token)) {491 build(context, token);492 return 8;493 }494 495 var stateComment = "State: 8 - GherkinDocument:0>Scenario_Definition:1>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt0:1>DocString:0>#DocStringSeparator:0";496 token.detach();497 var expectedTokens = ["#DocStringSeparator", "#Other"];498 var error = token.isEof ?499 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :500 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);501 if (self.stopAtFirstError) throw error;502 addError(context, error);503 return 8;504 }505 // GherkinDocument:0>Scenario_Definition:1>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt0:1>DocString:2>#DocStringSeparator:0506 function matchTokenAt_9(token, context) {507 if(match_EOF(context, token)) {508 endRule(context, 'DocString');509 endRule(context, 'Step');510 endRule(context, 'Scenario');511 endRule(context, 'Scenario_Definition');512 build(context, token);513 return 7;514 }515 if(match_StepLine(context, token)) {516 endRule(context, 'DocString');517 endRule(context, 'Step');518 startRule(context, 'Step');519 build(context, token);520 return 5;521 }522 if(match_TagLine(context, token)) {523 endRule(context, 'DocString');524 endRule(context, 'Step');525 endRule(context, 'Scenario');526 endRule(context, 'Scenario_Definition');527 startRule(context, 'Scenario_Definition');528 startRule(context, 'Tags');529 build(context, token);530 return 1;531 }532 if(match_ScenarioLine(context, token)) {533 endRule(context, 'DocString');534 endRule(context, 'Step');535 endRule(context, 'Scenario');536 endRule(context, 'Scenario_Definition');537 startRule(context, 'Scenario_Definition');538 startRule(context, 'Scenario');539 build(context, token);540 return 2;541 }542 if(match_Comment(context, token)) {543 build(context, token);544 return 9;545 }546 if(match_Empty(context, token)) {547 build(context, token);548 return 9;549 }550 551 var stateComment = "State: 9 - GherkinDocument:0>Scenario_Definition:1>Scenario:2>Scenario_Step:0>Step:1>Step_Arg:0>__alt0:1>DocString:2>#DocStringSeparator:0";552 token.detach();553 var expectedTokens = ["#EOF", "#StepLine", "#TagLine", "#ScenarioLine", "#Comment", "#Empty"];554 var error = token.isEof ?555 Errors.UnexpectedEOFException.create(token, expectedTokens, stateComment) :556 Errors.UnexpectedTokenException.create(token, expectedTokens, stateComment);557 if (self.stopAtFirstError) throw error;558 addError(context, error);559 return 9;560 }561 function match_EOF(context, token) {562 return handleExternalError(context, false, function () {563 return context.tokenMatcher.match_EOF(token);564 });565 }566 function match_Empty(context, token) {567 if(token.isEof) return false;568 return handleExternalError(context, false, function () {569 return context.tokenMatcher.match_Empty(token);570 });571 }572 function match_Comment(context, token) {573 if(token.isEof) return false;574 return handleExternalError(context, false, function () {575 return context.tokenMatcher.match_Comment(token);576 });577 }578 function match_TagLine(context, token) {579 if(token.isEof) return false;580 return handleExternalError(context, false, function () {581 return context.tokenMatcher.match_TagLine(token);582 });583 }584 function match_ScenarioLine(context, token) {585 if(token.isEof) return false;586 return handleExternalError(context, false, function () {587 return context.tokenMatcher.match_ScenarioLine(token);588 });589 }590 function match_ExamplesLine(context, token) {591 if(token.isEof) return false;592 return handleExternalError(context, false, function () {593 return context.tokenMatcher.match_ExamplesLine(token);594 });595 }596 function match_StepLine(context, token) {597 if(token.isEof) return false;598 return handleExternalError(context, false, function () {599 return context.tokenMatcher.match_StepLine(token);600 });601 }602 function match_DocStringSeparator(context, token) {603 if(token.isEof) return false;604 return handleExternalError(context, false, function () {605 return context.tokenMatcher.match_DocStringSeparator(token);606 });607 }608 function match_TableRow(context, token) {609 if(token.isEof) return false;610 return handleExternalError(context, false, function () {611 return context.tokenMatcher.match_TableRow(token);612 });613 }...

Full Screen

Full Screen

task_runner.py

Source:task_runner.py Github

copy

Full Screen

1import datetime2import os3import glob4from typing import Any, Optional, Union5from gherkin.token_scanner import TokenScanner6from gherkin.parser import Parser7from .junit_report import JUnitReport8from .feedback_adapter import FeedbackAdapter9from .scenario_result import ScenarioResult10from .feedback_schema import FeatureInfo, ScenarioFeedback11import inspect12from .helpers import excludeKeys13from .report import Report14from .testresult_info import TestResultInfo15from .timeline import Timeline16from .task import Task17from .scenario_context import ScenarioContext18import threading19import concurrent20from .color import bcolors21from concurrent.futures import ThreadPoolExecutor, wait, ProcessPoolExecutor22from .scenario import Scenario23from itertools import groupby24import multiprocessing25from gherkin.token_matcher import TokenMatcher26from gherkin.dialect import Dialect27from .custom_keywords import concurrent_keywords, match_stepline28from .dependency_graph import DependencyGraph29import uuid30import time31import signal32from .task_monitor import TaskMonitor33from .task_runner_config import TaskRunnerConfig34from .feedback import Feedback35from dataclasses import asdict36Dialect.concurrent_keywords = concurrent_keywords37TokenMatcher.match_StepLine = match_stepline38class TaskRunner:39 def __init__(self,debugMode=False,timeout=3600) -> None:40 self.parser = Parser()41 self.completedTasks: list[str] = []42 self.groups = {}43 self.pool = ThreadPoolExecutor()44 self.parallelPool = ProcessPoolExecutor(max_workers=multiprocessing.cpu_count(),mp_context=multiprocessing.get_context("spawn"))45 self.taskReport = []46 self.setupTasks: list[Task] = []47 self.teardownTasks: list[Task] = []48 self.allTaskIds: list[str] = []49 self.mainTasks: list[Task] = []50 self.debugMode: bool = debugMode51 self.testResult: TestResultInfo = None52 self.timeout = timeout53 self.taskMonitor = TaskMonitor()54 self.feedback = Feedback()55 def run(self, options: Union[list[str],TaskRunnerConfig]) -> TestResultInfo:56 57 if isinstance(options,TaskRunnerConfig):58 if len(options.featureFiles) > 0:59 files = self.__getAllFeatureFiles(options.featureFiles)60 for file in files:61 self.__parse(file, options.onlyRunScenarioTags)62 else:63 files = self.__getAllFeatureFiles(options)64 for file in files:65 self.__parse(file, [])66 67 start = time.time()68 startDate = datetime.datetime.now().strftime("%m/%d/%Y, %H:%M:%S")69 self.taskMonitor.start()70 self.feedback.startFeedback()71 ## run any setup tasks72 error = self.__runSetupTasks()73 if not error:74 ## run main tasks75 self.__runMainTasks()76 ## run any teardown tasks77 error = self.__runTeardownTasks()78 end = time.time()79 endDate = datetime.datetime.now().strftime("%m/%d/%Y, %H:%M:%S")80 self.taskMonitor.cancel()81 self.taskMonitor.join()82 self.taskMonitor.pids = list(dict.fromkeys(self.taskMonitor.pids))83 for pid in self.taskMonitor.pids:84 self.__print(f"kill process id: {pid}")85 try:86 os.kill(pid, signal.SIGTERM)87 except:88 pass89 ## print test report90 self.__printTestReport()91 self.testResult = TestResultInfo(92 elapsed=end-start,93 start=startDate,94 end=endDate,95 numCpu=multiprocessing.cpu_count(),96 pid=os.getpid(),97 success=len(list(filter(lambda x: "failed" in x["status"], self.taskReport))) <= 098 )99 self.feedback.stopFeedback()100 return self.testResult101 def __getAllFeatureFiles(self, paths: list[str]) -> list[str]:102 featureFiles: list[str] = []103 for p in paths:104 fullPath = os.path.abspath(p)105 if os.path.isfile(fullPath):106 if fullPath not in featureFiles:107 featureFiles.append(fullPath)108 elif os.path.isdir(fullPath):109 files = glob.glob(fullPath + '/**/*.feature', recursive=True)110 for file in files:111 if file not in featureFiles:112 featureFiles.append(file)113 return featureFiles114 115 def __parse(self, featureFile: str, onlyTags: list[str]):116 result = self.parser.parse(TokenScanner(featureFile))117 if not result:118 return119 120 if "feature" not in result:121 return122 if "children" not in result["feature"]:123 return124 125 feature = result["feature"]126 for child in feature["children"]:127 if "scenario" in child:128 sc = child["scenario"]129 self.__getScenario(sc, feature, onlyTags)130 131 # def __getFeatureId(self, feature: Any) -> str:132 # tags = feature["tags"]133 # id=uuid.uuid4().hex()134 # for tag in tags:135 # tg = tag["name"]136 # if temp := self.__getIdTag(tg, tag): id = temp137 # return id138 139 def __getScenario(self, scenario: Any, feature: Any, onlyIncludeTags: list[str]) -> Optional[Task]:140 tags = scenario["tags"]141 isConcurrent,id,depends,dependsGroups,group,runAlways,isSetup,isTeardown,isParallel = False,uuid.uuid4().hex,[],[],None,False,False,False,False142 143 # if scenario tags filtering is specified an scenario does not have any tag then exclude this scenario144 if len(onlyIncludeTags) > 0 and len(tags) <= 0:145 return None146 # filter scenario based on tags147 if len(onlyIncludeTags) > 0:148 if not any(item["name"] in onlyIncludeTags for item in tags):149 return None150 for tag in tags:151 tg = tag["name"]152 if temp := self.__getConcurrentTag(tg): isConcurrent = temp153 if temp := self.__getParallelTag(tg): isParallel = temp154 if temp := self.__getRunAlwaysTag(tg): runAlways = temp155 if temp := self.__getSetupTag(tg): isSetup = temp156 if temp := self.__getTeardownTag(tg): isTeardown = temp157 if temp := self.__getIdTag(tg, tag): id = temp158 if temp := self.__getDependsTag(tg, tag): depends.append(temp)159 if temp := self.__getDependsGroupsTag(tg, tag): dependsGroups.append(temp)160 if temp := self.__getGroupTag(tg, tag): group = temp161 sc = Scenario(scenario["name"],scenario,feature,id)162 t = Task(scenario["name"], sc, feature, id,depends,dependsGroups,runAlways,group, isSetup, isConcurrent,isTeardown,isParallel)163 self.allTaskIds.append(t.id)164 if group is not None:165 self.groups.setdefault(group, []).append(id)166 if isSetup:167 self.setupTasks.append(t)168 elif isTeardown:169 self.teardownTasks.append(t)170 else:171 self.mainTasks.append(t)172 return t173 def __getGroupTag(self, name: str, tag: Any) -> Optional[str]:174 return tag["name"].split("@group_")[-1] if name.startswith("@group_") else None175 def __getIdTag(self, name: str, tag: Any) -> Optional[str]:176 return tag["name"].split("@id_")[-1] if name.startswith("@id_") else None177 178 def __getConcurrentTag(self, name: str) -> bool:179 return name == "@concurrent"180 181 def __getParallelTag(self, name: str) -> bool:182 return name == "@parallel"183 184 def __getRunAlwaysTag(self, name: str) -> bool:185 return name == "@runAlways"186 def __getDependsTag(self, name: str, tag: Any) -> Optional[str]:187 return tag["name"].split("@depends_")[-1] if name.startswith("@depends_") else None188 189 def __getDependsGroupsTag(self, name: str, tag: Any) -> Optional[str]:190 return tag["name"].split("@dependsGroups_")[-1] if name.startswith("@dependsGroups_") else None191 192 def __getSetupTag(self, name: str) -> bool:193 return name == "@setup"194 195 def __getTeardownTag(self, name: str) -> bool:196 return name == "@teardown"197 def __getNextTask(self,taskList) -> list[Task]:198 new_tasks: list[Task] = []199 skipped_tasks: list[Task] = []200 self.__print(f"tasks pending: {[(f'name: {t.name}',f'id:{t.id}') for t in taskList]}")201 for task in taskList:202 self.__print(f"check pending task: (name:{task.name},id:{task.id})")203 if len(task.depends) > 0:204 self.__print(f"task (name:{task.name},id:{task.id}) depends on: {task.depends}")205 if not set(task.depends).issubset(self.allTaskIds):206 self.__addTaskToReport(task, "skipped", None, 0.0, None)207 skipped_tasks.append(task)208 self.completedTasks.append(task.id)209 continue210 if not set(task.depends).issubset(self.completedTasks):211 continue212 if self.__isParentTaskFailed(task.depends) and not task.runAlways:213 self.__addTaskToReport(task, "skipped", None, 0.0, None)214 self.__print(f"skip task: (name:{task.name},id:{task.id})")215 skipped_tasks.append(task)216 self.completedTasks.append(task.id)217 continue218 if len(task.dependsGroups) > 0:219 self.__print(f"task (name:{task.name},id:{task.id}) depends on groups: {task.dependsGroups}")220 combine_groups = []221 for g in task.dependsGroups:222 if g in self.groups:223 combine_groups += self.groups[g]224 if not bool(combine_groups):225 self.__print(f"no groups matching found for task: (name:{task.name},id:{task.id})")226 self.__addTaskToReport(task, "skipped", None, 0.0, None)227 skipped_tasks.append(task)228 self.completedTasks.append(task.id)229 continue230 if not set(combine_groups).issubset(self.completedTasks):231 continue232 if self.__isParentTaskFailed(combine_groups) and not task.runAlways:233 self.__addTaskToReport(task, "skipped", None, 0.0, None)234 self.__print(f"dependent tasks failed so skip task: (name:{task.name},id:{task.id})")235 skipped_tasks.append(task)236 self.completedTasks.append(task.id)237 continue238 new_tasks.append(task)239 if len(skipped_tasks) > 0:240 taskList = [i for i in taskList if not any(x.id == i.id for x in skipped_tasks)]241 if len(new_tasks) > 0:242 taskList = [i for i in taskList if not any(x.id == i.id for x in new_tasks)]243 return new_tasks, taskList244 def runWorkerThread(self, taskList):245 tasks_to_submit, taskList = self.__getNextTask(taskList)246 futures = {}247 for task in tasks_to_submit:248 if task.isConcurrent:249 futures[self.pool.submit(task.scenario.run,queue=None, feedbackQueue=self.feedback.messageQueue,context=self.__scenarioContextFromTask(task))] = task250 elif task.isParallel:251 futures[self.parallelPool.submit(task.scenario.run,queue=self.taskMonitor.signalQueue,feedbackQueue=self.feedback.messageQueue,context=self.__scenarioContextFromTask(task))] = task252 253 254 self.__print(f"adding new tasks: {[(f'name: {t.name}',f'id:{t.id}') for t in tasks_to_submit]}")255 self.__print(f"tasks in pool: {[(f'name: {t.name}',f'id:{t.id}') for t in futures.values()]}")256 startTime = time.time()257 currentTimeout = self.timeout258 while futures:259 done, notDone = wait(futures,return_when=concurrent.futures.FIRST_COMPLETED,timeout=currentTimeout)260 endTime = time.time()261 elapsed = endTime-startTime262 self.__print(f"elapsed time waiting for task to complete: {elapsed}")263 if elapsed >= currentTimeout:264 for c in notDone:265 self.__print(f"tasks not done: (name:{futures[c].name},id:{futures[c].id}, running:{c.running()},cancelled:{c.cancelled()})")266 self.__addTaskToReport(futures[c],"failed","timeout waiting for task to complete",self.timeout, None)267 self.__print(f"timeout waiting {self.timeout} (s) for remaining tasks to complete. Aborting.")268 break269 currentTimeout = currentTimeout - elapsed270 self.__print(f"Remaining timeout: {currentTimeout}")271 for c in done:272 fut = futures.pop(c)273 result = c.result()274 print(result.message)275 self.__print(f"task completed: (name:{fut.name},id:{result.id})")276 self.completedTasks.append(result.id)277 if result.exception is not None:278 self.__addTaskToReport(fut,"failed",result.exception,result.elapsed, result)279 else:280 self.__addTaskToReport(fut,"success",result.exception,result.elapsed, result)281 next_tasks,taskList = self.__getNextTask(taskList)282 if next_tasks is not None:283 for t in next_tasks:284 self.__print(f"adding new task (name:{t.name},id:{t.id})")285 if t.isConcurrent:286 item = self.pool.submit(t.scenario.run,queue=None,feedbackQueue=self.feedback.messageQueue,context=self.__scenarioContextFromTask(t))287 futures[item] = t288 elif t.isParallel:289 item = self.parallelPool.submit(t.scenario.run,queue=self.taskMonitor.signalQueue,feedbackQueue=self.feedback.messageQueue,context=self.__scenarioContextFromTask(t))290 futures[item] = t291 self.__print(f"remaining tasks in pool: {[(f'name: {t.name}',f'id:{t.id}') for t in futures.values()]}")292 293 def __printTestReport(self):294 print(f"Test report:\n")295 for key, group in groupby(sorted(self.taskReport,key=lambda x:x["feature"]), lambda x: x["feature"]):296 print(f"\nFeature: {key}\n")297 for t in group:298 if t['status'] == 'success':299 print(f"\tScenario: {t['name']}: {bcolors.OKGREEN}{t['status']}{bcolors.ENDC} (elapsed {t['elapsed']})")300 elif t['status'] == 'skipped':301 print(f"\tScenario: {t['name']}: {bcolors.WARNING}{t['status']}{bcolors.ENDC} (elapsed {t['elapsed']})")302 else:303 print(f"\tScenario: {t['name']}: {bcolors.FAIL}{t['status']}{bcolors.ENDC} (elapsed {t['elapsed']})")304 305 # if t['error'] is not None:306 # print(f"\t\tError: {bcolors.FAIL}{t['error']}{bcolors.ENDC}")307 308 #print(f"all steps report: {t['scenario']}")309 if 'scenario' in t and t["scenario"] is not None:310 if t['scenario'].steps:311 for step in t["scenario"].steps:312 status = step['status']313 if status == 'failed':314 print(f"\t Step: {step['keyword']}{step['text']}{bcolors.FAIL} {step['status']}{bcolors.ENDC} (elapsed {step['elapsed']})")315 elif status == 'skipped':316 print(f"\t Step: {step['keyword']}{step['text']}{bcolors.WARNING} {step['status']}{bcolors.ENDC} (elapsed {step['elapsed']})")317 else:318 print(f"\t Step: {step['keyword']}{step['text']}{bcolors.OKGREEN} {step['status']}{bcolors.ENDC} (elapsed {step['elapsed']})")319 if "error" in step and step['error'] is not None:320 print(f"\t\t{bcolors.FAIL}{step['error']}{bcolors.ENDC}")321 def __scenarioContextFromTask(self,task: Task):322 data = excludeKeys(asdict(task),["name","scenario","feature"])323 return ScenarioContext(324 **{325 key: (data[key] if val.default == val.empty else data.get(key, val.default))326 for key, val in inspect.signature(ScenarioContext).parameters.items()327 }328 )329 330 331 def __print(self,msg: str):332 if self.debugMode:333 print(f"{bcolors.OKCYAN}[{datetime.datetime.now().strftime('%m/%d/%Y, %H:%M:%S')} task_manager] {msg}{bcolors.ENDC}\n")334 335 def __isParentTaskFailed(self, groups):336 ptask = []337 for t in self.taskReport:338 if 'id' in t:339 if any(t['id'] == x for x in groups):340 ptask.append(t)341 return any(y['status'] == "failed" or y['status'] == "skipped" for y in ptask)342 343 def __addTaskToReport(self, task: Task, status: str, error: str, elapsed: float, scenarioResult: Any):344 if not any(task.name == x["name"] and task.feature["name"] == x["feature"] for x in self.taskReport):345 self.taskReport.append({"name":task.name,"status":status,"error":error, "elapsed": elapsed, "id": task.id, "feature": task.feature["name"], "task": task, "scenario": scenarioResult})346 self.feedback.notify(asdict(self.__feedbackSchemaFromTaskResult(task,scenarioResult,status,error,elapsed)))347 def __runMainTasks(self):348 return self.__runTasks(self.mainTasks)349 def __runSetupTasks(self):350 return self.__runTasks(self.setupTasks)351 352 def __runTeardownTasks(self):353 return self.__runTasks(self.teardownTasks)354 355 def __transformSeqTasks(self, taskList: list[Task]):356 dependTaskId = None357 for t in taskList:358 t.isConcurrent = True359 if dependTaskId is not None and len(t.depends) <= 0 and len(t.dependsGroups) <= 0:360 t.depends.append(dependTaskId)361 dependTaskId = t.id362 return taskList363 def __runTasks(self, taskList):364 error = False365 seqtasks = list(filter(lambda x: not x.isConcurrent and not x.isParallel, taskList))366 contasks = list(filter(lambda x: x.isConcurrent or x.isParallel, taskList))367 seqtasks = self.__transformSeqTasks(seqtasks)368 alltasks = contasks + seqtasks369 self.__print(f"all tasks: {[t.name for t in alltasks]}")370 workerThread = threading.Thread(target=self.runWorkerThread,kwargs={'taskList':alltasks})371 workerThread.start()372 373 workerThread.join()374 if len(list(filter(lambda x: "failed" in x["status"], self.taskReport))) > 0:375 error = True376 377 return error378 379 def __feedbackSchemaFromTaskResult(self,task: Task, scenarioResult: ScenarioResult,status: str, error: str, elapsed: float):380 obj = ScenarioFeedback()381 taskDict = asdict(task)382 feedDict = asdict(obj)383 obj = ScenarioFeedback(**{k:(taskDict[k] if k in taskDict else v) for k,v in feedDict.items()})384 obj.status = status385 obj.error = error386 obj.elapsed = elapsed387 if scenarioResult:388 obj.threadId = scenarioResult.threadId389 obj.pid = scenarioResult.pid390 obj.name = scenarioResult.scenario["name"]391 obj.column = scenarioResult.scenario["location"]["column"]392 obj.line = scenarioResult.scenario["location"]["line"]393 obj.tags = [t["name"] for t in scenarioResult.scenario["tags"]]394 obj.description = scenarioResult.scenario["description"]395 obj.numberOfSteps = len(scenarioResult.scenario["steps"])396 if scenarioResult.startTime:397 obj.startTime = scenarioResult.startTime398 if scenarioResult.endTime:399 obj.endTime = scenarioResult.endTime400 if task.feature:401 obj.featureInfo = FeatureInfo(402 description=task.feature["description"],403 name=task.feature["name"],404 tags=[t["name"] for t in task.feature["tags"]]405 )406 return obj407 408 def generateTimeline(self):409 timeline = Timeline()410 timeline.generateTimeline(self.taskReport)411 412 def generateDependencyGraph(self):413 depGraph = DependencyGraph()414 depGraph.generateGraph("dependency_output.html",self.taskReport,self.groups)415 416 def generateReport(self):417 report = Report()418 report.generateReport(self.taskReport, self.testResult)419 420 def registerFeedbackAdapter(self,adapter: FeedbackAdapter):421 self.feedback.addAdapter(adapter)422 423 def generateJUnitReport(self):424 report = JUnitReport()425 report.generateReport(self.taskReport,self.testResult)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Gherkin-python automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful