Custom error message for missing "end" #1141
Labels
C-Low Hanging Fruit
Ideal issue for new contributors.
L-Error reporting
Reporting language or runtime errors to the player.
L-Parsing
Parsing the Swarm language from a string into an AST.
S-Nice to have
The bug fix or feature would be nice but doesn't currently have much negative impact.
Z-Feature
A new feature to be added to the game.
I've found a common mistake in my own swarm-lang code to be a missing
end
keyword at end of adef
. One reason for the frequency of this error is probably that the languages I, and I suspect most others, are most familiar with (e.g. Python and Haskell) do not require this keyword at the end of a function.The error manifests itself far away (at the end of the file) and as the message
"unexpected end of input"
.Since it is a common error, could we special-case this error to have a more user-friendly message? Perhaps in the parser we can count to make sure that the number of
end
keywords matches the number ofdef
keywords.The text was updated successfully, but these errors were encountered: