From a8bcabb74197ce9d666794ddc1fbfd0109aabe8d Mon Sep 17 00:00:00 2001 From: gambas Date: Thu, 14 Mar 2019 01:52:37 +0100 Subject: [PATCH] Unary minus operator is now sticked to its argument when put between parentheses or brackets. [GB.EVAL] * NEW: Unary minus operator is now sticked to its argument when put between parentheses or brackets. --- main/lib/eval/eval_analyze.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/main/lib/eval/eval_analyze.c b/main/lib/eval/eval_analyze.c index 1136b23bf..6a56001c2 100644 --- a/main/lib/eval/eval_analyze.c +++ b/main/lib/eval/eval_analyze.c @@ -516,7 +516,20 @@ static void analyze(EVAL_ANALYZE *result) //space_before = FALSE; space_after = FALSE; } - else if (PATTERN_is(*pattern, RS_NOT) || *symbol == '-') + else if (*symbol == '-') + { + if (old_type == RT_OPERATOR && (PATTERN_is(pattern[-1], RS_LBRA) || PATTERN_is(pattern[-1],RS_LSQR))) + { + space_before = FALSE; + space_after = FALSE; + } + else + { + space_before = TRUE; + space_after = TRUE; + } + } + else if (PATTERN_is(*pattern, RS_NOT)) { if (old_type == RT_OPERATOR && (PATTERN_is(pattern[-1], RS_LBRA) || PATTERN_is(pattern[-1],RS_LSQR))) space_before = FALSE;