rpgsheet

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit e80264ada63a81f0cd1c6e9b0aa0d68a7139ff29
parent 75d2dc8b6e84571f365d87e34a5972757e8d1504
Author: Egg Milk Soup <egg@milksoup.net>
Date:   Thu,  9 Jun 2022 21:39:55 -0500

fix some compiler errors

Diffstat:
Msrc/rpgsheet.nim | 3+++
Msrc/utils.nim | 1+
Msrc/verb.nim | 7++++---
3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/rpgsheet.nim b/src/rpgsheet.nim @@ -22,9 +22,12 @@ proc loadSheet(file: string): YamlDocument = try: result = loadDom(stream) except YamlLoadingError as e: + result = (new YamlDocument)[] echo fmt"""Error at {e.mark}:""" echo e.lineContent quit(getCurrentExceptionMsg()) + except: + result = (new YamlDocument)[] stream.close() proc main(): void = diff --git a/src/utils.nim b/src/utils.nim @@ -31,6 +31,7 @@ proc key*(node: YamlNode, search: string): YamlNode = for key, _ in node.pairs: if key.content == search: return key + result = new YamlNode raise newException(ValueError, search & " is not defined") diff --git a/src/verb.nim b/src/verb.nim @@ -66,9 +66,10 @@ proc roll*(action: string, sheet: YamlDocument): string = return "Error: " & output var exp: YamlNode - try: - exp = sheet.expression(action) - except KeyError: + exp = try: sheet.expression(action) + except: YamlNode(kind: yScalar, tag: yTagNull, content: "") + + if exp.content == "": return action & " is not a dice expression or defined expression" var modifier: string