mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-04-06 17:39:38 +00:00
goto
may only occur at the end of a block.
This commit is contained in:
parent
3cd28bdb3e
commit
9e9284bee5
@ -380,6 +380,8 @@ class Parser(object):
|
||||
self.scanner.expect('{')
|
||||
while not self.scanner.on('}'):
|
||||
instrs.append(self.instr())
|
||||
if isinstance(instrs[-1], SingleOp) and instrs[-1].opcode == 'goto':
|
||||
break
|
||||
self.scanner.expect('}')
|
||||
return Block(self.scanner.line_number, instrs=instrs)
|
||||
|
||||
|
@ -2990,7 +2990,11 @@ Calling the vector does indeed trash the things the vector says it does.
|
||||
| }
|
||||
|
|
||||
| define main routine trashes x, z, n {
|
||||
| goto bar
|
||||
| ld x, 0
|
||||
| if z {
|
||||
| ld x, 1
|
||||
| goto bar
|
||||
| }
|
||||
| ld x, 0
|
||||
| }
|
||||
? IllegalJumpError
|
||||
|
@ -571,6 +571,18 @@ goto.
|
||||
| }
|
||||
? SyntaxError
|
||||
|
||||
`goto` may only be the final instruction in a block.
|
||||
|
||||
| define bar routine trashes x, z, n {
|
||||
| ld x, 200
|
||||
| }
|
||||
|
|
||||
| define main routine trashes x, z, n {
|
||||
| goto bar
|
||||
| ld x, 0
|
||||
| }
|
||||
? Expected '}', but found 'ld'
|
||||
|
||||
Buffers and pointers.
|
||||
|
||||
| buffer[2048] buf
|
||||
|
Loading…
x
Reference in New Issue
Block a user