-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaScanner.cpp
More file actions
48 lines (36 loc) · 940 Bytes
/
JavaScanner.cpp
File metadata and controls
48 lines (36 loc) · 940 Bytes
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
//
// main.cpp
// JavaScanner
//
// Created by 靳洪博 on 16/4/30.
// Copyright © 2016年 靳洪博. All rights reserved.
//
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include "SpecialBuffer.hpp"
#include "Scanner.hpp"
#include "Token.hpp"
using namespace std;
int main(int argc, const char * argv[]) {
if (argc == 3) {
Scanner scan(argv[1]);
scan.scan();
for (int i = 0; i < scan.tokens.size(); i ++) {
cout<<scan.tokens[i].toString()<<endl;
}
scan.write(argv[2]);
} else {
Scanner scan("./Test-Lexcial.java");
scan.scan();
for (int i = 0; i < scan.tokens.size(); i ++) {
cout<<scan.tokens[i].toString()<<endl;
}
scan.write("./scanner_output.txt");
}
return 0;
}