~rabbits/uxnfor

c2ddd967ac1365ee1c0bc44289a47a176a4aab64 — Devine Lu Linvega 2 months ago 826a38d
Simplifying handling of comments
2 files changed, 10 insertions(+), 22 deletions(-)

M etc/test.tal
M src/uxnfor.tal
M etc/test.tal => etc/test.tal +4 -8
@@ 34,12 34,9 @@
	( dez ) #1234 #1234 #1234 JMP2r

@padded ( -- )
	( | foo )
	#1234
	( | bar )
	#1234 #1234
	( | line 1 | line 2 | line 3 )
	#1234 #1234 #1234 JMP2r
	( | foo ) #1234
	( | bar ) #1234 #1234
	( | line 1 | line 2 | line 3 ) #1234 #1234 #1234 JMP2r

@eol-cond ( len* -- and )
	DUP2 #0002 EQU2 ?&byte


@@ 61,8 58,7 @@
		long body <send>
		#1234 <send>
		#5678 <send> }
	( | nesting )
	{ foo { bar }
	( | nesting ) { foo { bar }
		dez }
	foo { bar }
	dez

M src/uxnfor.tal => src/uxnfor.tal +6 -14
@@ 308,27 308,19 @@
	&end INC2 POP2r JMP2r

@<emit-comment> ( str* -- str* )
	INC2k INC2 LDA2 LIT2 "@| EQU2 ?<emit-mark>
	INC2k LDA2 LIT2 20 "| EQU2 ?<emit-line-comment>
	&>w ( -- )
	INC2k INC2 LDA2 [ LIT2 "@| ] NEQ2 ?{
		#0a <emit>
		LDAk <emit>
		#0a <emit>
		INC2 INC2 }
	&>w ( -- )
		LDAk #00 EQU ?&end
		LDAk <emit>
		INC2 LDAk #29 NEQ ?&>w
	LDAk <emit>
	&end ( str* -- str* )
	INC2 JMP2r

@<emit-line-comment> ( str* -- str* )
	<emit-comment>/>w
	DUP2 wcap/ INC2 LDA #28 EQU ?{ <emit-break-tab> }
	JMP2r

@<emit-mark> ( str* -: str* )
	#0a <emit>
	LDAk <emit>
	#0a <emit>
	INC2 INC2 !<emit-comment>/>w

@<emit-break-once> ( -: )
	;result/ptr LDA2 #0001 SUB2 LDA #1f GTH ?<emit-break-tab>
	JMP2r