From 347b259dd111ac2892931148ff4255bd19ff6a0b Mon Sep 17 00:00:00 2001 From: limuy Date: Sun, 12 May 2024 00:02:49 +0800 Subject: [PATCH] fix symbol --- src/compiler/token.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/compiler/token.rs b/src/compiler/token.rs index 543d31b4..b45bb168 100644 --- a/src/compiler/token.rs +++ b/src/compiler/token.rs @@ -1,9 +1,9 @@ use super::{Context, ValuePool}; -use crate::compiler::{token, CompilerImpl}; +use crate::compiler::CompilerImpl; use libcore::*; -use logos::{Lexer, Logos, Skip, Source}; +use logos::{Lexer, Logos, Source}; use rust_i18n::t; -use std::{cell::RefCell, fmt::Display, rc::Rc, u8}; +use std::{cell::RefCell, fmt::Display, rc::Rc}; fn add_float(lex: &mut Lexer) -> usize { // println!("{}", lex.slice()); @@ -184,7 +184,7 @@ pub enum Token { #[token("^=")] SelfXor, #[regex( - r#"[+-]?(0[bB][01_]+|0[oO][0-7_]+|0[xX][0-9a-fA-F_]+|[0-9][0-9_]*)"#, + r#"(0[bB][01_]+|0[oO][0-7_]+|0[xX][0-9a-fA-F_]+|[0-9][0-9_]*)"#, convert_int )] IntValue(usize), @@ -192,10 +192,7 @@ pub enum Token { // #[regex(r#""""(.)*""""#, add_string)] // TODO:MULT StringValue(usize), - #[regex( - r#"([-+]?)((\d+)\.(\d+))|(((\d+)|(\d+\.\d+))[eE][-+]?\d+)?"#, - add_float - )] + #[regex(r#"((\d+)\.(\d+))|(((\d+)|(\d+\.\d+))[eE][-+]?\d+)?"#, add_float)] FloatValue(usize), LongIntValue, #[regex(r#"'[^']*'"#, convert_char)]