rename next to advance
parent
28dae46b7d
commit
09e4d34ff2
|
@ -38,7 +38,7 @@ SYMBOL: tagstack
|
|||
swap >>text ; inline
|
||||
|
||||
: (read-quote) ( state-parser ch -- string )
|
||||
'[ [ current _ = ] take-until ] [ next drop ] bi ;
|
||||
'[ [ current _ = ] take-until ] [ advance drop ] bi ;
|
||||
|
||||
: read-single-quote ( state-parser -- string )
|
||||
CHAR: ' (read-quote) ;
|
||||
|
@ -69,12 +69,12 @@ SYMBOL: tagstack
|
|||
">" take-until-sequence dtd new-tag push-tag ;
|
||||
|
||||
: read-bang ( state-parser -- )
|
||||
next dup { [ current CHAR: - = ] [ peek-next CHAR: - = ] } 1&&
|
||||
[ next next read-comment ] [ read-dtd ] if ;
|
||||
advance dup { [ current CHAR: - = ] [ peek-next CHAR: - = ] } 1&&
|
||||
[ advance advance read-comment ] [ read-dtd ] if ;
|
||||
|
||||
: read-tag ( state-parser -- string )
|
||||
[ [ current "><" member? ] take-until ]
|
||||
[ dup current CHAR: < = [ next ] unless drop ] bi ;
|
||||
[ dup current CHAR: < = [ advance ] unless drop ] bi ;
|
||||
|
||||
: read-until-< ( state-parser -- string )
|
||||
[ current CHAR: < = ] take-until ;
|
||||
|
@ -104,7 +104,7 @@ SYMBOL: tagstack
|
|||
] state-parse ;
|
||||
|
||||
: read-< ( state-parser -- string/f )
|
||||
next dup current [
|
||||
advance dup current [
|
||||
CHAR: ! = [ read-bang f ] [ read-tag ] if
|
||||
] [
|
||||
drop f
|
||||
|
|
|
@ -24,15 +24,15 @@ TUPLE: state-parser sequence n ;
|
|||
: peek-next ( state-parser -- char/f )
|
||||
[ n>> 1 + ] keep state-parser-nth ; inline
|
||||
|
||||
: next ( state-parser -- state-parser )
|
||||
: advance ( state-parser -- state-parser )
|
||||
[ 1 + ] change-n ; inline
|
||||
|
||||
: get+increment ( state-parser -- char/f )
|
||||
[ current ] [ next drop ] bi ; inline
|
||||
[ current ] [ advance drop ] bi ; inline
|
||||
|
||||
:: skip-until ( state-parser quot: ( obj -- ? ) -- )
|
||||
state-parser current [
|
||||
state-parser quot call [ state-parser next quot skip-until ] unless
|
||||
state-parser quot call [ state-parser advance quot skip-until ] unless
|
||||
] when ; inline recursive
|
||||
|
||||
: state-parse-end? ( state-parser -- ? ) peek-next not ;
|
||||
|
@ -67,7 +67,7 @@ TUPLE: state-parser sequence n ;
|
|||
] take-until :> found
|
||||
found dup length
|
||||
growing length 1- - head
|
||||
state-parser next drop ;
|
||||
state-parser advance drop ;
|
||||
|
||||
: skip-whitespace ( state-parser -- state-parser )
|
||||
[ [ current blank? not ] take-until drop ] keep ;
|
||||
|
|
Loading…
Reference in New Issue