mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-02-09 01:30:50 +00:00
Two seperate words looks better.
This commit is contained in:
parent
b073fe54a0
commit
b79059faa4
@ -378,12 +378,13 @@ class Parser(object):
|
||||
return Repeat(self.scanner.line_number, src=src, block=block, inverted=inverted)
|
||||
elif self.scanner.consume('for'):
|
||||
dest = self.locexpr()
|
||||
if self.scanner.consume('downto'):
|
||||
if self.scanner.consume('down'):
|
||||
direction = -1
|
||||
elif self.scanner.consume('upto'):
|
||||
elif self.scanner.consume('up'):
|
||||
direction = 1
|
||||
else:
|
||||
self.syntax_error('expected "upto" or "downto", found "%s"' % self.scanner.token)
|
||||
self.syntax_error('expected "up" or "down", found "%s"' % self.scanner.token)
|
||||
self.scanner.expect('to')
|
||||
final = self.literal_int()
|
||||
block = self.block()
|
||||
return For(self.scanner.line_number, dest=dest, direction=direction, final=final, block=block)
|
||||
|
@ -1669,7 +1669,7 @@ In a "for" loop, we know the exact range the loop variable takes on.
|
||||
|
|
||||
| define foo routine inputs tab trashes a, x, c, z, v, n {
|
||||
| ld x, 0
|
||||
| for x upto 15 {
|
||||
| for x up to 15 {
|
||||
| ld a, tab + x
|
||||
| }
|
||||
| }
|
||||
@ -1679,7 +1679,7 @@ In a "for" loop, we know the exact range the loop variable takes on.
|
||||
|
|
||||
| define foo routine inputs tab trashes a, x, c, z, v, n {
|
||||
| ld x, 0
|
||||
| for x upto 15 {
|
||||
| for x up to 15 {
|
||||
| ld a, tab + x
|
||||
| }
|
||||
| }
|
||||
@ -1691,7 +1691,7 @@ You cannot modify the loop variable in a "for" loop.
|
||||
|
|
||||
| define foo routine inputs tab trashes a, x, c, z, v, n {
|
||||
| ld x, 0
|
||||
| for x upto 15 {
|
||||
| for x up to 15 {
|
||||
| ld x, 0
|
||||
| }
|
||||
| }
|
||||
@ -1703,19 +1703,19 @@ If the range isn't known to be smaller than the final value, you can't go up to
|
||||
|
|
||||
| define foo routine inputs tab trashes a, x, c, z, v, n {
|
||||
| ld x, 16
|
||||
| for x upto 15 {
|
||||
| for x up to 15 {
|
||||
| ld a, tab + x
|
||||
| }
|
||||
| }
|
||||
? RangeExceededError
|
||||
|
||||
In a "for" loop (downto variant), we know the exact range the loop variable takes on.
|
||||
In a "for" loop (downward-counting variant), we know the exact range the loop variable takes on.
|
||||
|
||||
| byte table[16] tab
|
||||
|
|
||||
| define foo routine inputs tab trashes a, x, c, z, v, n {
|
||||
| ld x, 15
|
||||
| for x downto 0 {
|
||||
| for x down to 0 {
|
||||
| ld a, tab + x
|
||||
| }
|
||||
| }
|
||||
@ -1725,19 +1725,19 @@ In a "for" loop (downto variant), we know the exact range the loop variable take
|
||||
|
|
||||
| define foo routine inputs tab trashes a, x, c, z, v, n {
|
||||
| ld x, 15
|
||||
| for x downto 0 {
|
||||
| for x down to 0 {
|
||||
| ld a, tab + x
|
||||
| }
|
||||
| }
|
||||
? RangeExceededError
|
||||
|
||||
You cannot modify the loop variable in a "for" loop (downto variant).
|
||||
You cannot modify the loop variable in a "for" loop (downward variant).
|
||||
|
||||
| byte table[16] tab
|
||||
|
|
||||
| define foo routine inputs tab trashes a, x, c, z, v, n {
|
||||
| ld x, 15
|
||||
| for x downto 0 {
|
||||
| for x down to 0 {
|
||||
| ld x, 0
|
||||
| }
|
||||
| }
|
||||
@ -1749,7 +1749,7 @@ If the range isn't known to be larger than the final value, you can't go down to
|
||||
|
|
||||
| define foo routine inputs tab trashes a, x, c, z, v, n {
|
||||
| ld x, 0
|
||||
| for x downto 0 {
|
||||
| for x down to 0 {
|
||||
| ld a, tab + x
|
||||
| }
|
||||
| }
|
||||
|
@ -137,11 +137,11 @@ Basic "open-faced for" loops, up and down.
|
||||
|
|
||||
| routine foo trashes a, x, c, z, v {
|
||||
| ld x, 0
|
||||
| for x upto 15 {
|
||||
| for x up to 15 {
|
||||
| ld a, tab + x
|
||||
| }
|
||||
| ld x, 15
|
||||
| for x downto 0 {
|
||||
| for x down to 0 {
|
||||
| ld a, tab + x
|
||||
| }
|
||||
| }
|
||||
|
Loading…
x
Reference in New Issue
Block a user