From 52e2dae3382a13cf4e582abe17332892d727f14e Mon Sep 17 00:00:00 2001 From: Ding Weihao <2521248869@qq.com> Date: Sat, 20 Apr 2024 18:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D'+''-'=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source.c | 3 ++- src/main.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source.c b/source.c index 8dd4343..f3946e7 100644 --- a/source.c +++ b/source.c @@ -1 +1,2 @@ -*a=2; \ No newline at end of file +*a=2; +int c = a+2; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index a59c7d6..d6f4ae0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -748,7 +748,7 @@ impl Lexer { self.tokens.push(Token::Operators(Operator::Add)); self.tokens_location.push(TokenLocation { row: self.row, - col: self.col, + col: self.col-1, }); self.state = State::Start; return ptr_index; @@ -812,7 +812,7 @@ impl Lexer { self.tokens.push(Token::Operators(Operator::Subtract)); self.tokens_location.push(TokenLocation { row: self.row, - col: self.col, + col: self.col-1, }); self.state = State::Start; return ptr_index;