---
ANY: '[\s\S]' # Any unicode character
SPACE: '[\ \t]' # A space or tab character
SPACES: '\ \t' # For use in character classes
BREAK: '\n' # A newline character
EOL: '\r?\n' # A Unix or DOS line ending
NON_BREAK: '.' # Any character except newline
LOWER: '[a-z]' # Lower case ASCII alphabetic character
UPPER: '[A-Z]' # Upper case ASCII alphabetic character
ALPHANUM: '[A-Za-z0-9]' # ASCII alphanumeric character
WORD: '\w' # ie '[A-Za-z0-9_]' - A "word" character
DIGIT: '[0-9]' # A numeric digit
DOLLAR: '\$' # A dollar sign
DOT: '\.' # A period character
HASH: '#' # An octothorpe (or hash) character
BACK: '\' # A backslash character
SINGLE: "'" # A single quote character
DOUBLE: '"' # A double quote character
ESCAPE: '[0nt]' # One of the escapable character IDs
document:
- meta_section
- test_section
- /:
- data_section
^: '?'
meta_section:
- /(?:$comment|$blank_line)*/
- /:
- meta_testml_statement
- _: No TestML meta directive found
- /:
- meta_statement
- comment
- blank_line
^: '*'
comment: /$HASH$line/
line: /$NON_BREAK*$EOL/
blank_line: /$SPACE*$EOL/
meta_testml_statement: /%TestML:$SPACE+($testml_version)(?:$SPACE+$comment|$EOL)/
testml_version: /($DIGIT$DOT$DIGIT+)/
meta_statement: /%($meta_keyword):$SPACE+($meta_value)(?:$SPACE+$comment|$EOL)/
meta_keyword: /(?:$core_meta_keyword|$user_meta_keyword)/
core_meta_keyword: /(?:Title|Data|Plan|BlockMarker|PointMarker)/
user_meta_keyword: /$LOWER$WORD*/
meta_value: /(?:$single_quoted_string|$double_quoted_string|$unquoted_string)/
single_quoted_string: /(?:$SINGLE(([^$BREAK$BACK$SINGLE]|$BACK$SINGLE|$BACK$BACK)*?)$SINGLE)/
double_quoted_string: /(?:$DOUBLE(([^$BREAK$BACK$DOUBLE]|$BACK$DOUBLE|$BACK$BACK|$BACK$ESCAPE)*?)$DOUBLE)/
unquoted_string: /[^$SPACES$BREAK$HASH](?:[^$BREAK$HASH]*[^$SPACES$BREAK$HASH])?/
test_section:
- /:
- ws
- test_statement
^: '*'
ws: /(?:$SPACE|$EOL|$comment)/
test_statement:
- test_expression
- =: assertion_expression
^: '?'
- /:
- /;/
- _: You seem to be missing a semicolon
test_expression:
- sub_expression
- /:
- - '!assertion_call_start'
- call_indicator
- sub_expression
^: '*'
sub_expression:
- /:
- transform_call
- data_point
- quoted_string
- constant
transform_call:
- transform_name
- /\($ws*/
- argument_list
- /$ws*\)/
transform_name:
/:
- user_transform
- core_transform
user_transform: /($LOWER$WORD*)/
core_transform: /($UPPER$WORD*)/
call_indicator: /(?:$DOT$ws*|$ws*$DOT)/
data_point: /($DOLLAR$LOWER$WORD*)/
constant: /($UPPER$WORD*)/
argument_list:
=:
- argument
- =:
- /$ws*,$ws*/
- argument
^: '*'
^: '?'
argument:
- sub_expression
quoted_string:
/:
- single_quoted_string
- double_quoted_string
assertion_expression:
/:
- assertion_operation
- assertion_call
assertion_operation:
- /$ws+/
- assertion_operator
- /$ws+/
- test_expression
assertion_operator: /(==)/
assertion_call:
- assertion_call_start
- test_expression
- /$ws*\)/
assertion_call_start:
- /$call_indicator$assertion_name\($ws*/
assertion_name: /EQ/
data_section: /($block_marker(?:$SPACE|$EOL)$ANY+|\Z)/
data:
=: data_block
^: '*'
data_block:
- block_header
- /:
- blank_line
- comment
^: '*'
- =: block_point
^: '*'
block_header:
- block_marker
- =:
- /$SPACE+/
- block_label
^: '?'
- /$SPACE*$EOL/
block_marker: /===/
block_label:
- /([^$SPACES$BREAK]($NON_BREAK*[^SPACES$BREAK])?)/
block_point:
/:
- lines_point
- phrase_point
lines_point:
- /$point_marker$SPACE+/
- user_point_name
- /$SPACE*$EOL/
- point_lines
user_point_name: /($LOWER$WORD*)/
point_lines: /((?:(?!$block_marker|$point_marker)$line)*)/
phrase_point:
- /$point_marker$SPACE+/
- user_point_name
- /:$SPACE/
- point_phrase
- /$EOL/
- /(?:$comment|$blank_line)*/
point_phrase: /($NON_BREAK*)/
point_marker: /---/