From: Juerg Billeter Date: Sat, 8 Mar 2008 15:50:40 +0000 (+0000) Subject: support declaration of local multi-dimensional array variables X-Git-Tag: VALA_0_2_0~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5f8293175ac37a0c878d914b9241dbced00eda35;p=thirdparty%2Fvala.git support declaration of local multi-dimensional array variables 2008-03-08 Juerg Billeter * vala/parser.y, vala/scanner.l: support declaration of local multi-dimensional array variables svn path=/trunk/; revision=1108 --- diff --git a/ChangeLog b/ChangeLog index bfeac0ac6..19712a9f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-08 Jürg Billeter + + * vala/parser.y, vala/scanner.l: support declaration of local + multi-dimensional array variables + 2008-03-08 Jürg Billeter * vapigen/valagidlparser.vala: improve instance delegate detection diff --git a/vala/parser.y b/vala/parser.y index dd7ff7bc1..36d8c1869 100644 --- a/vala/parser.y +++ b/vala/parser.y @@ -106,6 +106,7 @@ static gboolean check_is_struct (ValaSymbol *symbol, ValaSourceReference *src); %token OPEN_CAST_PARENS "cast (" %token CLOSE_PARENS ")" %token BRACKET_PAIR "[]" +%token OPEN_ARRAY_TYPE_BRACKET "array [" %token OPEN_BRACKET "[" %token CLOSE_BRACKET "]" %token ELLIPSIS "..." @@ -768,9 +769,9 @@ opt_bracket_pair ; bracket_pair - : BRACKET_PAIR + : OPEN_ARRAY_TYPE_BRACKET opt_comma_list CLOSE_BRACKET { - $$ = 1; + $$ = $2; } ; diff --git a/vala/scanner.l b/vala/scanner.l index 4565e0af6..5d04ecdc8 100644 --- a/vala/scanner.l +++ b/vala/scanner.l @@ -81,7 +81,7 @@ generic_type {type_name}("<"{space}{type_name}("?"|"*"+)?(","{space}{type_name "("({space}"weak")?{space}{ident}("."{ident})?("<"({ident}".")?{ident}(","({ident}".")?{ident})*">")?("["{space}"]")*{space}")"{space}("("|{ident}|{literal}) { yyless (1); uploc; return OPEN_CAST_PARENS; } "(" { uploc; return OPEN_PARENS; } ")" { uploc; return CLOSE_PARENS; } -"[]" { uploc; return BRACKET_PAIR; } +"["{space}(","{space})*"]" { yyless (1); uploc; return OPEN_ARRAY_TYPE_BRACKET; } "[" { uploc; return OPEN_BRACKET; } "]" { uploc; return CLOSE_BRACKET; } "..." { uploc; return ELLIPSIS; }