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
, xObject
*obj
);
43 // Get the next xObject from the input stream.
44 xObject
*getObj(xObject
*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
); }
65 // Returns true if <c> is a whitespace character.
66 static GBool
isSpace(int c
);
73 Array
*streams
; // array of input streams
74 int strPtr
; // index of current stream
75 xObject curStr
; // current stream
76 GBool freeArray
; // should lexer free the streams array?
77 char tokBuf
[tokBufSize
]; // temporary token buffer