You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.3 KiB
51 lines
1.3 KiB
1 year ago
|
#include <string>
|
||
|
#include <iostream>
|
||
|
#include <vector>
|
||
|
#include <fstream>
|
||
|
#include <sstream>
|
||
|
#include "lexer/Token.h"
|
||
|
#include "lexer/Lexer.h"
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
//int main() {
|
||
|
//#ifdef __WIN32__
|
||
|
// system("chcp 65001");
|
||
|
//#endif
|
||
|
// string a;
|
||
|
//cin >>a;
|
||
|
// fstream file;
|
||
|
// file.open("../learn2.sql", ios::in);
|
||
|
//
|
||
|
// if (!file.is_open()) {
|
||
|
// cout << "打开文件时发生错误";
|
||
|
// return -1;
|
||
|
// }
|
||
|
//
|
||
|
// stringstream stream;
|
||
|
// stream << file.rdbuf();
|
||
|
// string str = stream.str();
|
||
|
//
|
||
|
//// cout << str << endl;
|
||
|
//
|
||
|
// Lexer parser = Lexer(str.data());
|
||
|
//
|
||
|
// parser.lexAll();
|
||
|
//
|
||
|
// vector<Token> tokens = parser.getResults();
|
||
|
//
|
||
|
// cout << "-------------------------" << endl;
|
||
|
// cout << "总的Token数量: " << tokens.size() << endl;
|
||
|
// int count = 0;
|
||
|
// for (const auto &token: tokens) {
|
||
|
// cout << "-------------------------" << endl;
|
||
|
// cout << count++ << endl;
|
||
|
// cout << "内容: \t" << token.getContent() << endl;
|
||
|
// cout << "类型: \t" << TokenTypeName[token.getType()] << endl;
|
||
|
// cout << "长度: \t" << token.getLocation().length << endl;
|
||
|
// cout << "位置: \t[行:" << token.getLocation().line << ", 开始: " << token.getLocation().startChar << "]" << endl;
|
||
|
// }
|
||
|
//
|
||
|
// return 0;
|
||
|
//}
|