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
10use crate::position::Position;
11
12/// A token generated by a `Parser`.
13#[derive(Clone, Debug, Eq, Hash, PartialEq)]
14pub enum Token<'i, R> {
15 /// The starting `Position` of a matched `Rule`
16 Start {
17 /// matched rule
18 rule: R,
19 /// starting position
20 pos: Position<'i>,
21 },
22 /// The ending `Position` of a matched `Rule`
23 End {
24 /// matched rule
25 rule: R,
26 /// ending position
27 pos: Position<'i>,
28 },
29}
30