mirror of
https://github.com/fluencelabs/lalrpop
synced 2025-03-31 07:21:04 +00:00
remove nonce (unused)
This commit is contained in:
parent
8755723e7a
commit
753244f598
@ -1,6 +1,5 @@
|
|||||||
//! The grammar definition.
|
//! The grammar definition.
|
||||||
|
|
||||||
pub mod nonce;
|
|
||||||
pub mod parse_tree;
|
pub mod parse_tree;
|
||||||
pub mod repr;
|
pub mod repr;
|
||||||
// pub mod token;
|
// pub mod token;
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
/*!
|
|
||||||
|
|
||||||
A NONCE is just a guaranteed unique identifier. We use it to create
|
|
||||||
persistent identity for alternatives as we transform the grammar.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
use std::cell::Cell;
|
|
||||||
|
|
||||||
thread_local! {
|
|
||||||
static NONCE: Cell<u32> = Cell::new(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
|
||||||
pub struct Nonce {
|
|
||||||
counter: u32
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Nonce {
|
|
||||||
pub fn new() -> Nonce {
|
|
||||||
NONCE.with(|counter| {
|
|
||||||
let c = counter.get();
|
|
||||||
counter.set(c.checked_add(1).unwrap());
|
|
||||||
Nonce { counter: c }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user