Better error message
This commit is contained in:
@@ -79,8 +79,8 @@ public sealed class Parser
|
|||||||
Symbol.Func => ParseFunc(startIndex, exported, null),
|
Symbol.Func => ParseFunc(startIndex, exported, null),
|
||||||
Symbol.Struct => ParseStruct(startIndex, exported),
|
Symbol.Struct => ParseStruct(startIndex, exported),
|
||||||
_ => throw new ParseException(Diagnostic
|
_ => throw new ParseException(Diagnostic
|
||||||
.Error($"Expected 'func' or 'struct' but found '{keyword.Symbol}'")
|
.Error($"Expected 'func', 'struct', 'import' or 'module' but found '{keyword.Symbol}'")
|
||||||
.WithHelp("Valid definition keywords are 'func' and 'struct'")
|
.WithHelp("Valid top level statements are 'func', 'struct', 'import' and 'module'")
|
||||||
.At(keyword)
|
.At(keyword)
|
||||||
.Build())
|
.Build())
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user