aboutsummaryrefslogtreecommitdiff
path: root/Documentation/wmap-spec.ebnf
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-07-09 08:34:19 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-07-09 08:34:19 +0200
commit1ec7f2c6deb64f5b13b32fae2bf74ae2d8aaaabb (patch)
tree47b6addedf0bdb18d35774e9b027d07074929d4a /Documentation/wmap-spec.ebnf
parent6926feead1a7fadb7f5f974996bef8c30b3bfdbe (diff)
Account for CRLF/CR/LF. Lex note text. Use Wmap Parser for renderer.
Diffstat (limited to 'Documentation/wmap-spec.ebnf')
-rw-r--r--Documentation/wmap-spec.ebnf17
1 files changed, 11 insertions, 6 deletions
diff --git a/Documentation/wmap-spec.ebnf b/Documentation/wmap-spec.ebnf
index d3c5ad7..05eabe5 100644
--- a/Documentation/wmap-spec.ebnf
+++ b/Documentation/wmap-spec.ebnf
@@ -2,7 +2,7 @@
(* Top-level structure *)
program = { line } ;
-line = ( entity newline ) | ( ignored_line newline ) | newline ;
+line = ( entity line_ending ) | ( ignored_line line_ending ) | line_ending ;
entity = vertex | edge | note | stage | group | inertia | evolution ;
ignored_line = ? any sequence of tokens that doesn't match entity grammar ? ;
@@ -23,8 +23,8 @@ edge_type = "--" | "->" ;
sign = "+" | "-" ;
(* Terminal symbols *)
-vertex_label = preserved_case( { character - ( "-" | "+" | "," | "[" | "]" | "(" | ")" | newline ) } ) ;
-text = preserved_case( { character - newline } ) ;
+vertex_label = preserved_case( { character - ( "-" | "+" | "," | "[" | "]" | "(" | ")" | line_ending ) } ) ;
+text = preserved_case( { character - line_ending } ) ;
real_number = [ digit ] { digit } [ "." { digit } ] | "." digit { digit } ;
stage_number = case_insensitive( "i" | "ii" | "iii" | "iv" ) ;
shape_label = case_insensitive( "x" | "square" | "triangle" | "circle" ) ;
@@ -32,7 +32,10 @@ shape_label = case_insensitive( "x" | "square" | "triangle" | "circle" ) ;
(* Lexical elements *)
character = ? any Unicode character ? ;
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
-newline = ? newline character ? ;
+line_ending = lf | crlf | cr ;
+lf = ? U+000A (Line Feed) ? ;
+cr = ? U+000D (Carriage Return) ? ;
+crlf = cr lf ;
(* Lexical rules *)
case_insensitive(x) = ? case-insensitive match of x ? ;
@@ -42,6 +45,8 @@ preserved_case(x) = ? case-insensitive match of x, preserving original case for
(* - Keywords and shape labels are case-insensitive *)
(* - Vertex labels are case-insensitive for matching but preserve original case *)
(* - Text content preserves original case *)
-(* - Whitespace (except newlines) may appear between any tokens *)
+(* - Whitespace (except line endings) may appear between any tokens *)
(* - Each line contains exactly one entity *)
-(* - Invalid lines should be ignored. *)
+(* - Invalid lines should be ignored *)
+(* - Line endings support Unix (LF), Windows (CRLF), and classic Mac (CR) formats *)
+(* - CRLF is treated as a single line ending, not separate CR and LF *)