-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCGTFile.h
More file actions
117 lines (85 loc) · 2.59 KB
/
Copy pathCGTFile.h
File metadata and controls
117 lines (85 loc) · 2.59 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/***************************************************************************
CGTFile.h -
Encapsulates the Compiled Grammar Table File
read operations and structures.
-------------------
begin : Sat Jun 1 2002
copyright : (C) 2002 by Manuel Astudillo
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/
#ifndef _GP_CGTFILE_H
#define _GP_CGTFILE_H
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include "misc.h"
#include "DFA.h"
#include "LALR.h"
#include "SymbolTable.h"
#include "GrammarInfo.h"
using namespace std;
typedef struct EntryStruct {
bool vBool;
integer vInteger;
byte vByte;
wstring vString;
} EntryStruct ;
#if defined (WIN32) && defined (_USRDLL)
class __declspec(dllexport) CGTFile;
#endif
class CGTFile {
public:
CGTFile ();
~CGTFile ();
/*
Loads a CGT File.
Returns true if succesfull, false if error.
*/
bool load (char *filename);
bool load (ifstream *myStream);
GrammarInfo *getInfo ();
DFA *getScanner ();
LALR *getParser ();
char *getError ();
void printInfo ();
private:
void readEntry (EntryStruct *entry);
wstring readUnicodeString ();
// Header
wstring header;
// Info
GrammarInfo *gInfo;
bool caseSensitive;
integer startSymbol;
char *errorString;
ifstream *theStream;
// Character Table
integer nbrCharacterSets;
CharacterSetTable *characterSetTable;
// Symbol Table
integer nbrSymbolTable;
SymbolTable *symbolTable;
// DFA Table
integer nbrDFATable;
DFAStateTable *stateTable;
// Rules Table
integer nbrRuleTable;
RuleTable *ruleTable;
// LALR Table
integer nbrLALRTable;
LALRStateTable *LALRTable;
// Init States
integer DFAInit;
integer LALRInit;
DFA *theDFA;
LALR *theLALR;
};
#endif