+/- #23 add test file and screenshot; fix: remove if/else as "Folding in code 2", just keywords

This commit is contained in:
meisl 2021-05-04 21:55:12 +02:00
parent b7c5b1bfc7
commit 6485bf9ad9
3 changed files with 57 additions and 3 deletions

View File

@ -18,15 +18,15 @@
<Keywords name="Folders in code1, open">{ {{</Keywords>
<Keywords name="Folders in code1, middle"></Keywords>
<Keywords name="Folders in code1, close">} }}</Keywords>
<Keywords name="Folders in code2, open">if</Keywords>
<Keywords name="Folders in code2, open"></Keywords>
<Keywords name="Folders in code2, middle"></Keywords>
<Keywords name="Folders in code2, close">else</Keywords>
<Keywords name="Folders in code2, close"></Keywords>
<Keywords name="Folders in comment, open"></Keywords>
<Keywords name="Folders in comment, middle"></Keywords>
<Keywords name="Folders in comment, close"></Keywords>
<Keywords name="Keywords1">void const&#x000D;&#x000A;str&#x000D;&#x000A;byte ubyte&#x000D;&#x000A;word uword&#x000D;&#x000A;float&#x000D;&#x000A;zp</Keywords>
<Keywords name="Keywords2">%address&#x000D;&#x000A;%asm&#x000D;&#x000A;%asmbinary&#x000D;&#x000A;%asminclude&#x000D;&#x000A;%breakpoint&#x000D;&#x000A;%import&#x000D;&#x000A;%launcher&#x000D;&#x000A;%option&#x000D;&#x000A;%output&#x000D;&#x000A;%target&#x000D;&#x000A;%zeropage&#x000D;&#x000A;%zpreserved</Keywords>
<Keywords name="Keywords3">inline sub asmsub romsub&#x000D;&#x000A;clobbers&#x000D;&#x000A;asm&#x000D;&#x000A;when if else&#x000D;&#x000A;if_cc if_cs if_eq if_mi if_neg if_nz if_pl if_pos if_vc if_vs if_z&#x000D;&#x000A;for in step do while repeat&#x000D;&#x000A;break return goto</Keywords>
<Keywords name="Keywords3">inline sub asmsub romsub&#x000D;&#x000A;clobbers&#x000D;&#x000A;asm&#x000D;&#x000A;if&#x000D;&#x000A;when else&#x000D;&#x000A;if_cc if_cs if_eq if_mi if_neg if_nz if_pl if_pos if_vc if_vs if_z&#x000D;&#x000A;for in step do while repeat&#x000D;&#x000A;break return goto</Keywords>
<Keywords name="Keywords4">abs acos all any asin atan avg callfar callrom ceil cmp cos cos16 cos16u cos8 cos8u deg floor len ln log2 lsb lsl lsr max memory min mkword msb peek peekw poke pokew rad reverse rnd rndf rndw rol rol2 ror ror2 round sgn sin sin16 sin16u sin8 sin8u sizeof sort sqrt sqrt16 sum swap tan&#x000D;&#x000A;</Keywords>
<Keywords name="Keywords5">true false&#x000D;&#x000A;not and or xor&#x000D;&#x000A;as to downto</Keywords>
<Keywords name="Keywords6"></Keywords>

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -0,0 +1,54 @@
%target cx16
%import textio
%zeropage basicsafe
%option no_sysinit
; simple line comment; consecutive lines can be folded
; TODO: something
; FIXME #31
main {
str input = "string literal"
ubyte c = 'x' ; character literal in bold
ubyte decimal = 0 + 1 - 2 * 3
float pi = 3.1415
ubyte boolean = true or false and true xor not false
str temp = "?"
word[] numbers = [$80ea, %0101011, 23]
inline asmsub foo(ubyte char @A) clobbers(Y) {
asm {{
a_label:
nop
bcc _done
sec
_done: rts
}}
}
inline sub start(ubyte char @A) -> void {
ubyte @zp ch = min(max, n, (x, 5))
if (true) {
goto nirvana
} else {
return 0
}
repeat {
ch = input[index+5]
when ch {
0 -> {
break
}
else -> {
temp[0] = ch
txt.print(temp) ; wrongly optimized to
; lda #$3f
; jsr txt.chrout
; with -noopt the above line is correctly turned into
; ldy #>temp
; ldy #<temp
; jsr txt.print
}
}
index++
}
return
}
}