M etc/test.tal => etc/test.tal +4 -1
@@ 1,5 1,8 @@
-@hey ( -> )
+@vector1 ( -> )
+ BRK
+
+@vector2 ( -> )
BRK
M src/uxnfor.tal => src/uxnfor.tal +25 -17
@@ 35,18 35,18 @@
( name ) "Uxnfor 0a
( desc ) "Uxntal 20 "Formatter 0a
( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
- ( date ) "5 20 "Sep 20 "2023 $1
+ ( date ) "6 20 "Sep 20 "2023 $1
( exts ) 00
@await-src ( -> )
.Console/read DEI .src skey ?{ !exit }
- format-file
+ ;src <format-file>
( halt ) #800f DEO
!exit
@on-interactive ( -> )
.Console/read DEI .src skey ?{ !exit }
- format-file
+ ;src <format-file>
;src <sclr>
;dst <sclr>
!exit
@@ 54,33 54,37 @@
(
@|core )
-@format-file ( -- )
+@<format-file> ( src* -- )
+ .File/name DEO2
#0001 .File/length DEO2
[ LIT2 00 -err ] STZ
- result/new ;src .File/name DEO2
+ result/new
&s ( -- )
- ;&c .File/read DEO2
- .err LDZ ?&error
- .File/success DEI2 ORA ?{ eval-scope !save-file }
- [ LIT &c $1 ]
- ( ws to space ) #20 GTHk [ JMP SWP POP ]
- ( no repeat ) DUP #20 EQU OVR .last LDZ EQU AND ?{ DUP walk }
- .last STZ
- !&s
- &error ( -- )
+ ;&c feof ?&eof
+ .err LDZ ?&fail
+ [ LIT &c $1 ] walk-char !&s
+ &eof ( -- )
+ eval-scope !save-file
+ &fail ( -- )
;dict/err <sprint>
;mem/scope <wprint>
#0a19 DEO
JMP2r
-@walk ( c -- )
- .last LDZ #20 NEQ ?scope/put
+@walk-char ( c -- c )
+ ( space ws ) #20 GTHk [ JMP SWP POP ]
+ ( join seq ) [ LIT &last 20 ] OVR ,&last STR
+ ( no repeat ) DUP2 #2020 NEQ2 ?{ POP2 JMP2r }
+ #20 EQU ?walk-rune
+ !scope/put
+
+@walk-rune ( c -- )
DUP #28 NEQ ?{
[ LIT2 01 _&mute ] STR }
DUP #29 NEQ ?{
[ LIT2 00 _&mute ] STR }
[ LIT &mute $1 ] ?scope/put
- DUP LIT "@ NEQ ?scope/put
+ DUP [ LIT "@ ] NEQ ?scope/put
eval-scope !scope/put
@eval-scope ( -- )
@@ 482,6 486,10 @@
@wlen ( w* -- len* )
DUP2 wcap/ SWP2 SUB2 JMP2r
+@feof ( addr* -- f )
+ .File/read DEO2
+ .File/success DEI2 #0000 EQU2 JMP2r
+
@<sprint> ( str* -- )
&w ( -- )
LDAk #19 DEO