fix parsing errors on variables in arithmetics

This commit is contained in:
zawz 2021-06-22 10:01:29 +02:00
parent 5d8ea952a2
commit 56ed26ed96
2 changed files with 3 additions and 7 deletions

View file

@ -21,17 +21,13 @@
#define SPECIAL_TOKENS "\n;#()&|"
#define ALL_TOKENS "\n;#()&|{}"
#define ARITHMETIC_OPERATOR_END " \t\n$)"
#define SPECIAL_VARS "!#*@$?"
// bash specific
#define ARRAY_ARG_END " \t\n;#()&|<>]"
// macros
// #define PARSE_ERROR_I(str, ctx, i) format_error(str, ctx.filename, ctx.data, i)
// #define PARSE_ERROR(str, ctx) format_error(str, ctx.filename, ctx.data, ctx.i)
// #define PARSE_ERROR_I(str, ctx, i) { printFormatError(format_error(str, ctx.filename, ctx.data, i)); ctx.has_errored=true; }
// #define PARSE_ERROR(str, ctx) { printFormatError(format_error(str, ctx.filename, ctx.data, ctx.i)); ctx.has_errored=true; }
// structs
struct list_parse_options {

View file

@ -239,7 +239,7 @@ std::pair<std::string, uint32_t> get_operator(parse_context ctx)
std::string ret;
uint32_t start=ctx.i;
while(!is_alphanum(ctx[ctx.i]) && !is_in(ctx[ctx.i], SEPARATORS) && ctx[ctx.i]!=')' )
while(!is_alphanum(ctx[ctx.i]) && !is_in(ctx[ctx.i], ARITHMETIC_OPERATOR_END))
ctx.i++;
ret = std::string(ctx.data+start, ctx.i-start);