From f318c2ba39ff825e346c6cdd8e780d57c743ed3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Thu, 15 Aug 2013 14:16:17 +0000 Subject: [PATCH] [COMPILER] * NEW: The ".[xxx]" syntax now can be used inside a WITH ... END WITH control structure. It is a synonymous for "[xxx]". git-svn-id: svn://localhost/gambas/trunk@5797 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- main/gbc/gbc_trans_expr.c | 4 ++-- main/gbc/gbc_trans_tree.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/main/gbc/gbc_trans_expr.c b/main/gbc/gbc_trans_expr.c index 83922d54c..a2de8282c 100644 --- a/main/gbc/gbc_trans_expr.c +++ b/main/gbc/gbc_trans_expr.c @@ -170,7 +170,7 @@ void TRANS_class(int index) } } -static void trans_identifier(int index, bool first, bool point, PATTERN next) +static void trans_identifier(int index, bool point, PATTERN next) { CLASS_SYMBOL *sym = CLASS_get_symbol(JOB->class, index); bool is_static; @@ -356,7 +356,7 @@ static void trans_expr_from_tree(TRANS_TREE *tree, int count) push_string(PATTERN_index(pattern), TRUE); else if (PATTERN_is_identifier(pattern)) - trans_identifier(PATTERN_index(pattern), PATTERN_is_first(pattern), PATTERN_is_point(pattern), next_pattern); + trans_identifier(PATTERN_index(pattern), PATTERN_is_point(pattern), next_pattern); else if (PATTERN_is_class(pattern)) TRANS_class(PATTERN_index(pattern)); diff --git a/main/gbc/gbc_trans_tree.c b/main/gbc/gbc_trans_tree.c index 5c11c768c..9635b160d 100644 --- a/main/gbc/gbc_trans_tree.c +++ b/main/gbc/gbc_trans_tree.c @@ -40,9 +40,9 @@ static short level; static PATTERN *current; static TRANS_TREE tree[MAX_EXPR_PATTERN]; static int tree_length = 0; -/*static PATTERN last_pattern;*/ static void analyze_expr(short priority, short op_main); +static void analyze_array(); static void inc_level() @@ -338,7 +338,7 @@ static void analyze_single(int op) add_operator(PATTERN_index(*pattern), 1); } - /* . symbol */ + /* . symbol | . [] */ else if (PATTERN_is(*current, RS_PT) && PATTERN_is_identifier(current[1])) { @@ -346,6 +346,13 @@ static void analyze_single(int op) add_pattern(PATTERN_set_flag(current[1], RT_POINT)); current += 2; } + else if (PATTERN_is(*current, RS_PT) && PATTERN_is(current[1], RS_LSQR)) + { + add_operator(PATTERN_index(current[0]), 0); + //add_pattern(PATTERN_set_flag(RS_RSQR, RT_POINT)); + current += 2; + analyze_array(); + } /* NULL, TRUE, FALSE, ME, PARENT, LAST, ERROR */ /* number, string or symbol */