toka.nbk: Home | Index | Next Page: Ports | Previous Page: parser
Implement the parser.
Variables:
FILE *input[]
Current file stream to parse from. Setup as
an array of 8 inputs.
long isp
Pointer to the most recent input source in the array
long base
Holds the current numeric base
long parser
When ON (TRUE), system parsing words will parse. When
OFF (FALSE), they will take a string from the stack.
to_number()
Attempt to convert a string (on TOS) to a number.
This accepts a format of:
[-]number
If successful, it leaves the number and a flag of
-1 on the stack. Otherwise, it leaves the original
string, and a flag of 0.
parse()
Parse the input buffer until the character passed
on TOS is found, or until the end of the line is
encountered. Return a pointer to the resulting
string on the stack.
get_token(char *s, long delim)
Return a string (in "s") up to the specified
delimiter. This also puts the resulting string
on the stack.
long include_file(char *s)
Attempt to open a file ("s") and add it to the
top of the input stack.
include()
Take a filename off the stack, attempt to open
it and add it to the input stream if successful.
needs()
Take a filename off the stack. Attempt to open it
from the library, and add it to the input stream
if successful.
force_eof()
Remove the current file from the input stack. This
can be used to abort an include.
>number parser parse include needs end.
toka.nbk: Home | Index | Next Page: Ports | Previous Page: parser
Notebook exported on Sunday, 1 July 2007, 19:54:43 PM EDT