Skip to content

Commit 315f3cb

Browse files
Manuel AstudilloManuel Astudillo
Manuel Astudillo
authored and
Manuel Astudillo
committed
Added new symbol enums and removed a warning.
1 parent daaf578 commit 315f3cb

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

include/SymbolTable.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@
2020
#include "misc.h"
2121
#include <string>
2222

23-
enum SymbolType {TERMINAL = 1, NON_TERMINAL = 0};
23+
enum SymbolType
24+
{
25+
TERMINAL = 1,
26+
NON_TERMINAL = 0,
27+
WHITESPACE = 2,
28+
END_SYMBOL = 3,
29+
START_COMMENT = 4,
30+
END_COMMENT = 5,
31+
LINE_COMMENT = 6
32+
};
2433

2534
typedef struct SymbolStruct {
2635
std::wstring name;

src/DFA.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,28 +181,24 @@
181181
tokenBeginCol = currentCol;
182182
break;
183183

184-
// Whitespaces
185-
case 2:
184+
case WHITESPACE:
186185
// Just dont do anything or generate error for token not accepted
187186
tokenBeginCol = currentCol;
188187
break;
189188

190-
// End symbol
191-
case 3:
189+
case END_SYMBOL:
192190
wprintf (L"EOF SYMBOL");
193191
break;
194192

195-
// Comment Start
196-
case 4:
193+
case START_COMMENT:
197194
commentBlock = true;
198195
break;
199196

200-
// Comment End
201-
case 5:
197+
case END_COMMENT:
202198
commentBlock = false;
203199
break;
204200

205-
case 6:
201+
case LINE_COMMENT:
206202
commentLine = true;
207203
break;
208204
}

0 commit comments

Comments
 (0)