mirror of
https://github.com/fluencelabs/lalrpop
synced 2025-03-16 17:00:53 +00:00
remove nonce (unused)
This commit is contained in:
parent
8755723e7a
commit
753244f598
@ -1,6 +1,5 @@
|
||||
//! The grammar definition.
|
||||
|
||||
pub mod nonce;
|
||||
pub mod parse_tree;
|
||||
pub mod repr;
|
||||
// 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