# Correct the needed linklibs in curl-config also.
[AROS-Contrib.git] / arospdf / xpdf / Lexer.h
blob6685a794cbf1b366e115384a0715e34070cb0b31
1 //========================================================================
2 //
3 // Lexer.h
4 //
5 // Copyright 1996-2003 Glyph & Cog, LLC
6 //
7 //========================================================================
9 #ifndef LEXER_H
10 #define LEXER_H
12 #include <aconf.h>
14 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
18 #include "Object.h"
19 #include "Stream.h"
21 class XRef;
23 #define tokBufSize 128 // size of token buffer
25 //------------------------------------------------------------------------
26 // Lexer
27 //------------------------------------------------------------------------
29 class Lexer {
30 public:
32 // Construct a lexer for a single stream. Deletes the stream when
33 // lexer is deleted.
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);
40 // Destructor.
41 ~Lexer();
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(); }
52 // Get stream.
53 Stream *getStream()
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.
58 int getPos()
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);
68 private:
70 int getChar();
71 int lookChar();
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
80 #endif