Lexer
class is a generic lexer for tom sources, not tied to a
particular parser. Subclasses of it are used by the tom and unit
parsers.
tom.MutableDictionary tokens;
redefine instance (id) alloc;
alloc
to provide some of Objective-C's
+initialize functionality.
void addToken (tom.ByteString, int) (name, number);
name
to the identifier-like tokens
as the
Token
value number
.
deferred void fillTokens;
tokens
by repeatedly invoking addToken
.
deferred class (gps.Parser) parserClass;
tom.MutableByteString buf;
int size;
int start;
int next;
int beyond;
int intvalue;
tom.ByteSubstring doc_tag;
buf
.
public mutable boolean docp;
TRUE
, we are supposedly interested in documentation.
public mutable boolean skips;
TRUE
, we do not collect semantics with the tokens.
redefine id initWithStream tom.InputStream s named tom.String n;
boolean docp tom.String tag;
TRUE
iff we are interested in documentation that starts
with the tag
. The default implementation simply asks self whether
docp
(plain).
int nextToken;
int semantics;
deferred int character;
deferred int identifier;
deferred int number;
deferred int string;
int documentation tom.String body tag tom.String tag at int line;
docp
is set while lexer thinks it should not. A
lexer genuinly interested in documentation, for the time being, should
return the correct documentation token to the caller, or it could
inform the parser
of the documentation, which avoids having to flood
the grammar with DOCUMENTATION tokens.
int documentation tom.String body tag tom.String tag;