2
//========================================================================
6
// Copyright 1996-2002 Glyph & Cog, LLC
8
//========================================================================
15
#ifdef USE_GCC_PRAGMAS
24
#define tokBufSize 128 // size of token buffer
26
//------------------------------------------------------------------------
28
//------------------------------------------------------------------------
33
// Construct a lexer for a single stream. Deletes the stream when
35
Lexer(XRef *xref, Stream *str);
37
// Construct a lexer for a stream or array of streams (assumes obj
38
// is either a stream or array of streams).
39
Lexer(XRef *xref, Object *obj);
44
// Get the next object from the input stream.
45
Object *getObj(Object *obj);
47
// Skip to the beginning of the next line in the input stream.
48
void skipToNextLine();
50
// Skip over one character.
51
void skipChar() { getChar(); }
55
{ return curStr.isNone() ? (Stream *)NULL : curStr.getStream(); }
57
// Get current position in file. This is only used for error
58
// messages, so it returns an int instead of a Guint.
60
{ return curStr.isNone() ? -1 : (int)curStr.streamGetPos(); }
62
// Set position in file.
63
void setPos(Guint pos, int dir = 0)
64
{ if (!curStr.isNone()) curStr.streamSetPos(pos, dir); }
71
Array *streams; // array of input streams
72
int strPtr; // index of current stream
73
Object curStr; // current stream
74
GBool freeArray; // should lexer free the streams array?
75
char tokBuf[tokBufSize]; // temporary token buffer