summaryrefslogtreecommitdiff
path: root/support/pkgcheck/src/generate.pest
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/pkgcheck/src/generate.pest
Initial commit
Diffstat (limited to 'support/pkgcheck/src/generate.pest')
-rw-r--r--support/pkgcheck/src/generate.pest34
1 files changed, 34 insertions, 0 deletions
diff --git a/support/pkgcheck/src/generate.pest b/support/pkgcheck/src/generate.pest
new file mode 100644
index 0000000000..749cb60e5e
--- /dev/null
+++ b/support/pkgcheck/src/generate.pest
@@ -0,0 +1,34 @@
+file = { SOI ~ ( generatefile_stmt | generate_stmt | filecontents | other)* ~ EOI }
+
+other = _{ (!NEWLINE ~ ANY) }
+
+generatefile_stmt = _{ "\\generateFile" ~ LPAREN ~ filename ~ RPAREN }
+
+generate_stmt = _{ "\\generate" ~ LPAREN ~ (file_stmt | cmd )+ ~ RPAREN }
+file_stmt = _{ "\\file" ~ LPAREN ~ filename ~ RPAREN ~
+ LPAREN ~ (from | cmd) + ~RPAREN }
+
+filecontents = _{ "\\begin" ~ LPAREN ~ filecontents_lit ~ RPAREN ~
+ LPAREN ~ filename ~ RPAREN }
+
+filecontents_lit = _{ "filecontents*" | "filecontents" }
+
+filename = { (!RPAREN ~ ANY)* }
+
+from = _{ "\\from" ~ LPAREN ~ anyx ~ RPAREN ~
+ LPAREN ~ anyx ~ RPAREN }
+
+cmd = _{ "\\" ~ ident ~ (LPAREN ~ anyx ~ RPAREN)* }
+
+ident_char = _{ 'a'..'z' | 'A'..'Z' | '0'..'9' | "_" }
+ident = _{
+ ('a'..'z' | 'A'..'Z') ~ ident_char* |
+ "_" ~ ident_char+ }
+
+
+LPAREN = _{ "{" }
+RPAREN = _{ "}" }
+
+anyx = _{ (!RPAREN ~ ANY)* }
+WHITESPACE = _{ " " | "\t" | NEWLINE }
+COMMENT = _{ "%" ~ (!NEWLINE ~ ANY)* } \ No newline at end of file