Remove limit crate in favor usize

This commit is contained in:
Lukas Wirth 2025-02-20 18:58:42 +01:00
parent e865b249e6
commit 0b2e8166a1
17 changed files with 23 additions and 131 deletions

View file

@ -3,7 +3,6 @@
use std::cell::Cell;
use drop_bomb::DropBomb;
use limit::Limit;
use crate::{
event::Event,
@ -30,7 +29,7 @@ pub(crate) struct Parser<'t> {
edition: Edition,
}
static PARSER_STEP_LIMIT: Limit = Limit::new(15_000_000);
const PARSER_STEP_LIMIT: usize = 15_000_000;
impl<'t> Parser<'t> {
pub(super) fn new(inp: &'t Input, edition: Edition) -> Parser<'t> {
@ -54,7 +53,7 @@ impl<'t> Parser<'t> {
assert!(n <= 3);
let steps = self.steps.get();
assert!(PARSER_STEP_LIMIT.check(steps as usize).is_ok(), "the parser seems stuck");
assert!((steps as usize) < PARSER_STEP_LIMIT, "the parser seems stuck");
self.steps.set(steps + 1);
self.inp.kind(self.pos + n)