From 9835e2ae736235810b4ea1c162ca5e65c547e770 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:50 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/pest_derive/tests/implicit.pest | 14 ++++++++++++++ vendor/pest_derive/tests/implicit.rs | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 vendor/pest_derive/tests/implicit.pest create mode 100644 vendor/pest_derive/tests/implicit.rs (limited to 'vendor/pest_derive/tests') 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 +// or the MIT +// license , 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()); +} -- cgit v1.2.3