Remove lazy_static dependency
I just learned about thread local storage, so we really don't lazy_static for anything anymore - it was only being used for the lexer regex. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -203,7 +203,6 @@ name = "sybil"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"gc",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"structopt",
|
||||
"thiserror",
|
||||
|
||||
@@ -9,5 +9,4 @@ edition = "2021"
|
||||
thiserror = "1.0"
|
||||
structopt = "0.3"
|
||||
regex = "1.5"
|
||||
lazy_static = "1.4"
|
||||
gc = { version = "0.4", features = ["derive"] }
|
||||
@@ -1,10 +1,9 @@
|
||||
use crate::syn::{error::*, span::*, token::*};
|
||||
use lazy_static::lazy_static;
|
||||
use regex::{Regex, RegexBuilder};
|
||||
use std::rc::Rc;
|
||||
|
||||
lazy_static! {
|
||||
static ref LEX_PAT: Regex = RegexBuilder::new(
|
||||
thread_local! {
|
||||
static LEX_PAT: Regex = RegexBuilder::new(
|
||||
r#"^(
|
||||
(?P<float>[-+]?[0-9]+\.[0-9]+([eE][+\-][0-9]+)?)
|
||||
| (?P<int>[-+]?[0-9]+)
|
||||
@@ -88,7 +87,8 @@ impl<'t> Lexer<'t> {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
if let Some(cap) = LEX_PAT.captures(&self.text[self.start.byte..]) {
|
||||
LEX_PAT.with(|lex| {
|
||||
if let Some(cap) = lex.captures(&self.text[self.start.byte..]) {
|
||||
self.end = self.end.next_str(cap.get(0).unwrap().as_str());
|
||||
let sp_token = if let Some(_) = cap.name("assign") {
|
||||
self.make_token(Token::Assign)
|
||||
@@ -121,6 +121,7 @@ impl<'t> Lexer<'t> {
|
||||
got: expected_got_char(self.curr().unwrap()),
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user