Skip to content

Instantly share code, notes, and snippets.

@alistairjevans
Created February 2, 2020 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alistairjevans/e04add0b8ba305f78f8dc370f71bd47c to your computer and use it in GitHub Desktop.
Save alistairjevans/e04add0b8ba305f78f8dc370f71bd47c to your computer and use it in GitHub Desktop.
// This parser rule is only used for line tokenisation
// it doesn't natively understand more context than a single line.
// It is also more forgiving than the normal parser.
onlyLine: WS? TAG lineTerm #lineTag
| WS? OPTION lineTerm #lineOpt
| WS? STEP_DEFINE DEF_WS? stepDeclaration? lineTerm #lineStepDefine
| WS? FEATURE WS? text? lineTerm #lineFeature
| WS? BACKGROUND lineTerm #lineBackground
| WS? SCENARIO WS? text? lineTerm #lineScenario
| WS? SCENARIO_OUTLINE WS? text? lineTerm #lineScenarioOutline
| WS? EXAMPLES lineTerm #lineExamples
| WS? tableRowCell+ CELL_DELIMITER #lineTableRow
| WS? GIVEN statementBody? lineTerm #lineGiven
| WS? WHEN statementBody? lineTerm #lineWhen
| WS? THEN statementBody? lineTerm #lineThen
| WS? AND statementBody? lineTerm #lineAnd
| WS? text? lineTerm #lineText
;
lineTerm: STATEMENT_NEWLINE
| DEF_NEWLINE
| ROW_NL
| WS? EOF;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment