This commit is contained in:
nub31
2025-06-22 18:18:42 +02:00
parent 88d85c6849
commit 33b101681d
39 changed files with 154 additions and 163 deletions

View File

@@ -62,19 +62,21 @@ public static class Tokenizer
private static SourceText _sourceText;
private static int _index;
public static DiagnosticsResult<List<Token>> Tokenize(SourceText sourceText)
public static IEnumerable<Token> Tokenize(SourceText sourceText, out IEnumerable<Diagnostic> diagnostics)
{
_sourceText = sourceText;
_index = 0;
List<Token> tokens = [];
while (ParseToken().TryGetValue(out var token))
{
tokens.Add(token);
}
return new DiagnosticsResult<List<Token>>([], tokens);
// TODO: Implement diagnostics
diagnostics = [];
return tokens;
}
private static void ConsumeWhitespace()
@@ -99,7 +101,7 @@ public static class Tokenizer
{
Next();
Next();
if (Peek().TryGetValue(out var thirdChar) && thirdChar == '/')
{
Next();
@@ -109,6 +111,7 @@ public static class Tokenizer
buffer += character;
Next();
}
Next();
return new DocumentationToken(CreateSpan(startIndex), buffer);
}
@@ -117,6 +120,7 @@ public static class Tokenizer
{
Next();
}
Next();
return ParseToken();
}