-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added 'raise' statement Syntax: raise ErrorType "Error Message" * Expressions as error messages Things like: raise RTError 1+1 or msg = "Error Message" raise TypeError msg would work now * New Syntax Syntax: raise FooError("message") * Added `raise.rn` test * Some Bugfixes + `raise` support for only functions Now it is only possible to raise errors with function calls ``` fun ArgError(arg) { return "Argument `"+arg+"` not found" } raise ArgError("arg1") ``` The name of the function will also be the error type ``` ArgError: Argument `arg1` not found ``` * Updated tests Updated `raise.rn.json` to match the new output Removed debug line (parser.py:167) * Some fixes * Normalize line endings in stdout and stderr * Some Type fixes * Revert "Some Type fixes" This reverts commit 6a6763d. * feat: handled message less error formatting. * fix: visit_RaiseNode None message type. * fix: optional types. * Update parser.py * fix: type issues. * fix: type issues. * fix: type error * fix: ruff formattings. * Update parser.py * fix: type errors * fix: ruff formattings. --------- Co-authored-by: Md. Almas Ali <[email protected]>
- Loading branch information
1 parent
a9d13be
commit d178d09
Showing
9 changed files
with
79 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
fun ArgError(arg) | ||
{ | ||
return "Argument `"+arg+"` not found" | ||
} | ||
print("test1") | ||
print("test2") | ||
|
||
raise ArgError("arg1") | ||
raise ArgError("arg2") | ||
|
||
print("test3") | ||
print("test4") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"code": 1, "stdout": "test1\ntest2\n\u001b[38;5;208mRadiation (most recent call last):\n\u001b[0m File \u001b[38;5;117mtests/raise.rn\u001b[0m, line \u001b[38;5;117m8\u001b[0m\n\u001b[1m\u001b[31mArgError\u001b[0m: \u001b[38;5;203mArgument `arg1` not found\u001b[0m\n\nraise \u001b[1m\u001b[31mArgError(\"arg1\"\u001b[0m)\n \u001b[1m\u001b[31m^^^^^^^^^^^^^^^\u001b[0m\n", "stderr": ""} |