Replies: 1 comment
-
Hello, I have tried to reproduce your problem. I made the following grammar:
And the following program: extern crate pest;
#[macro_use]
extern crate pest_derive;
use pest::Parser;
#[derive(Parser)]
#[grammar = "grammar.pest"]
pub struct SeqParser;
const SEQ: &str =
"begin
line
line
end
";
fn main() {
let parse = SeqParser::parse(Rule::sequence_body, SEQ);
match parse {
Err(e) => println!("error: {}", e),
Ok(_) => println!("done"),
}
} However, this seems to work fine. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have the following grammar
I expect it to match the following:
because sequence_line starts with ASCII_ALPHA+, and sequence_end starts with "end", which is also ASCII_ALPHA+, I added !sequence_end
And I got the error:
unexpected sequence_end
it refers to the actual sequence_end
(!sequence_end ~ line) * ~ sequence_end
if the parser hits the first !sequence_end, I would expect it to finish the
()*
part and then match the second positive sequence_end.but instead, it just generates an error.
plantumlparser.zip
the reproducible project is attached too.
Beta Was this translation helpful? Give feedback.
All reactions