]> git.proxmox.com Git - rustc.git/blob - vendor/pest_derive/tests/grammar.pest
New upstream version 1.32.0~beta.2+dfsg1
[rustc.git] / vendor / pest_derive / tests / grammar.pest
1 // pest. The Elegant Parser
2 // Copyright (c) 2018 DragoČ™ Tiselice
3 //
4 // Licensed under the Apache License, Version 2.0
5 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
6 // license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. All files in the project carrying such notice may not be copied,
8 // modified, or distributed except according to those terms.
9
10 string = { "abc" }
11 insensitive = { ^"abc" }
12 range = { '0'..'9' }
13 ident = { string }
14 pos_pred = { &string }
15 neg_pred = { !string }
16 double_neg_pred = { !!string }
17 sequence = !{ string ~ string }
18 sequence_compound = ${ string ~ string }
19 sequence_atomic = @{ string ~ string }
20 sequence_non_atomic = @{ sequence }
21 sequence_atomic_compound = @{ sequence_compound }
22 sequence_nested = { string ~ string }
23 sequence_compound_nested = ${ sequence_nested }
24 choice = { string | range }
25 optional = { string? }
26 repeat = { string* }
27 repeat_atomic = @{ string* }
28 repeat_once = { string+ }
29 repeat_once_atomic = @{ string+ }
30 repeat_min_max = { string{2, 3} }
31 repeat_min_max_atomic = @{ string{2, 3} }
32 repeat_exact = { string{2} }
33 repeat_min = { string{2,} }
34 repeat_min_atomic = @{ string{2,} }
35 repeat_max = { string{, 2} }
36 repeat_max_atomic = @{ string{, 2} }
37 peek_ = { push(range) ~ push(range) ~ peek ~ peek }
38 pop_ = { push(range) ~ push(range) ~ pop ~ pop }
39 pop_fail = { push(range) ~ !pop ~ range ~ pop }
40 whitespace = _{ " " }
41 comment = _{ "$"+ }