fix parsing errors on variables in arithmetics
This commit is contained in:
parent
5d8ea952a2
commit
56ed26ed96
2 changed files with 3 additions and 7 deletions
|
|
@ -21,17 +21,13 @@
|
||||||
#define SPECIAL_TOKENS "\n;#()&|"
|
#define SPECIAL_TOKENS "\n;#()&|"
|
||||||
#define ALL_TOKENS "\n;#()&|{}"
|
#define ALL_TOKENS "\n;#()&|{}"
|
||||||
|
|
||||||
|
#define ARITHMETIC_OPERATOR_END " \t\n$)"
|
||||||
|
|
||||||
#define SPECIAL_VARS "!#*@$?"
|
#define SPECIAL_VARS "!#*@$?"
|
||||||
|
|
||||||
// bash specific
|
// bash specific
|
||||||
#define ARRAY_ARG_END " \t\n;#()&|<>]"
|
#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
|
// structs
|
||||||
|
|
||||||
struct list_parse_options {
|
struct list_parse_options {
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ std::pair<std::string, uint32_t> get_operator(parse_context ctx)
|
||||||
std::string ret;
|
std::string ret;
|
||||||
uint32_t start=ctx.i;
|
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++;
|
ctx.i++;
|
||||||
|
|
||||||
ret = std::string(ctx.data+start, ctx.i-start);
|
ret = std::string(ctx.data+start, ctx.i-start);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue