Skip to content

Commit

Permalink
Improved REPL console with coloring and title.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Oct 28, 2024
1 parent 6ae48e2 commit 5e1f28d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/zhivo/core/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* along with Zhivo. If not, see <https://www.gnu.org/licenses/>.
*/

#include <Zhivo.hpp>

#include <zhivo/ast/ASTNode.hpp>
#include <zhivo/ast/ASTNodeException.hpp>
#include <zhivo/ast/TerminativeSignal.hpp>
Expand Down Expand Up @@ -102,7 +104,15 @@ void Runtime::repl() {
std::string input, line;
int iterNum = 1;

std::cout << ">>> ";
std::cout
<< "\u001b[1;36mZhivo Programming Language ("
<< ZHIVO_VERSION
<< ", "
<< ZHIVO_BUILD_TIME
<< ")\u001b[0m"
<< std::endl;
std::cout << "\u001b[1;32m>>>\u001b[0m ";

while(std::getline(std::cin, line)) {
input += line + '\n';

Expand Down Expand Up @@ -190,8 +200,8 @@ void Runtime::repl() {
input.clear();
iterNum++;

std::cout << std::endl << ">>> ";
std::cout << std::endl << "\u001b[1;32m>>>\u001b[0m ";
}
else std::cout << "... ";
else std::cout << "\u001b[93m...\u001b[0m ";
}
}

0 comments on commit 5e1f28d

Please sign in to comment.