fix: 词法位置报错 (#53)
Co-authored-by: Huaps <1183155719@qq.com> Reviewed-on: PostGuard/Canon#53
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Canon.Core.Enums;
|
||||
using Canon.Core.Enums;
|
||||
|
||||
namespace Canon.Core.LexicalParser;
|
||||
|
||||
|
@@ -10,7 +10,7 @@ public class Lexer : ILexer
|
||||
// 记录token
|
||||
private SemanticToken? _semanticToken;
|
||||
private readonly StringBuilder _tokenBuilder = new();
|
||||
private readonly List<SemanticToken> _tokens = [];
|
||||
private List<SemanticToken> _tokens = [];
|
||||
|
||||
// 状态机
|
||||
private StateType _state = StateType.Start;
|
||||
@@ -25,6 +25,7 @@ public class Lexer : ILexer
|
||||
public IEnumerable<SemanticToken> Tokenize(ISourceReader reader)
|
||||
{
|
||||
_reader = reader;
|
||||
_tokens = [];
|
||||
_state = StateType.Start;
|
||||
|
||||
while (_state != StateType.Done)
|
||||
|
Reference in New Issue
Block a user