Skip to content

Commit 57a6e08

Browse files
Merge pull request #24 from JunLang-dev/development
v1.14.9
2 parents 6f86130 + d208e52 commit 57a6e08

File tree

7 files changed

+2
-79
lines changed

7 files changed

+2
-79
lines changed

.idea/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/JunLang.iml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/init.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <filesystem>
1111
using namespace std;
1212
#pragma GCC std("c++17")
13-
const string _VERSION_ = "v1.14.8";
13+
const string _VERSION_ = "v1.14.9";
1414
const int _BUFFER_SIZE_ = 1024;
1515
const string identifiers[] = {
1616
"output",

src/main.cpp

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,7 @@ int main(int argc, char* argv[]) {
44
if (argc == 1) {
55
cout << "JunLang " << _VERSION_ << endl;
66
cout << "Usage: " << argv[0] << " [filename]" << endl;
7-
string str;
8-
fstream f;
9-
string temp_filename = to_string(time(nullptr)) + ".jun";
10-
f.open(temp_filename, ios::out);
11-
while (cout << ">>", getline(cin, str)) {
12-
if (str[0] != '%') {
13-
f << str << endl;
14-
}
15-
else if (str.find("%run") != str.npos || str.find("%RUN") != str.npos || str.find("%Run") != str.npos) {
16-
char *file[] = {"", temp_filename.data()};
17-
read(file);
18-
cout << endl;
19-
}
20-
else if (str.find("%exit") != str.npos || str.find("%EXIT") != str.npos || str.find("%Exit") != str.npos) {
21-
f.close();
22-
filesystem::remove(temp_filename);
23-
exit(0);
24-
}
25-
else if (str.find("%save") != str.npos || str.find("%SAVE") != str.npos || str.find("%Save") != str.npos) {
26-
string filename;
27-
vector<string> vec(split(str, ' '));
28-
filename = vec[1];
29-
filesystem::remove(filename);
30-
filesystem::copy(temp_filename, filename);
31-
}
32-
else if (str.find("%open") != str.npos || str.find("%OPEN") != str.npos || str.find("%Open") != str.npos) {
33-
string filename;
34-
vector<string> vec(split(str, ' '));
35-
filename = vec[1];
36-
f.close();
37-
filesystem::remove(temp_filename);
38-
filesystem::copy(filename, temp_filename);
39-
f = fstream();
40-
f.open(temp_filename, ios::out);
41-
}
42-
else if (str.find("%clear") != str.npos || str.find("%CLEAR") != str.npos || str.find("%Clear") != str.npos) {
43-
f.close();
44-
f = fstream();
45-
f.open(temp_filename, ios::out);
46-
}
47-
else {
48-
cout << "%run\tRun the code in buffer." << endl;
49-
cout << "%exit\tExit editor." << endl;
50-
cout << "%save <filename>\tSave file." << endl;
51-
cout << "%open <filename>\tOpen file." << endl;
52-
cout << "%clear\tClear buffer." << endl;
53-
cout << "%help\tView this list." << endl;
54-
cout << "<code>\tPut code to buffer." << endl;
55-
}
56-
}
7+
exit(0);
578
}
589
read(argv);
5910
return 0;

0 commit comments

Comments
 (0)