1 //========================================================================
5 // Copyright 1996-2002 Glyph & Cog, LLC
7 //========================================================================
21 #define tokBufSize 128 // size of token buffer
23 //------------------------------------------------------------------------
25 //------------------------------------------------------------------------
30 // Construct a lexer for a single stream. Deletes the stream when
32 Lexer(XRef
*xref
, Stream
*str
);
34 // Construct a lexer for a stream or array of streams (assumes obj
35 // is either a stream or array of streams).
36 Lexer(XRef
*xref
, Object
*obj
);
41 // Get the next object from the input stream.
42 Object
*getObj(Object
*obj
);
44 // Skip to the beginning of the next line in the input stream.
45 void skipToNextLine();
47 // Skip over one character.
48 void skipChar() { getChar(); }
52 { return curStr
.isNone() ? (Stream
*)NULL
: curStr
.getStream(); }
54 // Get current position in file. This is only used for error
55 // messages, so it returns an int instead of a Guint.
57 { return curStr
.isNone() ? -1 : (int)curStr
.streamGetPos(); }
59 // Set position in file.
60 void setPos(Guint pos
, int dir
= 0)
61 { if (!curStr
.isNone()) curStr
.streamSetPos(pos
, dir
); }
68 Array
*streams
; // array of input streams
69 int strPtr
; // index of current stream
70 Object curStr
; // current stream
71 GBool freeArray
; // should lexer free the streams array?
72 char tokBuf
[tokBufSize
]; // temporary token buffer