mirror of
https://github.com/irmen/prog8.git
synced 2024-12-01 15:52:54 +00:00
allow curly brace on next line also after subroutine and when
This commit is contained in:
parent
b0794cf35e
commit
eab63ecc6c
@ -1,6 +1,9 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
|
- also allow this?
|
||||||
|
if variable { txt.print("yes") }
|
||||||
|
else { txt.print("no") }
|
||||||
- is it possible to allow the curly brace to be on the next line instead of requiring it to follow on the same line?
|
- is it possible to allow the curly brace to be on the next line instead of requiring it to follow on the same line?
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -1,28 +1,24 @@
|
|||||||
%import textio
|
%import textio
|
||||||
%option no_sysinit
|
%zeropage basicsafe
|
||||||
%zeropage dontuse
|
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
uword variable=55555
|
sub start()
|
||||||
|
{
|
||||||
|
ubyte variable=55
|
||||||
|
when variable
|
||||||
|
{
|
||||||
|
33 -> txt.print("33")
|
||||||
|
}
|
||||||
|
|
||||||
sub start() {
|
if variable
|
||||||
txt.print("active rambank=")
|
{
|
||||||
txt.print_ub(cx16.getrambank())
|
txt.print("yes")
|
||||||
txt.print("\nvar addr=")
|
}
|
||||||
txt.print_uwhex(&variable, true)
|
else
|
||||||
txt.print("\nvalue=")
|
{
|
||||||
txt.print_uw(variable)
|
txt.print("no")
|
||||||
txt.print("\n(rambank 10) variable=")
|
}
|
||||||
cx16.rambank(10)
|
|
||||||
txt.print_uw(variable)
|
|
||||||
txt.print("\n(rambank 2) variable=")
|
|
||||||
cx16.rambank(2)
|
|
||||||
txt.print_uw(variable)
|
|
||||||
txt.print("\n(rambank 1) variable=")
|
|
||||||
cx16.rambank(1)
|
|
||||||
txt.print_uw(variable)
|
|
||||||
txt.nl()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ inlineir: '%ir' INLINEASMBLOCK;
|
|||||||
inline: 'inline';
|
inline: 'inline';
|
||||||
|
|
||||||
subroutine :
|
subroutine :
|
||||||
'sub' identifier '(' sub_params? ')' sub_return_part? (statement_block EOL)
|
'sub' identifier '(' sub_params? ')' sub_return_part? EOL? (statement_block EOL)
|
||||||
;
|
;
|
||||||
|
|
||||||
sub_return_part : '->' datatype ;
|
sub_return_part : '->' datatype ;
|
||||||
@ -296,6 +296,6 @@ repeatloop: 'repeat' expression? EOL? (statement | statement_block) ;
|
|||||||
|
|
||||||
unrollloop: 'unroll' integerliteral? EOL? (statement | statement_block) ;
|
unrollloop: 'unroll' integerliteral? EOL? (statement | statement_block) ;
|
||||||
|
|
||||||
whenstmt: 'when' expression '{' EOL (when_choice | EOL) * '}' EOL? ;
|
whenstmt: 'when' expression EOL? '{' EOL (when_choice | EOL) * '}' EOL? ;
|
||||||
|
|
||||||
when_choice: (expression_list | 'else' ) '->' (statement | statement_block ) ;
|
when_choice: (expression_list | 'else' ) '->' (statement | statement_block ) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user