summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--idlc/source/parser.y20
-rw-r--r--idlc/test/parser/constant.tests88
-rw-r--r--idlc/test/parser/published.tests69
3 files changed, 52 insertions, 125 deletions
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index 2b5997d00d2f..629c2f23ea84 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -361,7 +361,7 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
/*
* These are production names:
*/
-%type <dclval> type_dcl const_dcl
+%type <dclval> type_dcl
%type <dclval> array_declarator
%type <dclval> exception_name
%type <cdclval> array_type constructed_type_spec enum_type op_type_spec
@@ -448,14 +448,6 @@ publishable_definition:
{
idlc()->setParseState(PS_NoState);
}
- | const_dcl
- {
- idlc()->setParseState(PS_ConstantDeclSeen);
- }
- ';'
- {
- idlc()->setParseState(PS_NoState);
- }
| exception_dcl
{
idlc()->setParseState(PS_ExceptionDeclSeen);
@@ -1288,13 +1280,6 @@ constants_exports :
;
constants_export :
- const_dcl
- {
- idlc()->setParseState(PS_ConstantDeclSeen);
- }
- ';' {};
-
-const_dcl :
IDL_CONST
{
idlc()->setParseState(PS_ConstSeen);
@@ -1331,7 +1316,10 @@ const_dcl :
}
}
delete $5;
+
+ idlc()->setParseState(PS_ConstantDeclSeen);
}
+ ';' {};
;
constants_dcl :
diff --git a/idlc/test/parser/constant.tests b/idlc/test/parser/constant.tests
index 4d4f5f2a98ec..505a8c2b1588 100644
--- a/idlc/test/parser/constant.tests
+++ b/idlc/test/parser/constant.tests
@@ -31,7 +31,7 @@ constants C {
};
-EXPECT SUCCESS "constant.tests 2":
+EXPECT FAILURE "constant.tests 2":
module m {
const boolean C1 = FALSE;
const byte C2 = 0;
@@ -75,7 +75,7 @@ constants C {};
EXPECT SUCCESS "constant.tests 8":
-module m {
+constants C {
const byte C1 = -128;
const byte C2 = -0200;
const byte C3 = -0x80;
@@ -119,168 +119,168 @@ module m {
EXPECT FAILURE "constant.tests 9":
-module m { const byte C = -129; };
+constants C { const byte C1 = -129; };
EXPECT FAILURE "constant.tests 10":
-module m { const byte C = -0201; };
+constants C { const byte C1 = -0201; };
EXPECT FAILURE "constant.tests 11":
-module m { const byte C = -0x81; };
+constants C { const byte C1 = -0x81; };
EXPECT FAILURE "constant.tests 12":
-module m { const byte C = 256; };
+constants C { const byte C1 = 256; };
EXPECT FAILURE "constant.tests 13":
-module m { const byte C = 0400; };
+constants C { const byte C1 = 0400; };
EXPECT FAILURE "constant.tests 14":
-module m { const byte C = 0x100; };
+constants C { const byte C1 = 0x100; };
EXPECT FAILURE "constant.tests 15":
-module m { const short C = -32769; };
+constants C { const short C1 = -32769; };
EXPECT FAILURE "constant.tests 16":
-module m { const short C = -0100001; };
+constants C { const short C1 = -0100001; };
EXPECT FAILURE "constant.tests 17":
-module m { const short C = -0x8001; };
+constants C { const short C1 = -0x8001; };
EXPECT FAILURE "constant.tests 18":
-module m { const short C = 32768; };
+constants C { const short C1 = 32768; };
EXPECT FAILURE "constant.tests 19":
-module m { const short C = 0100000; };
+constants C { const short C1 = 0100000; };
EXPECT FAILURE "constant.tests 20":
-module m { const short C = 0x8000; };
+constants C { const short C1 = 0x8000; };
EXPECT FAILURE "constant.tests 21":
-module m { const unsigned short C = -1; };
+constants C { const unsigned short C1 = -1; };
EXPECT FAILURE "constant.tests 22":
-module m { const unsigned short C = -01; };
+constants C { const unsigned short C1 = -01; };
EXPECT FAILURE "constant.tests 23":
-module m { const unsigned short C = -0x1; };
+constants C { const unsigned short C1 = -0x1; };
EXPECT FAILURE "constant.tests 24":
-module m { const unsigned short C = 65536; };
+constants C { const unsigned short C1 = 65536; };
EXPECT FAILURE "constant.tests 25":
-module m { const unsigned short C = 0200000; };
+constants C { const unsigned short C1 = 0200000; };
EXPECT FAILURE "constant.tests 26":
-module m { const unsigned short C = 0x10000; };
+constants C { const unsigned short C1 = 0x10000; };
EXPECT FAILURE "constant.tests 27":
-module m { const long C = -2147483649; };
+constants C { const long C1 = -2147483649; };
EXPECT FAILURE "constant.tests 28":
-module m { const long C = -020000000001; };
+constants C { const long C1 = -020000000001; };
EXPECT FAILURE "constant.tests 29":
-module m { const long C = -0x80000001; };
+constants C { const long C1 = -0x80000001; };
EXPECT FAILURE "constant.tests 30":
-module m { const long C = 2147483648; };
+constants C { const long C1 = 2147483648; };
EXPECT FAILURE "constant.tests 31":
-module m { const long C = 020000000000; };
+constants C { const long C1 = 020000000000; };
EXPECT FAILURE "constant.tests 32":
-module m { const long C = 0x80000000; };
+constants C { const long C1 = 0x80000000; };
EXPECT FAILURE "constant.tests 33":
-module m { const unsigned long C = -1; };
+constants C { const unsigned long C1 = -1; };
EXPECT FAILURE "constant.tests 34":
-module m { const unsigned long C = -01; };
+constants C { const unsigned long C1 = -01; };
EXPECT FAILURE "constant.tests 35":
-module m { const unsigned long C = -0x1; };
+constants C { const unsigned long C1 = -0x1; };
EXPECT FAILURE "constant.tests 36":
-module m { const unsigned long C = 4294967296; };
+constants C { const unsigned long C1 = 4294967296; };
EXPECT FAILURE "constant.tests 37":
-module m { const unsigned long C = 040000000000; };
+constants C { const unsigned long C1 = 040000000000; };
EXPECT FAILURE "constant.tests 38":
-module m { const unsigned long C = 0x100000000; };
+constants C { const unsigned long C1 = 0x100000000; };
EXPECT FAILURE "constant.tests 39":
-module m { const hyper C = -9223372036854775809; };
+constants C { const hyper C1 = -9223372036854775809; };
EXPECT FAILURE "constant.tests 40":
-module m { const hyper C = -01000000000000000000001; };
+constants C { const hyper C1 = -01000000000000000000001; };
EXPECT FAILURE "constant.tests 41":
-module m { const hyper C = -0x8000000000000001; };
+constants C { const hyper C1 = -0x8000000000000001; };
EXPECT FAILURE "constant.tests 42":
-module m { const hyper C = 9223372036854775808; };
+constants C { const hyper C1 = 9223372036854775808; };
EXPECT FAILURE "constant.tests 43":
-module m { const hyper C = 01000000000000000000000; };
+constants C { const hyper C1 = 01000000000000000000000; };
EXPECT FAILURE "constant.tests 44":
-module m { const hyper C = 0x8000000000000000; };
+constants C { const hyper C1 = 0x8000000000000000; };
EXPECT FAILURE "constant.tests 45":
-module m { const unsigned hyper C = -1; };
+constants C { const unsigned hyper C1 = -1; };
EXPECT FAILURE "constant.tests 46":
-module m { const unsigned hyper C = -01; };
+constants C { const unsigned hyper C1 = -01; };
EXPECT FAILURE "constant.tests 47":
-module m { const unsigned hyper C = -0x1; };
+constants C { const unsigned hyper C1 = -0x1; };
EXPECT FAILURE "constant.tests 48":
-module m { const unsigned hyper C = 18446744073709551616; };
+constants C { const unsigned hyper C1 = 18446744073709551616; };
EXPECT FAILURE "constant.tests 49":
-module m { const unsigned hyper C = 02000000000000000000000; };
+constants C { const unsigned hyper C1 = 02000000000000000000000; };
EXPECT FAILURE "constant.tests 50":
-module m { const unsigned hyper C = 0x10000000000000000; };
+constants C { const unsigned hyper C1 = 0x10000000000000000; };
diff --git a/idlc/test/parser/published.tests b/idlc/test/parser/published.tests
index e2bb7b734079..e19a0f00acf2 100644
--- a/idlc/test/parser/published.tests
+++ b/idlc/test/parser/published.tests
@@ -23,7 +23,6 @@ published struct Struct2<T> { T member; };
published exception E1 {};
published interface I1 {};
published typedef long Typedef;
-published const long Constant = 1;
published constants Constants { const long Constant = 1; };
published service Service1: I1 {};
published service Service2 { interface I1; };
@@ -413,26 +412,6 @@ published typedef E T;
published struct S { T m; };
-EXPECT SUCCESS "published.tests 69":
-const long C1 = 1;
-const long C2 = C1 + 1;
-
-
-EXPECT FAILURE "published.tests 70":
-const long C1 = 1;
-published const long C2 = C1 + 1;
-
-
-EXPECT SUCCESS "published.tests 71":
-published const long C1 = 1;
-const long C2 = C1 + 1;
-
-
-EXPECT SUCCESS "published.tests 72":
-published const long C1 = 1;
-published const long C2 = C1 + 1;
-
-
EXPECT SUCCESS "published.tests 73":
constants Cs {
const long C1 = 1;
@@ -447,46 +426,6 @@ published constants Cs {
};
-EXPECT SUCCESS "published.tests 75":
-constants Cs { const long C1 = 1; };
-const long C2 = Cs::C1 + 1;
-
-
-EXPECT FAILURE "published.tests 76":
-constants Cs { const long C1 = 1; };
-published const long C2 = Cs::C1 + 1;
-
-
-EXPECT SUCCESS "published.tests 77":
-published constants Cs { const long C1 = 1; };
-const long C2 = Cs::C1 + 1;
-
-
-EXPECT SUCCESS "published.tests 78":
-published constants Cs { const long C1 = 1; };
-published const long C2 = Cs::C1 + 1;
-
-
-EXPECT SUCCESS "published.tests 79":
-const long C1 = 1;
-constants Cs { const long C2 = C1 + 1; };
-
-
-EXPECT FAILURE "published.tests 80":
-const long C1 = 1;
-published constants Cs { const long C2 = C1 + 1; };
-
-
-EXPECT SUCCESS "published.tests 81":
-published const long C1 = 1;
-constants Cs { const long C2 = C1 + 1; };
-
-
-EXPECT SUCCESS "published.tests 82":
-published const long C1 = 1;
-published constants Cs { const long C2 = C1 + 1; };
-
-
EXPECT SUCCESS "published.tests 83":
constants Cs1 { const long C1 = 1; };
constants Cs2 { const long C2 = Cs1::C1 + 1; };
@@ -509,22 +448,22 @@ published constants Cs2 { const long C2 = Cs1::C1 + 1; };
EXPECT SUCCESS "published.tests 87":
typedef long T;
-const T C = 1;
+constants Cs { const T C = 1; };
EXPECT FAILURE "published.tests 88":
typedef long T;
-published const T C = 1;
+published constants Cs { const T C = 1; };
EXPECT SUCCESS "published.tests 89":
published typedef long T;
-const T C = 1;
+constants Cs { const T C = 1; };
EXPECT SUCCESS "published.tests 90":
published typedef long T;
-published const T C = 1;
+published constants Cs { const T C = 1; };
EXPECT SUCCESS "published.tests 91":