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 */