git @ Cat's Eye Technologies SixtyPical / b79059f
Two seperate words looks better. Chris Pressey 3 years ago
3 changed file(s) with 16 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
377377 return Repeat(self.scanner.line_number, src=src, block=block, inverted=inverted)
378378 elif self.scanner.consume('for'):
379379 dest = self.locexpr()
380 if self.scanner.consume('downto'):
380 if self.scanner.consume('down'):
381381 direction = -1
382 elif self.scanner.consume('upto'):
382 elif self.scanner.consume('up'):
383383 direction = 1
384384 else:
385 self.syntax_error('expected "upto" or "downto", found "%s"' % self.scanner.token)
385 self.syntax_error('expected "up" or "down", found "%s"' % self.scanner.token)
386 self.scanner.expect('to')
386387 final = self.literal_int()
387388 block = self.block()
388389 return For(self.scanner.line_number, dest=dest, direction=direction, final=final, block=block)
16681668 |
16691669 | define foo routine inputs tab trashes a, x, c, z, v, n {
16701670 | ld x, 0
1671 | for x upto 15 {
1671 | for x up to 15 {
16721672 | ld a, tab + x
16731673 | }
16741674 | }
16781678 |
16791679 | define foo routine inputs tab trashes a, x, c, z, v, n {
16801680 | ld x, 0
1681 | for x upto 15 {
1681 | for x up to 15 {
16821682 | ld a, tab + x
16831683 | }
16841684 | }
16901690 |
16911691 | define foo routine inputs tab trashes a, x, c, z, v, n {
16921692 | ld x, 0
1693 | for x upto 15 {
1693 | for x up to 15 {
16941694 | ld x, 0
16951695 | }
16961696 | }
17021702 |
17031703 | define foo routine inputs tab trashes a, x, c, z, v, n {
17041704 | ld x, 16
1705 | for x upto 15 {
1705 | for x up to 15 {
17061706 | ld a, tab + x
17071707 | }
17081708 | }
17091709 ? RangeExceededError
17101710
1711 In a "for" loop (downto variant), we know the exact range the loop variable takes on.
1711 In a "for" loop (downward-counting variant), we know the exact range the loop variable takes on.
17121712
17131713 | byte table[16] tab
17141714 |
17151715 | define foo routine inputs tab trashes a, x, c, z, v, n {
17161716 | ld x, 15
1717 | for x downto 0 {
1717 | for x down to 0 {
17181718 | ld a, tab + x
17191719 | }
17201720 | }
17241724 |
17251725 | define foo routine inputs tab trashes a, x, c, z, v, n {
17261726 | ld x, 15
1727 | for x downto 0 {
1727 | for x down to 0 {
17281728 | ld a, tab + x
17291729 | }
17301730 | }
17311731 ? RangeExceededError
17321732
1733 You cannot modify the loop variable in a "for" loop (downto variant).
1733 You cannot modify the loop variable in a "for" loop (downward variant).
17341734
17351735 | byte table[16] tab
17361736 |
17371737 | define foo routine inputs tab trashes a, x, c, z, v, n {
17381738 | ld x, 15
1739 | for x downto 0 {
1739 | for x down to 0 {
17401740 | ld x, 0
17411741 | }
17421742 | }
17481748 |
17491749 | define foo routine inputs tab trashes a, x, c, z, v, n {
17501750 | ld x, 0
1751 | for x downto 0 {
1751 | for x down to 0 {
17521752 | ld a, tab + x
17531753 | }
17541754 | }
136136 |
137137 | routine foo trashes a, x, c, z, v {
138138 | ld x, 0
139 | for x upto 15 {
139 | for x up to 15 {
140140 | ld a, tab + x
141141 | }
142142 | ld x, 15
143 | for x downto 0 {
143 | for x down to 0 {
144144 | ld a, tab + x
145145 | }
146146 | }