Guest User

Untitled

a guest
Feb 21st, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. grammar Gherkin;
  2.  
  3. //options {
  4. // language=Ruby;
  5. //}
  6.  
  7. feature : NEWLINE* comment? NEWLINE* SPACE* tags? NEWLINE* SPACE* feature_keyword SPACE* line_to_eol NEWLINE+ (feature_elements .)* feature_elements ;
  8.  
  9. fragment
  10. feature_elements
  11. : (scenario_outline | scenario)* ;
  12.  
  13. scenario
  14. : comment? tags? scenario_keyword SPACE* line_to_eol NEWLINE+ steps ;
  15.  
  16. scenario_outline
  17. : comment? tags? scenario_outline_keyword SPACE* line_to_eol NEWLINE+ steps examples_sections ;
  18.  
  19. steps : step* ;
  20.  
  21. step : step_keyword SPACE* line_to_eol NEWLINE+ multiline_arg? ;
  22.  
  23. examples_sections
  24. : examples+ ;
  25.  
  26. examples
  27. : examples_keyword SPACE* line_to_eol NEWLINE+ table ;
  28.  
  29. multiline_arg
  30. : table ;
  31.  
  32. table : table_row+ ;
  33.  
  34. table_row
  35. : SPACE* '|' (cell '|')+ SPACE* (NEWLINE+) ;
  36.  
  37. cell : (~('|' | NEWLINE) .)* ;
  38.  
  39. tags : tag (SPACE tag)* NEWLINE+ ;
  40.  
  41. tag : '@' tag_name=ID ;
  42.  
  43. comment
  44. : (comment_line NEWLINE)* ;
  45.  
  46. comment_line
  47. : '#' line_to_eol;
  48.  
  49. line_to_eol
  50. : (~NEWLINE)* ;
  51.  
  52. feature_keyword
  53. : 'Feature' ':'? ;
  54.  
  55. scenario_keyword
  56. : 'Scenario' ':'? ;
  57.  
  58. scenario_outline_keyword
  59. : 'Scenario Outline' ':'? ;
  60.  
  61. step_keyword
  62. : 'Given' | 'When' | 'Then' | 'And' | 'But' ;
  63.  
  64. examples_keyword
  65. : 'Examples' ':'? ;
  66.  
  67.  
  68. ID : ('a'..'z'|'A'..'Z'|'_')+ ;
  69.  
  70. NEWLINE : (('\r')? '\n' )+ ;
  71.  
  72. SPACE : (' '|'\t')+ {skip();};
Add Comment
Please, Sign In to add comment