summaryrefslogtreecommitdiffstats
path: root/vendor/pest_derive/examples/help-menu.pest
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/pest_derive/examples/help-menu.pest')
-rw-r--r--vendor/pest_derive/examples/help-menu.pest36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/pest_derive/examples/help-menu.pest b/vendor/pest_derive/examples/help-menu.pest
new file mode 100644
index 000000000..f7d398537
--- /dev/null
+++ b/vendor/pest_derive/examples/help-menu.pest
@@ -0,0 +1,36 @@
+WHITESPACE = _{ " " }
+
+Rew = ! { ( ASCII_DIGIT | ASCII_ALPHA_UPPER | "_" | "-" ) + }
+Lit = ! { ( ASCII_ALPHANUMERIC | "_" | "-" ) + }
+Word = _ { Rew | Lit }
+WordGroup = _ { Word ~ ( " " ~ Word ) * }
+
+// Argument groups are nonatomic;
+// "<whitespace |between|the|bar|or|braces |is | OK>"
+
+ArgOptChoiceGroup = { ( "[" ~ Word + ~
+ ( "|" ~ ( Word
+ | ArgChoiceGroup ) + ) * ~
+ "]" ) + }
+ArgReqChoiceGroup = { ( "<" ~ Word + ~
+ ( "|" ~ ( Word
+ | ArgChoiceGroup ) + ) * ~
+ ">" ) + }
+ArgChoiceGroup = _ { ArgOptChoiceGroup
+ | ArgReqChoiceGroup }
+
+Command = {
+ ( WordGroup ) ~
+ ( ArgChoiceGroup ) *
+}
+
+HelpMenu = {
+ SOI ~
+
+ (
+ Command ~
+ NEWLINE
+ ) * ~
+
+ EOI
+}