summaryrefslogtreecommitdiffstats
path: root/vendor/pest_derive/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/pest_derive/tests
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/pest_derive/tests')
-rw-r--r--vendor/pest_derive/tests/implicit.pest14
-rw-r--r--vendor/pest_derive/tests/implicit.rs25
2 files changed, 39 insertions, 0 deletions
diff --git a/vendor/pest_derive/tests/implicit.pest b/vendor/pest_derive/tests/implicit.pest
new file mode 100644
index 000000000..18ebf7eaf
--- /dev/null
+++ b/vendor/pest_derive/tests/implicit.pest
@@ -0,0 +1,14 @@
+program = _{ SOI ~ implicit ~ EOI }
+implicit= ${ or ~ (WHITESPACE+ ~ or )* }
+
+or = !{ and ~ (or_op ~ and)+ | and }
+and = { comp ~ (and_op ~ comp)+ | comp }
+comp = { array ~ eq_op ~ array | array }
+
+array = ${ term }
+
+term = _{ ASCII_ALPHANUMERIC+ }
+or_op = { "||" }
+and_op = { "&&" }
+eq_op = { "=" }
+WHITESPACE = _{ " " | "\t" | NEWLINE } \ No newline at end of file
diff --git a/vendor/pest_derive/tests/implicit.rs b/vendor/pest_derive/tests/implicit.rs
new file mode 100644
index 000000000..8ad5a7e6a
--- /dev/null
+++ b/vendor/pest_derive/tests/implicit.rs
@@ -0,0 +1,25 @@
+// 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.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+extern crate alloc;
+extern crate pest;
+extern crate pest_derive;
+
+use pest::Parser;
+use pest_derive::Parser;
+
+#[derive(Parser)]
+#[grammar = "../tests/implicit.pest"]
+struct TestImplicitParser;
+
+#[test]
+fn test_implicit_whitespace() {
+ // this failed to parse due to a bug in the optimizer
+ // see: https://github.com/pest-parser/pest/issues/762#issuecomment-1375374868
+ let successful_parse = TestImplicitParser::parse(Rule::program, "a a");
+ assert!(successful_parse.is_ok());
+}