mirror of
https://github.com/irmen/prog8.git
synced 2024-10-21 04:24:05 +00:00
allow labels also in blocks instead of only in subroutines
This commit is contained in:
parent
c70bbdab26
commit
a086d6e009
@ -45,7 +45,8 @@ private fun prog8Parser.BlockContext.toAst(isInLibrary: Boolean, encoding: IStri
|
|||||||
it.subroutinedeclaration()!=null -> it.subroutinedeclaration().toAst(encoding)
|
it.subroutinedeclaration()!=null -> it.subroutinedeclaration().toAst(encoding)
|
||||||
it.directive()!=null -> it.directive().toAst()
|
it.directive()!=null -> it.directive().toAst()
|
||||||
it.inlineasm()!=null -> it.inlineasm().toAst()
|
it.inlineasm()!=null -> it.inlineasm().toAst()
|
||||||
else -> throw FatalAstException("weird block statement $it")
|
it.labeldef()!=null -> it.labeldef().toAst()
|
||||||
|
else -> throw FatalAstException("weird block node $it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Block(identifier().text, integerliteral()?.toAst()?.number?.toInt(), blockstatements.toMutableList(), isInLibrary, toPosition())
|
return Block(identifier().text, integerliteral()?.toAst()?.number?.toInt(), blockstatements.toMutableList(), isInLibrary, toPosition())
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
- allow labels in blocks instead of only in subroutines?
|
|
||||||
|
|
||||||
- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine)
|
- hoist all variable declarations up to the subroutine scope *before* even the constant folding takes place (to avoid undefined symbol errors when referring to a variable from another nested scope in the subroutine)
|
||||||
- c64: make the graphics.BITMAP_ADDRESS configurable (VIC banking)
|
- c64: make the graphics.BITMAP_ADDRESS configurable (VIC banking)
|
||||||
- get rid of all other TODO's in the code ;-)
|
- get rid of all other TODO's in the code ;-)
|
||||||
|
@ -3,7 +3,12 @@
|
|||||||
%import test_stack
|
%import test_stack
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
|
blocklabel:
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
|
label1:
|
||||||
ubyte xx=99
|
ubyte xx=99
|
||||||
if 0==xx {
|
if 0==xx {
|
||||||
txt.print("fout")
|
txt.print("fout")
|
||||||
|
@ -80,6 +80,7 @@ block_statement:
|
|||||||
| variabledeclaration
|
| variabledeclaration
|
||||||
| subroutinedeclaration
|
| subroutinedeclaration
|
||||||
| inlineasm
|
| inlineasm
|
||||||
|
| labeldef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user