ArkScript
A small, lisp-inspired, functional scripting language
Utils.hpp
Go to the documentation of this file.
1/**
2 * @file Utils.hpp
3 * @author Lexy Plateau (lexplt.dev@gmail.com)
4 * @brief replxx utilities
5 * @date 2020-10-27
6 *
7 * @copyright Copyright (c) 2020-2026
8 *
9 */
10
11#ifndef REPL_REPLXX_UTIL_HPP
12#define REPL_REPLXX_UTIL_HPP
13
14#include <vector>
15#include <string>
16
17#include <replxx.hxx>
18
19namespace Ark::internal
20{
21 /**
22 * @brief Compute a list of all the language keywords and builtins
23 *
24 * @return std::vector<std::string>
25 */
26 std::vector<std::string> getAllKeywords();
27
28 /**
29 * @brief Compute a list of pairs (word -> color) to be used for coloration by the REPL
30 * @return std::vector<std::pair<std::string, replxx::Replxx::Color>>
31 */
32 std::vector<std::pair<std::string, replxx::Replxx::Color>> getColorPerKeyword();
33
34 replxx::Replxx::completions_t hookCompletion(const std::vector<std::string>& words, const std::string& context, int& length);
35
36 void hookColor(const std::vector<std::pair<std::string, replxx::Replxx::Color>>& words_colors, const std::string& context, replxx::Replxx::colors_t& colors);
37
38 replxx::Replxx::hints_t hookHint(const std::vector<std::string>& words, const std::string& context, int& length, replxx::Replxx::Color& color);
39}
40
41#endif
std::vector< std::string > getAllKeywords()
Compute a list of all the language keywords and builtins.
void hookColor(const std::vector< std::pair< std::string, replxx::Replxx::Color > > &words_colors, const std::string &context, replxx::Replxx::colors_t &colors)
constexpr std::array colors
Definition Logger.cpp:8
replxx::Replxx::completions_t hookCompletion(const std::vector< std::string > &words, const std::string &context, int &length)
std::vector< std::pair< std::string, replxx::Replxx::Color > > getColorPerKeyword()
Compute a list of pairs (word -> color) to be used for coloration by the REPL.
replxx::Replxx::hints_t hookHint(const std::vector< std::string > &words, const std::string &context, int &length, replxx::Replxx::Color &color)