Skip to content

Commit

Permalink
Change _ to - in rule names
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Apr 23, 2014
1 parent fabf8a5 commit 8c71181
Showing 1 changed file with 113 additions and 113 deletions.
226 changes: 113 additions & 113 deletions testml.pgx
Expand Up @@ -2,24 +2,24 @@
%version 0.0.1
%include atom

testml_document:
code_section
data_section?
testml-document:
code-section
data-section?

# General Tokens
escape: / [0nt] /
line: / ANY* EOL /
blanks: / BLANK+ /
blank_line: / BLANK* EOL /
blank-line: / BLANK* EOL /
comment: / '#' line /
ws: /(: BLANK | EOL | comment )/

# Strings
quoted_string:
| single_quoted_string
| double_quoted_string
quoted-string:
| single-quoted-string
| double-quoted-string

single_quoted_string:
single-quoted-string:
/(:
SINGLE
((:
Expand All @@ -30,7 +30,7 @@ single_quoted_string:
SINGLE
)/

double_quoted_string:
double-quoted-string:
/(:
DOUBLE
((:
Expand All @@ -42,7 +42,7 @@ double_quoted_string:
DOUBLE
)/

unquoted_string:
unquoted-string:
/(
[^ BLANKS BREAK HASH]
(:
Expand All @@ -55,184 +55,184 @@ number: / ( DIGIT+ ) /


# TestML Code Section
code_section: (
code-section: (
| +
| assignment_statement
| code_statement
| assignment-statement
| code-statement
)*

assignment_statement:
variable_name
assignment-statement:
variable-name
/ WS+ '=' WS+ /
code_expression
code-expression
ending

variable_name: /( ALPHA WORD* )/
variable-name: /( ALPHA WORD* )/

code_statement:
code_expression
assertion_call?
code-statement:
code-expression
assertion-call?
ending

ending: /(: ';' | EOL )/ | =ending2

ending2: /- '}'/

code_expression:
code_object
call_call*

call_call:
!assertion_call_test
call_indicator
code_object

code_object:
| function_object
| point_object
| string_object
| number_object
| call_object

function_object:
function_signature?
function_start
( + | assignment_statement | code_statement )*
code-expression:
code-object
call-call*

call-call:
!assertion-call-test
call-indicator
code-object

code-object:
| function-object
| point-object
| string-object
| number-object
| call-object

function-object:
function-signature?
function-start
( + | assignment-statement | code-statement )*
/- '}'/

function_start: /- ( '{' ) -/
function-start: /- ( '{' ) -/

function_signature:
function-signature:
/'(' -/
function_variables?
function-variables?
/- ')'/

function_variables:
function_variable+ % /- ',' -/
function-variables:
function-variable+ % /- ',' -/

function_variable: /( ALPHA WORD* )/
function-variable: /( ALPHA WORD* )/

point_object: /( '*' LOWER WORD* )/
point-object: /( '*' LOWER WORD* )/

string_object: quoted_string
string-object: quoted-string

number_object: number
number-object: number

call_object:
call_name
call_argument_list?
call-object:
call-name
call-argument-list?

call_name: user_call | core_call
call-name: user-call | core-call

user_call: /( LOWER WORD* )/
user-call: /( LOWER WORD* )/

core_call: /( UPPER WORD* )/
core-call: /( UPPER WORD* )/

call_indicator: /(: '.' - | - '.' )/
call-indicator: /(: '.' - | - '.' )/

call_argument_list:
call-argument-list:
/'(' -/
call_argument* % /- ',' -/
call-argument* % /- ',' -/
/- ')'/

call_argument: code_expression
call-argument: code-expression

assertion_call_test: / call_indicator (:EQ|OK|HAS) /
assertion-call-test: / call-indicator (:EQ|OK|HAS) /

assertion_call:
| +assertion_eq
| +assertion_ok
| +assertion_has
assertion-call:
| +assertion-eq
| +assertion-ok
| +assertion-has

assertion_eq:
| +assertion_operator_eq
| +assertion_function_eq
assertion-eq:
| +assertion-operator-eq
| +assertion-function-eq

assertion_operator_eq:
assertion-operator-eq:
/+ '==' +/
code_expression
code-expression

assertion_function_eq:
/ call_indicator 'EQ(' /
code_expression
assertion-function-eq:
/ call-indicator 'EQ(' /
code-expression
/ ')' /

assertion_ok: assertion_function_ok
assertion-ok: assertion-function-ok

assertion_function_ok: / call_indicator ('OK') empty_parens? /
assertion-function-ok: / call-indicator ('OK') empty-parens? /

assertion_has: +assertion_operator_has | +assertion_function_has
assertion-has: +assertion-operator-has | +assertion-function-has

assertion_operator_has:
assertion-operator-has:
/+ '~~' +/
code_expression
code-expression

assertion_function_has:
/ call_indicator 'HAS(' /
code_expression
assertion-function-has:
/ call-indicator 'HAS(' /
code-expression
/ ')' /

empty_parens: /(: '(' - ')' )/
empty-parens: /(: '(' - ')' )/

# TestML Data Section
block_marker: '==='
point_marker: '---'
block-marker: '==='
point-marker: '---'

data_section: data_block*
data-section: data-block*

data_block:
block_header
.( blank_line | comment )*
block_point*
data-block:
block-header
.( blank-line | comment )*
block-point*

block_header:
block_marker
( blanks block_label )?
blank_line
block-header:
block-marker
( blanks block-label )?
blank-line

block_label: unquoted_string
block-label: unquoted-string

block_point: lines_point | phrase_point
block-point: lines-point | phrase-point

lines_point:
point_marker
lines-point:
point-marker
blanks
point_name
blank_line
point_lines
point-name
blank-line
point-lines

point_lines: /(
point-lines: /(
(:
(!
block_marker |
point_marker
block-marker |
point-marker
)
line
)*
)/

phrase_point:
point_marker
phrase-point:
point-marker
blanks
point_name
point-name
/ COLON BLANK /
point_phrase
point-phrase
/ EOL /
/(:
comment |
blank_line
blank-line
)*/

point_name:
point-name:
/(
user_point_name |
core_point_name
user-point-name |
core-point-name
)/

user_point_name: / LOWER WORD* /
user-point-name: / LOWER WORD* /

core_point_name: / UPPER WORD* /
core-point-name: / UPPER WORD* /

point_phrase: unquoted_string
point-phrase: unquoted-string

# vim: sw=2:

0 comments on commit 8c71181

Please sign in to comment.