Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Commit

Permalink
Fixed jumping back from more than 1 indented block
Browse files Browse the repository at this point in the history
  • Loading branch information
deathbeam committed May 20, 2016
1 parent 57e9be8 commit 2102d5a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions examples/classes.spoon
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ class Point2d
@x : Int = x
@y : Int = y

to-string = : String -> "Point2d: x=#{@x}, y=#{@y}"
to-string = : String ->
"Point2d: x=#{@x}, y=#{@y}"

class Point3d < Point2d
new = (x : Int, y : Int, z : Int) : Void ->
super x, y
@z : Int = z

\override
to-string = : String -> "Point3d: x=#{@x}, y=#{@y}, z=#{@z}"
to-string = : String ->
"Point3d: x=#{@x}, y=#{@y}, z=#{@z}"

point2d = Point2d(100, 200)
trace point2d.to-string!
Expand Down
4 changes: 2 additions & 2 deletions examples/draw.spoon
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import js.Browser.document

@graphic = [["color":"f68712","path":[["x":45,"y":12],["x":12,"y":45],["x":45,"y":78],["x":78,"y":45],["x":45,"y":12]]],["color":"fab20b","path":[["x":2,"y":1],["x":45,"y":12],["x":12,"y":45],["x":2,"y":1]]],["color":"f89c0e","path":[["x":2,"y":89],["x":12,"y":45],["x":45,"y":78],["x":2,"y":89]]],["color":"f47216","path":[["x":89,"y":1],["x":78,"y":45],["x":45,"y":12],["x":89,"y":1]]],["color":"f25c19","path":[["x":89,"y":89],["x":45,"y":78],["x":78,"y":45],["x":89,"y":89]]],["color":"fbc707","path":[["x":45,"y":12],["x":2,"y":1],["x":23,"y":1],["x":45,"y":12]]],["color":"fbc707","path":[["x":45,"y":12],["x":89,"y":1],["x":67,"y":1],["x":45,"y":12]]],["color":"f68712","path":[["x":45,"y":78],["x":89,"y":89],["x":67,"y":89],["x":45,"y":78]]],["color":"f25c19","path":[["x":45,"y":78],["x":2,"y":89],["x":23,"y":89],["x":45,"y":78]]],["color":"fff200","path":[["x":12,"y":45],["x":2,"y":89],["x":2,"y":67],["x":12,"y":45]]],["color":"fff200","path":[["x":12,"y":45],["x":2,"y":1],["x":2,"y":23],["x":12,"y":45]]],["color":"f1471d","path":[["x":78,"y":45],["x":89,"y":89],["x":89,"y":67],["x":78,"y":45]]],["color":"f1471d","path":[["x":78,"y":45],["x":89,"y":1],["x":89,"y":23],["x":78,"y":45]]]]
graphic = [["color":"f68712","path":[["x":45,"y":12],["x":12,"y":45],["x":45,"y":78],["x":78,"y":45],["x":45,"y":12]]],["color":"fab20b","path":[["x":2,"y":1],["x":45,"y":12],["x":12,"y":45],["x":2,"y":1]]],["color":"f89c0e","path":[["x":2,"y":89],["x":12,"y":45],["x":45,"y":78],["x":2,"y":89]]],["color":"f47216","path":[["x":89,"y":1],["x":78,"y":45],["x":45,"y":12],["x":89,"y":1]]],["color":"f25c19","path":[["x":89,"y":89],["x":45,"y":78],["x":78,"y":45],["x":89,"y":89]]],["color":"fbc707","path":[["x":45,"y":12],["x":2,"y":1],["x":23,"y":1],["x":45,"y":12]]],["color":"fbc707","path":[["x":45,"y":12],["x":89,"y":1],["x":67,"y":1],["x":45,"y":12]]],["color":"f68712","path":[["x":45,"y":78],["x":89,"y":89],["x":67,"y":89],["x":45,"y":78]]],["color":"f25c19","path":[["x":45,"y":78],["x":2,"y":89],["x":23,"y":89],["x":45,"y":78]]],["color":"fff200","path":[["x":12,"y":45],["x":2,"y":89],["x":2,"y":67],["x":12,"y":45]]],["color":"fff200","path":[["x":12,"y":45],["x":2,"y":1],["x":2,"y":23],["x":12,"y":45]]],["color":"f1471d","path":[["x":78,"y":45],["x":89,"y":89],["x":89,"y":67],["x":78,"y":45]]],["color":"f1471d","path":[["x":78,"y":45],["x":89,"y":1],["x":89,"y":23],["x":78,"y":45]]]]

@draw = ->
draw = ->
canvas = document.create-canvas-element!
canvas.width = 400
canvas.height = 400
Expand Down
4 changes: 3 additions & 1 deletion lib/spoon/util/indent_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def check_indentation(source)
@prev_stack.push @last
@stack.push @current
elsif @current < @last
@stack.pop
while @current != @stack[@stack.length - 1] && !@stack.empty?
@stack.pop
end
end

AlwaysMatch.new
Expand Down

0 comments on commit 2102d5a

Please sign in to comment.