From 3fb4cc1748b248196f0621f07184461ec6f65107 Mon Sep 17 00:00:00 2001 From: An Ko Date: Wed, 25 Nov 2015 19:59:34 +0100 Subject: [PATCH] Make invalid AST error highlighting work again This makes the clearer errors for #9 from bf7bb54 work again; with the updated name for the location property and no longer needing the -1 offset-offset, thanks to the smarter parser. --- src/cli.ls | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli.ls b/src/cli.ls index 9c8e32d..a4ee761 100644 --- a/src/cli.ls +++ b/src/cli.ls @@ -130,7 +130,7 @@ string-splice = (string, start, end, inserted-text="") -> # Use the node's location data (if present) to show the lines on which the # problem occurred. point-at-problem = (input, problematic-node) -> - { location } = problematic-node + { loc : location } = problematic-node switch typeof! location | \String => stringified-node = JSON.stringify do @@ -148,8 +148,8 @@ point-at-problem = (input, problematic-node) -> # Subtract 1 from both offsets because of open-paren that's implicitly # added to the input # inputs. - start-offset = start.offset - 1 - end-offset = end.offset - 1 + start-offset = start.offset + end-offset = end.offset highlighted-part = chalk.black.bg-yellow (lines.slice start-offset, end-offset)