📄 lexicalanalyzer.h
字号:
#pragma once
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <assert.h>
#include <iostream>
#include <string>
#include <queue>
using namespace std;
#include "SymbolTable.h"
class LexicalAnalyzer
{
public:
// static LexicalAnalyzer* getInstance(string src);
string getNextToken(string& token);
bool eof();
LexicalAnalyzer(char* src);
~LexicalAnalyzer(void);
private:
void transLetter(int startState, int endState);
void transDigit(int startState, int endState);
void transEpsilon(int startState, int endState);
void transWhite();
set<int> move(set<int> S, char a);
set<int> getEpsilonClosure(set<int> T);
SymbolTable symbTbl;
char getNextChar();
// static LexicalAnalyzer* instance;
set<int>** transitionTable;
queue<char> innedSq;
queue<char> lastSq;
int curLexLen;
int NUM_OF_STATES;
ifstream infile;
string currentToken;
int currentFinalState;
bool* isFinal;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -