summaryrefslogtreecommitdiff
path: root/util/epist/parser.hh
blob: a237053482d837821a35a5a480b80ab8f65d78db (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
#include "actions.hh"
#include "keytree.hh"

#include <string>

class parser {
public:
    parser(keytree *);
    ~parser();

    void parse(std::string);

    void setKey(std::string key)
    {  _key = key; }

    void setArgumentNum(std::string arg)
    { _arg = arg; }

    void setArgumentNegNum(std::string arg)
    { _arg = "-" + arg; }

    void setArgumentStr(std::string arg)
    { _arg = arg.substr(1, arg.size() - 2); }

    void setAction(std::string);
    void addModifier(std::string);
    void endAction();
    void startChain();
    void setChainBinding();
    void endChain();

private:
    void reset();

    keytree *_kt;
    unsigned int _mask;
    Action::ActionType _action;
    std::string _key;
    std::string _arg;
};