-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Parser.hpp
47 lines (39 loc) · 1019 Bytes
/
Parser.hpp
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
47
//
// JoraLang
//
// Created by Pierre-Henry Soria on 31/07/2016.
// Copyright © 2016 Pierre-Henry Soria. All rights reserved.
//
#ifndef JORA_PARSER_H_INCLUDED
#define JORA_PARSER_H_INCLUDED
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <list>
namespace JoraLang
{
typedef std::list<std::string> tokenList;
class Parser {
public:
Parser();
Parser( const tokenList& );
void parse();
tokenList get(std::string);
void append( const tokenList& );
void append( std::string tok );
void clear();
bool empty() const;
std::string cur() const;
bool next();
bool find(const std::string&);
bool isFront( std::string ) const;
bool isNext( std::string ) const;
protected:
bool checkSize() const;
static std::set<char> m_specialTokens;
private:
tokenList m_tokens;
};
}
#endif // JORA_PARSER_H_INCLUDED