Hi all,

I'm still stuck trying to get my recogniser to work on NMEA strings.
Part of my challenge in understanding this appears to be the word
parse.

Consider this which works as expected:

: ., [CHAR] , PARSE 2dup TYPE ;
 ok

> ., $abcdefg,12345 .s
$abcdefg3  12345 8 303  ok

Which indicates the word ., correctly parsed for the comma and the
remainder of the tib (which starts at address 300) was recognised as
the number 12345

> ., $abcdefg,a12345 .s
$abcdefg ?? -13 18

Again shows ., worked as expected and the rest of the tib, or "a12345"
 could not be interpreted


My lack of understanding arises now if I try the following word:

: parsetest
        ." type test string now: "
        tib dup 40 accept
        [char] , parse \ returns addr len of string delimited by ,
\       type
        ;
        
parsetest
type test string now: $abcdefg,12345
 ok
> .s
4  65535 310 14 300  ok
>

I can see the tib address on the stack (300 ) and 14 characters were
accepted. But PARSE no longer works.

>From other tests it appears parse is operating on the tib when it
contained "parsetest" and not after the input string was accepted.

Can anyone please confirm if I am correctly accepting the string or
using PARSE incorrectly?

Kind regards
Richard

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to