Skip to content

Commit

Permalink
Replace 'step' with 'by' in for loops, fixes #1704
Browse files Browse the repository at this point in the history
  • Loading branch information
c3d committed Dec 5, 2011
1 parent 14ab137 commit 47b150d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
7 changes: 4 additions & 3 deletions xlr/include/basics.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ INFIX(TextAt, text, text, "at", integer,
SYNOPSIS("")
DESCRIPTION("")
RETURNS(text, ""))
INFIX(ListIndex, tree, tree, "at", tree, return xl_index(context, &l, &r), )
INFIX(ListIndex, tree, tree, "at", tree,
return xl_array_index(context, &l, &r), )

// Some other text primitives
PREFIX(TextLength, integer, "text_length",
Expand Down Expand Up @@ -878,7 +879,7 @@ FORM(IntegerForLoop, tree,
PARM(Body, source, ""),
return xl_integer_for_loop(context,self, &Var, Low, High, 1, &Body), )
FORM(IntegerForLoopStep, tree,
"for Var in Low:integer..High:integer step Step:integer loop Body",
"for Var in Low:integer..High:integer by Step:integer loop Body",
PARM(Var, tree, "")
PARM(Low, integer, "")
PARM(High, integer, "")
Expand All @@ -893,7 +894,7 @@ FORM(RealForLoop, tree,
PARM(Body, source, ""),
return xl_real_for_loop(context,self, &Var, Low, High, 1.0, &Body), )
FORM(RealForLoopStep, tree,
"for Var in Low:real..High:real step Step:real loop Body",
"for Var in Low:real..High:real by Step:real loop Body",
PARM(Var, tree, "")
PARM(Low, real, "")
PARM(High, real, "")
Expand Down
16 changes: 8 additions & 8 deletions xlr/tests/05.Control/loops.xl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ for I in 1..9 loop
writeln

writeln "Step loop"
for I in 1..9 step 2 loop
for J in 1..9 step 3 loop
for I in 1..9 by 2 loop
for J in 1..9 by 3 loop
write "[", I, ",", J, "]"
writeln

Expand All @@ -31,21 +31,21 @@ for A in 0.3..9.1 loop
writeln

writeln "Step real loop"
for A in 0.1..2.9 step 1.3 loop
for B in 0.3..9.1 step 3.1 loop
for A in 0.1..2.9 by 1.3 loop
for B in 0.3..9.1 by 3.1 loop
write "[", A, ",", B, "]"
writeln


writeln "Step loop backwards"
for I in 9..1 step -2 loop
for J in 9..1 step -3 loop
for I in 9..1 by -2 loop
for J in 9..1 by -3 loop
write "[", I, ",", J, "]"
writeln

writeln "Step real loop backwards"
for A in 5.1..3.3 step -0.3 loop
for B in 9.4..9.1 step -0.1 loop
for A in 5.1..3.3 by -0.3 loop
for B in 9.4..9.1 by -0.1 loop
write "[", A, ",", B, "]"
writeln

Expand Down
4 changes: 2 additions & 2 deletions xlr/xl.syntax
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ INFIX
50 then require ensure
61 ;
75 with
85 := += -= *= /= ^= |= &=
85 := += -= *= /= ^= |= &=
100 STATEMENT
110 is as
120 written
Expand All @@ -18,7 +18,7 @@ INFIX
250 and or xor
260 in at contains
271 of to
280 .. step
280 .. by
290 = < > <= >= <>
300 & |
310 + -
Expand Down

0 comments on commit 47b150d

Please sign in to comment.