mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Add edition to parser struct
This commit is contained in:
parent
f3c7bd0c90
commit
392538c830
2 changed files with 20 additions and 5 deletions
|
@ -26,13 +26,27 @@ pub(crate) struct Parser<'t> {
|
|||
pos: usize,
|
||||
events: Vec<Event>,
|
||||
steps: Cell<u32>,
|
||||
edition: Edition,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
pub enum Edition {
|
||||
Edition2015,
|
||||
Edition2018,
|
||||
Edition2021,
|
||||
}
|
||||
|
||||
static PARSER_STEP_LIMIT: Limit = Limit::new(15_000_000);
|
||||
|
||||
impl<'t> Parser<'t> {
|
||||
pub(super) fn new(inp: &'t Input) -> Parser<'t> {
|
||||
Parser { inp, pos: 0, events: Vec::new(), steps: Cell::new(0) }
|
||||
pub(super) fn new(inp: &'t Input, edition: Edition) -> Parser<'t> {
|
||||
Parser {
|
||||
inp,
|
||||
pos: 0,
|
||||
events: Vec::new(),
|
||||
steps: Cell::new(0),
|
||||
edition,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn finish(self) -> Vec<Event> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue