-
Notifications
You must be signed in to change notification settings - Fork 0
/
Parser.h
79 lines (61 loc) · 1.71 KB
/
Parser.h
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
72
73
74
75
76
77
78
79
/*
* File: Parser.h
* Author: RAJIB AHMED - raae10
* Author: MOHAMMAD ABDUR RAZZAK - morc10
*
* Created on November 15, 2011, 7:20 AM
*/
#ifndef PARSER_H
#define PARSER_H
#define SEPARATOR -1
#define END_LINE "_*_"
#define LOCATIONS 142
#define VERBS 50
#define LONG_DESC_SECTION 0
#define SHORT_DESC_SECTION 1
#define TRAVEL_TABLE 2
#define VOCABULARY 3
#define ELEMENT_DESC 4
#define ELEMENT_LOCATION 6
#define ABBR_MSG 5
#define ACTIONS 7
#define LIQUID_ASSET 8
#define CLASS_MSG 9
#define HINTS 10
#define MAGIC_WORDS 11
#include <iostream>
#include <map>
#include "Node.h"
#include "Element.h"
using namespace std;
class Parser {
public:
string fileData;
Node* locations[LOCATIONS] ;
Element* elements[65];
int element_counter;
int action_verbs[32];
string abbr_messages[202];
map <string, int> vocabulary;
size_t start_idx;
size_t end_idx;
//METHODS
Parser(string file);
~Parser();
void parse_locations(string &line, int first_number=0);
void parse_vocabulary(string &line);
void parse_travel_table(string &line, int first_number=0);
void parse_element_desc(string &line);
void parse_element_location(string &line);
void parse_actions(string &line);
void parse_player_classification(string &line);
void parse_abbr_msg(string &line);
bool is_object(string key);
bool is_special(string key);
bool is_motion(string key);
bool is_action(string key);
string tokenizer(string &line , string d="\t");
private:
int getFirstNumberOf(string &line);
};
#endif /* PARSER_H */