remove trailing whitespace
This commit is contained in:
parent
77564fd414
commit
888911988d
20
regex.tal
20
regex.tal
|
@ -148,7 +148,7 @@
|
|||
&found POP2 POP2r #01 JMP2r ( 01 )
|
||||
&eof ;rx-reset JSR2 ( s* [r*] )
|
||||
DUP2 ;search-start STA2 ( s* [r*] )
|
||||
STH2r ;loop JMP2 ( b^ )
|
||||
STH2r ;loop JMP2 ( b^ )
|
||||
|
||||
( reset all "runtime" memory allocated during match/search )
|
||||
@rx-reset ( -> )
|
||||
|
@ -197,7 +197,7 @@
|
|||
&end-of-string POP2 #01 JMP2r
|
||||
&has-next ;loop JMP2
|
||||
|
||||
( handle the empty node -- just follow the next pointer )
|
||||
( handle the empty node -- just follow the next pointer )
|
||||
@do-empty ( str* regex* -> bool^ )
|
||||
INC2 LDA2 ( load next )
|
||||
;goto-next JMP2 ( jump to next )
|
||||
|
@ -234,7 +234,7 @@
|
|||
;match-multiline LDA ,&no-match JCN ( are we in multi-line mode? )
|
||||
DUP2 #0001 SUB2 LDA #0a EQU ,&at-start JCN ( just after newline? )
|
||||
&no-match POP2r POP2 ;goto-backtrack JMP2 ( clear stacks and backtrack )
|
||||
&at-start STH2r ;goto-next JMP2 ( go to next without advancing )
|
||||
&at-start STH2r ;goto-next JMP2 ( go to next without advancing )
|
||||
|
||||
( hande dollar -- match string end (or possibly before newline) without advancing )
|
||||
@do-dollar ( str* regex* -> bool^ )
|
||||
|
@ -242,7 +242,7 @@
|
|||
LDAk #00 EQU ,&at-end JCN ( at string end? )
|
||||
;match-multiline LDA ,&no-match JCN ( are we in multi-line mode? )
|
||||
LDAk #0a EQU ,&at-end JCN ( at newline? )
|
||||
&no-match POP2r POP2 ;goto-backtrack JMP2 ( clear stacks and backtrack )
|
||||
&no-match POP2r POP2 ;goto-backtrack JMP2 ( clear stacks and backtrack )
|
||||
&at-end STH2r ;goto-next JMP2 ( go to next without advancing )
|
||||
|
||||
( handle literal -- match one specific character )
|
||||
|
@ -267,7 +267,7 @@
|
|||
@matches-cls ( str* regex* -> bool^ )
|
||||
OVR2 LDA ,¬-null JCN
|
||||
( needs to have a character to match )
|
||||
POP2 POP2 ;goto-backtrack JMP2
|
||||
POP2 POP2 ;goto-backtrack JMP2
|
||||
¬-null
|
||||
DUP2 INC2 LDA2 STH2 ( str regex [next] )
|
||||
OVR2 INC2 STH2 ( str regex [str+1 next] )
|
||||
|
@ -328,7 +328,7 @@
|
|||
,&is-eof JCN ( pos s [c] )
|
||||
INC2 ( pos s+1 [c] )
|
||||
SWP2 STA2 ,&return JMP ( [c] )
|
||||
&is-eof POP2 POP2
|
||||
&is-eof POP2 POP2
|
||||
&return STHr ( c )
|
||||
JMP2r
|
||||
|
||||
|
@ -399,9 +399,9 @@
|
|||
DUP LIT '[ EQU ;c-lbrk JCN2
|
||||
DUP LIT '] EQU ;c-rbrk JCN2
|
||||
DUP LIT '\ EQU ;c-esc JCN2
|
||||
DUP LIT '* EQU ;c-star JCN2
|
||||
DUP LIT '+ EQU ;c-plus JCN2
|
||||
DUP LIT '? EQU ;c-qmark JCN2
|
||||
DUP LIT '* EQU ;c-star JCN2
|
||||
DUP LIT '+ EQU ;c-plus JCN2
|
||||
DUP LIT '? EQU ;c-qmark JCN2
|
||||
;c-char JMP2
|
||||
|
||||
( either finalize the given r0/r1 or else wrap it in )
|
||||
|
@ -460,7 +460,7 @@
|
|||
( 2. decrement parens )
|
||||
( 3. unroll the current region on the stack into one regex node )
|
||||
( 4. finalize that node and append it to the previous region )
|
||||
( 5. continue parsing )
|
||||
( 5. continue parsing )
|
||||
@c-rpar ( c^ -> r2* )
|
||||
POP
|
||||
;parens LDA2 #0000 EQU2 ,&mismatched-parens JCN
|
||||
|
|
Loading…
Reference in New Issue