20 char *copy_expression_part(
const char *
start,
const char *end) {
21 if (start >= end || (end == (start+1) && start[0] ==
'*'))
return NULp;
35 const char *
dot = strchr(search_expr,
'.');
37 key = strdup(search_expr);
41 const char *end = strchr(dot+1, 0);
43 key = copy_expression_part(search_expr, dot-1);
44 value = copy_expression_part(dot+1, end-1);
54 return !key || strcmp(token->
get_key(), key) == 0;
66 if (!next_token && cont_in_next_list) {
68 if (next_list) next_token = next_list->
first_token();
84 if (!tokens)
return NULp;
91 while (curs && !found) {
92 bool cont_in_next_list =
false;
100 cont_in_next_list =
true;
104 cont_in_next_list =
true;
122 const Token *at = cursor;
128 const char *slash = strchr(str,
'/');
139 slash = strchr(str,
'/');
151 while (var[0] ==
'&') {
157 char *doppelpunkt = strchr(var,
':');
if (doppelpunkt) *(doppelpunkt++) = 0;
158 char *bar = strchr(var,
'|');
if (bar) *(bar++) = 0;
169 if (!allow_missing_var) {
185 int len = strlen(in) + strlen(cur->
get_key());
186 char *buf1 = (
char *) calloc(
sizeof(
char), len + 2);
187 sprintf(buf1,
"%s/%s", cur->
get_key(), in);
209 int len = strlen(in);
211 while (doppelpunkt && !err) {
212 char *nextdp = strchr(doppelpunkt,
':');
213 if (nextdp) *(nextdp++) = 0;
214 if (!doppelpunkt[0]) {
219 bar = strchr(doppelpunkt+1,
'=');
226 int findl = strlen(doppelpunkt);
227 int replacel = strlen(bar);
230 for (
char *finds = strstr(in, doppelpunkt); finds; finds = strstr(buf2, doppelpunkt)) {
231 len += replacel - findl;
233 char *buf1 = (
char *) calloc(
sizeof(
char), len + 1);
236 memcpy(buf1, in, offset);
237 memcpy(buf1 + offset, bar, replacel);
239 buf2 = buf1 + offset + replacel;
240 memcpy(buf2, in + offset + findl, len - replacel - offset);
245 buf2 = in + offset + replacel;
247 doppelpunkt = nextdp;
char * copy_string_part(const char *first, const char *last)
const TokenList * parent_list() const
static void dot(double **i, double **j, double **k)
static void dump_token_recursive(const Token *tok, FILE *out)
static const Interpreter * instance
const TokenListBlock * parent_block() const
static HelixNrInfo * start
static const Token * nextTokenMatching(const Token *tok, const TokenMatcher &wanted, bool cont_in_next_list)
bool matches(const Token *token) const
const Token * find_token(const Token *curs, const char *str, LookupScope scope) const
#define print_error(code_or_loc, err)
const TokenList * next_list() const
static const Token * nextToken(const Token *tok, bool cont_in_next_list)
const char * get_key() const
const Token * next_token() const
TokenMatcher(const char *search_expr)
fputs(TRACE_PREFIX, stderr)
char * get_var_string(const Data &data, char *var, bool allow_missing_var)
const char * get_value() const
const Token * first_token() const
#define printf_error(code_or_loc, format, arg)
const Token * parent_block_token() const
const Token * first_token() const
const char * read_local(const char *key) const
bool matchesValueOf(const Token *token) const
const TokenListBlock * get_tokens() const
void dump_cursor_pos(FILE *out) const
#define aisc_assert(cond)
const TokenListBlock * get_content() const
bool matchesKeyOf(const Token *token) const
void SKIP_SPACE_LF(const char *&var)
const Token * find_qualified_token(const char *str, LookupScope scope) const