Better error message

This commit is contained in:
nub31
2025-10-22 14:42:47 +02:00
parent 0637007345
commit 589d4cdd4e

View File

@@ -79,8 +79,8 @@ public sealed class Parser
Symbol.Func => ParseFunc(startIndex, exported, null),
Symbol.Struct => ParseStruct(startIndex, exported),
_ => throw new ParseException(Diagnostic
.Error($"Expected 'func' or 'struct' but found '{keyword.Symbol}'")
.WithHelp("Valid definition keywords are 'func' and 'struct'")
.Error($"Expected 'func', 'struct', 'import' or 'module' but found '{keyword.Symbol}'")
.WithHelp("Valid top level statements are 'func', 'struct', 'import' and 'module'")
.At(keyword)
.Build())
};