Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Created August 5, 2010 01:30
Show Gist options
  • Save ingydotnet/509079 to your computer and use it in GitHub Desktop.
Save ingydotnet/509079 to your computer and use it in GitHub Desktop.
assertion_call => <assertion_eq> | <assertion_ok> | <assertion_has>
---
- '['
- '<assertion_eq>'
- '|'
- '<assertion_ok>'
- '|'
- '<assertion_has>'
- ']'
...
assertion_call_test => /<call_indicator>(?:EQ|OK|HAS)<LPAREN>/
---
- '['
- /<call_indicator>(?:EQ|OK|HAS)<LPAREN>/
- ']'
...
assertion_eq => <assertion_operator_eq> | <assertion_function_eq>
---
- '['
- '<assertion_operator_eq>'
- '|'
- '<assertion_function_eq>'
- ']'
...
assertion_function_eq => /<call_indicator>EQ<LPAREN>/ <test_expression> /<RPAREN>/
---
- '['
- /<call_indicator>EQ<LPAREN>/
- '<test_expression>'
- /<RPAREN>/
- ']'
...
assertion_function_has => /<call_indicator>HAS<LPAREN>/ <test_expression> /<RPAREN>/
---
- '['
- /<call_indicator>HAS<LPAREN>/
- '<test_expression>'
- /<RPAREN>/
- ']'
...
assertion_function_ok => /<call_indicator>OK<empty_parens>?/
---
- '['
- /<call_indicator>OK<empty_parens>?/
- ']'
...
assertion_has => <assertion_operator_has> | <assertion_function_has>
---
- '['
- '<assertion_operator_has>'
- '|'
- '<assertion_function_has>'
- ']'
...
assertion_ok => <assertion_function_ok>
---
- '['
- '<assertion_function_ok>'
- ']'
...
assertion_operator_eq => /<ws>+<EQUAL><EQUAL><ws>+/ <test_expression>
---
- '['
- /<ws>+<EQUAL><EQUAL><ws>+/
- '<test_expression>'
- ']'
...
assertion_operator_has => /<ws>+<TILDE><TILDE><ws>+/ <test_expression>
---
- '['
- /<ws>+<TILDE><TILDE><ws>+/
- '<test_expression>'
- ']'
...
blank_line => /<SPACE>*<EOL>/
---
- '['
- /<SPACE>*<EOL>/
- ']'
...
block_header => <block_marker> [ /<SPACE>+/ <block_label> ]? /<SPACE>*<EOL>/
---
- '['
- '<block_marker>'
-
- '['
- /<SPACE>+/
- '<block_label>'
- ']?'
- /<SPACE>*<EOL>/
- ']'
...
block_label => <unquoted_string>
---
- '['
- '<unquoted_string>'
- ']'
...
block_marker => /<EQUAL><EQUAL><EQUAL>/
---
- '['
- /<EQUAL><EQUAL><EQUAL>/
- ']'
...
block_point => <lines_point> | <phrase_point>
---
- '['
- '<lines_point>'
- '|'
- '<phrase_point>'
- ']'
...
call_indicator => /(?:<DOT><ws>*|<ws>*<DOT>)/
---
- '['
- /(?:<DOT><ws>*|<ws>*<DOT>)/
- ']'
...
comment => /<HASH><line>/
---
- '['
- /<HASH><line>/
- ']'
...
core_meta_keyword => /(?:Title|Data|Plan|BlockMarker|PointMarker)/
---
- '['
- /(?:Title|Data|Plan|BlockMarker|PointMarker)/
- ']'
...
core_transform => /(<UPPER><WORD>*)/
---
- '['
- /(<UPPER><WORD>*)/
- ']'
...
data_block => <block_header> [ <blank_line> | <comment> ]* <block_point>*
---
- '['
- '<block_header>'
-
- '['
- '<blank_line>'
- '|'
- '<comment>'
- ']*'
- <block_point>*
- ']'
...
data_section => <testml_data_section> | <yaml_data_section> | <json_data_section> | <xml_data_section>
---
- '['
- '<testml_data_section>'
- '|'
- '<yaml_data_section>'
- '|'
- '<json_data_section>'
- '|'
- '<xml_data_section>'
- ']'
...
document => <meta_section> <test_section> <data_section>?
---
- '['
- '<meta_section>'
- '<test_section>'
- <data_section>?
- ']'
...
double_quoted_string => /(?:<DOUBLE>(([^<BREAK><BACK><DOUBLE>]|<BACK><DOUBLE>|<BACK><BACK>|<BACK><escape>)*?)<DOUBLE>)/
---
- '['
- '/(?:<DOUBLE>(([^<BREAK><BACK><DOUBLE>]|<BACK><DOUBLE>|<BACK><BACK>|<BACK><escape>)*?)<DOUBLE>)/'
- ']'
...
empty_parens => /(?:<LPAREN><ws>*<RPAREN>)/
---
- '['
- /(?:<LPAREN><ws>*<RPAREN>)/
- ']'
...
escape => /[0nt]/
---
- '['
- '/[0nt]/'
- ']'
...
json_data_section => /(<LSQUARE><rest>)/
---
- '['
- /(<LSQUARE><rest>)/
- ']'
...
line => /<ANY>*<EOL>/
---
- '['
- /<ANY>*<EOL>/
- ']'
...
lines_point => <point_marker> /<SPACE>+/ <point_name> /<SPACE>*<EOL>/ <point_lines>
---
- '['
- '<point_marker>'
- /<SPACE>+/
- '<point_name>'
- /<SPACE>*<EOL>/
- '<point_lines>'
- ']'
...
meta_keyword => /(?:<core_meta_keyword>|<user_meta_keyword>)/
---
- '['
- /(?:<core_meta_keyword>|<user_meta_keyword>)/
- ']'
...
meta_section => /(?:<comment>|<blank_line>)*/ [ <meta_testml_statement> | `No TestML meta directive found` ] [ <meta_statement> | <comment> | <blank_line> ]*
---
- '['
- /(?:<comment>|<blank_line>)*/
-
- '['
- '<meta_testml_statement>'
- '|'
- '`No TestML meta directive found`'
- ']'
-
- '['
- '<meta_statement>'
- '|'
- '<comment>'
- '|'
- '<blank_line>'
- ']*'
- ']'
...
meta_statement => /%(<meta_keyword>):<SPACE>+(<meta_value>)(?:<SPACE>+<comment>|<EOL>)/
---
- '['
- /%(<meta_keyword>):<SPACE>+(<meta_value>)(?:<SPACE>+<comment>|<EOL>)/
- ']'
...
meta_testml_statement => /%TestML:<SPACE>+(<testml_version>)(?:<SPACE>+<comment>|<EOL>)/
---
- '['
- /%TestML:<SPACE>+(<testml_version>)(?:<SPACE>+<comment>|<EOL>)/
- ']'
...
meta_value => /(?:<single_quoted_string>|<double_quoted_string>|<unquoted_string>)/
---
- '['
- /(?:<single_quoted_string>|<double_quoted_string>|<unquoted_string>)/
- ']'
...
phrase_point => <point_marker> /<SPACE>+/ <point_name> /<COLON><SPACE>/ <point_phrase> /<EOL>/ /(?:<comment>|<blank_line>)*/
---
- '['
- '<point_marker>'
- /<SPACE>+/
- '<point_name>'
- /<COLON><SPACE>/
- '<point_phrase>'
- /<EOL>/
- /(?:<comment>|<blank_line>)*/
- ']'
...
point_call => /(<STAR><LOWER><WORD>*)/
---
- '['
- /(<STAR><LOWER><WORD>*)/
- ']'
...
point_lines => /((?:(?!<block_marker>|<point_marker>)<line>)*)/
---
- '['
- /((?:(?!<block_marker>|<point_marker>)<line>)*)/
- ']'
...
point_marker => /<DASH><DASH><DASH>/
---
- '['
- /<DASH><DASH><DASH>/
- ']'
...
point_name => /(<LOWER><WORD>*)/
---
- '['
- /(<LOWER><WORD>*)/
- ']'
...
point_phrase => /(<unquoted_string>)/
---
- '['
- /(<unquoted_string>)/
- ']'
...
quoted_string => <single_quoted_string> | <double_quoted_string>
---
- '['
- '<single_quoted_string>'
- '|'
- '<double_quoted_string>'
- ']'
...
rest => /<ANY>+/
---
- '['
- /<ANY>+/
- ']'
...
single_quoted_string => /(?:<SINGLE>(([^<BREAK><BACK><SINGLE>]|<BACK><SINGLE>|<BACK><BACK>)*?)<SINGLE>)/
---
- '['
- '/(?:<SINGLE>(([^<BREAK><BACK><SINGLE>]|<BACK><SINGLE>|<BACK><BACK>)*?)<SINGLE>)/'
- ']'
...
string_call => <quoted_string>
---
- '['
- '<quoted_string>'
- ']'
...
sub_expression => <point_call> | <string_call> | <transform_call>
---
- '['
- '<point_call>'
- '|'
- '<string_call>'
- '|'
- '<transform_call>'
- ']'
...
test_expression => <sub_expression> [ <!assertion_call_test> <call_indicator> <sub_expression> ]*
---
- '['
- '<sub_expression>'
-
- '['
- '<!assertion_call_test>'
- '<call_indicator>'
- '<sub_expression>'
- ']*'
- ']'
...
test_section => [ <ws> | <test_statement> ]*
---
- '['
-
- '['
- '<ws>'
- '|'
- '<test_statement>'
- ']*'
- ']'
...
test_statement => <test_expression> <assertion_call>? [ <SEMI> | `You seem to be missing a semicolon` ]
---
- '['
- '<test_expression>'
- <assertion_call>?
-
- '['
- '<SEMI>'
- '|'
- '`You seem to be missing a semicolon`'
- ']'
- ']'
...
testml_data_section => <data_block>*
---
- '['
- <data_block>*
- ']'
...
testml_version => /(<DIGIT><DOT><DIGIT>+)/
---
- '['
- /(<DIGIT><DOT><DIGIT>+)/
- ']'
...
transform_argument => <sub_expression>
---
- '['
- '<sub_expression>'
- ']'
...
transform_argument_list => /<LPAREN><ws>*/ <transform_arguments>? /<ws>*<RPAREN>/
---
- '['
- /<LPAREN><ws>*/
- <transform_arguments>?
- /<ws>*<RPAREN>/
- ']'
...
transform_arguments => <transform_argument> [ /<ws>*<COMMA><ws>*/ <transform_argument> ]*
---
- '['
- '<transform_argument>'
-
- '['
- /<ws>*<COMMA><ws>*/
- '<transform_argument>'
- ']*'
- ']'
...
transform_call => <transform_name> <transform_argument_list>?
---
- '['
- '<transform_name>'
- <transform_argument_list>?
- ']'
...
transform_name => <user_transform> | <core_transform>
---
- '['
- '<user_transform>'
- '|'
- '<core_transform>'
- ']'
...
unquoted_string => /([^<SPACES><BREAK><HASH>][^<BREAK><HASH>]*[^<SPACES><BREAK><HASH>])?)/
---
- '['
- '/([^<SPACES><BREAK><HASH>][^<BREAK><HASH>]*[^<SPACES><BREAK><HASH>])?)/'
- ']'
...
user_meta_keyword => /<LOWER><WORD>*/
---
- '['
- /<LOWER><WORD>*/
- ']'
...
user_transform => /(<LOWER><WORD>*)/
---
- '['
- /(<LOWER><WORD>*)/
- ']'
...
ws => /[<SPACE>|<EOL>|<comment>]/
---
- '['
- '/[<SPACE>|<EOL>|<comment>]/'
- ']'
...
xml_data_section => /(<LANGLE><rest>)/
---
- '['
- /(<LANGLE><rest>)/
- ']'
...
yaml_data_section => /(<DASH><DASH><DASH><SPACE>*<EOL><rest>)/
---
- '['
- /(<DASH><DASH><DASH><SPACE>*<EOL><rest>)/
- ']'
...
assertion_call => <assertion_eq> | <assertion_ok> | <assertion_has>
---
- '['
- '<assertion_eq>'
- '|'
- '<assertion_ok>'
- '|'
- '<assertion_has>'
- ']'
...
assertion_call_test => /<call_indicator>(?:EQ|OK|HAS)<LPAREN>/
---
- '['
- /<call_indicator>(?:EQ|OK|HAS)<LPAREN>/
- ']'
...
assertion_eq => <assertion_operator_eq> | <assertion_function_eq>
---
- '['
- '<assertion_operator_eq>'
- '|'
- '<assertion_function_eq>'
- ']'
...
assertion_function_eq => /<call_indicator>EQ<LPAREN>/ <test_expression> /<RPAREN>/
---
- '['
- /<call_indicator>EQ<LPAREN>/
- '<test_expression>'
- /<RPAREN>/
- ']'
...
assertion_function_has => /<call_indicator>HAS<LPAREN>/ <test_expression> /<RPAREN>/
---
- '['
- /<call_indicator>HAS<LPAREN>/
- '<test_expression>'
- /<RPAREN>/
- ']'
...
assertion_function_ok => /<call_indicator>OK<empty_parens>?/
---
- '['
- /<call_indicator>OK<empty_parens>?/
- ']'
...
assertion_has => <assertion_operator_has> | <assertion_function_has>
---
- '['
- '<assertion_operator_has>'
- '|'
- '<assertion_function_has>'
- ']'
...
assertion_ok => <assertion_function_ok>
---
- '['
- '<assertion_function_ok>'
- ']'
...
assertion_operator_eq => /<ws>+<EQUAL><EQUAL><ws>+/ <test_expression>
---
- '['
- /<ws>+<EQUAL><EQUAL><ws>+/
- '<test_expression>'
- ']'
...
assertion_operator_has => /<ws>+<TILDE><TILDE><ws>+/ <test_expression>
---
- '['
- /<ws>+<TILDE><TILDE><ws>+/
- '<test_expression>'
- ']'
...
blank_line => /<SPACE>*<EOL>/
---
- '['
- /<SPACE>*<EOL>/
- ']'
...
block_header => <block_marker> [ /<SPACE>+/ <block_label> ]? /<SPACE>*<EOL>/
---
- '['
- '<block_marker>'
-
- '['
- /<SPACE>+/
- '<block_label>'
- ']?'
- /<SPACE>*<EOL>/
- ']'
...
block_label => <unquoted_string>
---
- '['
- '<unquoted_string>'
- ']'
...
block_marker => /<EQUAL><EQUAL><EQUAL>/
---
- '['
- /<EQUAL><EQUAL><EQUAL>/
- ']'
...
block_point => <lines_point> | <phrase_point>
---
- '['
- '<lines_point>'
- '|'
- '<phrase_point>'
- ']'
...
call_indicator => /(?:<DOT><ws>*|<ws>*<DOT>)/
---
- '['
- /(?:<DOT><ws>*|<ws>*<DOT>)/
- ']'
...
comment => /<HASH><line>/
---
- '['
- /<HASH><line>/
- ']'
...
core_meta_keyword => /(?:Title|Data|Plan|BlockMarker|PointMarker)/
---
- '['
- /(?:Title|Data|Plan|BlockMarker|PointMarker)/
- ']'
...
core_transform => /(<UPPER><WORD>*)/
---
- '['
- /(<UPPER><WORD>*)/
- ']'
...
data_block => <block_header> [ <blank_line> | <comment> ]* <block_point>*
---
- '['
- '<block_header>'
-
- '['
- '<blank_line>'
- '|'
- '<comment>'
- ']*'
- <block_point>*
- ']'
...
data_section => <testml_data_section> | <yaml_data_section> | <json_data_section> | <xml_data_section>
---
- '['
- '<testml_data_section>'
- '|'
- '<yaml_data_section>'
- '|'
- '<json_data_section>'
- '|'
- '<xml_data_section>'
- ']'
...
document => <meta_section> <test_section> <data_section>?
---
- '['
- '<meta_section>'
- '<test_section>'
- <data_section>?
- ']'
...
double_quoted_string => /(?:<DOUBLE>(([^<BREAK><BACK><DOUBLE>]|<BACK><DOUBLE>|<BACK><BACK>|<BACK><escape>)*?)<DOUBLE>)/
---
- '['
- '/(?:<DOUBLE>(([^<BREAK><BACK><DOUBLE>]|<BACK><DOUBLE>|<BACK><BACK>|<BACK><escape>)*?)<DOUBLE>)/'
- ']'
...
empty_parens => /(?:<LPAREN><ws>*<RPAREN>)/
---
- '['
- /(?:<LPAREN><ws>*<RPAREN>)/
- ']'
...
escape => /[0nt]/
---
- '['
- '/[0nt]/'
- ']'
...
json_data_section => /(<LSQUARE><rest>)/
---
- '['
- /(<LSQUARE><rest>)/
- ']'
...
line => /<ANY>*<EOL>/
---
- '['
- /<ANY>*<EOL>/
- ']'
...
lines_point => <point_marker> /<SPACE>+/ <point_name> /<SPACE>*<EOL>/ <point_lines>
---
- '['
- '<point_marker>'
- /<SPACE>+/
- '<point_name>'
- /<SPACE>*<EOL>/
- '<point_lines>'
- ']'
...
meta_keyword => /(?:<core_meta_keyword>|<user_meta_keyword>)/
---
- '['
- /(?:<core_meta_keyword>|<user_meta_keyword>)/
- ']'
...
meta_section => /(?:<comment>|<blank_line>)*/ [ <meta_testml_statement> | `No TestML meta directive found` ] [ <meta_statement> | <comment> | <blank_line> ]*
---
- '['
- /(?:<comment>|<blank_line>)*/
-
- '['
- '<meta_testml_statement>'
- '|'
- '`No TestML meta directive found`'
- ']'
-
- '['
- '<meta_statement>'
- '|'
- '<comment>'
- '|'
- '<blank_line>'
- ']*'
- ']'
...
meta_statement => /%(<meta_keyword>):<SPACE>+(<meta_value>)(?:<SPACE>+<comment>|<EOL>)/
---
- '['
- /%(<meta_keyword>):<SPACE>+(<meta_value>)(?:<SPACE>+<comment>|<EOL>)/
- ']'
...
meta_testml_statement => /%TestML:<SPACE>+(<testml_version>)(?:<SPACE>+<comment>|<EOL>)/
---
- '['
- /%TestML:<SPACE>+(<testml_version>)(?:<SPACE>+<comment>|<EOL>)/
- ']'
...
meta_value => /(?:<single_quoted_string>|<double_quoted_string>|<unquoted_string>)/
---
- '['
- /(?:<single_quoted_string>|<double_quoted_string>|<unquoted_string>)/
- ']'
...
phrase_point => <point_marker> /<SPACE>+/ <point_name> /<COLON><SPACE>/ <point_phrase> /<EOL>/ /(?:<comment>|<blank_line>)*/
---
- '['
- '<point_marker>'
- /<SPACE>+/
- '<point_name>'
- /<COLON><SPACE>/
- '<point_phrase>'
- /<EOL>/
- /(?:<comment>|<blank_line>)*/
- ']'
...
point_call => /(<STAR><LOWER><WORD>*)/
---
- '['
- /(<STAR><LOWER><WORD>*)/
- ']'
...
point_lines => /((?:(?!<block_marker>|<point_marker>)<line>)*)/
---
- '['
- /((?:(?!<block_marker>|<point_marker>)<line>)*)/
- ']'
...
point_marker => /<DASH><DASH><DASH>/
---
- '['
- /<DASH><DASH><DASH>/
- ']'
...
point_name => /(<LOWER><WORD>*)/
---
- '['
- /(<LOWER><WORD>*)/
- ']'
...
point_phrase => /(<unquoted_string>)/
---
- '['
- /(<unquoted_string>)/
- ']'
...
quoted_string => <single_quoted_string> | <double_quoted_string>
---
- '['
- '<single_quoted_string>'
- '|'
- '<double_quoted_string>'
- ']'
...
rest => /<ANY>+/
---
- '['
- /<ANY>+/
- ']'
...
single_quoted_string => /(?:<SINGLE>(([^<BREAK><BACK><SINGLE>]|<BACK><SINGLE>|<BACK><BACK>)*?)<SINGLE>)/
---
- '['
- '/(?:<SINGLE>(([^<BREAK><BACK><SINGLE>]|<BACK><SINGLE>|<BACK><BACK>)*?)<SINGLE>)/'
- ']'
...
string_call => <quoted_string>
---
- '['
- '<quoted_string>'
- ']'
...
sub_expression => <point_call> | <string_call> | <transform_call>
---
- '['
- '<point_call>'
- '|'
- '<string_call>'
- '|'
- '<transform_call>'
- ']'
...
test_expression => <sub_expression> [ <!assertion_call_test> <call_indicator> <sub_expression> ]*
---
- '['
- '<sub_expression>'
-
- '['
- '<!assertion_call_test>'
- '<call_indicator>'
- '<sub_expression>'
- ']*'
- ']'
...
test_section => [ <ws> | <test_statement> ]*
---
- '['
-
- '['
- '<ws>'
- '|'
- '<test_statement>'
- ']*'
- ']'
...
test_statement => <test_expression> <assertion_call>? [ <SEMI> | `You seem to be missing a semicolon` ]
---
- '['
- '<test_expression>'
- <assertion_call>?
-
- '['
- '<SEMI>'
- '|'
- '`You seem to be missing a semicolon`'
- ']'
- ']'
...
testml_data_section => <data_block>*
---
- '['
- <data_block>*
- ']'
...
testml_version => /(<DIGIT><DOT><DIGIT>+)/
---
- '['
- /(<DIGIT><DOT><DIGIT>+)/
- ']'
...
transform_argument => <sub_expression>
---
- '['
- '<sub_expression>'
- ']'
...
transform_argument_list => /<LPAREN><ws>*/ <transform_arguments>? /<ws>*<RPAREN>/
---
- '['
- /<LPAREN><ws>*/
- <transform_arguments>?
- /<ws>*<RPAREN>/
- ']'
...
transform_arguments => <transform_argument> [ /<ws>*<COMMA><ws>*/ <transform_argument> ]*
---
- '['
- '<transform_argument>'
-
- '['
- /<ws>*<COMMA><ws>*/
- '<transform_argument>'
- ']*'
- ']'
...
transform_call => <transform_name> <transform_argument_list>?
---
- '['
- '<transform_name>'
- <transform_argument_list>?
- ']'
...
transform_name => <user_transform> | <core_transform>
---
- '['
- '<user_transform>'
- '|'
- '<core_transform>'
- ']'
...
unquoted_string => /([^<SPACES><BREAK><HASH>][^<BREAK><HASH>]*[^<SPACES><BREAK><HASH>])?)/
---
- '['
- '/([^<SPACES><BREAK><HASH>][^<BREAK><HASH>]*[^<SPACES><BREAK><HASH>])?)/'
- ']'
...
user_meta_keyword => /<LOWER><WORD>*/
---
- '['
- /<LOWER><WORD>*/
- ']'
...
user_transform => /(<LOWER><WORD>*)/
---
- '['
- /(<LOWER><WORD>*)/
- ']'
...
ws => /[<SPACE>|<EOL>|<comment>]/
---
- '['
- '/[<SPACE>|<EOL>|<comment>]/'
- ']'
...
xml_data_section => /(<LANGLE><rest>)/
---
- '['
- /(<LANGLE><rest>)/
- ']'
...
yaml_data_section => /(<DASH><DASH><DASH><SPACE>*<EOL><rest>)/
---
- '['
- /(<DASH><DASH><DASH><SPACE>*<EOL><rest>)/
- ']'
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment