From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/pest_derive/tests/grammar.pest | 83 +++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 vendor/pest_derive/tests/grammar.pest (limited to 'vendor/pest_derive/tests/grammar.pest') 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 +// 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. + +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" } +*/ -- cgit v1.2.3