This commit is contained in:
nub31
2025-07-07 18:56:47 +02:00
parent aa8bf71c23
commit 5672d181fe
15 changed files with 155 additions and 150 deletions

View File

@@ -9,12 +9,12 @@ namespace NubLang.Syntax.Parsing;
public sealed class Parser
{
private string _namespace;
private readonly IEnumerable<Token> _tokens;
private readonly IReadOnlyList<Token> _tokens;
private readonly List<Diagnostic> _diagnostics = [];
private int _tokenIndex;
public Parser(IEnumerable<Token> tokens)
public Parser(IReadOnlyList<Token> tokens)
{
_namespace = "default";
_tokens = tokens;
@@ -815,9 +815,9 @@ public sealed class Parser
_tokenIndex++;
}
private IEnumerable<Token> GetTokens(int startIndex)
private List<Token> GetTokens(int startIndex)
{
return _tokens.Skip(startIndex).Take(Math.Min(_tokenIndex, _tokens.Count() - 1) - startIndex);
return _tokens.Skip(startIndex).Take(Math.Min(_tokenIndex, _tokens.Count() - 1) - startIndex).ToList();
}
}