Fix statement recovery infinite loop
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
import c
|
||||
|
||||
// Test
|
||||
// Test2
|
||||
// Test3
|
||||
// Test4
|
||||
/// # Documentation
|
||||
/// ## Documentation subtitle
|
||||
global func main(args: []string) {
|
||||
i = 0
|
||||
printf("%d\n", args.count)
|
||||
while i < args.count {
|
||||
// Test
|
||||
printf("%s\n", args[i])
|
||||
i = i + 1
|
||||
}
|
||||
|
||||
i: string = "test"
|
||||
}
|
||||
|
||||
@@ -82,8 +82,6 @@ public class Parser
|
||||
|
||||
ExpectSymbol(Symbol.OpenParen);
|
||||
|
||||
if (!TryExpectSymbol(Symbol.CloseParen))
|
||||
{
|
||||
while (!TryExpectSymbol(Symbol.CloseParen))
|
||||
{
|
||||
parameters.Add(ParseFuncParameter());
|
||||
@@ -97,7 +95,6 @@ public class Parser
|
||||
.Build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var returnType = Optional<NubType>.Empty();
|
||||
if (TryExpectSymbol(Symbol.Colon))
|
||||
@@ -529,7 +526,7 @@ public class Parser
|
||||
var startIndex = _index;
|
||||
ExpectSymbol(Symbol.OpenBrace);
|
||||
List<StatementNode> statements = [];
|
||||
while (!TryExpectSymbol(Symbol.CloseBrace))
|
||||
while (Peek().HasValue && !TryExpectSymbol(Symbol.CloseBrace))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user