summaryrefslogtreecommitdiff
path: root/spec/parser.ebnf
diff options
context:
space:
mode:
Diffstat (limited to 'spec/parser.ebnf')
-rw-r--r--spec/parser.ebnf30
1 files changed, 22 insertions, 8 deletions
diff --git a/spec/parser.ebnf b/spec/parser.ebnf
index 44b1967..60f7890 100644
--- a/spec/parser.ebnf
+++ b/spec/parser.ebnf
@@ -1,11 +1,14 @@
-unit : blank* ( datum blank? | EOF ) ;
+unit : empty_unit | datum_unit ;
-blank : 9...13 | comment ;
+empty_unit : blank* EOF ;
-datum : one_datum ( join_char? one_datum )* ;
+datum_unit : blank* datum blank? ;
-join_char : '.' | ':' | '|' ;
+
+blank : 9...13 | comment ;
+
+datum : join_data | dot_string ;
comment : ';' ( skip_unit | skip_line ) ;
@@ -15,9 +18,18 @@ skip_unit : '~' unit ;
skip_line : ( ~10 )* 10? ;
-one_datum : ( bare_str | clad_datum ) ;
+join_data : one_datum ( join_char? one_datum )*
+
+join_char : '.' | ':' | '|' ;
+
+dot_string : '.'{2,}
+
-bare_str : bare_str_elt+ ;
+one_datum : ( num_string | bare_string | clad_datum ) ;
+
+num_string : ( '+' | '-' )? digit ( bare_str_elt | '.' )* ;
+
+bare_string : bare_str_elt+ ;
clad_datum : '\' bare_esc_str
| '"' quoted_str '"'
@@ -37,11 +49,13 @@ bare_esc_str : bare_esc bare_str_elt* ;
quoted_str : ( quoted_char | '\' quoted_esc )* ;
hash_expr : rune clad_datum?
- | '%' label ( '%' | '=' unit )
+ | '%' label ( '%' | '=' datum_unit )
| clad_datum
;
-list : unit+ ( '.' blank+ unit )? blank* ;
+list : datum_unit+ list_tail? blank* ;
+
+list_tail : '.' blank+ datum_unit
quote_expr : ( "'" | "`" | "," ) datum ;