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