This repository was archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRG_Substitution.h
More file actions
63 lines (44 loc) · 1.35 KB
/
RG_Substitution.h
File metadata and controls
63 lines (44 loc) · 1.35 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
/**
* @file RG_Substitution.h
* @author Yacine Smaoui, Florian Hemmelgarn
*
* @brief Definition of the Substitution class
*/
#ifndef SUBSTITUTION_H_
#define SUBSTITUTION_H_
#include <string>
#include "RG_DynArray.h"
using namespace std;
struct flaggedString {
string s;
int isTerminal;
};
/**
* @class Substitution
* @brief defines the right side of a Production in a Grammar
*
* composed of:
* A RawString : the substitution in a string form without any editing.
* and a DecodedSubstitution: a DynArray containing the different Terminals and Non-Terminals composing the Substitution
*/
class Substitution
{
public:
Substitution();
~Substitution();
void decode(DynArray<string> referenceTerminals, DynArray<string> referenceNonTerminals);
void setRawString(string s);
string getRawString();
DynArray<flaggedString>* getDecodedSubstitution();
string toString();
flaggedString getSymbol(int index);
int symbolIsTerminal(int index);
string getSymbolstring(int index);
int getDecodedSubstitutionLength();
private:
/** the substitution in a string form without any editing */
string rawString;
/** a DynArray containing the different Terminals and Non-Terminals composing the Substitution */
DynArray<flaggedString> decodedSubstitution;
};
#endif /* SUBSTITUTION_H_ */