Parsing slate files

John Leuner jewel at pixie.co.za
Sat Jun 5 04:35:49 PDT 2004


How do I determine when the parser has reached the last node in a file?

When I call (aparser next) it continuously returns a Nil Literal. What
is the correct test to determine EOF/EOS?

(The code below is the result of experimentation, it is not intended to
be coherent)

s@(String traits) fileIn
[ | input aparser interp p|
" Console ; 'Filing in $'' ; s ; '$'.$\n'."
 input: (File open: s).
 aparser: ((Syntax Parser clone) newOn: (input reader)).
 p: aparser next.
 [ p is: Syntax Literal /\ (p value) isNil] whileFalse: [ (lobby
interpretHook: [ p evaluateIn: lobby ]).
   p: aparser next.
 ].
" (lobby interpretHook: [ (aparser next) evaluateIn: lobby ]).
 (lobby interpretHook: [ (aparser next) evaluateIn: lobby ]).
 (lobby interpretHook: [ (aparser next) evaluateIn: lobby ])."
 input close.
].

-- 
John Leuner <jewel at pixie.co.za>




More information about the Slate mailing list