In article ,   
   Hans Bezemer wrote:   
   >On 10-10-2024 11:57, dxf wrote:   
   >> I wasn't aware you had reverse split.   
   >> I was coming to the conclusion SCAN< as I defined it was of little   
   >> value on it's own and planned to subsume it into reverse split.   
   >> OTOH a reverse SCAN that gave the same results as forward SCAN might   
   >> be useful.   
   >   
   >I got a full load of the whole shebang - since I have to parse some   
   >crazy stuff sometimes. It may not be pretty, but it served me well   
   >through the years (since 2004).   
   >   
   >Basically I can scan whatever I like however I like it:   
   >   
   >---8<---   
   >: (NO) NOT ;   
   >: (YES) ;   
   >   
   >defer is-type ( c -- f)   
   >   
   >: (-tokenize) ( a1 n2 xt -- a2 n2 )   
   > is ?not begin dup while 2dup 1- chars + c@ is-type ?not while 1- repeat   
   >;   
   > ( a1 n2 xt -- a2 n2)   
   >: (tokenize) is ?not begin dup while over c@ is-type ?not while chop   
   >repeat ;   
   >: scan> ['] (no) (tokenize) ; ( a1 n1 -- a2 n2 )   
   >: scan< ['] (no) (-tokenize) ; ( a1 n1 -- a2 n2 )   
   >: skip> ['] (yes) (tokenize) ; ( a1 n1 -- a2 n2 )   
   >: skip< ['] (yes) (-tokenize) ; ( a1 n1 -- a2 n2 )   
   >: split> 2dup scan> 2swap >r over r> swap - ;   
   >: split< dup >r scan< 2dup chars + -rot r> over - -rot ;   
   > ( a1 n1 -- a2 n2 a3 n3)   
   >---8<---   
   >   
   >It's still 4tH stuff so your mileage may vary.   
      
   Compare to what I'm doing. Promoting the actual API specification   
   so that you can decide whether you want to actually use it.   
      
    $/   
      
      
    STACKEFFECT: sc c --- sc1 sc2   
      
    DESCRIPTION: []   
      
    Find the first c in the string constant sc and split it at that   
    address. Return the strings after and before c into sc1 and sc2   
    respectively. If the character is not present sc1 is a null string   
    (its address is zero) and sc2 is the original string. Both sc1 and sc2   
    may be empty strings (i.e. their count is zero), if c is the last or   
    first character in sc .   
      
   >   
   >Hans Bezemer   
   >   
   --   
   Temu exploits Christians: (Disclaimer, only 10 apostles)   
   Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall   
   Art For Home, Office And Garden Decor - Perfect For Windows, Bars,   
   And Gifts For Friends Family And Colleagues.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|