Skip to content

Commit

Permalink
Make invalid AST error highlighting work again
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anko committed Nov 25, 2015
1 parent 337a95a commit 3fb4cc1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cli.ls
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 3fb4cc1

Please sign in to comment.