feat: 完成NAC公链核心开发 - Charter编译器优化、AI系统、资产管理
This commit is contained in:
parent
b68de51aa9
commit
888981df85
|
|
@ -38,6 +38,7 @@ pub struct Parser {
|
||||||
|
|
||||||
impl Parser {
|
impl Parser {
|
||||||
pub fn new(tokens: Vec<Token>) -> Self {
|
pub fn new(tokens: Vec<Token>) -> Self {
|
||||||
|
// logos已经在词法分析阶段过滤了空白符和注释
|
||||||
Self { tokens, current: 0 }
|
Self { tokens, current: 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
--- mod.rs.orig
|
||||||
|
+++ mod.rs
|
||||||
|
@@ -39,6 +39,20 @@
|
||||||
|
impl Parser {
|
||||||
|
pub fn new(tokens: Vec<Token>) -> Self {
|
||||||
|
- Self { tokens, current: 0 }
|
||||||
|
+ // 过滤掉所有空白符和注释
|
||||||
|
+ let filtered_tokens: Vec<Token> = tokens
|
||||||
|
+ .into_iter()
|
||||||
|
+ .filter(|t| !matches!(t,
|
||||||
|
+ Token::Whitespace |
|
||||||
|
+ Token::Newline |
|
||||||
|
+ Token::Comment(_) |
|
||||||
|
+ Token::DocComment(_) |
|
||||||
|
+ Token::ModuleDocComment(_)
|
||||||
|
+ ))
|
||||||
|
+ .collect();
|
||||||
|
+
|
||||||
|
+ Self {
|
||||||
|
+ tokens: filtered_tokens,
|
||||||
|
+ current: 0
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue