Skip to content

Commit cbabaef

Browse files
committed
Help menu
1 parent ae0d74c commit cbabaef

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/launch/repl.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static const std::string multilineKeywords[] = {
2020
};
2121

2222
bool startREPL() {
23-
std::cout << "PseudoEngine2 v" << PseudoEngine2_VERSION_MAJOR << '.' << PseudoEngine2_VERSION_MINOR << '.' << PseudoEngine2_VERSION_PATCH << " REPL\nEnter 'EXIT' to quit\n";
23+
std::cout << "PseudoEngine2 v" << PseudoEngine2_VERSION_MAJOR << '.' << PseudoEngine2_VERSION_MINOR << '.' << PseudoEngine2_VERSION_PATCH << " REPL\nEnter '?' for help, 'EXIT' to quit\n";
2424

2525
Lexer lexer;
2626
Parser parser;
@@ -32,8 +32,12 @@ bool startREPL() {
3232

3333
size_t size = code.size();
3434
if (size == 0) continue;
35-
if (code == "EXIT") break;
36-
if (code.starts_with("RUNFILE")) {
35+
if (code == "?") {
36+
std::cout << "Visit https://github.com/SingularityT3/PseudoEngine2 for syntax, examples and more info\nUse `RUNFILE <filename>` to run programs stored in files" << std::endl;
37+
continue;
38+
} else if (code == "EXIT") {
39+
break;
40+
} else if (code.starts_with("RUNFILE")) {
3741
if (size < 9) {
3842
std::cerr << "Expected filename" << std::endl;
3943
continue;
@@ -45,10 +49,10 @@ bool startREPL() {
4549
}
4650
REPLMode = false;
4751

48-
std::cout << "Running file " << psfilename << "\n";
52+
std::cout << "==> Running file '" << psfilename << "'\n";
4953
std::string exit = runFile() ? "successfully" : "with an error";
50-
std::cout << "\nProgram exited " << exit << "\n";
51-
54+
std::cout << "\n==> Program exited " << exit << "\n";
55+
5256
psfilename = "<stdin>";
5357
REPLMode = true;
5458
continue;

0 commit comments

Comments
 (0)