lxsh/include/parse.hpp

30 lines
941 B
C++

#ifndef PARSE_HPP
#define PARSE_HPP
#include "struc.hpp"
#include <string>
#include <ztd/filedat.hpp>
#define SPACES " \t"
#define SEPARATORS " \t\n"
#define ARG_END " \t\n;#()&|<>"
#define VARNAME_END " \t\n;#()&|=\"'\\{}/-+"
#define BLOCK_TOKEN_END " \t\n;#()&|=\"'\\"
#define COMMAND_SEPARATOR "\n;"
#define CONTROL_END "#)"
#define PIPELINE_END "\n;#()&"
#define ARGLIST_END "\n;#()&|"
#define SPECIAL_TOKENS "\n;#()&|"
#define ALL_TOKENS "\n;#()&|{}"
#define SPECIAL_VARS "!#*@$?"
std::string import_file(std::string const& path);
shmain* parse_text(const char* in, uint32_t size, std::string const& filename="");
inline shmain* parse_text(std::string const& in, std::string const& filename="") { return parse_text(in.c_str(), in.size(), filename); }
inline shmain* parse(std::string const& file) { return parse_text(import_file(file), file); }
#endif //PARSE_HPP