21 line(
const char* _b = 0,
const char* _e = 0) :
token(_b, _e) {}
26 PLAIN, URL, FLOAT_VALUE, TIME_VALUE, DATE_VALUE
75 const char* begin,
const char* end,
76 std::vector<token>& tokens,
77 const std::string& separators,
78 bool merge_separators =
true,
79 const std::string& open_parenthesis =
"",
const std::string& close_parenthesis =
"",
80 const std::string& whitespaces =
" \t\n",
81 unsigned int max_nr_tokens = -1);
86 std::vector<token>& tokens,
87 const std::string& separators,
88 bool merge_separators =
true,
89 const std::string& open_parenthesis =
"",
const std::string& close_parenthesis =
"",
90 const std::string& whitespaces =
" \t\n",
96 separators,merge_separators,open_parenthesis,close_parenthesis,whitespaces);
101 const std::string& s,
102 std::vector<token>& tokens,
103 const std::string& separators,
104 bool merge_separators =
true,
105 const std::string& open_parenthesis =
"",
const std::string& close_parenthesis =
"",
106 const std::string& whitespaces =
" \t\n",
107 unsigned int = (
unsigned int)-1)
109 split_to_tokens(&s[0],&s[0]+s.size(),tokens,separators,merge_separators,open_parenthesis,close_parenthesis,whitespaces);
115extern CGV_API
void split_to_lines(
const char* begin,
const char* end,
116 std::vector<line>& lines,
117 bool truncate_trailing_spaces =
true);
120 std::vector<line>& lines,
121 bool truncate_trailing_spaces =
true) {
127 std::vector<line>& lines,
128 bool truncate_trailing_spaces =
true) {
129 split_to_lines(&s[0],&s[0]+s.size(),lines,truncate_trailing_spaces);
143 const char* begin,
const char* end,
145 char open_parenthesis,
char close_parenthesis);
148 const token& expression,
150 char open_parenthesis,
char close_parenthesis) {
152 content,open_parenthesis,close_parenthesis);
155 const std::string& expression,
157 char open_parenthesis,
char close_parenthesis) {
159 content,open_parenthesis,close_parenthesis);
168extern CGV_API std::string
strip_cpp_comments(
const std::string& source,
bool correct_new_lines =
true);
173#include <cgv/config/lib_end.h>
token_type
different types that a typed_token can have
void split_to_tokens(const char *begin, const char *end, std::vector< token > &tokens, const std::string &separators, bool merge_separators, const std::string &open_parenthesis, const std::string &close_parenthesis, const std::string &whitespaces, unsigned int max_nr_tokens)
this function splits a text range into tokens.
void split_to_lines(const char *global_begin, const char *global_end, std::vector< line > &lines, bool truncate_trailing_spaces)
this function splits a text range at the newline characters into single lines.
std::string strip_cpp_comments(const std::string &source, bool correct_new_lines)
remove cpp-style comments from string
bool balanced_find_content(const char *begin, const char *end, token &content, char open_parenthesis, char close_parenthesis)
the input range must begin with an open parenthesis.
Helper functions to process strings.
a line in a text is simply represented as a token
line(const char *_b=0, const char *_e=0)
construct from range
representation of a token in a text by two pointers begin and end, that point to the first character ...
const char * begin
pointers that define the range of characters
token()
construct with both pointers set to 0
a typed token also stores the type and value of a parsed token.