| Re: Parsing text files with standard words |
|
 |
|
 |
|
 |
|
 |
Group: comp.lang.forth · Group Profile
Author: David N. WilliamsDavid N. Williams Date: Sep 19, 2008 04:21
Gerry wrote:
> [...]
>
> OK I'll work one up, but I would prefer to do it via a FILE-
> SOURCE proposal with EXECUTE-PARSING-FILE as a fall-back.
Good!
As a data point, the approach that I have followed has been to
straightforwardly mimic the usual input stream words on a line
file input stream with a file text input buffer and parse area
and a file input stream stack.
So, there are words like:
LFSOURCE LFPARSE-AREA@ LFPARSE-AREA!
EMPTY-LFPARSE-AREA
LFPARSE LFPARSE-NAME
LFREFILL SAVE-LFIN RESTORE-LFIN
The user explicity opens and closes the file input stream, and
any of the usual parsing words, such as those in the ToolBelt,
can be mimicked pretty much by just inserting names like those
above in place of their counterparts.
|