Newer
Older
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
// [lexeme-list.h]
// -------------------------------------------------------------------------------------------- //
// lexeme list
// -------------------------------------------------------------------------------------------- //
#include "lexeme.h"
namespace scm
{
class LexemeList {
public:
// add calls
// -------------------------------------------------------------------------------------------- //
void add(const char* token, const Lexeme::TYPE type, const int tag);
void add(const char* token, const Lexeme::TYPE type);
// -------------------------------------------------------------------------------------------- //
// get calls
// -------------------------------------------------------------------------------------------- //
int get_size() const;
const Lexeme get_lexeme(const int idx) const;
const char* get_token(const int idx) const;
Lexeme::TYPE get_type(const int idx) const;
int get_tag(const int idx) const;
// -------------------------------------------------------------------------------------------- //
// check lexeme type
// -------------------------------------------------------------------------------------------- //
bool is_operator(const int idx) const;
bool is_function(const int idx) const;
bool is_ctor(const int idx) const;
bool is_value(const int idx) const;
// -------------------------------------------------------------------------------------------- //
// clear & reset
// -------------------------------------------------------------------------------------------- //
void clear();
void reset();
// -------------------------------------------------------------------------------------------- //
// swap & assignment
// -------------------------------------------------------------------------------------------- //
const LexemeList& operator=(LexemeList list);
void swap(LexemeList& list);
// -------------------------------------------------------------------------------------------- //
// -------------------------------------------------------------------------------------------- //
LexemeList();
LexemeList(const LexemeList& list);
~LexemeList();
// -------------------------------------------------------------------------------------------- //
private:
// data (private):
// -------------------------------------------------------------------------------------------- //
Lexeme *lexeme;
int size;
int nalloc;
static const int c_nalloc_inc = 256;
};
}
// -------------------------------------------------------------------------------------------- //