From 34acf54301dc872517c27d8c238185c58cbbef3b Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 22 Dec 2022 12:00:39 -0800 Subject: [PATCH] Print scope in warnings --- src/uxnlin.tal | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/uxnlin.tal b/src/uxnlin.tal index 0095077..3c6169d 100644 --- a/src/uxnlin.tal +++ b/src/uxnlin.tal @@ -7,6 +7,7 @@ @src $40 @token $30 &last $30 &last2 $30 + @scope $20 @stats &lines $2 &tokens $2 ( @@ -28,6 +29,8 @@ BRK @on-ready ( -> ) + ( set default scope ) + ;dict/default-scope ;scope ;scpy JSR2 #0a18 DEO ;src ,lint JSR ( halt ) @@ -80,13 +83,23 @@ JMP2r ( is blank ) ;token LDA #00 EQU ;&ignore JCN2 ( incr tokens ) .stats/tokens LDZ2k INC2 ROT STZ2 + ( dangle token ) + ;token + + ( set scope ) + LDAk LIT "@ NEQ ,&no-scope JCN + INC2k LDA ;ciuc JSR2 ,&no-scope JCN + DUP2 ;slen JSR2 #001f GTH2 ,&no-scope JCN + DUP2 ;scope ;scpy JSR2 + &no-scope + ( token length ) - ;token ;slen JSR2 #0019 LTH2 ,&no-clip JCN + DUP2 ;slen JSR2 #0019 LTH2 ,&no-clip JCN ;tokenlen ;print-warn JSR2 &no-clip ( chain include ) - ;token LDA LIT "~ NEQ ,&no-inc JCN + ( use dangling token ) LDA LIT "~ NEQ ,&no-inc JCN ;src DUP2 ;sclr JSR2 ;token INC2 OVR2 ;scpy JSR2 @@ -228,7 +241,9 @@ JMP2 @print-line ( -- ) - ;dict/line-txt ;pstr JSR2 + ;dict/in-txt ;pstr JSR2 + ;scope ;pstr JSR2 + ;dict/at-txt ;pstr JSR2 ;src ;pstr JSR2 LIT ": #18 DEO .stats/lines LDZ2 INC2 ;pdec JSR2 #0a18 DEO @@ -250,6 +265,7 @@ JMP2r ( @|stdlib ) +@ciuc ( c -- f ) LIT "A SUB #19 LTH JMP2r @scap ( str* -- end* ) LDAk #00 NEQ JMP JMP2r &w INC2 LDAk ,&w JCN JMP2r @sput ( chr str* -- ) ,scap JSR STA JMP2r @slen ( str* -- len* ) DUP2 ,scap JSR SWP2 SUB2 JMP2r @@ -332,11 +348,13 @@ JMP2r @dict &input "Input(.tal): 20 $1 - &line-txt ", 20 "at 20 $1 + &in-txt ", 20 "in 20 $1 + &at-txt ", 20 "at 20 $1 &linted-txt "Linted 20 $1 &with-txt "with $1 &tokens-txt "tokens $1 &lines-txt "lines $1 + &default-scope "@on-reset $1 ( @|hints )