summaryrefslogtreecommitdiff
path: root/src/lexer.h
blob: 57b2865b6db77dc9221bffbda9ba88908db46644 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef LEXER_H
#define LEXER_H

#include <bu/stream.h>

class Token;

class Lexer
{
public:
    Lexer( Bu::Stream &rIn );
    virtual ~Lexer();

    enum Mode
    {
        modeNormal,
        modeCommand,
    };

    void setMode( Mode e ) { eMode = e; }
    Mode getMode() const { return eMode; }

    Token nextToken();

    int getScale() const { return iScale; }
    void setScale( int i ) { iScale = i; }

    int getRadix() const { return iRadix; }
    void setRadix( int i );

private:
    Token nextTokenNormal();
    Token nextTokenCommand();

private:
    Bu::Stream &rIn;
    Bu::String sBuf;
    int iBufPos;
    int iScale;
    int iRadix;
    char numRangeTop;
    char ascRangeTop;
    Mode eMode;
};

#endif