docs parsing

This commit is contained in:
nub31
2025-05-24 20:59:26 +02:00
parent 757e3490f5
commit 0cb10a68f6
8 changed files with 84 additions and 40 deletions

View File

@@ -37,14 +37,14 @@ public class Parser
List<Modifier> modifiers = [];
List<string> documentationParts = [];
while (_index < _tokens.Count && _tokens[_index] is CommentToken commentToken)
while (_index < _tokens.Count && _tokens[_index] is DocumentationToken commentToken)
{
documentationParts.Add(commentToken.Comment);
documentationParts.Add(commentToken.Documentation);
_index++;
}
var documentation = documentationParts.Count == 0 ? null : string.Join('\n', documentationParts);
while (TryExpectModifier(out var modifier))
{
modifiers.Add(modifier);
@@ -570,11 +570,11 @@ public class Parser
private Optional<Token> Peek()
{
var peekIndex = _index;
while (peekIndex < _tokens.Count && _tokens[peekIndex] is CommentToken)
while (peekIndex < _tokens.Count && _tokens[peekIndex] is DocumentationToken)
{
peekIndex++;
}
if (peekIndex < _tokens.Count)
{
return _tokens[peekIndex];
@@ -585,11 +585,11 @@ public class Parser
private void Next()
{
while (_index < _tokens.Count && _tokens[_index] is CommentToken)
while (_index < _tokens.Count && _tokens[_index] is DocumentationToken)
{
_index++;
}
_index++;
}
}