The syntax for JMoribus is based on the Gherkin syntax. Therefore it knows the keywords Given, When, Then and And for steps. These can be grouped in Scenarios by the keyword Scenario: followed by a title. See the following simple example:

Feature: MultiScenarioTitle
  In order to realize a named business value
  As a explicit system actor
  I want to gain some beneficial outcome which furthers the goal

#-- This is a comment

Scenario: scenario description
Given a system state
When I do something
Then system is in a different state
And the system is still working fine

Tables

TODO

Examples

TODO

Prologue

TODO

Referring

TODO

Antlr grammar

JMoribus' parser is based on a Antlr grammar file:

grammar Gherkins;

story
    : feature? prologue? scenario*;

feature
    : feature_keyword feature_title feature_content
    ;

feature_content
    : (NEWLINE SPACE SPACE line)* ;

feature_title
    : line ;

prologue
    : NEWLINE*? prologue_keyword (NEWLINE step)+;

scenario
    : NEWLINE*? scenario_keyword scenario_title (NEWLINE step)+ NEWLINE* examples*;

scenario_title
    : line ;

examples
    : examples_keyword NEWLINE+ SPACE SPACE examples_table ;

examples_table
    : table ;

table
    : table_row+;

table_row
    : (SPACE SPACE)? '|' cell+  NEWLINE?;

cell
    : (SPACE|TEXT)*? '|';

step
    : step_keyword step_line (NEWLINE SPACE SPACE step_line)*;

step_line
    : (step_text_line|step_table_line) ;

step_text_line
    : line ;

step_table_line
    : table ;

line
    : (SPACE|TEXT)*;

feature_keyword
    :   'Feature:';

prologue_keyword
    :   'Prologue:';

scenario_keyword
    :   'Scenario:';

examples_keyword
    :   'Examples:';

step_keyword
    :   'Given' | 'When' | 'Then' | 'And' | 'Referring';

SPACE   : ' ' | '\t';

NEWLINE : '\r'? '\n';

TEXT
    : (UPPERCASE_LETTER | LOWERCASE_LETTER | DIGIT| SYMBOL )
    ;

fragment UPPERCASE_LETTER
    : 'A'..'Z'
    ;

fragment LOWERCASE_LETTER
    : 'a'..'z'
    ;

fragment DIGIT
    : '0'..'9'
    ;

fragment SYMBOL
    : '\u0021'..'\u0027'
    | '\u002a'..'\u002f'
    | '\u003a'..'\u0040'
    | '\u005e'..'\u0060'
    | '\u00a1'..'\u00FF'
    | '\u0152'..'\u0192'
    | '\u2013'..'\u2122'
    | '\u2190'..'\u21FF'
    | '\u2200'..'\u22FF'
    | '('..')'
    | '['..']'
    | '{'..'}'
    ;

COMMENT
    :   '/*' .*? '*/' -> skip
    ;

LINE_COMMENT
    :   '#-- ' .*? [\r\n] -> skip
    ;