summaryrefslogtreecommitdiffstats
path: root/vendor/pest_derive/tests/grammar.pest
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/pest_derive/tests/grammar.pest
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/pest_derive/tests/grammar.pest')
-rw-r--r--vendor/pest_derive/tests/grammar.pest83
1 files changed, 83 insertions, 0 deletions
diff --git a/vendor/pest_derive/tests/grammar.pest b/vendor/pest_derive/tests/grammar.pest
new file mode 100644
index 000000000..43a7b8cfd
--- /dev/null
+++ b/vendor/pest_derive/tests/grammar.pest
@@ -0,0 +1,83 @@
+// pest. The Elegant Parser
+// Copyright (c) 2018 DragoČ™ Tiselice
+//
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
+// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. All files in the project carrying such notice may not be copied,
+// modified, or distributed except according to those terms.
+
+string = { "abc" }
+insensitive = { ^"abc" }
+range = { '0'..'9' }
+ident = { string }
+pos_pred = { &string }
+neg_pred = { !string }
+double_neg_pred = { !!string }
+sequence = !{ string ~ string }
+sequence_compound = ${ string ~ string }
+sequence_atomic = @{ string ~ string }
+sequence_non_atomic = @{ sequence }
+sequence_atomic_compound = @{ sequence_compound }
+sequence_nested = { string ~ string }
+sequence_compound_nested = ${ sequence_nested }
+choice = { string | range }
+optional = { string? }
+repeat = { string* }
+repeat_atomic = @{ string* }
+repeat_once = { string+ }
+repeat_once_atomic = @{ string+ }
+repeat_min_max = { string{2, 3} }
+repeat_min_max_atomic = @{ string{2, 3} }
+repeat_exact = { string{2} }
+repeat_min = { string{2,} }
+repeat_min_atomic = @{ string{2,} }
+repeat_max = { string{, 2} }
+repeat_max_atomic = @{ string{, 2} }
+soi_at_start = { SOI ~ string }
+repeat_mutate_stack = { (PUSH('a'..'c') ~ ",")* ~ POP ~ POP ~ POP }
+peek_ = { PUSH(range) ~ PUSH(range) ~ PEEK ~ PEEK }
+peek_all = { PUSH(range) ~ PUSH(range) ~ PEEK_ALL }
+peek_slice_23 = { PUSH(range) ~ PUSH(range) ~ PUSH(range) ~ PUSH(range) ~ PUSH(range) ~ PEEK[1..-2] }
+pop_ = { PUSH(range) ~ PUSH(range) ~ POP ~ POP }
+pop_all = { PUSH(range) ~ PUSH(range) ~ POP_ALL }
+pop_fail = { PUSH(range) ~ !POP ~ range ~ POP }
+checkpoint_restore = ${
+ PUSH("") ~ (PUSH("a") ~ "b" ~ POP | DROP ~ "b" | POP ~ "a") ~ EOI
+}
+ascii_digits = { ASCII_DIGIT+ }
+ascii_nonzero_digits = { ASCII_NONZERO_DIGIT+ }
+ascii_bin_digits = { ASCII_BIN_DIGIT+ }
+ascii_oct_digits = { ASCII_OCT_DIGIT+ }
+ascii_hex_digits = { ASCII_HEX_DIGIT+ }
+ascii_alpha_lowers = { ASCII_ALPHA_LOWER+ }
+ascii_alpha_uppers = { ASCII_ALPHA_UPPER+ }
+ascii_alphas = { ASCII_ALPHA+ }
+ascii_alphanumerics = { ASCII_ALPHANUMERIC+ }
+asciis = { ASCII+ }
+newline = { NEWLINE+ }
+unicode = { XID_START ~ XID_CONTINUE* }
+SYMBOL = { "shadows builtin" }
+
+WHITESPACE = _{ " " }
+COMMENT = _{ "$"+ }
+
+// Line comment
+
+/* 1-line multiline comment */
+
+/*
+ N-line multiline comment
+*/
+
+/*
+ // Line comment inside multiline
+
+ /*
+ (Multiline inside) multiline
+ */
+
+ Invalid segment of grammar below (repeated rule)
+
+ WHITESPACE = _{ "hi" }
+*/