filters
Lexer.h00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef LEXER_H
00010 #define LEXER_H
00011
00012 #include <aconf.h>
00013
00014 #ifdef USE_GCC_PRAGMAS
00015 #pragma interface
00016 #endif
00017
00018 #include "Object.h"
00019 #include "Stream.h"
00020
00021 class XRef;
00022
00023 #define tokBufSize 128 // size of token buffer
00024
00025
00026
00027
00028
00029 class Lexer {
00030 public:
00031
00032
00033
00034 Lexer(XRef *xref, Stream *str);
00035
00036
00037
00038 Lexer(XRef *xref, Object *obj);
00039
00040
00041 ~Lexer();
00042
00043
00044 Object *getObj(Object *obj);
00045
00046
00047 void skipToNextLine();
00048
00049
00050 void skipChar() { getChar(); }
00051
00052
00053 Stream *getStream()
00054 { return curStr.isNone() ? (Stream *)NULL : curStr.getStream(); }
00055
00056
00057
00058 int getPos()
00059 { return curStr.isNone() ? -1 : (int)curStr.streamGetPos(); }
00060
00061
00062 void setPos(Guint pos, int dir = 0)
00063 { if (!curStr.isNone()) curStr.streamSetPos(pos, dir); }
00064
00065 private:
00066
00067 int getChar();
00068 int lookChar();
00069
00070 Array *streams;
00071 int strPtr;
00072 Object curStr;
00073 GBool freeArray;
00074 char tokBuf[tokBufSize];
00075 };
00076
00077 #endif
|