mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-24 00:38:06 +11:00
2d17b4e8ec
I'm not sure why I chose null-terminated initially. Probably because the z80asm version had null-terminated strings. Length-prefixes strings are the traditional form of strings in Forth and it's a bit easier to work with them with traditional forth words when they're under this form.
12 lines
309 B
Plaintext
12 lines
309 B
Plaintext
( strings being sent to parse routines are always null
|
|
terminated )
|
|
|
|
: (parsec) ( a -- n f )
|
|
( apostrophe is ASCII 39 )
|
|
DUP 1+ C@ 39 = OVER 3 + C@ 39 = AND ( a f )
|
|
NOT IF 0 EXIT THEN ( a 0 )
|
|
( surrounded by apos, good, return )
|
|
2+ C@ 1 ( n 1 )
|
|
;
|
|
|