inline everything so stuff compiles
parent
6585133cc1
commit
ccdef35949
|
@ -46,7 +46,7 @@ TUPLE: link attributes clickable ;
|
||||||
: find-between-all ( vector quot -- seq )
|
: find-between-all ( vector quot -- seq )
|
||||||
dupd
|
dupd
|
||||||
'[ _ [ closing?>> not ] bi and ] find-all
|
'[ _ [ closing?>> not ] bi and ] find-all
|
||||||
[ first2 find-between* ] with map ;
|
[ first2 find-between* ] with map ; inline
|
||||||
|
|
||||||
: remove-blank-text ( vector -- vector' )
|
: remove-blank-text ( vector -- vector' )
|
||||||
[
|
[
|
||||||
|
@ -113,7 +113,7 @@ TUPLE: link attributes clickable ;
|
||||||
[ clickable>> [ bl bl text>> print ] each nl ] bi ;
|
[ clickable>> [ bl bl text>> print ] each nl ] bi ;
|
||||||
|
|
||||||
: find-by-text ( seq quot -- tag )
|
: find-by-text ( seq quot -- tag )
|
||||||
[ dup name>> text = ] prepose find drop ;
|
[ dup name>> text = ] prepose find drop ; inline
|
||||||
|
|
||||||
: find-opening-tags-by-name ( name seq -- seq )
|
: find-opening-tags-by-name ( name seq -- seq )
|
||||||
[ [ name>> = ] [ closing?>> not ] bi and ] with find-all ;
|
[ [ name>> = ] [ closing?>> not ] bi and ] with find-all ;
|
||||||
|
|
|
@ -137,7 +137,7 @@ SYMBOL: tagstack
|
||||||
] when ;
|
] when ;
|
||||||
|
|
||||||
: tag-parse ( quot -- vector )
|
: tag-parse ( quot -- vector )
|
||||||
V{ } clone tagstack [ string-parse ] with-variable ;
|
V{ } clone tagstack [ string-parse ] with-variable ; inline
|
||||||
|
|
||||||
: parse-html ( string -- vector )
|
: parse-html ( string -- vector )
|
||||||
[ (parse-html) tagstack get ] tag-parse ;
|
[ (parse-html) tagstack get ] tag-parse ;
|
||||||
|
|
|
@ -5,22 +5,22 @@ IN: html.parser.state
|
||||||
|
|
||||||
TUPLE: state string i ;
|
TUPLE: state string i ;
|
||||||
|
|
||||||
: get-i ( -- i ) state get i>> ;
|
: get-i ( -- i ) state get i>> ; inline
|
||||||
|
|
||||||
: get-char ( -- char )
|
: get-char ( -- char )
|
||||||
state get [ i>> ] [ string>> ] bi ?nth ;
|
state get [ i>> ] [ string>> ] bi ?nth ; inline
|
||||||
|
|
||||||
: get-next ( -- char )
|
: get-next ( -- char )
|
||||||
state get [ i>> 1+ ] [ string>> ] bi ?nth ;
|
state get [ i>> 1+ ] [ string>> ] bi ?nth ; inline
|
||||||
|
|
||||||
: next ( -- )
|
: next ( -- )
|
||||||
state get [ 1+ ] change-i drop ;
|
state get [ 1+ ] change-i drop ; inline
|
||||||
|
|
||||||
: string-parse ( string quot -- )
|
: string-parse ( string quot -- )
|
||||||
[ 0 state boa state ] dip with-variable ;
|
[ 0 state boa state ] dip with-variable ; inline
|
||||||
|
|
||||||
: short* ( n seq -- n' seq )
|
: short* ( n seq -- n' seq )
|
||||||
over [ nip dup length swap ] unless ;
|
over [ nip dup length swap ] unless ; inline
|
||||||
|
|
||||||
: skip-until ( quot: ( -- ? ) -- )
|
: skip-until ( quot: ( -- ? ) -- )
|
||||||
get-char [
|
get-char [
|
||||||
|
@ -30,12 +30,12 @@ TUPLE: state string i ;
|
||||||
|
|
||||||
: take-until ( quot: ( -- ? ) -- )
|
: take-until ( quot: ( -- ? ) -- )
|
||||||
get-i [ skip-until ] dip get-i
|
get-i [ skip-until ] dip get-i
|
||||||
state get string>> subseq ;
|
state get string>> subseq ; inline
|
||||||
|
|
||||||
: string-matches? ( string circular -- ? )
|
: string-matches? ( string circular -- ? )
|
||||||
get-char over push-growing-circular sequence= ;
|
get-char over push-growing-circular sequence= ; inline
|
||||||
|
|
||||||
: take-string ( match -- string )
|
: take-string ( match -- string )
|
||||||
dup length <growing-circular>
|
dup length <growing-circular>
|
||||||
[ 2dup string-matches? ] take-until nip
|
[ 2dup string-matches? ] take-until nip
|
||||||
dup length rot length 1- - head next ;
|
dup length rot length 1- - head next ; inline
|
||||||
|
|
Loading…
Reference in New Issue