aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-18 00:06:34 +0200
committerMattias Andrée <maandree@kth.se>2021-04-18 00:06:34 +0200
commit0697cc07dcdee8ec6c4440c565fb629502ad7f1f (patch)
tree9fdf7984b7de3e91454e4094a206db828a6b19f3
parentm (diff)
downloadlibparser-0697cc07dcdee8ec6c4440c565fb629502ad7f1f.tar.gz
libparser-0697cc07dcdee8ec6c4440c565fb629502ad7f1f.tar.bz2
libparser-0697cc07dcdee8ec6c4440c565fb629502ad7f1f.tar.xz
Simplify whitespace in grammar representation
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--README20
-rw-r--r--libparser.720
2 files changed, 20 insertions, 20 deletions
diff --git a/README b/README
index b6594b4..3042070 100644
--- a/README
+++ b/README
@@ -75,14 +75,14 @@ EXTENDED DESCRIPTION
_low = character | integer;
_high = character | integer;
- concatenation = _, _operand, _, {",", _, _operand, _};
- alternation = _, concatenation, _, {"|", _, concatenation, _};
- optional = _, "[", _, _expression, _, "]", _;
- repeated = _, "{", _, _expression, _, "}", _;
- group = _, "(", _, _expression, _, ")", _;
- char-range = _, "<", _, _low, _, ",", _, _high, "_", ">", _;
- exception = _, "-", _;
- embedded-rule = _, identifier, _;
+ concatenation = _operand, {_, ",", _, _operand};
+ alternation = concatenation, {_, "|", _, concatenation};
+ optional = "[", _, _expression, _, "]";
+ repeated = "{", _, _expression, _, "}";
+ group = "(", _, _expression, _, ")";
+ char-range = "<", _, _low, _, ",", _, _high, "_", ">";
+ exception = "-";
+ embedded-rule = identifier;
_literal = char-range | exception | string;
_group = optional | repeated | group | embedded-rule;
@@ -93,10 +93,10 @@ EXTENDED DESCRIPTION
(* RULES *)
- rule = _, identifier, _, "=", _, _expression, ";";
+ rule = identifier, _, "=", _, _expression, _, ";";
(* This is the root rule of the grammar. *)
- grammar = {rules, _}, _;
+ grammar = _, {rules, _};
The file must be encoded in UTF-8, with LF as the line
break (CR and FF are illegal just becuase).
diff --git a/libparser.7 b/libparser.7
index 1402dcd..31fff65 100644
--- a/libparser.7
+++ b/libparser.7
@@ -87,14 +87,14 @@ integer = _decimal | _hexadecimal; (* May not exceed 255. *)
_low = character | integer;
_high = character | integer;
-concatenation = _, _operand, _, {\(dq,\(dq, _, _operand, _};
-alternation = _, concatenation, _, {\(dq|\(dq, _, concatenation, _};
-optional = _, \(dq[\(dq, _, _expression, _, \(dq]\(dq, _;
-repeated = _, \(dq{\(dq, _, _expression, _, \(dq}\(dq, _;
-group = _, \(dq(\(dq, _, _expression, _, \(dq)\(dq, _;
-char-range = _, \(dq<\(dq, _, _low, _, \(dq,\(dq, _, _high, \(dq_\(dq, \(dq>\(dq, _;
-exception = _, \(dq-\(dq, _;
-embedded-rule = _, identifier, _;
+concatenation = _operand, {_, \(dq,\(dq, _, _operand};
+alternation = concatenation, {_, \(dq|\(dq, _, concatenation};
+optional = \(dq[\(dq, _, _expression, _, \(dq]\(dq;
+repeated = \(dq{\(dq, _, _expression, _, \(dq}\(dq;
+group = \(dq(\(dq, _, _expression, _, \(dq)\(dq;
+char-range = \(dq<\(dq, _, _low, _, \(dq,\(dq, _, _high, \(dq_\(dq, \(dq>\(dq;
+exception = \(dq-\(dq;
+embedded-rule = identifier;
_literal = char-range | exception | string;
_group = optional | repeated | group | embedded-rule;
@@ -105,10 +105,10 @@ _expression = alternation;
(* RULES *)
-rule = _, identifier, _, \(dq=\(dq, _, _expression, \(dq;\(dq;
+rule = identifier, _, \(dq=\(dq, _, _expression, _, \(dq;\(dq;
(* This is the root rule of the grammar. *)
-grammar = {rules, _}, _;
+grammar = _, {rules, _};
.fi
.PP
.RE