mirror of
https://github.com/irmen/prog8.git
synced 2025-02-16 22:30:46 +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.directive()!=null -> it.directive().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())
|
||||
|
@ -2,8 +2,6 @@
|
||||
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)
|
||||
- c64: make the graphics.BITMAP_ADDRESS configurable (VIC banking)
|
||||
- get rid of all other TODO's in the code ;-)
|
||||
|
@ -3,7 +3,12 @@
|
||||
%import test_stack
|
||||
|
||||
main {
|
||||
|
||||
blocklabel:
|
||||
|
||||
sub start() {
|
||||
|
||||
label1:
|
||||
ubyte xx=99
|
||||
if 0==xx {
|
||||
txt.print("fout")
|
||||
|
@ -80,6 +80,7 @@ block_statement:
|
||||
| variabledeclaration
|
||||
| subroutinedeclaration
|
||||
| inlineasm
|
||||
| labeldef
|
||||
;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user