diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-02-08 09:41:55 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-02-08 09:41:55 -0500 |
commit | af38cbf2ebf9c009fcea81cc316be64176da620e (patch) | |
tree | 28d6975bf5f1c4b7b89a5c24d2e1d9f1a2ba633c /cpp/src | |
parent | Added wide char overloads of Ice::createProperties & Ice::initialize (diff) | |
download | ice-af38cbf2ebf9c009fcea81cc316be64176da620e.tar.bz2 ice-af38cbf2ebf9c009fcea81cc316be64176da620e.tar.xz ice-af38cbf2ebf9c009fcea81cc316be64176da620e.zip |
Make Slice enums scoped
Add new cpp:scoped and objc:scoped metadata directives
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Slice/Checksum.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.cpp | 1674 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.h | 10 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.y | 124 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 327 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.h | 17 | ||||
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 19 | ||||
-rw-r--r-- | cpp/src/Slice/RubyUtil.cpp | 17 | ||||
-rw-r--r-- | cpp/src/Slice/Scanner.cpp | 509 | ||||
-rw-r--r-- | cpp/src/slice2confluence/Gen.cpp | 4 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 49 | ||||
-rw-r--r-- | cpp/src/slice2cs/CsUtil.cpp | 2 | ||||
-rw-r--r-- | cpp/src/slice2cs/Gen.cpp | 22 | ||||
-rw-r--r-- | cpp/src/slice2html/Gen.cpp | 4 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 19 | ||||
-rw-r--r-- | cpp/src/slice2java/GenCompat.cpp | 19 | ||||
-rw-r--r-- | cpp/src/slice2js/Gen.cpp | 18 | ||||
-rw-r--r-- | cpp/src/slice2objc/Gen.cpp | 20 | ||||
-rw-r--r-- | cpp/src/slice2objc/Gen.h | 2 | ||||
-rw-r--r-- | cpp/src/slice2objc/ObjCUtil.cpp | 39 | ||||
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 22 |
22 files changed, 1635 insertions, 1292 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 9cf3dbb42d5..8b3219bf0fd 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -1679,7 +1679,7 @@ Slice::findMetaData(const StringList& metaData, int typeCtx) // // The priority of the metadata is as follows: // 1: array, range (C++98 only), view-type for "view" parameters - // 2: class (C++98 only), unscoped (C++11 only) + // 2: class (C++98 only), scoped (C++98 only), unscoped (C++11 only) // if(pos != string::npos) @@ -1716,7 +1716,7 @@ Slice::findMetaData(const StringList& metaData, int typeCtx) } } // - // Otherwise if the data is "class", "unscoped" it is returned. + // Otherwise if the data is "class", "scoped" or "unscoped" it is returned. // else { @@ -1725,6 +1725,10 @@ Slice::findMetaData(const StringList& metaData, int typeCtx) { return "%class"; } + else if(ss == "scoped" && !(typeCtx & TypeContextCpp11)) + { + return "%scoped"; + } else if(ss == "unscoped" && (typeCtx & TypeContextCpp11)) { return "%unscoped"; diff --git a/cpp/src/Slice/Checksum.cpp b/cpp/src/Slice/Checksum.cpp index 1c8a21511e8..11892bdedb7 100644 --- a/cpp/src/Slice/Checksum.cpp +++ b/cpp/src/Slice/Checksum.cpp @@ -352,7 +352,7 @@ Slice::ChecksumVisitor::visitEnum(const EnumPtr& p) // const bool explicitValue = p->explicitValue(); - EnumeratorList enums = p->getEnumerators(); + EnumeratorList enums = p->enumerators(); if(explicitValue) { // diff --git a/cpp/src/Slice/Grammar.cpp b/cpp/src/Slice/Grammar.cpp index af37d694387..c81edc0c8b8 100644 --- a/cpp/src/Slice/Grammar.cpp +++ b/cpp/src/Slice/Grammar.cpp @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -68,7 +68,7 @@ /* Copy the first part of user declarations. */ -#line 1 "../Slice/Grammar.y" /* yacc.c:339 */ +#line 1 "src/Slice/Grammar.y" /* yacc.c:339 */ // ********************************************************************** @@ -120,7 +120,7 @@ slice_error(const char* s) } -#line 124 "Grammar.tab.c" /* yacc.c:339 */ +#line 124 "src/Slice/Grammar.cpp" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -139,9 +139,9 @@ slice_error(const char* s) #endif /* In a future release of Bison, this section will be replaced - by #include "Grammar.tab.h". */ -#ifndef YY_SLICE_GRAMMAR_TAB_H_INCLUDED -# define YY_SLICE_GRAMMAR_TAB_H_INCLUDED + by #include "Grammar.hpp". */ +#ifndef YY_SLICE_SRC_SLICE_GRAMMAR_HPP_INCLUDED +# define YY_SLICE_SRC_SLICE_GRAMMAR_HPP_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -212,11 +212,11 @@ typedef int YYSTYPE; int slice_parse (void); -#endif /* !YY_SLICE_GRAMMAR_TAB_H_INCLUDED */ +#endif /* !YY_SLICE_SRC_SLICE_GRAMMAR_HPP_INCLUDED */ /* Copy the second part of user declarations. */ -#line 220 "Grammar.tab.c" /* yacc.c:358 */ +#line 220 "src/Slice/Grammar.cpp" /* yacc.c:358 */ #ifdef short # undef short @@ -458,16 +458,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 13 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 920 +#define YYLAST 954 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 55 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 72 +#define YYNNTS 73 /* YYNRULES -- Number of rules. */ -#define YYNRULES 205 +#define YYNRULES 206 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 304 +#define YYNSTATES 305 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ @@ -522,23 +522,23 @@ static const yytype_uint16 yyrline[] = 165, 164, 169, 174, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 239, 238, 272, 276, 287, 298, 297, 324, 333, 341, 350, 353, 358, - 365, 378, 398, 454, 462, 475, 483, 498, 504, 508, - 519, 530, 529, 571, 580, 583, 588, 595, 601, 605, - 616, 641, 706, 718, 732, 731, 771, 806, 814, 819, - 827, 836, 839, 844, 851, 873, 900, 922, 948, 957, - 968, 977, 986, 996, 1010, 1016, 1024, 1036, 1060, 1085, - 1109, 1140, 1139, 1162, 1161, 1184, 1185, 1191, 1195, 1206, - 1221, 1220, 1255, 1290, 1325, 1330, 1340, 1345, 1353, 1362, - 1365, 1370, 1377, 1383, 1390, 1402, 1414, 1425, 1434, 1449, - 1460, 1477, 1481, 1493, 1492, 1516, 1531, 1537, 1545, 1557, - 1580, 1588, 1597, 1601, 1640, 1647, 1658, 1660, 1676, 1692, - 1704, 1716, 1727, 1743, 1748, 1756, 1759, 1765, 1778, 1782, - 1786, 1790, 1794, 1798, 1802, 1806, 1810, 1814, 1818, 1822, - 1826, 1845, 1886, 1892, 1900, 1907, 1919, 1926, 1936, 1949, - 1962, 2008, 2019, 2030, 2046, 2055, 2069, 2072, 2075, 2078, - 2081, 2084, 2087, 2090, 2093, 2096, 2099, 2102, 2105, 2108, - 2111, 2114, 2117, 2120, 2123, 2126, 2129, 2132, 2135, 2138, - 2141, 2144, 2147, 2150, 2153, 2156 + 365, 378, 398, 491, 499, 512, 520, 535, 541, 545, + 556, 567, 566, 608, 617, 620, 625, 632, 638, 642, + 653, 678, 780, 792, 806, 805, 845, 880, 888, 893, + 901, 910, 913, 918, 925, 947, 974, 996, 1022, 1031, + 1042, 1051, 1060, 1070, 1084, 1090, 1098, 1110, 1134, 1159, + 1183, 1214, 1213, 1236, 1235, 1258, 1259, 1265, 1269, 1280, + 1295, 1294, 1329, 1364, 1399, 1404, 1414, 1419, 1427, 1436, + 1439, 1444, 1451, 1457, 1464, 1476, 1488, 1499, 1508, 1523, + 1534, 1551, 1555, 1567, 1566, 1599, 1598, 1617, 1623, 1631, + 1643, 1663, 1671, 1680, 1684, 1723, 1730, 1741, 1743, 1759, + 1775, 1787, 1799, 1810, 1826, 1831, 1839, 1842, 1848, 1861, + 1865, 1869, 1873, 1877, 1881, 1885, 1889, 1893, 1897, 1901, + 1905, 1909, 1928, 1969, 1975, 1983, 1990, 2002, 2009, 2019, + 2032, 2045, 2092, 2103, 2114, 2130, 2139, 2153, 2156, 2159, + 2162, 2165, 2168, 2171, 2174, 2177, 2180, 2183, 2186, 2189, + 2192, 2195, 2198, 2201, 2204, 2207, 2210, 2213, 2216, 2219, + 2222, 2225, 2228, 2231, 2234, 2237, 2240 }; #endif @@ -571,7 +571,7 @@ static const char *const yytname[] = "interface_id", "interface_decl", "interface_def", "@10", "interface_list", "interface_extends", "interface_exports", "interface_export", "exception_list", "exception", "sequence_def", - "dictionary_def", "enum_id", "enum_def", "@11", "enumerator_list", + "dictionary_def", "enum_id", "enum_def", "@11", "@12", "enumerator_list", "enumerator", "enumerator_initializer", "out_qualifier", "parameters", "throws", "scoped_name", "type", "string_literal", "string_list", "local_qualifier", "const_initializer", "const_def", "keyword", YY_NULLPTR @@ -592,12 +592,12 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -221 +#define YYPACT_NINF -214 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-221))) + (!!((Yystate) == (-214))) -#define YYTABLE_NINF -137 +#define YYTABLE_NINF -138 #define yytable_value_is_error(Yytable_value) \ 0 @@ -606,37 +606,37 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - 523, -16, 2, 2, 34, -221, 19, -221, -221, 2, - -221, 24, -15, -221, 115, 43, -221, 40, 39, -221, - -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, - -221, 124, -221, 115, -221, -221, 2, -221, -221, -221, - 221, 65, 601, 669, 701, 733, 60, 61, 488, 3, - 79, 9, 123, 4, -221, -221, -221, 89, -221, -221, - -221, -221, -221, -221, -221, -221, 83, -221, -221, 104, - -221, 6, -10, 115, -221, -221, -221, -221, -221, -221, - -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, - -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, - -221, -221, -221, -221, -221, -1, -221, -221, -221, -221, - -221, -221, -221, 40, 40, -221, 765, -221, 46, -221, - 93, 46, 130, 59, -221, 100, 442, -221, -221, 114, - -221, 99, 66, -221, 101, 10, 221, 221, 102, 103, - 106, -221, 120, 108, 362, 120, 59, -221, -221, -221, - -221, -7, 112, 765, 116, -221, 66, -221, -221, -221, - -221, -221, 120, -221, -221, -221, 117, 118, 54, -221, - 765, 396, 119, 880, 125, -221, 121, 59, 294, 127, - -221, -221, 797, 40, -221, -221, 120, -221, 126, 880, - 131, 362, -221, 35, 128, 221, 134, -221, 829, -221, - 328, -221, 136, 440, 137, -221, -221, -221, 221, 396, - -221, 221, 138, 141, -221, 829, -221, -221, 122, -221, - 29, 66, 139, 133, 362, -221, -221, 144, 440, 143, - 294, -221, 521, 221, 67, 257, -221, 147, -221, -221, - 142, -221, -221, 66, 396, -221, -221, -221, -221, 66, - -221, 328, 221, -221, -221, 148, 564, -221, -221, 69, - -221, -221, -221, 135, -221, 40, 23, 294, 861, -221, - -221, -221, -221, 133, 328, -221, -221, -221, 880, -221, - 185, -221, -221, -221, -221, 184, -221, 829, 184, 40, - 637, -221, -221, -221, 880, -221, 149, 120, -221, -221, - 829, 637, -221, -221 + 454, 23, 44, 44, 83, -214, 19, -214, -214, 44, + -214, -9, 38, -214, 122, 51, -214, 52, 46, -214, + -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, + -214, 129, -214, 122, -214, -214, 44, -214, -214, -214, + 920, 49, 532, 600, 632, 664, 56, 59, 696, 0, + 68, 11, 104, 1, -214, -214, -214, 72, -214, -214, + -214, -214, -214, -214, -214, -214, 66, -214, -214, 87, + -214, 8, 10, 122, -214, -214, -214, -214, -214, -214, + -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, + -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, + -214, -214, -214, -214, -214, -2, -214, -214, -214, -214, + -214, -214, -214, 52, 52, -214, 94, -214, 40, -214, + 96, 40, 131, 43, -214, 98, 443, -214, -214, 116, + -214, 67, 70, -214, 102, 31, 920, 920, 728, 120, + 107, 363, 120, 43, -214, -214, -214, -214, -8, 108, + 728, 110, -214, 70, -214, -214, -214, -214, -214, 120, + -214, -214, -214, 103, 109, 111, 118, 117, -214, 397, + 121, 895, 124, -214, 126, 43, 295, 127, -214, -214, + 760, 52, 54, -214, 728, 123, 895, 134, 363, -214, + 2, 133, 920, 128, -214, 792, -214, 329, -214, 138, + 844, 137, -214, -214, -214, 920, -214, -214, 120, -214, + 397, -214, 920, 136, 142, -214, 792, -214, -214, 130, + -214, 32, 70, 139, 143, 363, -214, -214, 144, 844, + 146, 295, -214, 870, 920, 63, 258, -214, 145, -214, + -214, 147, -214, -214, 70, 397, -214, -214, -214, -214, + 70, -214, 329, 920, -214, -214, 149, 495, -214, -214, + 71, -214, -214, -214, 148, -214, 52, -22, 295, 824, + -214, -214, -214, -214, 143, 329, -214, -214, -214, 895, + -214, 181, -214, -214, -214, -214, 182, -214, 792, 182, + 52, 568, -214, -214, -214, 895, -214, 150, 120, -214, + -214, 792, 568, -214, -214 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -644,63 +644,63 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 0, 0, 0, 0, 6, 167, 2, 10, 163, - 165, 0, 0, 1, 0, 0, 166, 5, 12, 14, + 0, 0, 0, 0, 0, 6, 168, 2, 10, 164, + 166, 0, 0, 1, 0, 0, 167, 5, 12, 14, 19, 20, 21, 22, 15, 16, 17, 18, 23, 24, - 25, 0, 26, 0, 162, 4, 0, 3, 7, 27, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, - 50, 62, 67, 99, 123, 11, 164, 0, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 158, 159, 0, - 145, 160, 0, 0, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 58, 0, 59, 97, 98, 29, - 30, 48, 49, 5, 5, 121, 131, 122, 0, 32, - 0, 0, 69, 0, 100, 0, 0, 157, 146, 0, - 161, 0, 0, 9, 0, 0, 0, 0, 128, 0, - 127, 130, 34, 0, 0, 66, 0, 64, 104, 105, - 106, 103, 0, 131, 0, 147, 0, 172, 173, 171, - 168, 169, 170, 175, 60, 61, 0, 0, 0, 125, - 131, 0, 0, 0, 0, 68, 0, 0, 0, 0, - 28, 174, 0, 5, 132, 129, 133, 126, 0, 0, - 0, 0, 44, 0, 78, 0, 55, 57, 83, 52, - 0, 102, 0, 0, 0, 124, 117, 118, 0, 0, - 46, 0, 74, 38, 47, 77, 33, 54, 0, 43, - 0, 0, 80, 0, 0, 40, 82, 0, 0, 0, - 0, 86, 0, 0, 0, 0, 112, 110, 85, 101, - 0, 37, 45, 0, 0, 76, 41, 42, 79, 0, - 53, 0, 0, 95, 96, 72, 77, 65, 109, 0, - 84, 87, 89, 0, 134, 5, 0, 0, 0, 75, - 36, 81, 71, 84, 0, 88, 90, 93, 0, 91, - 135, 108, 119, 120, 70, 144, 137, 141, 144, 5, - 0, 94, 139, 92, 0, 143, 114, 115, 116, 138, - 142, 0, 140, 113 + 25, 0, 26, 0, 163, 4, 0, 3, 7, 27, + 0, 0, 0, 0, 0, 0, 0, 0, 125, 31, + 50, 62, 67, 99, 123, 11, 165, 0, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 159, 160, 0, + 146, 161, 0, 0, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 58, 0, 59, 97, 98, 29, + 30, 48, 49, 5, 5, 121, 0, 122, 0, 32, + 0, 0, 69, 0, 100, 0, 0, 158, 147, 0, + 162, 0, 0, 9, 0, 0, 0, 0, 132, 34, + 0, 0, 66, 0, 64, 104, 105, 106, 103, 0, + 132, 0, 148, 0, 173, 174, 172, 169, 170, 171, + 176, 60, 61, 0, 0, 129, 0, 128, 131, 0, + 0, 0, 0, 68, 0, 0, 0, 0, 28, 175, + 0, 5, 0, 126, 132, 0, 0, 0, 0, 44, + 0, 78, 0, 55, 57, 83, 52, 0, 102, 0, + 0, 0, 124, 117, 118, 0, 133, 130, 134, 127, + 0, 46, 0, 74, 38, 47, 77, 33, 54, 0, + 43, 0, 0, 80, 0, 0, 40, 82, 0, 0, + 0, 0, 86, 0, 0, 0, 0, 112, 110, 85, + 101, 0, 37, 45, 0, 0, 76, 41, 42, 79, + 0, 53, 0, 0, 95, 96, 72, 77, 65, 109, + 0, 84, 87, 89, 0, 135, 5, 0, 0, 0, + 75, 36, 81, 71, 84, 0, 88, 90, 93, 0, + 91, 136, 108, 119, 120, 70, 145, 138, 142, 145, + 5, 0, 94, 140, 92, 0, 144, 114, 115, 116, + 139, 143, 0, 141, 113 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -221, -221, -221, -17, -12, -221, -221, -221, -221, -221, - -221, -221, -221, -221, -221, -221, -191, -170, -165, -208, - -221, -221, -221, -221, -221, -168, -221, -221, -221, -221, - -221, -221, -221, -221, -220, -29, -221, -30, -221, -25, - -221, -221, -221, -221, -221, -221, -221, -119, -221, -218, - -221, -97, -221, -221, -221, -221, -221, -221, -105, -221, - -221, -72, -221, -79, -104, -27, 11, 207, -221, -145, - -221, -38 + -214, -214, -214, -17, -12, -214, -214, -214, -214, -214, + -214, -214, -214, -214, -214, -214, -187, -162, -163, -211, + -214, -214, -214, -214, -214, -173, -214, -214, -214, -214, + -214, -214, -214, -214, -212, -30, -214, -31, -214, -26, + -214, -214, -214, -214, -214, -214, -214, -119, -214, -213, + -214, -98, -214, -214, -214, -214, -214, -214, -214, -130, + -214, -214, -75, -214, -82, -104, -24, 17, 208, -214, + -150, -214, -38 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 4, 5, 6, 7, 14, 41, 33, 18, 19, - 57, 49, 20, 21, 143, 119, 190, 210, 211, 212, - 213, 50, 22, 23, 120, 174, 196, 51, 52, 24, - 25, 176, 122, 147, 229, 214, 197, 234, 235, 236, - 288, 285, 255, 53, 26, 27, 152, 150, 124, 204, - 237, 295, 296, 28, 29, 54, 30, 125, 139, 140, - 185, 265, 266, 291, 71, 223, 10, 11, 31, 163, - 32, 141 + 57, 49, 20, 21, 140, 119, 187, 211, 212, 213, + 214, 50, 22, 23, 120, 172, 193, 51, 52, 24, + 25, 174, 122, 144, 230, 215, 194, 235, 236, 237, + 289, 286, 256, 53, 26, 27, 149, 147, 124, 201, + 238, 296, 297, 28, 29, 54, 30, 125, 116, 166, + 167, 207, 266, 267, 292, 71, 224, 10, 11, 31, + 160, 32, 168 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -708,196 +708,202 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 40, 135, 38, 194, 106, 108, 110, 112, 195, -63, - 117, 181, 258, 72, 142, 118, 123, 145, 241, 151, - 34, 55, 15, 217, 131, 222, 129, 175, 162, 37, - 8, 272, 69, 70, 13, 134, 36, 9, 233, 129, - 132, 242, 151, 129, 177, 16, 17, 56, 179, 281, - -35, -107, 162, 270, 284, -63, 250, -63, 201, 165, - 130, 133, 129, 252, 186, 187, 35, 233, 69, 70, - 286, 218, 279, 151, 280, 36, 248, 39, 247, 69, - 70, 2, 242, 148, 219, -8, 299, 69, 70, 220, - 184, 149, 69, 70, 157, 158, 136, 137, 269, 69, - 70, 159, 160, 161, 271, 261, 262, 275, 276, 166, - 167, 73, 113, 114, 154, -13, 1, 162, -5, -5, - -5, -5, -5, -5, -5, -5, -51, 173, 42, 43, - 44, 45, 46, 47, 48, 121, 126, 127, 128, 162, - 144, -5, -5, 146, 207, 162, 198, 153, 155, 156, - 164, 169, 168, 129, 189, 171, 2, 170, 3, 178, - 226, 203, 215, -13, 180, 191, 208, 225, 200, 183, - 182, 246, 209, 199, 173, 205, 238, 245, 221, 216, - 224, 240, 230, 228, 277, 239, 297, 244, 243, 249, - 251, 257, 189, 267, 274, 268, 264, 297, 290, 253, - 301, 256, 259, 254, 303, 238, 260, 173, 289, 293, - 12, 0, 0, 203, 0, 0, 0, 0, 245, 0, - 0, 0, 0, 0, 0, 273, 0, 189, 0, 0, - 283, 0, 0, 0, 228, 0, 0, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 0, 278, 292, - 203, 287, 298, 68, 69, 70, 0, 228, 263, 0, - 0, 0, 302, 298, 0, 0, 0, 300, 264, 0, - 0, 0, 294, -135, -135, -135, -135, -135, -135, -135, - -135, -135, -135, 0, 0, 0, 0, 0, -135, -135, - -135, -135, 0, 0, 0, 202, 0, -135, -135, 0, - 0, 0, 0, 0, 0, 0, -136, 0, -136, -5, + 40, 135, 38, 179, 106, 108, 110, 112, 192, 191, + 117, -63, 118, 123, 139, 218, 72, 142, 259, 148, + 177, 55, 15, 242, 173, 129, 34, 280, 159, 281, + 223, 69, 70, 35, 134, 69, 70, 234, 219, 148, + 273, 129, 36, 175, 131, 16, 17, -35, -107, 159, + 243, 220, 251, 56, 209, 282, 198, -63, 271, -63, + 132, 133, 130, 285, 129, 129, 253, 145, 287, 8, + 234, 148, 249, 69, 70, 146, 69, 70, 208, 9, + 162, 248, 37, 13, 300, 39, 221, 69, 70, 36, + 206, 243, -8, 2, 270, 73, 136, 137, 154, 155, + 272, 262, 263, 69, 70, 156, 157, 158, 113, 276, + 277, 114, 163, 164, 151, -51, 121, 153, 159, 126, + 127, 128, -13, 1, 171, -5, -5, -5, -5, -5, + -5, -5, -5, 42, 43, 44, 45, 46, 47, 48, + 159, 138, 204, 141, 143, 150, 159, 195, -5, -5, + 152, 161, 186, 129, 169, 176, 180, 227, 178, 200, + 181, 182, 216, 2, 205, 3, 183, 188, 184, 210, + -13, 171, 196, 197, 225, 202, 239, 226, 246, 247, + 229, 241, 217, 222, 231, 240, 244, 298, 245, 250, + 252, 268, 265, 186, 258, 275, 291, 278, 298, 254, + 269, 302, 260, 255, 304, 257, 290, 294, 171, 239, + 261, 12, 0, 0, 200, 0, 0, 0, 0, 246, + 0, 0, 0, 0, 0, 0, 0, 0, 186, 274, + 0, 284, 0, 0, 0, 229, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 279, + 293, 200, 0, 299, 0, 288, 0, 0, 229, 264, + 0, 0, 0, 303, 299, 0, 0, 0, 0, 265, + 0, 301, 0, 295, -136, -136, -136, -136, -136, -136, + -136, -136, -136, -136, 0, 0, 0, 0, 0, -136, + -136, -136, -136, 0, 0, 0, 199, 0, -136, -136, + 0, 0, 0, 0, 0, 0, 0, -137, 0, -137, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - 0, 0, 0, 0, -5, -5, -5, -5, -5, 227, - 0, 0, 0, 0, -5, 2, 0, 0, 0, 0, - 0, 0, -111, -5, -5, -5, -5, -5, -5, -5, - -5, -5, -5, -5, 0, 0, 0, 0, -5, -5, - -5, -5, -5, 172, 0, 0, 0, 0, -5, 2, - 0, 0, 0, 0, 0, 0, -73, 0, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, 0, 0, - 0, 0, 0, -5, -5, -5, -5, 188, 0, 0, - 0, 0, -5, 2, 0, 0, 0, 0, 0, 0, - -56, 0, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, 0, 0, 0, 0, 0, -5, -5, -5, - -5, 0, 0, 0, 0, 0, -5, 2, 0, 0, - 0, 0, 0, 1, -39, -5, -5, -5, -5, -5, - -5, -5, -5, 0, 0, 231, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 0, 0, -5, -5, - 232, 192, 68, 69, 70, 0, 0, 0, 0, 0, - 193, 0, 0, 2, 0, 3, 0, 0, 0, 0, - -13, 74, 75, 76, 77, 78, 79, 80, 81, 82, + -5, 0, 0, 0, 0, -5, -5, -5, -5, -5, + 228, 0, 0, 0, 0, -5, 2, 0, 0, 0, + 0, 0, 0, -111, -5, -5, -5, -5, -5, -5, + -5, -5, -5, -5, -5, 0, 0, 0, 0, -5, + -5, -5, -5, -5, 170, 0, 0, 0, 0, -5, + 2, 0, 0, 0, 0, 0, 0, -73, 0, -5, + -5, -5, -5, -5, -5, -5, -5, -5, -5, 0, + 0, 0, 0, 0, -5, -5, -5, -5, 185, 0, + 0, 0, 0, -5, 2, 0, 0, 0, 0, 0, + 0, -56, 0, -5, -5, -5, -5, -5, -5, -5, + -5, -5, -5, 0, 0, 0, 0, 0, -5, -5, + -5, -5, 0, 0, 0, 0, 0, -5, 2, 0, + 0, 0, 0, 0, 1, -39, -5, -5, -5, -5, + -5, -5, -5, -5, -13, 1, 0, -5, -5, -5, + -5, -5, -5, -5, -5, 0, 0, 0, 0, -5, + -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -5, -5, 0, 0, 2, 0, 3, 0, 0, 0, + 0, -13, 0, 0, 0, 2, 0, 3, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 0, 226, + 0, 0, 0, -85, -85, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 0, 104, 0, 0, 0, + 105, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 0, 115, -13, 1, 0, -5, -5, -5, -5, - -5, -5, -5, -5, 0, 116, 231, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 0, 0, -5, - -5, 0, 192, 68, 69, 70, 0, 0, 0, 0, - 0, 193, 0, 0, 2, 0, 3, 74, 75, 76, + 103, 69, 70, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 0, 107, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 0, 109, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 0, 225, 0, - 0, 0, -85, -85, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 0, 104, 0, 0, 0, 105, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 69, 70, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 0, 107, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 0, 109, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 0, 111, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 0, 138, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 0, 206, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 0, 225, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 0, 282, 58, 59, 60, 61, + 97, 98, 99, 100, 101, 102, 103, 0, 111, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 0, + 115, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 0, 165, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 0, 203, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 0, 226, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 0, 283, 232, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 0, 0, 0, 0, 233, 189, 68, 69, 70, 0, + 0, 0, 0, 0, 190, 232, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 0, 0, 0, 0, + 0, 189, 68, 69, 70, 0, 0, 0, 0, 0, + 190, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 0, 0, 0, 0, 0, 189, 68, 69, 70, + 0, 0, 0, 0, 0, 190, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 0, 0, 0, 0, - 0, 192, 68, 69, 70, 0, 0, 0, 0, 0, - 193 + 0, 0, 68, 69, 70 }; static const yytype_int16 yycheck[] = { - 17, 105, 14, 173, 42, 43, 44, 45, 173, 0, - 48, 156, 230, 40, 118, 12, 12, 121, 209, 123, - 9, 33, 3, 191, 34, 195, 33, 146, 132, 44, - 46, 251, 33, 34, 0, 36, 51, 35, 203, 33, - 50, 211, 146, 33, 51, 26, 27, 36, 153, 267, - 47, 47, 156, 244, 274, 46, 224, 48, 177, 49, - 54, 73, 33, 228, 168, 170, 42, 232, 33, 34, - 278, 36, 49, 177, 51, 51, 221, 34, 49, 33, - 34, 41, 252, 24, 49, 46, 294, 33, 34, 193, - 36, 32, 33, 34, 28, 29, 113, 114, 243, 33, - 34, 35, 36, 37, 249, 38, 39, 38, 39, 136, - 137, 46, 52, 52, 126, 0, 1, 221, 3, 4, - 5, 6, 7, 8, 9, 10, 47, 144, 4, 5, - 6, 7, 8, 9, 10, 12, 47, 54, 34, 243, - 47, 26, 27, 13, 182, 249, 173, 47, 34, 50, - 49, 48, 50, 33, 171, 47, 41, 51, 43, 47, - 198, 178, 189, 48, 48, 46, 183, 34, 47, 51, - 53, 49, 46, 48, 191, 48, 203, 215, 50, 48, - 46, 208, 46, 200, 49, 48, 290, 46, 50, 50, - 46, 48, 209, 46, 46, 53, 11, 301, 14, 228, - 51, 228, 232, 228, 301, 232, 233, 224, 280, 288, - 3, -1, -1, 230, -1, -1, -1, -1, 256, -1, - -1, -1, -1, -1, -1, 252, -1, 244, -1, -1, - 268, -1, -1, -1, 251, -1, -1, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, -1, 265, 287, - 267, 278, 290, 32, 33, 34, -1, 274, 1, -1, - -1, -1, 300, 301, -1, -1, -1, 294, 11, -1, - -1, -1, 289, 16, 17, 18, 19, 20, 21, 22, + 17, 105, 14, 153, 42, 43, 44, 45, 171, 171, + 48, 0, 12, 12, 118, 188, 40, 121, 231, 123, + 150, 33, 3, 210, 143, 33, 9, 49, 132, 51, + 192, 33, 34, 42, 36, 33, 34, 200, 36, 143, + 252, 33, 51, 51, 34, 26, 27, 47, 47, 153, + 212, 49, 225, 36, 184, 268, 175, 46, 245, 48, + 50, 73, 54, 275, 33, 33, 229, 24, 279, 46, + 233, 175, 222, 33, 34, 32, 33, 34, 182, 35, + 49, 49, 44, 0, 295, 34, 190, 33, 34, 51, + 36, 253, 46, 41, 244, 46, 113, 114, 28, 29, + 250, 38, 39, 33, 34, 35, 36, 37, 52, 38, + 39, 52, 136, 137, 126, 47, 12, 50, 222, 47, + 54, 34, 0, 1, 141, 3, 4, 5, 6, 7, + 8, 9, 10, 4, 5, 6, 7, 8, 9, 10, + 244, 47, 180, 47, 13, 47, 250, 171, 26, 27, + 34, 49, 169, 33, 47, 47, 53, 195, 48, 176, + 51, 50, 186, 41, 181, 43, 48, 46, 51, 46, + 48, 188, 48, 47, 46, 48, 200, 34, 216, 49, + 197, 205, 48, 50, 46, 48, 50, 291, 46, 50, + 46, 46, 11, 210, 48, 46, 14, 49, 302, 229, + 53, 51, 233, 229, 302, 229, 281, 289, 225, 233, + 234, 3, -1, -1, 231, -1, -1, -1, -1, 257, + -1, -1, -1, -1, -1, -1, -1, -1, 245, 253, + -1, 269, -1, -1, -1, 252, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 266, + 288, 268, -1, 291, -1, 279, -1, -1, 275, 1, + -1, -1, -1, 301, 302, -1, -1, -1, -1, 11, + -1, 295, -1, 290, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, -1, -1, -1, -1, -1, 31, + 32, 33, 34, -1, -1, -1, 1, -1, 40, 41, + -1, -1, -1, -1, -1, -1, -1, 49, -1, 51, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 1, -1, -1, -1, -1, 40, 41, -1, -1, -1, + -1, -1, -1, 48, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, -1, -1, -1, -1, 30, + 31, 32, 33, 34, 1, -1, -1, -1, -1, 40, + 41, -1, -1, -1, -1, -1, -1, 48, -1, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, + -1, -1, -1, -1, 31, 32, 33, 34, 1, -1, + -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, + -1, 48, -1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, 31, 32, - 33, 34, -1, -1, -1, 1, -1, 40, 41, -1, - -1, -1, -1, -1, -1, -1, 49, -1, 51, 15, + 33, 34, -1, -1, -1, -1, -1, 40, 41, -1, + -1, -1, -1, -1, 1, 48, 3, 4, 5, 6, + 7, 8, 9, 10, 0, 1, -1, 3, 4, 5, + 6, 7, 8, 9, 10, -1, -1, -1, -1, 26, + 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 26, 27, -1, -1, 41, -1, 43, -1, -1, -1, + -1, 48, -1, -1, -1, 41, -1, 43, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, + -1, -1, -1, 38, 39, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, 34, -1, -1, -1, + 38, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, 34, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, 34, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - -1, -1, -1, -1, 30, 31, 32, 33, 34, 1, - -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, - -1, -1, 48, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, -1, -1, -1, -1, 30, 31, - 32, 33, 34, 1, -1, -1, -1, -1, 40, 41, - -1, -1, -1, -1, -1, -1, 48, -1, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, - -1, -1, -1, 31, 32, 33, 34, 1, -1, -1, - -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, - 48, -1, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, -1, -1, -1, -1, -1, 31, 32, 33, - 34, -1, -1, -1, -1, -1, 40, 41, -1, -1, - -1, -1, -1, 1, 48, 3, 4, 5, 6, 7, - 8, 9, 10, -1, -1, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, -1, -1, 26, 27, - 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, - 40, -1, -1, 41, -1, 43, -1, -1, -1, -1, - 48, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 26, 27, 28, 29, 30, 31, 32, -1, 34, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, + 34, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, -1, 34, 0, 1, -1, 3, 4, 5, 6, - 7, 8, 9, 10, -1, 47, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, -1, -1, 26, - 27, -1, 31, 32, 33, 34, -1, -1, -1, -1, - -1, 40, -1, -1, 41, -1, 43, 3, 4, 5, + 32, -1, 34, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, 34, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, 34, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, -1, 34, -1, - -1, -1, 38, 39, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, -1, 34, -1, -1, -1, 38, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, -1, 34, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, -1, 34, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, -1, 34, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - -1, 34, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, -1, 34, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, -1, 34, 16, 17, 18, 19, + 26, 27, 28, 29, 30, 31, 32, -1, 34, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + -1, -1, -1, -1, 30, 31, 32, 33, 34, -1, + -1, -1, -1, -1, 40, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, 31, 32, 33, 34, -1, -1, -1, -1, -1, - 40 + 40, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, -1, -1, -1, -1, -1, 31, 32, 33, 34, + -1, -1, -1, -1, -1, 40, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, + -1, -1, 32, 33, 34 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -905,36 +911,36 @@ static const yytype_int16 yycheck[] = static const yytype_uint8 yystos[] = { 0, 1, 41, 43, 56, 57, 58, 59, 46, 35, - 121, 122, 122, 0, 60, 3, 26, 27, 63, 64, + 122, 123, 123, 0, 60, 3, 26, 27, 63, 64, 67, 68, 77, 78, 84, 85, 99, 100, 108, 109, - 111, 123, 125, 62, 121, 42, 51, 44, 59, 34, + 111, 124, 126, 62, 122, 42, 51, 44, 59, 34, 58, 61, 4, 5, 6, 7, 8, 9, 10, 66, - 76, 82, 83, 98, 110, 59, 121, 65, 16, 17, + 76, 82, 83, 98, 110, 59, 122, 65, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, - 34, 119, 120, 46, 3, 4, 5, 6, 7, 8, + 34, 120, 121, 46, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 34, 38, 126, 34, 126, 34, - 126, 34, 126, 52, 52, 34, 47, 126, 12, 70, + 29, 30, 31, 32, 34, 38, 127, 34, 127, 34, + 127, 34, 127, 52, 52, 34, 113, 127, 12, 70, 79, 12, 87, 12, 103, 112, 47, 54, 34, 33, - 54, 34, 50, 59, 36, 119, 58, 58, 34, 113, - 114, 126, 119, 69, 47, 119, 13, 88, 24, 32, - 102, 119, 101, 47, 59, 34, 50, 28, 29, 35, - 36, 37, 119, 124, 49, 49, 120, 120, 50, 48, - 51, 47, 1, 58, 80, 102, 86, 51, 47, 113, - 48, 124, 53, 51, 36, 115, 119, 113, 1, 58, - 71, 46, 31, 40, 72, 73, 81, 91, 120, 48, - 47, 102, 1, 58, 104, 48, 34, 126, 58, 46, - 72, 73, 74, 75, 90, 120, 48, 80, 36, 49, - 119, 50, 72, 120, 46, 34, 126, 1, 58, 89, - 46, 15, 30, 73, 92, 93, 94, 105, 120, 48, - 120, 71, 72, 50, 46, 126, 49, 49, 124, 50, - 80, 46, 73, 90, 94, 97, 120, 48, 104, 92, - 120, 38, 39, 1, 11, 116, 117, 46, 53, 124, - 71, 124, 89, 120, 46, 38, 39, 49, 58, 49, - 51, 104, 34, 126, 89, 96, 74, 120, 95, 116, - 14, 118, 126, 118, 58, 106, 107, 119, 126, 74, - 120, 51, 126, 106 + 54, 34, 50, 59, 36, 120, 58, 58, 47, 120, + 69, 47, 120, 13, 88, 24, 32, 102, 120, 101, + 47, 59, 34, 50, 28, 29, 35, 36, 37, 120, + 125, 49, 49, 121, 121, 34, 114, 115, 127, 47, + 1, 58, 80, 102, 86, 51, 47, 114, 48, 125, + 53, 51, 50, 48, 51, 1, 58, 71, 46, 31, + 40, 72, 73, 81, 91, 121, 48, 47, 102, 1, + 58, 104, 48, 34, 127, 58, 36, 116, 120, 114, + 46, 72, 73, 74, 75, 90, 121, 48, 80, 36, + 49, 120, 50, 72, 121, 46, 34, 127, 1, 58, + 89, 46, 15, 30, 73, 92, 93, 94, 105, 121, + 48, 121, 71, 72, 50, 46, 127, 49, 49, 125, + 50, 80, 46, 73, 90, 94, 97, 121, 48, 104, + 92, 121, 38, 39, 1, 11, 117, 118, 46, 53, + 125, 71, 125, 89, 121, 46, 38, 39, 49, 58, + 49, 51, 104, 34, 127, 89, 96, 74, 121, 95, + 117, 14, 119, 127, 119, 58, 106, 107, 120, 127, + 74, 121, 51, 127, 106 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ @@ -952,15 +958,15 @@ static const yytype_uint8 yyr1[] = 93, 95, 94, 96, 94, 97, 97, 98, 98, 99, 101, 100, 102, 102, 102, 102, 103, 103, 104, 104, 104, 104, 105, 106, 106, 107, 107, 108, 108, 109, - 109, 110, 110, 112, 111, 111, 113, 113, 114, 114, - 114, 114, 115, 115, 116, 116, 117, 117, 117, 117, - 117, 117, 117, 118, 118, 119, 119, 119, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, - 124, 124, 124, 124, 125, 125, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126 + 109, 110, 110, 112, 111, 113, 111, 114, 114, 115, + 115, 115, 115, 116, 116, 117, 117, 118, 118, 118, + 118, 118, 118, 118, 119, 119, 120, 120, 120, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 122, 122, 123, 123, 124, 124, 125, + 125, 125, 125, 125, 125, 126, 126, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -978,15 +984,15 @@ static const yytype_uint8 yyr2[] = 3, 0, 5, 0, 5, 1, 1, 2, 2, 2, 0, 7, 3, 1, 1, 1, 2, 0, 4, 3, 2, 0, 1, 3, 1, 1, 1, 7, 7, 10, - 10, 2, 2, 0, 6, 5, 3, 1, 1, 3, - 1, 0, 1, 1, 1, 0, 0, 3, 5, 4, - 6, 3, 5, 2, 0, 1, 2, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, - 1, 2, 2, 1, 3, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 6, 5, 1, 1, 1, 1, + 10, 2, 2, 0, 6, 0, 6, 3, 1, 1, + 3, 1, 0, 1, 1, 1, 0, 0, 3, 5, + 4, 6, 3, 5, 2, 0, 1, 2, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, + 1, 1, 2, 2, 1, 3, 1, 1, 0, 1, + 1, 1, 1, 1, 1, 6, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 1 }; @@ -1667,38 +1673,38 @@ yyreduce: switch (yyn) { case 2: -#line 116 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 116 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 1674 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1680 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 3: -#line 124 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 124 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[-1]); } -#line 1682 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1688 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 4: -#line 133 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 133 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[-1]); } -#line 1690 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1696 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 5: -#line 137 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 137 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = new StringListTok; } -#line 1698 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1704 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 6: -#line 146 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 146 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[0])); if(!metaData->v.empty()) @@ -1706,11 +1712,11 @@ yyreduce: unit->addGlobalMetaData(metaData->v); } } -#line 1710 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1716 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 8: -#line 155 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 155 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[-1])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[0])); @@ -1719,138 +1725,138 @@ yyreduce: contained->setMetaData(metaData->v); } } -#line 1723 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1729 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 10: -#line 165 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 165 "src/Slice/Grammar.y" /* yacc.c:1661 */ { yyerrok; } -#line 1731 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1737 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 12: -#line 170 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 170 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("`;' missing after definition"); } -#line 1739 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1745 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 13: -#line 174 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 174 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 1746 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1752 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 14: -#line 182 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 182 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || ModulePtr::dynamicCast((yyvsp[0]))); } -#line 1754 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1760 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 15: -#line 186 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 186 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || ClassDeclPtr::dynamicCast((yyvsp[0]))); } -#line 1762 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1768 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 16: -#line 190 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 190 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || ClassDefPtr::dynamicCast((yyvsp[0]))); } -#line 1770 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1776 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 17: -#line 194 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 194 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || ClassDeclPtr::dynamicCast((yyvsp[0]))); } -#line 1778 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1784 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 18: -#line 198 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 198 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || ClassDefPtr::dynamicCast((yyvsp[0]))); } -#line 1786 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1792 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 19: -#line 202 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 202 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0); } -#line 1794 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1800 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 20: -#line 206 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 206 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || ExceptionPtr::dynamicCast((yyvsp[0]))); } -#line 1802 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1808 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 21: -#line 210 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 210 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0); } -#line 1810 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1816 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 22: -#line 214 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 214 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || StructPtr::dynamicCast((yyvsp[0]))); } -#line 1818 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1824 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 23: -#line 218 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 218 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || SequencePtr::dynamicCast((yyvsp[0]))); } -#line 1826 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1832 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 24: -#line 222 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 222 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || DictionaryPtr::dynamicCast((yyvsp[0]))); } -#line 1834 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1840 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 25: -#line 226 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 226 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || EnumPtr::dynamicCast((yyvsp[0]))); } -#line 1842 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1848 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 26: -#line 230 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 230 "src/Slice/Grammar.y" /* yacc.c:1661 */ { assert((yyvsp[0]) == 0 || ConstPtr::dynamicCast((yyvsp[0]))); } -#line 1850 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1856 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 27: -#line 239 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 239 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->setSeenDefinition(); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -1867,11 +1873,11 @@ yyreduce: (yyval) = 0; } } -#line 1871 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1877 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 28: -#line 256 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 256 "src/Slice/Grammar.y" /* yacc.c:1661 */ { if((yyvsp[-3])) { @@ -1883,38 +1889,38 @@ yyreduce: (yyval) = 0; } } -#line 1887 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1893 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 29: -#line 273 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 273 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 1895 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1901 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 30: -#line 277 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 277 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); unit->error("keyword `" + ident->v + "' cannot be used as exception name"); (yyval) = (yyvsp[0]); // Dummy } -#line 1905 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1911 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 31: -#line 288 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 288 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("exceptions cannot be forward declared"); (yyval) = 0; } -#line 1914 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1920 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 32: -#line 298 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 298 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-2])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[-1])); @@ -1928,11 +1934,11 @@ yyreduce: } (yyval) = ex; } -#line 1932 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1938 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 33: -#line 312 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 312 "src/Slice/Grammar.y" /* yacc.c:1661 */ { if((yyvsp[-3])) { @@ -1940,11 +1946,11 @@ yyreduce: } (yyval) = (yyvsp[-3]); } -#line 1944 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1950 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 34: -#line 325 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 325 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[0])); ContainerPtr cont = unit->currentContainer(); @@ -1952,19 +1958,19 @@ yyreduce: cont->checkIntroduced(scoped->v); (yyval) = contained; } -#line 1956 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1962 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 35: -#line 333 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 333 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = 0; } -#line 1964 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1970 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 36: -#line 342 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 342 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[-3])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[-2])); @@ -1973,33 +1979,33 @@ yyreduce: contained->setMetaData(metaData->v); } } -#line 1977 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1983 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 37: -#line 351 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 351 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 1984 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1990 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 38: -#line 354 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 354 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("`;' missing after definition"); } -#line 1992 "Grammar.tab.c" /* yacc.c:1646 */ +#line 1998 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 39: -#line 358 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 358 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 1999 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2005 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 40: -#line 366 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 366 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypePtr type = TypePtr::dynamicCast((yyvsp[-1])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -2007,11 +2013,11 @@ yyreduce: typestring->v = make_pair(type, ident->v); (yyval) = typestring; } -#line 2011 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2017 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 41: -#line 379 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 379 "src/Slice/Grammar.y" /* yacc.c:1661 */ { IntegerTokPtr i = IntegerTokPtr::dynamicCast((yyvsp[-1])); @@ -2031,17 +2037,54 @@ yyreduce: m->v.tag = tag; (yyval) = m; } -#line 2035 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2041 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 42: -#line 399 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 399 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[-1])); ContainerPtr cont = unit->currentContainer(); assert(cont); - ContainedList cl = cont->lookupContained(scoped->v); + ContainedList cl = cont->lookupContained(scoped->v, false); + if(cl.empty()) + { + EnumeratorList enumerators = cont->enumerators(scoped->v); + if(enumerators.size() == 1) + { + // Found + cl.push_back(enumerators.front()); + scoped->v = enumerators.front()->scoped(); + unit->warning(Deprecated, string("referencing enumerator `") + scoped->v + + "' without its enumeration's scope is deprecated"); + } + else if(enumerators.size() > 1) + { + ostringstream os; + os << "enumerator `" << scoped->v << "' could designate"; + bool first = true; + for(EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p) + { + if(first) + { + first = false; + } + else + { + os << " or"; + } + + os << " `" << (*p)->scoped() << "'"; + } + unit->error(os.str()); + } + else + { + unit->error(string("`") + scoped->v + "' is not defined"); + } + } + if(cl.empty()) { YYERROR; // Can't continue, jump to next yyerrok @@ -2091,11 +2134,11 @@ yyreduce: m->v.tag = tag; (yyval) = m; } -#line 2095 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2138 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 43: -#line 455 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 492 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("missing tag for optional"); OptionalDefTokPtr m = new OptionalDefTok; // Dummy @@ -2103,11 +2146,11 @@ yyreduce: m->v.tag = -1; (yyval) = m; } -#line 2107 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2150 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 44: -#line 463 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 500 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("missing tag for optional"); OptionalDefTokPtr m = new OptionalDefTok; // Dummy @@ -2115,11 +2158,11 @@ yyreduce: m->v.tag = -1; (yyval) = m; } -#line 2119 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2162 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 45: -#line 476 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 513 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr m = OptionalDefTokPtr::dynamicCast((yyvsp[-1])); TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[0])); @@ -2127,11 +2170,11 @@ yyreduce: m->v.name = ts->v.second; (yyval) = m; } -#line 2131 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2174 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 46: -#line 484 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 521 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[0])); OptionalDefTokPtr m = new OptionalDefTok; @@ -2141,38 +2184,38 @@ yyreduce: m->v.tag = -1; (yyval) = m; } -#line 2145 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2188 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 48: -#line 505 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 542 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 2153 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2196 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 49: -#line 509 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 546 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); unit->error("keyword `" + ident->v + "' cannot be used as struct name"); (yyval) = (yyvsp[0]); // Dummy } -#line 2163 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2206 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 50: -#line 520 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 557 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("structs cannot be forward declared"); (yyval) = 0; // Dummy } -#line 2172 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2215 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 51: -#line 530 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 567 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-1])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -2191,11 +2234,11 @@ yyreduce: } (yyval) = st; } -#line 2195 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2238 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 52: -#line 549 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 586 "src/Slice/Grammar.y" /* yacc.c:1661 */ { if((yyvsp[-3])) { @@ -2213,11 +2256,11 @@ yyreduce: unit->error("struct `" + st->name() + "' must have at least one member"); // $$ is a dummy } } -#line 2217 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2260 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 53: -#line 572 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 609 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[-3])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[-2])); @@ -2226,51 +2269,51 @@ yyreduce: contained->setMetaData(metaData->v); } } -#line 2230 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2273 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 54: -#line 581 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 618 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 2237 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2280 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 55: -#line 584 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 621 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("`;' missing after definition"); } -#line 2245 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2288 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 56: -#line 588 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 625 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 2252 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2295 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 58: -#line 602 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 639 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 2260 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2303 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 59: -#line 606 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 643 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); unit->error("keyword `" + ident->v + "' cannot be used as class name"); (yyval) = (yyvsp[0]); // Dummy } -#line 2270 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2313 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 60: -#line 617 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 654 "src/Slice/Grammar.y" /* yacc.c:1661 */ { IceUtil::Int64 id = IntegerTokPtr::dynamicCast((yyvsp[-1]))->v; if(id < 0) @@ -2295,17 +2338,54 @@ yyreduce: classId->t = static_cast<int>(id); (yyval) = classId; } -#line 2299 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2342 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 61: -#line 642 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 679 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[-1])); ContainerPtr cont = unit->currentContainer(); assert(cont); - ContainedList cl = cont->lookupContained(scoped->v); + ContainedList cl = cont->lookupContained(scoped->v, false); + if(cl.empty()) + { + EnumeratorList enumerators = cont->enumerators(scoped->v); + if(enumerators.size() == 1) + { + // Found + cl.push_back(enumerators.front()); + scoped->v = enumerators.front()->scoped(); + unit->warning(Deprecated, string("referencing enumerator `") + scoped->v + + "' without its enumeration's scope is deprecated"); + } + else if(enumerators.size() > 1) + { + ostringstream os; + os << "enumerator `" << scoped->v << "' could designate"; + bool first = true; + for(EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p) + { + if(first) + { + first = false; + } + else + { + os << " or"; + } + + os << " `" << (*p)->scoped() << "'"; + } + unit->error(os.str()); + } + else + { + unit->error(string("`") + scoped->v + "' is not defined"); + } + } + if(cl.empty()) { YYERROR; // Can't continue, jump to next yyerrok @@ -2364,22 +2444,22 @@ yyreduce: (yyval) = classId; } -#line 2368 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2448 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 62: -#line 707 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 781 "src/Slice/Grammar.y" /* yacc.c:1661 */ { ClassIdTokPtr classId = new ClassIdTok(); classId->v = StringTokPtr::dynamicCast((yyvsp[0]))->v; classId->t = -1; (yyval) = classId; } -#line 2379 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2459 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 63: -#line 719 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 793 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-1])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -2387,11 +2467,11 @@ yyreduce: ClassDeclPtr cl = cont->createClassDecl(ident->v, false, local->v); (yyval) = cl; } -#line 2391 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2471 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 64: -#line 732 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 806 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-3])); ClassIdTokPtr ident = ClassIdTokPtr::dynamicCast((yyvsp[-2])); @@ -2414,11 +2494,11 @@ yyreduce: (yyval) = 0; } } -#line 2418 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2498 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 65: -#line 755 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 829 "src/Slice/Grammar.y" /* yacc.c:1661 */ { if((yyvsp[-3])) { @@ -2430,11 +2510,11 @@ yyreduce: (yyval) = 0; } } -#line 2434 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2514 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 66: -#line 772 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 846 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[0])); ContainerPtr cont = unit->currentContainer(); @@ -2468,35 +2548,35 @@ yyreduce: } } } -#line 2472 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2552 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 67: -#line 806 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 880 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = 0; } -#line 2480 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2560 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 68: -#line 815 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 889 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 2488 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2568 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 69: -#line 819 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 893 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = new ClassListTok; } -#line 2496 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2576 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 70: -#line 828 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 902 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[-3])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[-2])); @@ -2505,33 +2585,33 @@ yyreduce: contained->setMetaData(metaData->v); } } -#line 2509 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2589 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 71: -#line 837 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 911 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 2516 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2596 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 72: -#line 840 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 914 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("`;' missing after definition"); } -#line 2524 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2604 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 73: -#line 844 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 918 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 2531 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2611 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 74: -#line 852 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 926 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr def = OptionalDefTokPtr::dynamicCast((yyvsp[0])); ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); @@ -2553,11 +2633,11 @@ yyreduce: unit->currentContainer()->checkIntroduced(def->v.name, dm); (yyval) = dm; } -#line 2557 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2637 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 75: -#line 874 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 948 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr def = OptionalDefTokPtr::dynamicCast((yyvsp[-2])); ConstDefTokPtr value = ConstDefTokPtr::dynamicCast((yyvsp[0])); @@ -2584,11 +2664,11 @@ yyreduce: unit->currentContainer()->checkIntroduced(def->v.name, dm); (yyval) = dm; } -#line 2588 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2668 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 76: -#line 901 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 975 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypePtr type = TypePtr::dynamicCast((yyvsp[-1])); string name = StringTokPtr::dynamicCast((yyvsp[0]))->v; @@ -2610,11 +2690,11 @@ yyreduce: assert((yyval)); unit->error("keyword `" + name + "' cannot be used as data member name"); } -#line 2614 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2694 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 77: -#line 923 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 997 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypePtr type = TypePtr::dynamicCast((yyvsp[0])); ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); @@ -2635,11 +2715,11 @@ yyreduce: assert((yyval)); unit->error("missing data member name"); } -#line 2639 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2719 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 78: -#line 949 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1023 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[0])); StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); @@ -2648,11 +2728,11 @@ yyreduce: unit->currentContainer()->checkIntroduced(ts->v.second, dm); (yyval) = dm; } -#line 2652 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2732 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 79: -#line 958 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1032 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[-2])); ConstDefTokPtr value = ConstDefTokPtr::dynamicCast((yyvsp[0])); @@ -2663,11 +2743,11 @@ yyreduce: unit->currentContainer()->checkIntroduced(ts->v.second, dm); (yyval) = dm; } -#line 2667 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2747 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 80: -#line 969 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1043 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[0])); StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); @@ -2676,11 +2756,11 @@ yyreduce: assert((yyval)); unit->error("optional data members not supported in struct"); } -#line 2680 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2760 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 81: -#line 978 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1052 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[-2])); StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); @@ -2689,11 +2769,11 @@ yyreduce: assert((yyval)); unit->error("optional data members not supported in struct"); } -#line 2693 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2773 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 82: -#line 987 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1061 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypePtr type = TypePtr::dynamicCast((yyvsp[-1])); string name = StringTokPtr::dynamicCast((yyvsp[0]))->v; @@ -2703,11 +2783,11 @@ yyreduce: assert((yyval)); unit->error("keyword `" + name + "' cannot be used as data member name"); } -#line 2707 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2787 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 83: -#line 997 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1071 "src/Slice/Grammar.y" /* yacc.c:1661 */ { TypePtr type = TypePtr::dynamicCast((yyvsp[0])); StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); @@ -2716,21 +2796,21 @@ yyreduce: assert((yyval)); unit->error("missing data member name"); } -#line 2720 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2800 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 84: -#line 1011 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1085 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr m = OptionalDefTokPtr::dynamicCast((yyvsp[-1])); m->v.type = TypePtr::dynamicCast((yyvsp[0])); (yyval) = m; } -#line 2730 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2810 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 85: -#line 1017 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1091 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr m = new OptionalDefTok(); m->v.type = TypePtr::dynamicCast((yyvsp[0])); @@ -2738,22 +2818,22 @@ yyreduce: m->v.tag = -1; (yyval) = m; } -#line 2742 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2822 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 86: -#line 1025 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1099 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr m = new OptionalDefTok; m->v.optional = false; m->v.tag = -1; (yyval) = m; } -#line 2753 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2833 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 87: -#line 1037 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1111 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr returnType = OptionalDefTokPtr::dynamicCast((yyvsp[-1])); string name = StringTokPtr::dynamicCast((yyvsp[0]))->v; @@ -2777,11 +2857,11 @@ yyreduce: (yyval) = 0; } } -#line 2781 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2861 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 88: -#line 1061 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1135 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr returnType = OptionalDefTokPtr::dynamicCast((yyvsp[-1])); string name = StringTokPtr::dynamicCast((yyvsp[0]))->v; @@ -2806,11 +2886,11 @@ yyreduce: (yyval) = 0; } } -#line 2810 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2890 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 89: -#line 1086 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1160 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr returnType = OptionalDefTokPtr::dynamicCast((yyvsp[-1])); string name = StringTokPtr::dynamicCast((yyvsp[0]))->v; @@ -2834,11 +2914,11 @@ yyreduce: (yyval) = 0; } } -#line 2838 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2918 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 90: -#line 1110 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1184 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OptionalDefTokPtr returnType = OptionalDefTokPtr::dynamicCast((yyvsp[-1])); string name = StringTokPtr::dynamicCast((yyvsp[0]))->v; @@ -2863,11 +2943,11 @@ yyreduce: (yyval) = 0; } } -#line 2867 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2947 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 91: -#line 1140 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1214 "src/Slice/Grammar.y" /* yacc.c:1661 */ { if((yyvsp[-2])) { @@ -2879,11 +2959,11 @@ yyreduce: (yyval) = 0; } } -#line 2883 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2963 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 92: -#line 1152 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1226 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OperationPtr op = OperationPtr::dynamicCast((yyvsp[-1])); ExceptionListTokPtr el = ExceptionListTokPtr::dynamicCast((yyvsp[0])); @@ -2893,11 +2973,11 @@ yyreduce: op->setExceptionList(el->v); } } -#line 2897 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2977 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 93: -#line 1162 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1236 "src/Slice/Grammar.y" /* yacc.c:1661 */ { if((yyvsp[-2])) { @@ -2905,11 +2985,11 @@ yyreduce: } yyerrok; } -#line 2909 "Grammar.tab.c" /* yacc.c:1646 */ +#line 2989 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 94: -#line 1170 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1244 "src/Slice/Grammar.y" /* yacc.c:1661 */ { OperationPtr op = OperationPtr::dynamicCast((yyvsp[-1])); ExceptionListTokPtr el = ExceptionListTokPtr::dynamicCast((yyvsp[0])); @@ -2919,29 +2999,29 @@ yyreduce: op->setExceptionList(el->v); // Dummy } } -#line 2923 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3003 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 97: -#line 1192 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1266 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 2931 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3011 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 98: -#line 1196 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1270 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); unit->error("keyword `" + ident->v + "' cannot be used as interface name"); (yyval) = (yyvsp[0]); // Dummy } -#line 2941 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3021 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 99: -#line 1207 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1281 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-1])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -2950,11 +3030,11 @@ yyreduce: cont->checkIntroduced(ident->v, cl); (yyval) = cl; } -#line 2954 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3034 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 100: -#line 1221 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1295 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-2])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[-1])); @@ -2972,11 +3052,11 @@ yyreduce: (yyval) = 0; } } -#line 2976 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3056 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 101: -#line 1239 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1313 "src/Slice/Grammar.y" /* yacc.c:1661 */ { if((yyvsp[-3])) { @@ -2988,11 +3068,11 @@ yyreduce: (yyval) = 0; } } -#line 2992 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3072 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 102: -#line 1256 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1330 "src/Slice/Grammar.y" /* yacc.c:1661 */ { ClassListTokPtr intfs = ClassListTokPtr::dynamicCast((yyvsp[0])); StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[-2])); @@ -3027,11 +3107,11 @@ yyreduce: } (yyval) = intfs; } -#line 3031 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3111 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 103: -#line 1291 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1365 "src/Slice/Grammar.y" /* yacc.c:1661 */ { ClassListTokPtr intfs = new ClassListTok; StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3066,45 +3146,45 @@ yyreduce: } (yyval) = intfs; } -#line 3070 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3150 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 104: -#line 1326 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1400 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("illegal inheritance from type Object"); (yyval) = new ClassListTok; // Dummy } -#line 3079 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3159 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 105: -#line 1331 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1405 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("illegal inheritance from type Value"); (yyval) = new ClassListTok; // Dummy } -#line 3088 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3168 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 106: -#line 1341 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1415 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 3096 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3176 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 107: -#line 1345 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1419 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = new ClassListTok; } -#line 3104 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3184 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 108: -#line 1354 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1428 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[-3])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[-2])); @@ -3113,55 +3193,55 @@ yyreduce: contained->setMetaData(metaData->v); } } -#line 3117 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3197 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 109: -#line 1363 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1437 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 3124 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3204 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 110: -#line 1366 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1440 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("`;' missing after definition"); } -#line 3132 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3212 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 111: -#line 1370 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1444 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 3139 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3219 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 113: -#line 1384 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1458 "src/Slice/Grammar.y" /* yacc.c:1661 */ { ExceptionPtr exception = ExceptionPtr::dynamicCast((yyvsp[-2])); ExceptionListTokPtr exceptionList = ExceptionListTokPtr::dynamicCast((yyvsp[0])); exceptionList->v.push_front(exception); (yyval) = exceptionList; } -#line 3150 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3230 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 114: -#line 1391 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1465 "src/Slice/Grammar.y" /* yacc.c:1661 */ { ExceptionPtr exception = ExceptionPtr::dynamicCast((yyvsp[0])); ExceptionListTokPtr exceptionList = new ExceptionListTok; exceptionList->v.push_front(exception); (yyval) = exceptionList; } -#line 3161 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3241 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 115: -#line 1403 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1477 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[0])); ContainerPtr cont = unit->currentContainer(); @@ -3173,21 +3253,21 @@ yyreduce: cont->checkIntroduced(scoped->v, exception); (yyval) = exception; } -#line 3177 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3257 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 116: -#line 1415 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1489 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); unit->error("keyword `" + ident->v + "' cannot be used as exception name"); (yyval) = unit->currentContainer()->createException(IceUtil::generateUUID(), 0, false, Dummy); // Dummy } -#line 3187 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3267 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 117: -#line 1426 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1500 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-6])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3196,11 +3276,11 @@ yyreduce: ContainerPtr cont = unit->currentContainer(); (yyval) = cont->createSequence(ident->v, type, metaData->v, local->v); } -#line 3200 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3280 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 118: -#line 1435 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1509 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-6])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3210,11 +3290,11 @@ yyreduce: (yyval) = cont->createSequence(ident->v, type, metaData->v, local->v); // Dummy unit->error("keyword `" + ident->v + "' cannot be used as sequence name"); } -#line 3214 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3294 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 119: -#line 1450 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1524 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-9])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3225,11 +3305,11 @@ yyreduce: ContainerPtr cont = unit->currentContainer(); (yyval) = cont->createDictionary(ident->v, keyType, keyMetaData->v, valueType, valueMetaData->v, local->v); } -#line 3229 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3309 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 120: -#line 1461 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1535 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-9])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3241,91 +3321,107 @@ yyreduce: (yyval) = cont->createDictionary(ident->v, keyType, keyMetaData->v, valueType, valueMetaData->v, local->v); // Dummy unit->error("keyword `" + ident->v + "' cannot be used as dictionary name"); } -#line 3245 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3325 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 121: -#line 1478 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1552 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 3253 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3333 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 122: -#line 1482 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1556 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); unit->error("keyword `" + ident->v + "' cannot be used as enumeration name"); (yyval) = (yyvsp[0]); // Dummy } -#line 3263 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3343 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 123: -#line 1493 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1567 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-1])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); ContainerPtr cont = unit->currentContainer(); EnumPtr en = cont->createEnum(ident->v, local->v); - cont->checkIntroduced(ident->v, en); + if(en) + { + cont->checkIntroduced(ident->v, en); + } + else + { + en = cont->createEnum(IceUtil::generateUUID(), local->v, Dummy); + } + unit->pushContainer(en); (yyval) = en; } -#line 3276 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3364 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 124: -#line 1502 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1584 "src/Slice/Grammar.y" /* yacc.c:1661 */ { EnumPtr en = EnumPtr::dynamicCast((yyvsp[-3])); if(en) { - EnumeratorListTokPtr enumerators = EnumeratorListTokPtr::dynamicCast((yyvsp[-1])); - if(enumerators->v.empty()) - { - unit->error("enum `" + en->name() + "' must have at least one enumerator"); - } - en->setEnumerators(enumerators->v); // Dummy + EnumeratorListTokPtr enumerators = EnumeratorListTokPtr::dynamicCast((yyvsp[-1])); + if(enumerators->v.empty()) + { + unit->error("enum `" + en->name() + "' must have at least one enumerator"); + } + unit->popContainer(); } (yyval) = (yyvsp[-3]); } -#line 3294 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3382 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 125: -#line 1517 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1599 "src/Slice/Grammar.y" /* yacc.c:1661 */ { unit->error("missing enumeration name"); - BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-4])); + BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[-1])); ContainerPtr cont = unit->currentContainer(); - EnumPtr en = cont->createEnum(IceUtil::generateUUID(), local->v, Dummy); // Dummy - EnumeratorListTokPtr enumerators = EnumeratorListTokPtr::dynamicCast((yyvsp[-1])); - en->setEnumerators(enumerators->v); // Dummy + EnumPtr en = cont->createEnum(IceUtil::generateUUID(), local->v, Dummy); + unit->pushContainer(en); (yyval) = en; } -#line 3308 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3395 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 126: -#line 1532 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 1608 "src/Slice/Grammar.y" /* yacc.c:1661 */ + { + unit->popContainer(); + (yyval) = (yyvsp[-4]); +} +#line 3404 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ + break; + + case 127: +#line 1618 "src/Slice/Grammar.y" /* yacc.c:1661 */ { EnumeratorListTokPtr ens = EnumeratorListTokPtr::dynamicCast((yyvsp[-2])); ens->v.splice(ens->v.end(), EnumeratorListTokPtr::dynamicCast((yyvsp[0]))->v); (yyval) = ens; } -#line 3318 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3414 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 127: -#line 1538 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 128: +#line 1624 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 3325 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3421 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 128: -#line 1546 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 129: +#line 1632 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); EnumeratorListTokPtr ens = new EnumeratorListTok; @@ -3333,15 +3429,15 @@ yyreduce: EnumeratorPtr en = cont->createEnumerator(ident->v); if(en) { - ens->v.push_front(en); + ens->v.push_front(en); } (yyval) = ens; } -#line 3341 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3437 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 129: -#line 1558 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 130: +#line 1644 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[-2])); EnumeratorListTokPtr ens = new EnumeratorListTok; @@ -3356,47 +3452,44 @@ yyreduce: else { EnumeratorPtr en = cont->createEnumerator(ident->v, static_cast<int>(intVal->v)); - if(en) - { - ens->v.push_front(en); - } + ens->v.push_front(en); } } (yyval) = ens; } -#line 3368 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3461 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 130: -#line 1581 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 131: +#line 1664 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); unit->error("keyword `" + ident->v + "' cannot be used as enumerator"); EnumeratorListTokPtr ens = new EnumeratorListTok; // Dummy (yyval) = ens; } -#line 3379 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3472 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 131: -#line 1588 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 132: +#line 1671 "src/Slice/Grammar.y" /* yacc.c:1661 */ { EnumeratorListTokPtr ens = new EnumeratorListTok; (yyval) = ens; // Dummy } -#line 3388 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3481 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 132: -#line 1598 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 133: +#line 1681 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 3396 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3489 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 133: -#line 1602 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 134: +#line 1685 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[0])); ContainedList cl = unit->currentContainer()->lookupContained(scoped->v); @@ -3430,38 +3523,38 @@ yyreduce: (yyval) = tok; } -#line 3434 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3527 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 134: -#line 1641 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 135: +#line 1724 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr out = new BoolTok; out->v = true; (yyval) = out; } -#line 3444 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3537 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 135: -#line 1647 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 136: +#line 1730 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr out = new BoolTok; out->v = false; (yyval) = out; } -#line 3454 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3547 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 136: -#line 1658 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 137: +#line 1741 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 3461 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3554 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 137: -#line 1661 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 138: +#line 1744 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[-2])); OptionalDefTokPtr tsp = OptionalDefTokPtr::dynamicCast((yyvsp[0])); @@ -3477,11 +3570,11 @@ yyreduce: } } } -#line 3481 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3574 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 138: -#line 1677 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 139: +#line 1760 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[-2])); OptionalDefTokPtr tsp = OptionalDefTokPtr::dynamicCast((yyvsp[0])); @@ -3497,11 +3590,11 @@ yyreduce: } } } -#line 3501 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3594 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 139: -#line 1693 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 140: +#line 1776 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[-3])); TypePtr type = TypePtr::dynamicCast((yyvsp[-1])); @@ -3513,11 +3606,11 @@ yyreduce: unit->error("keyword `" + ident->v + "' cannot be used as parameter name"); } } -#line 3517 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3610 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 140: -#line 1705 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 141: +#line 1788 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[-3])); TypePtr type = TypePtr::dynamicCast((yyvsp[-1])); @@ -3529,11 +3622,11 @@ yyreduce: unit->error("keyword `" + ident->v + "' cannot be used as parameter name"); } } -#line 3533 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3626 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 141: -#line 1717 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 142: +#line 1800 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[-2])); TypePtr type = TypePtr::dynamicCast((yyvsp[0])); @@ -3544,11 +3637,11 @@ yyreduce: unit->error("missing parameter name"); } } -#line 3548 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3641 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 142: -#line 1728 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 143: +#line 1811 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[-2])); TypePtr type = TypePtr::dynamicCast((yyvsp[0])); @@ -3559,44 +3652,44 @@ yyreduce: unit->error("missing parameter name"); } } -#line 3563 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3656 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 143: -#line 1744 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 144: +#line 1827 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = (yyvsp[0]); } -#line 3571 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3664 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 144: -#line 1748 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 145: +#line 1831 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = new ExceptionListTok; } -#line 3579 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3672 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 145: -#line 1757 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 146: +#line 1840 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 3586 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3679 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 146: -#line 1760 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 147: +#line 1843 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); ident->v = "::" + ident->v; (yyval) = ident; } -#line 3596 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3689 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 147: -#line 1766 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 148: +#line 1849 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[-2])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3604,107 +3697,107 @@ yyreduce: scoped->v += ident->v; (yyval) = scoped; } -#line 3608 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3701 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 148: -#line 1779 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 149: +#line 1862 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindByte); } -#line 3616 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3709 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 149: -#line 1783 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 150: +#line 1866 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindBool); } -#line 3624 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3717 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 150: -#line 1787 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 151: +#line 1870 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindShort); } -#line 3632 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3725 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 151: -#line 1791 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 152: +#line 1874 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindInt); } -#line 3640 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3733 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 152: -#line 1795 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 153: +#line 1878 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindLong); } -#line 3648 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3741 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 153: -#line 1799 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 154: +#line 1882 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindFloat); } -#line 3656 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3749 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 154: -#line 1803 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 155: +#line 1886 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindDouble); } -#line 3664 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3757 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 155: -#line 1807 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 156: +#line 1890 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindString); } -#line 3672 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3765 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 156: -#line 1811 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 157: +#line 1894 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindObject); } -#line 3680 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3773 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 157: -#line 1815 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 158: +#line 1898 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindObjectProxy); } -#line 3688 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3781 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 158: -#line 1819 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 159: +#line 1902 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindLocalObject); } -#line 3696 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3789 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 159: -#line 1823 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 160: +#line 1906 "src/Slice/Grammar.y" /* yacc.c:1661 */ { (yyval) = unit->builtin(Builtin::KindValue); } -#line 3704 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3797 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 160: -#line 1827 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 161: +#line 1910 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[0])); ContainerPtr cont = unit->currentContainer(); @@ -3723,11 +3816,11 @@ yyreduce: (yyval) = 0; } } -#line 3727 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3820 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 161: -#line 1846 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 162: +#line 1929 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[-1])); ContainerPtr cont = unit->currentContainer(); @@ -3763,70 +3856,70 @@ yyreduce: (yyval) = 0; } } -#line 3767 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3860 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 162: -#line 1887 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 163: +#line 1970 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr str1 = StringTokPtr::dynamicCast((yyvsp[-1])); StringTokPtr str2 = StringTokPtr::dynamicCast((yyvsp[0])); str1->v += str2->v; } -#line 3777 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3870 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 163: -#line 1893 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 164: +#line 1976 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 3784 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3877 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 164: -#line 1901 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 165: +#line 1984 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr str = StringTokPtr::dynamicCast((yyvsp[0])); StringListTokPtr stringList = StringListTokPtr::dynamicCast((yyvsp[-2])); stringList->v.push_back(str->v); (yyval) = stringList; } -#line 3795 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3888 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 165: -#line 1908 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 166: +#line 1991 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr str = StringTokPtr::dynamicCast((yyvsp[0])); StringListTokPtr stringList = new StringListTok; stringList->v.push_back(str->v); (yyval) = stringList; } -#line 3806 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3899 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 166: -#line 1920 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 167: +#line 2003 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = new BoolTok; local->v = true; (yyval) = local; } -#line 3816 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3909 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 167: -#line 1926 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 168: +#line 2009 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BoolTokPtr local = new BoolTok; local->v = false; (yyval) = local; } -#line 3826 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3919 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 168: -#line 1937 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 169: +#line 2020 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BuiltinPtr type = unit->builtin(Builtin::KindLong); IntegerTokPtr intVal = IntegerTokPtr::dynamicCast((yyvsp[0])); @@ -3839,11 +3932,11 @@ yyreduce: def->v.valueAsLiteral = intVal->literal; (yyval) = def; } -#line 3843 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3936 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 169: -#line 1950 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 170: +#line 2033 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BuiltinPtr type = unit->builtin(Builtin::KindDouble); FloatingTokPtr floatVal = FloatingTokPtr::dynamicCast((yyvsp[0])); @@ -3856,17 +3949,18 @@ yyreduce: def->v.valueAsLiteral = floatVal->literal; (yyval) = def; } -#line 3860 "Grammar.tab.c" /* yacc.c:1646 */ +#line 3953 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 170: -#line 1963 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 171: +#line 2046 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[0])); ConstDefTokPtr def = new ConstDefTok; - ContainedList cl = unit->currentContainer()->lookupContained(scoped->v); + ContainedList cl = unit->currentContainer()->lookupContained(scoped->v, false); if(cl.empty()) { + // Could be an enumerator def->v.type = TypePtr(0); def->v.value = SyntaxTreeBasePtr(0); def->v.valueAsString = scoped->v; @@ -3906,11 +4000,11 @@ yyreduce: } (yyval) = def; } -#line 3910 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4004 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 171: -#line 2009 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 172: +#line 2093 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BuiltinPtr type = unit->builtin(Builtin::KindString); StringTokPtr literal = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3921,11 +4015,11 @@ yyreduce: def->v.valueAsLiteral = literal->literal; (yyval) = def; } -#line 3925 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4019 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 172: -#line 2020 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 173: +#line 2104 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BuiltinPtr type = unit->builtin(Builtin::KindBool); StringTokPtr literal = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3936,11 +4030,11 @@ yyreduce: def->v.valueAsLiteral = "false"; (yyval) = def; } -#line 3940 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4034 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 173: -#line 2031 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 174: +#line 2115 "src/Slice/Grammar.y" /* yacc.c:1661 */ { BuiltinPtr type = unit->builtin(Builtin::KindBool); StringTokPtr literal = StringTokPtr::dynamicCast((yyvsp[0])); @@ -3951,11 +4045,11 @@ yyreduce: def->v.valueAsLiteral = "true"; (yyval) = def; } -#line 3955 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4049 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 174: -#line 2047 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 175: +#line 2131 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[-4])); TypePtr const_type = TypePtr::dynamicCast((yyvsp[-3])); @@ -3964,11 +4058,11 @@ yyreduce: (yyval) = unit->currentContainer()->createConst(ident->v, const_type, metaData->v, value->v.value, value->v.valueAsString, value->v.valueAsLiteral); } -#line 3968 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4062 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; - case 175: -#line 2056 "../Slice/Grammar.y" /* yacc.c:1646 */ + case 176: +#line 2140 "src/Slice/Grammar.y" /* yacc.c:1661 */ { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[-3])); TypePtr const_type = TypePtr::dynamicCast((yyvsp[-2])); @@ -3977,221 +4071,221 @@ yyreduce: (yyval) = unit->currentContainer()->createConst(IceUtil::generateUUID(), const_type, metaData->v, value->v.value, value->v.valueAsString, value->v.valueAsLiteral, Dummy); // Dummy } -#line 3981 "Grammar.tab.c" /* yacc.c:1646 */ - break; - - case 176: -#line 2070 "../Slice/Grammar.y" /* yacc.c:1646 */ - { -} -#line 3988 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4075 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 177: -#line 2073 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2154 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 3995 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4082 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 178: -#line 2076 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2157 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4002 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4089 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 179: -#line 2079 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2160 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4009 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4096 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 180: -#line 2082 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2163 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4016 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4103 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 181: -#line 2085 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2166 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4023 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4110 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 182: -#line 2088 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2169 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4030 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4117 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 183: -#line 2091 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2172 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4037 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4124 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 184: -#line 2094 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2175 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4044 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4131 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 185: -#line 2097 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2178 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4051 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4138 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 186: -#line 2100 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2181 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4058 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4145 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 187: -#line 2103 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2184 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4065 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4152 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 188: -#line 2106 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2187 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4072 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4159 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 189: -#line 2109 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2190 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4079 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4166 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 190: -#line 2112 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2193 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4086 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4173 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 191: -#line 2115 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2196 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4093 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4180 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 192: -#line 2118 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2199 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4100 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4187 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 193: -#line 2121 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2202 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4107 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4194 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 194: -#line 2124 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2205 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4114 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4201 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 195: -#line 2127 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2208 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4121 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4208 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 196: -#line 2130 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2211 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4128 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4215 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 197: -#line 2133 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2214 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4135 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4222 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 198: -#line 2136 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2217 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4142 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4229 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 199: -#line 2139 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2220 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4149 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4236 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 200: -#line 2142 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2223 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4156 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4243 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 201: -#line 2145 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2226 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4163 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4250 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 202: -#line 2148 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2229 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4170 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4257 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 203: -#line 2151 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2232 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4177 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4264 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 204: -#line 2154 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2235 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4184 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4271 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; case 205: -#line 2157 "../Slice/Grammar.y" /* yacc.c:1646 */ +#line 2238 "src/Slice/Grammar.y" /* yacc.c:1661 */ + { +} +#line 4278 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ + break; + + case 206: +#line 2241 "src/Slice/Grammar.y" /* yacc.c:1661 */ { } -#line 4191 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4285 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ break; -#line 4195 "Grammar.tab.c" /* yacc.c:1646 */ +#line 4289 "src/Slice/Grammar.cpp" /* yacc.c:1661 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4419,5 +4513,5 @@ yyreturn: #endif return yyresult; } -#line 2161 "../Slice/Grammar.y" /* yacc.c:1906 */ +#line 2245 "src/Slice/Grammar.y" /* yacc.c:1906 */ diff --git a/cpp/src/Slice/Grammar.h b/cpp/src/Slice/Grammar.h index 66aa4b73ccd..86819102570 100644 --- a/cpp/src/Slice/Grammar.h +++ b/cpp/src/Slice/Grammar.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,8 +30,8 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_SLICE_GRAMMAR_TAB_H_INCLUDED -# define YY_SLICE_GRAMMAR_TAB_H_INCLUDED +#ifndef YY_SLICE_SRC_SLICE_GRAMMAR_HPP_INCLUDED +# define YY_SLICE_SRC_SLICE_GRAMMAR_HPP_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -102,4 +102,4 @@ typedef int YYSTYPE; int slice_parse (void); -#endif /* !YY_SLICE_GRAMMAR_TAB_H_INCLUDED */ +#endif /* !YY_SLICE_SRC_SLICE_GRAMMAR_HPP_INCLUDED */ diff --git a/cpp/src/Slice/Grammar.y b/cpp/src/Slice/Grammar.y index 9d04ed64c73..1cca612ee8b 100644 --- a/cpp/src/Slice/Grammar.y +++ b/cpp/src/Slice/Grammar.y @@ -50,7 +50,7 @@ slice_error(const char* s) %} -%pure_parser +%pure-parser // // All keyword tokens. Make sure to modify the "keyword" rule in this @@ -401,7 +401,44 @@ optional ContainerPtr cont = unit->currentContainer(); assert(cont); - ContainedList cl = cont->lookupContained(scoped->v); + ContainedList cl = cont->lookupContained(scoped->v, false); + if(cl.empty()) + { + EnumeratorList enumerators = cont->enumerators(scoped->v); + if(enumerators.size() == 1) + { + // Found + cl.push_back(enumerators.front()); + scoped->v = enumerators.front()->scoped(); + unit->warning(Deprecated, string("referencing enumerator `") + scoped->v + + "' without its enumeration's scope is deprecated"); + } + else if(enumerators.size() > 1) + { + ostringstream os; + os << "enumerator `" << scoped->v << "' could designate"; + bool first = true; + for(EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p) + { + if(first) + { + first = false; + } + else + { + os << " or"; + } + + os << " `" << (*p)->scoped() << "'"; + } + unit->error(os.str()); + } + else + { + unit->error(string("`") + scoped->v + "' is not defined"); + } + } + if(cl.empty()) { YYERROR; // Can't continue, jump to next yyerrok @@ -644,7 +681,44 @@ class_id ContainerPtr cont = unit->currentContainer(); assert(cont); - ContainedList cl = cont->lookupContained(scoped->v); + ContainedList cl = cont->lookupContained(scoped->v, false); + if(cl.empty()) + { + EnumeratorList enumerators = cont->enumerators(scoped->v); + if(enumerators.size() == 1) + { + // Found + cl.push_back(enumerators.front()); + scoped->v = enumerators.front()->scoped(); + unit->warning(Deprecated, string("referencing enumerator `") + scoped->v + + "' without its enumeration's scope is deprecated"); + } + else if(enumerators.size() > 1) + { + ostringstream os; + os << "enumerator `" << scoped->v << "' could designate"; + bool first = true; + for(EnumeratorList::iterator p = enumerators.begin(); p != enumerators.end(); ++p) + { + if(first) + { + first = false; + } + else + { + os << " or"; + } + + os << " `" << (*p)->scoped() << "'"; + } + unit->error(os.str()); + } + else + { + unit->error(string("`") + scoped->v + "' is not defined"); + } + } + if(cl.empty()) { YYERROR; // Can't continue, jump to next yyerrok @@ -1495,7 +1569,15 @@ enum_def StringTokPtr ident = StringTokPtr::dynamicCast($2); ContainerPtr cont = unit->currentContainer(); EnumPtr en = cont->createEnum(ident->v, local->v); - cont->checkIntroduced(ident->v, en); + if(en) + { + cont->checkIntroduced(ident->v, en); + } + else + { + en = cont->createEnum(IceUtil::generateUUID(), local->v, Dummy); + } + unit->pushContainer(en); $$ = en; } '{' enumerator_list '}' @@ -1503,26 +1585,30 @@ enum_def EnumPtr en = EnumPtr::dynamicCast($3); if(en) { - EnumeratorListTokPtr enumerators = EnumeratorListTokPtr::dynamicCast($5); - if(enumerators->v.empty()) - { - unit->error("enum `" + en->name() + "' must have at least one enumerator"); - } - en->setEnumerators(enumerators->v); // Dummy + EnumeratorListTokPtr enumerators = EnumeratorListTokPtr::dynamicCast($5); + if(enumerators->v.empty()) + { + unit->error("enum `" + en->name() + "' must have at least one enumerator"); + } + unit->popContainer(); } $$ = $3; } | -local_qualifier ICE_ENUM '{' enumerator_list '}' +local_qualifier ICE_ENUM { unit->error("missing enumeration name"); BoolTokPtr local = BoolTokPtr::dynamicCast($1); ContainerPtr cont = unit->currentContainer(); - EnumPtr en = cont->createEnum(IceUtil::generateUUID(), local->v, Dummy); // Dummy - EnumeratorListTokPtr enumerators = EnumeratorListTokPtr::dynamicCast($4); - en->setEnumerators(enumerators->v); // Dummy + EnumPtr en = cont->createEnum(IceUtil::generateUUID(), local->v, Dummy); + unit->pushContainer(en); $$ = en; } +'{' enumerator_list '}' +{ + unit->popContainer(); + $$ = $2; +} ; // ---------------------------------------------------------------------- @@ -1550,7 +1636,7 @@ enumerator EnumeratorPtr en = cont->createEnumerator(ident->v); if(en) { - ens->v.push_front(en); + ens->v.push_front(en); } $$ = ens; } @@ -1569,10 +1655,7 @@ enumerator else { EnumeratorPtr en = cont->createEnumerator(ident->v, static_cast<int>(intVal->v)); - if(en) - { - ens->v.push_front(en); - } + ens->v.push_front(en); } } $$ = ens; @@ -1963,9 +2046,10 @@ const_initializer { StringTokPtr scoped = StringTokPtr::dynamicCast($1); ConstDefTokPtr def = new ConstDefTok; - ContainedList cl = unit->currentContainer()->lookupContained(scoped->v); + ContainedList cl = unit->currentContainer()->lookupContained(scoped->v, false); if(cl.empty()) { + // Could be an enumerator def->v.type = TypePtr(0); def->v.value = SyntaxTreeBasePtr(0); def->v.valueAsString = scoped->v; diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 656da795cf4..de6ad85bb96 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1167,13 +1167,8 @@ Slice::Container::createEnum(const string& name, bool local, NodeType nt) EnumeratorPtr Slice::Container::createEnumerator(const string& name) { - EnumeratorPtr p = validateEnumerator(name); - if(p) - { - return p; - } - - p = new Enumerator(this, name); + validateEnumerator(name); + EnumeratorPtr p = new Enumerator(this, name); _contents.push_back(p); return p; } @@ -1181,13 +1176,8 @@ Slice::Container::createEnumerator(const string& name) EnumeratorPtr Slice::Container::createEnumerator(const string& name, int value) { - EnumeratorPtr p = validateEnumerator(name); - if(p) - { - return p; - } - - p = new Enumerator(this, name, value); + validateEnumerator(name); + EnumeratorPtr p = new Enumerator(this, name, value); _contents.push_back(p); return p; } @@ -1233,15 +1223,17 @@ Slice::Container::createConst(const string name, const TypePtr& constType, const checkForGlobalDef(name, "constant"); // Don't return here -- we create the constant anyway. } + SyntaxTreeBasePtr resolvedValueType = valueType; + // - // Validate the constant and its value. + // Validate the constant and its value; for enums, find enumerator // - if(nt == Real && !validateConstant(name, constType, valueType, value, true)) + if(nt == Real && !validateConstant(name, constType, resolvedValueType, value, true)) { return 0; } - ConstPtr p = new Const(this, name, constType, metaData, valueType, value, literal); + ConstPtr p = new Const(this, name, constType, metaData, resolvedValueType, value, literal); _contents.push_back(p); return p; } @@ -1626,6 +1618,86 @@ Slice::Container::enums() const return result; } +EnumeratorList +Slice::Container::enumerators() const +{ + EnumeratorList result; + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + EnumeratorPtr q = EnumeratorPtr::dynamicCast(*p); + if(q) + { + result.push_back(q); + } + } + return result; +} + +// +// Find enumerators using the old unscoped enumerators lookup +// +EnumeratorList +Slice::Container::enumerators(const string& scoped) const +{ + EnumeratorList result; + string::size_type lastColon = scoped.rfind(':'); + + if(lastColon == string::npos) + { + // check all enclosing scopes + ContainerPtr container = const_cast<Container*>(this); + do + { + EnumList enums = container->enums(); + for(EnumList::iterator p = enums.begin(); p != enums.end(); ++p) + { + ContainedList cl = (*p)->lookupContained(scoped, false); + if(!cl.empty()) + { + result.push_back(EnumeratorPtr::dynamicCast(cl.front())); + } + } + + ContainedPtr contained = ContainedPtr::dynamicCast(container); + if(contained) + { + container = contained->container(); + } + else + { + container = 0; + } + } + while(result.empty() && container); + } + else + { + // Find the referenced scope + ContainerPtr container = const_cast<Container*>(this); + string scope = scoped.substr(0, scoped.rfind("::")); + ContainedList cl = container->lookupContained(scope, false); + if(!cl.empty()) + { + container = ContainerPtr::dynamicCast(cl.front()); + if(container) + { + EnumList enums = container->enums(); + string name = scoped.substr(lastColon + 1); + for(EnumList::iterator p = enums.begin(); p != enums.end(); ++p) + { + ContainedList cl = (*p)->lookupContained(name, false); + if(!cl.empty()) + { + result.push_back(EnumeratorPtr::dynamicCast(cl.front())); + } + } + } + } + } + + return result; +} + ConstList Slice::Container::consts() const { @@ -2627,7 +2699,7 @@ Slice::Container::checkGlobalMetaData(const StringList& m1, const StringList& m2 } bool -Slice::Container::validateConstant(const string& name, const TypePtr& type, const SyntaxTreeBasePtr& valueType, +Slice::Container::validateConstant(const string& name, const TypePtr& type, SyntaxTreeBasePtr& valueType, const string& value, bool isConstant) { // @@ -2856,20 +2928,57 @@ Slice::Container::validateConstant(const string& name, const TypePtr& type, cons } else { - EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); - - if(!lte) + if(valueType) { - string msg = "type of initializer is incompatible with the type of " + desc + " `" + name + "'"; - _unit->error(msg); - return false; + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + + if(!lte) + { + string msg = "type of initializer is incompatible with the type of " + desc + " `" + name + "'"; + _unit->error(msg); + return false; + } + EnumeratorList elist = e->enumerators(); + if(find(elist.begin(), elist.end(), lte) == elist.end()) + { + string msg = "enumerator `" + value + "' is not defined in enumeration `" + e->scoped() + "'"; + _unit->error(msg); + return false; + } } - EnumeratorList elist = e->getEnumerators(); - if(find(elist.begin(), elist.end(), lte) == elist.end()) + else { - string msg = "enumerator `" + value + "' is not defined in enumeration `" + e->scoped() + "'"; - _unit->error(msg); - return false; + // Check if value designates an enumerator of e + string newVal = value; + string::size_type lastColon = value.rfind(':'); + if(lastColon != string::npos && lastColon + 1 < value.length()) + { + newVal = value.substr(0, lastColon + 1) + e->name() + "::" + value.substr(lastColon + 1); + } + + ContainedList clist = e->lookupContained(newVal, false); + if(clist.empty()) + { + string msg = "`" + value + "' does not designate an enumerator of `" + e->scoped() + "'"; + _unit->error(msg); + return false; + } + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(clist.front()); + if(lte) + { + valueType = lte; + if(lastColon != string::npos) + { + _unit->warning(Deprecated, string("referencing enumerator `") + lte->name() + + "' in its enumeration's enclosing scope is deprecated"); + } + } + else + { + string msg = "type of initializer is incompatible with the type of " + desc + " `" + name + "'"; + _unit->error(msg); + return false; + } } } } @@ -2877,7 +2986,7 @@ Slice::Container::validateConstant(const string& name, const TypePtr& type, cons return true; } -EnumeratorPtr +void Slice::Container::validateEnumerator(const string& name) { checkIdentifier(name); @@ -2885,32 +2994,19 @@ Slice::Container::validateEnumerator(const string& name) ContainedList matches = _unit->findContents(thisScope() + name); if(!matches.empty()) { - EnumeratorPtr p = EnumeratorPtr::dynamicCast(matches.front()); - if(p) - { - if(_unit->ignRedefs()) - { - p->updateIncludeLevel(); - return p; - } - } if(matches.front()->name() == name) { - string msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name(); - msg += "' as enumerator"; - _unit->error(msg); + _unit->error(string("redefinition of enumerator `") + name + "'"); } else { string msg = "enumerator `" + name + "' differs only in capitalization from "; - msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'"; + msg += "`" + matches.front()->name() + "'"; _unit->error(msg); } } nameIsLegal(name, "enumerator"); // Don't return here -- we create the enumerator anyway. - - return 0; } // ---------------------------------------------------------------------- @@ -3486,7 +3582,7 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type, bool string dv = defaultValue; string dl = defaultLiteral; - if(dlt) + if(dlt || (EnumPtr::dynamicCast(type) && !dv.empty())) { // // Validate the default value. @@ -4009,7 +4105,7 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type, bool string dv = defaultValue; string dl = defaultLiteral; - if(dlt) + if(dlt || (EnumPtr::dynamicCast(type) && !dv.empty())) { // // Validate the default value. @@ -4331,7 +4427,7 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type, bool op string dv = defaultValue; string dl = defaultLiteral; - if(dlt) + if(dlt || (EnumPtr::dynamicCast(type) && !dv.empty())) { // // Validate the default value. @@ -4797,71 +4893,9 @@ Slice::Dictionary::Dictionary(const ContainerPtr& container, const string& name, void Slice::Enum::destroy() { - _enumerators.clear(); SyntaxTreeBase::destroy(); } -EnumeratorList -Slice::Enum::getEnumerators() -{ - return _enumerators; -} - -void -Slice::Enum::setEnumerators(const EnumeratorList& ens) -{ - _enumerators = ens; - int lastValue = -1; - set<int> values; - for(EnumeratorList::iterator p = _enumerators.begin(); p != _enumerators.end(); ++p) - { - (*p)->_type = this; - - if((*p)->_explicitValue) - { - _explicitValue = true; - - if((*p)->_value < 0) - { - string msg = "value for enumerator `" + (*p)->name() + "' is out of range"; - _unit->error(msg); - } - } - else - { - if(lastValue == Int32Max) - { - string msg = "value for enumerator `" + (*p)->name() + "' is out of range"; - _unit->error(msg); - } - - // - // If the enumerator was not assigned an explicit value, we automatically assign - // it one more than the previous enumerator. - // - (*p)->_value = lastValue + 1; - } - - if(values.count((*p)->_value) != 0) - { - string msg = "enumerator `" + (*p)->name() + "' has a duplicate value"; - _unit->error(msg); - } - values.insert((*p)->_value); - - lastValue = (*p)->_value; - - if(lastValue > _maxValue) - { - _maxValue = lastValue; - } - if(lastValue < _minValue) - { - _minValue = lastValue; - } - } -} - bool Slice::Enum::explicitValue() const { @@ -4930,15 +4964,77 @@ Slice::Enum::recDependencies(set<ConstructedPtr>&) Slice::Enum::Enum(const ContainerPtr& container, const string& name, bool local) : SyntaxTreeBase(container->unit()), + Container(container->unit()), Type(container->unit()), Contained(container, name), Constructed(container, name, local), _explicitValue(false), _minValue(Int32Max), - _maxValue(0) + _maxValue(0), + _lastValue(-1) { } +int +Slice::Enum::newEnumerator(const EnumeratorPtr& p) +{ + if(p->explicitValue()) + { + _explicitValue = true; + _lastValue = p->value(); + + if(_lastValue < 0) + { + string msg = "value for enumerator `" + p->name() + "' is out of range"; + _unit->error(msg); + } + } + else + { + if(_lastValue == Int32Max) + { + string msg = "value for enumerator `" + p->name() + "' is out of range"; + _unit->error(msg); + } + else + { + // + // If the enumerator was not assigned an explicit value, we automatically assign + // it one more than the previous enumerator. + // + ++_lastValue; + } + } + + bool checkForDuplicates = true; + if(_lastValue > _maxValue) + { + _maxValue = _lastValue; + checkForDuplicates = false; + } + if(_lastValue < _minValue) + { + _minValue = _lastValue; + checkForDuplicates = false; + } + + if(checkForDuplicates) + { + EnumeratorList enl = enumerators(); + for(EnumeratorList::iterator q = enl.begin(); q != enl.end(); ++q) + { + EnumeratorPtr& r = *q; + if(r != p && r->value() == _lastValue) + { + _unit->error(string("enumerator `") + p->name() + "' has the same value as enumerator `" + + r->name() + "'"); + } + } + } + + return _lastValue; +} + // ---------------------------------------------------------------------- // Enumerator // ---------------------------------------------------------------------- @@ -4946,7 +5042,7 @@ Slice::Enum::Enum(const ContainerPtr& container, const string& name, bool local) EnumPtr Slice::Enumerator::type() const { - return _type; + return EnumPtr::dynamicCast(container()); } Contained::ContainedType @@ -4985,6 +5081,7 @@ Slice::Enumerator::Enumerator(const ContainerPtr& container, const string& name) _explicitValue(false), _value(-1) { + _value = EnumPtr::dynamicCast(container)->newEnumerator(this); } Slice::Enumerator::Enumerator(const ContainerPtr& container, const string& name, int value) : @@ -4993,6 +5090,7 @@ Slice::Enumerator::Enumerator(const ContainerPtr& container, const string& name, _explicitValue(true), _value(value) { + EnumPtr::dynamicCast(container)->newEnumerator(this); } // ---------------------------------------------------------------------- @@ -5065,6 +5163,11 @@ Slice::Const::Const(const ContainerPtr& container, const string& name, const Typ _value(value), _literal(literal) { + if(valueType == 0) + { + cerr << "const " << name << " created with null valueType" << endl; + } + } // ---------------------------------------------------------------------- diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h index 1c7fc8f2fea..b5afc987e75 100644 --- a/cpp/src/Slice/Parser.h +++ b/cpp/src/Slice/Parser.h @@ -451,6 +451,8 @@ public: SequenceList sequences() const; DictionaryList dictionaries() const; EnumList enums() const; + EnumeratorList enumerators() const; + EnumeratorList enumerators(const std::string&) const; ConstList consts() const; ContainedList contents() const; bool hasNonLocalClassDecls() const; @@ -492,8 +494,8 @@ protected: void checkIdentifier(const std::string&) const; bool checkInterfaceAndLocal(const std::string&, bool, bool, bool, bool, bool); bool checkGlobalMetaData(const StringList&, const StringList&); - bool validateConstant(const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, bool); - EnumeratorPtr validateEnumerator(const std::string&); + bool validateConstant(const std::string&, const TypePtr&, SyntaxTreeBasePtr&, const std::string&, bool); + void validateEnumerator(const std::string&); ContainedList _contents; std::map<std::string, ContainedPtr, CICompare> _introducedMap; @@ -855,13 +857,11 @@ protected: // Enum // ---------------------------------------------------------------------- -class Enum : public virtual Constructed +class Enum : public virtual Container, public virtual Constructed { public: virtual void destroy(); - EnumeratorList getEnumerators(); - void setEnumerators(const EnumeratorList&); bool explicitValue() const; int minValue() const; int maxValue() const; @@ -877,12 +877,15 @@ public: protected: Enum(const ContainerPtr&, const std::string&, bool); + int newEnumerator(const EnumeratorPtr&); + friend class Container; + friend class Enumerator; - EnumeratorList _enumerators; bool _explicitValue; IceUtil::Int64 _minValue; IceUtil::Int64 _maxValue; + int _lastValue; }; // ---------------------------------------------------------------------- @@ -906,9 +909,7 @@ protected: Enumerator(const ContainerPtr&, const std::string&); Enumerator(const ContainerPtr&, const std::string&, int); friend class Container; - friend class Enum; - EnumPtr _type; bool _explicitValue; int _value; }; diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index f4c59dd141b..bb21315c21a 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -1653,7 +1653,7 @@ Slice::Python::CodeVisitor::visitEnum(const EnumPtr& p) string scoped = p->scoped(); string abs = getAbsolute(p); string name = fixIdent(p->name()); - EnumeratorList enums = p->getEnumerators(); + EnumeratorList enums = p->enumerators(); EnumeratorList::iterator q; _out << sp << nl << "if " << getDictLookup(p) << ':'; @@ -1876,7 +1876,7 @@ Slice::Python::CodeVisitor::writeInitializer(const DataMemberPtr& m) EnumPtr en = EnumPtr::dynamicCast(p); if(en) { - EnumeratorList enums = en->getEnumerators(); + EnumeratorList enums = en->enumerators(); _out << getSymbol(en) << "." << fixIdent(enums.front()->name()); return; } @@ -2042,18 +2042,9 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax } else if(en) { - string enumName = getSymbol(en); - string::size_type colon = value.rfind(':'); - string enumerator; - if(colon != string::npos) - { - enumerator = fixIdent(value.substr(colon + 1)); - } - else - { - enumerator = fixIdent(value); - } - _out << enumName << '.' << enumerator; + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + _out << getSymbol(lte); } else { diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp index 9c1a32d8e77..19cb48567c9 100644 --- a/cpp/src/Slice/RubyUtil.cpp +++ b/cpp/src/Slice/RubyUtil.cpp @@ -1028,7 +1028,7 @@ Slice::Ruby::CodeVisitor::visitEnum(const EnumPtr& p) { string scoped = p->scoped(); string name = fixIdent(p->name(), IdentToUpper); - EnumeratorList enums = p->getEnumerators(); + EnumeratorList enums = p->enumerators(); _out << sp << nl << "if not defined?(" << getAbsolute(p, IdentToUpper) << ')'; _out.inc(); @@ -1286,7 +1286,7 @@ Slice::Ruby::CodeVisitor::getInitializer(const DataMemberPtr& m) EnumPtr en = EnumPtr::dynamicCast(p); if(en) { - EnumeratorList enums = en->getEnumerators(); + EnumeratorList enums = en->enumerators(); return getAbsolute(en, IdentToUpper) + "::" + fixIdent(enums.front()->name(), IdentToUpper); } @@ -1355,16 +1355,9 @@ Slice::Ruby::CodeVisitor::writeConstantValue(const TypePtr& type, const SyntaxTr } else if(en) { - _out << getAbsolute(en, IdentToUpper) << "::"; - string::size_type colon = value.rfind(':'); - if(colon != string::npos) - { - _out << fixIdent(value.substr(colon + 1), IdentToUpper); - } - else - { - _out << fixIdent(value, IdentToUpper); - } + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + _out << getAbsolute(lte, IdentToUpper); } else { diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp index b866d155494..8d14ff3cd30 100644 --- a/cpp/src/Slice/Scanner.cpp +++ b/cpp/src/Slice/Scanner.cpp @@ -1,7 +1,7 @@ #include <IceUtil/ScannerConfig.h> -#line 2 "lex.yy.c" +#line 1 "lex.yy.c" -#line 4 "lex.yy.c" +#line 3 "lex.yy.c" #define YY_INT_ALIGNED short int @@ -28,12 +28,90 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 3 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif + #define yy_create_buffer slice__create_buffer + + #define yy_delete_buffer slice__delete_buffer + + #define yy_scan_buffer slice__scan_buffer + + #define yy_scan_string slice__scan_string + + #define yy_scan_bytes slice__scan_bytes + + #define yy_init_buffer slice__init_buffer + + #define yy_flush_buffer slice__flush_buffer + + #define yy_load_buffer_state slice__load_buffer_state + + #define yy_switch_to_buffer slice__switch_to_buffer + + #define yypush_buffer_state slice_push_buffer_state + + #define yypop_buffer_state slice_pop_buffer_state + + #define yyensure_buffer_stack slice_ensure_buffer_stack + + #define yylex slice_lex + + #define yyrestart slice_restart + + #define yylex_init slice_lex_init + + #define yylex_init_extra slice_lex_init_extra + + #define yylex_destroy slice_lex_destroy + + #define yyget_debug slice_get_debug + + #define yyset_debug slice_set_debug + + #define yyget_extra slice_get_extra + + #define yyset_extra slice_set_extra + + #define yyget_in slice_get_in + + #define yyset_in slice_set_in + + #define yyget_out slice_get_out + + #define yyset_out slice_set_out + + #define yyget_leng slice_get_leng + + #define yyget_text slice_get_text + + #define yyget_lineno slice_get_lineno + + #define yyset_lineno slice_set_lineno + + #define yywrap slice_wrap + + #define yyalloc slice_alloc + + #define yyrealloc slice_realloc + + #define yyfree slice_free + + #define yytext slice_text + + #define yyleng slice_leng + + #define yyin slice_in + + #define yyout slice_out + + #define yy_flex_debug slice__flex_debug + + #define yylineno slice_lineno + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -67,7 +145,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -75,7 +152,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -106,63 +182,55 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST +#endif /* ! C99 */ -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +#endif /* ! FLEXINT_H */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE slice_restart(slice_in ) - #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -179,15 +247,16 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t slice_leng; +extern int slice_leng; extern FILE *slice_in, *slice_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -202,7 +271,6 @@ extern FILE *slice_in, *slice_out; YY_DO_BEFORE_ACTION; /* set up slice_text again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -217,12 +285,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -245,7 +313,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -273,7 +341,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -284,7 +352,6 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ @@ -292,11 +359,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when slice_text is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t slice_leng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int slice_leng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -305,30 +372,28 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void slice_restart (FILE *input_file ); -void slice__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE slice__create_buffer (FILE *file,int size ); -void slice__delete_buffer (YY_BUFFER_STATE b ); -void slice__flush_buffer (YY_BUFFER_STATE b ); -void slice_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void slice_pop_buffer_state (void ); - -static void slice_ensure_buffer_stack (void ); -static void slice__load_buffer_state (void ); -static void slice__init_buffer (YY_BUFFER_STATE b,FILE *file ); - +void slice_restart ( FILE *input_file ); +void slice__switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE slice__create_buffer ( FILE *file, int size ); +void slice__delete_buffer ( YY_BUFFER_STATE b ); +void slice__flush_buffer ( YY_BUFFER_STATE b ); +void slice_push_buffer_state ( YY_BUFFER_STATE new_buffer ); +void slice_pop_buffer_state ( void ); + +static void slice_ensure_buffer_stack ( void ); +static void slice__load_buffer_state ( void ); +static void slice__init_buffer ( YY_BUFFER_STATE b, FILE *file ); #define YY_FLUSH_BUFFER slice__flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE slice__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE slice__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE slice__scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE slice__scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE slice__scan_string ( const char *yy_str ); +YY_BUFFER_STATE slice__scan_bytes ( const char *bytes, int len ); -void *slice_alloc (yy_size_t ); -void *slice_realloc (void *,yy_size_t ); -void slice_free (void * ); +void *slice_alloc ( yy_size_t ); +void *slice_realloc ( void *, yy_size_t ); +void slice_free ( void * ); #define yy_new_buffer slice__create_buffer - #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ @@ -338,7 +403,6 @@ void slice_free (void * ); } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ @@ -348,42 +412,41 @@ void slice_free (void * ); } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define slice_wrap(n) 1 +#define slice_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *slice_in = (FILE *) 0, *slice_out = (FILE *) 0; +FILE *slice_in = NULL, *slice_out = NULL; typedef int yy_state_type; extern int slice_lineno; - int slice_lineno = 1; extern char *slice_text; +#ifdef yytext_ptr +#undef yytext_ptr +#endif #define yytext_ptr slice_text -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up slice_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - slice_leng = (yy_size_t) (yy_cp - yy_bp); \ + slice_leng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 20 #define YY_END_OF_BUFFER 21 /* This struct is not used in this scanner, @@ -393,7 +456,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[73] = +static const flex_int16_t yy_accept[73] = { 0, 0, 0, 0, 0, 0, 0, 21, 19, 17, 17, 14, 19, 19, 19, 15, 15, 19, 13, 8, 19, @@ -405,7 +468,7 @@ static yyconst flex_int16_t yy_accept[73] = 4, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, @@ -437,7 +500,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[32] = +static const YY_CHAR yy_meta[32] = { 0, 1, 2, 3, 4, 1, 1, 4, 1, 5, 5, 1, 1, 6, 6, 6, 1, 7, 7, 7, 8, @@ -445,7 +508,7 @@ static yyconst flex_int32_t yy_meta[32] = 1 } ; -static yyconst flex_int16_t yy_base[85] = +static const flex_int16_t yy_base[85] = { 0, 0, 185, 0, 26, 0, 184, 189, 192, 192, 192, 192, 22, 25, 33, 47, 35, 153, 40, 147, 0, @@ -458,7 +521,7 @@ static yyconst flex_int16_t yy_base[85] = 156, 164, 170, 179 } ; -static yyconst flex_int16_t yy_def[85] = +static const flex_int16_t yy_def[85] = { 0, 72, 1, 1, 1, 1, 1, 72, 72, 72, 72, 72, 72, 72, 72, 72, 15, 72, 73, 72, 74, @@ -471,7 +534,7 @@ static yyconst flex_int16_t yy_def[85] = 72, 72, 72, 72 } ; -static yyconst flex_int16_t yy_nxt[224] = +static const flex_int16_t yy_nxt[224] = { 0, 8, 9, 10, 9, 11, 8, 8, 8, 12, 12, 13, 14, 15, 16, 16, 17, 18, 18, 18, 18, @@ -500,7 +563,7 @@ static yyconst flex_int16_t yy_nxt[224] = 72, 72, 72 } ; -static yyconst flex_int16_t yy_chk[224] = +static const flex_int16_t yy_chk[224] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -625,9 +688,9 @@ int checkKeyword(string&); #define YY_USER_INIT initScanner(); +#line 690 "lex.yy.c" - -#line 630 "lex.yy.c" +#line 692 "lex.yy.c" #define INITIAL 0 #define BOMSCAN 1 @@ -645,36 +708,36 @@ int checkKeyword(string&); #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int slice_lex_destroy (void ); +int slice_lex_destroy ( void ); -int slice_get_debug (void ); +int slice_get_debug ( void ); -void slice_set_debug (int debug_flag ); +void slice_set_debug ( int debug_flag ); -YY_EXTRA_TYPE slice_get_extra (void ); +YY_EXTRA_TYPE slice_get_extra ( void ); -void slice_set_extra (YY_EXTRA_TYPE user_defined ); +void slice_set_extra ( YY_EXTRA_TYPE user_defined ); -FILE *slice_get_in (void ); +FILE *slice_get_in ( void ); -void slice_set_in (FILE * in_str ); +void slice_set_in ( FILE * _in_str ); -FILE *slice_get_out (void ); +FILE *slice_get_out ( void ); -void slice_set_out (FILE * out_str ); +void slice_set_out ( FILE * _out_str ); -yy_size_t slice_get_leng (void ); + int slice_get_leng ( void ); -char *slice_get_text (void ); +char *slice_get_text ( void ); -int slice_get_lineno (void ); +int slice_get_lineno ( void ); -void slice_set_lineno (int line_number ); +void slice_set_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -682,35 +745,43 @@ void slice_set_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int slice_wrap (void ); +extern "C" int slice_wrap ( void ); #else -extern int slice_wrap (void ); +extern int slice_wrap ( void ); #endif #endif - static void yyunput (int c,char *buf_ptr ); +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr ); +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -718,7 +789,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( slice_text, slice_leng, 1, slice_out ) +#define ECHO do { if (fwrite( slice_text, (size_t) slice_leng, 1, slice_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -729,7 +800,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( slice_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -742,7 +813,7 @@ static int input (void ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, slice_in))==0 && ferror(slice_in)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, slice_in)) == 0 && ferror(slice_in)) \ { \ if( errno != EINTR) \ { \ @@ -797,7 +868,7 @@ extern int slice_lex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -810,15 +881,10 @@ extern int slice_lex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 98 "src/Slice/Scanner.l" - - -#line 820 "lex.yy.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -845,7 +911,13 @@ YY_DECL slice__load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 98 "src/Slice/Scanner.l" + + +#line 917 "lex.yy.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -862,7 +934,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -872,9 +944,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 72 ); @@ -904,7 +976,7 @@ YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP #line 100 "src/Slice/Scanner.l" { - if(unit->scanPosition(slice_text)) + if(unit->scanPosition(yytext)) { BEGIN(BOMSCAN); } @@ -913,12 +985,13 @@ YY_RULE_SETUP case 2: /* rule 2 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up slice_text */ +YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP #line 107 "src/Slice/Scanner.l" { - if(unit->scanPosition(slice_text)) + if(unit->scanPosition(yytext)) { BEGIN(BOMSCAN); } @@ -931,7 +1004,7 @@ YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP #line 114 "src/Slice/Scanner.l" { - if(unit->scanPosition(slice_text)) + if(unit->scanPosition(yytext)) { BEGIN(BOMSCAN); } @@ -940,12 +1013,13 @@ YY_RULE_SETUP case 4: /* rule 4 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up slice_text */ +YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP #line 121 "src/Slice/Scanner.l" { - if(unit->scanPosition(slice_text)) + if(unit->scanPosition(yytext)) { BEGIN(BOMSCAN); } @@ -975,7 +1049,7 @@ YY_RULE_SETUP { // C-style comment BEGIN(MAINSCAN); - string comment = slice_text + 2; + string comment = yytext + 2; while(true) { int c = yyinput(); @@ -1060,10 +1134,10 @@ YY_RULE_SETUP { BEGIN(MAINSCAN); StringTokPtr ident = new StringTok; - ident->v = *slice_text == '\\' ? slice_text + 1 : slice_text; + ident->v = *yytext == '\\' ? yytext + 1 : yytext; ident->v.erase(ident->v.find_first_of(" \t\v\n\r\f(")); *yylvalp = ident; - if(*slice_text == '\\') + if(*yytext == '\\') { return ICE_IDENT_OP; } @@ -1088,9 +1162,9 @@ YY_RULE_SETUP { BEGIN(MAINSCAN); StringTokPtr ident = new StringTok; - ident->v = *slice_text == '\\' ? slice_text + 1 : slice_text; + ident->v = *yytext == '\\' ? yytext + 1 : yytext; *yylvalp = ident; - return *slice_text == '\\' ? ICE_IDENTIFIER : checkKeyword(ident->v); + return *yytext == '\\' ? ICE_IDENTIFIER : checkKeyword(ident->v); } YY_BREAK case 14: @@ -1305,13 +1379,13 @@ YY_RULE_SETUP { BEGIN(MAINSCAN); IntegerTokPtr itp = new IntegerTok; - itp->literal = string(slice_text); + itp->literal = string(yytext); *yylvalp = itp; - if(!IceUtilInternal::stringToInt64(string(slice_text), itp->v)) + if(!IceUtilInternal::stringToInt64(string(yytext), itp->v)) { assert(itp->v != 0); string msg = "integer constant `"; - msg += slice_text; + msg += yytext; msg += "' out of range"; unit->error(msg); } @@ -1326,7 +1400,7 @@ YY_RULE_SETUP errno = 0; FloatingTokPtr ftp = new FloatingTok; *yylvalp = ftp; - string literal(slice_text); + string literal(yytext); ftp->literal = literal; char lastChar = literal[literal.size() - 1]; if(lastChar == 'f' || lastChar == 'F') @@ -1337,14 +1411,14 @@ YY_RULE_SETUP if((ftp->v == HUGE_VAL || ftp->v == -HUGE_VAL) && errno == ERANGE) { string msg = "floating-point constant `"; - msg += slice_text; + msg += yytext; msg += "' too large (overflow)"; unit->error(msg); } else if(ftp->v == 0 && errno == ERANGE) { string msg = "floating-point constant `"; - msg += slice_text; + msg += yytext; msg += "' too small (underflow)"; unit->error(msg); } @@ -1362,7 +1436,7 @@ YY_RULE_SETUP { BEGIN(MAINSCAN); } - if(slice_text[0] == '\n') + if(yytext[0] == '\n') { unit->nextLine(); } @@ -1382,18 +1456,18 @@ YY_RULE_SETUP #line 510 "src/Slice/Scanner.l" { BEGIN(MAINSCAN); - if(slice_text[0] < 32 || slice_text[0] > 126) + if(yytext[0] < 32 || yytext[0] > 126) { stringstream s; s << "illegal input character: '\\"; s.width(3); s.fill('0'); - s << oct << static_cast<int>(static_cast<unsigned char>(slice_text[0])); + s << oct << static_cast<int>(static_cast<unsigned char>(yytext[0])); s << "'"; unit->error(s.str()); return BAD_CHAR; } - return slice_text[0]; + return yytext[0]; } YY_BREAK case 20: @@ -1401,7 +1475,7 @@ YY_RULE_SETUP #line 526 "src/Slice/Scanner.l" ECHO; YY_BREAK -#line 1404 "lex.yy.c" +#line 1477 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(BOMSCAN): case YY_STATE_EOF(MAINSCAN): @@ -1535,6 +1609,7 @@ case YY_STATE_EOF(MAINSCAN): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of slice_lex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1546,9 +1621,9 @@ case YY_STATE_EOF(MAINSCAN): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1577,7 +1652,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1590,21 +1665,21 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1613,11 +1688,11 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - slice_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + slice_realloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1659,10 +1734,10 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) slice_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) slice_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } @@ -1680,15 +1755,15 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1698,9 +1773,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1713,10 +1788,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1726,17 +1801,19 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 72); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); @@ -1746,10 +1823,10 @@ static int yy_get_next_buffer (void) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1758,7 +1835,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1771,6 +1848,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1795,7 +1874,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1927,7 +2006,7 @@ static void slice__load_buffer_state (void) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) slice_alloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) slice_alloc((yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in slice__create_buffer()" ); @@ -2077,15 +2156,15 @@ static void slice_ensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)slice_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in slice_ensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -2094,7 +2173,7 @@ static void slice_ensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)slice_realloc @@ -2114,7 +2193,7 @@ static void slice_ensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE slice__scan_buffer (char * base, yy_size_t size ) { @@ -2124,16 +2203,16 @@ YY_BUFFER_STATE slice__scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; b = (YY_BUFFER_STATE) slice_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in slice__scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; @@ -2153,27 +2232,28 @@ YY_BUFFER_STATE slice__scan_buffer (char * base, yy_size_t size ) * @note If you want to scan bytes that may contain NUL values, then use * slice__scan_bytes() instead. */ -YY_BUFFER_STATE slice__scan_string (yyconst char * yystr ) +YY_BUFFER_STATE slice__scan_string (const char * yystr ) { - return slice__scan_bytes(yystr,strlen(yystr) ); + return slice__scan_bytes(yystr,(int) strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to slice_lex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE slice__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE slice__scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; + n = (yy_size_t) (_yybytes_len + 2); buf = (char *) slice_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in slice__scan_bytes()" ); @@ -2199,9 +2279,9 @@ YY_BUFFER_STATE slice__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2229,7 +2309,7 @@ static void yy_fatal_error (yyconst char* msg ) */ int slice_get_lineno (void) { - + return slice_lineno; } @@ -2252,7 +2332,7 @@ FILE *slice_get_out (void) /** Get the length of the current token. * */ -yy_size_t slice_get_leng (void) +int slice_get_leng (void) { return slice_leng; } @@ -2267,29 +2347,29 @@ char *slice_get_text (void) } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void slice_set_lineno (int line_number ) +void slice_set_lineno (int _line_number ) { - slice_lineno = line_number; + slice_lineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * * @see slice__switch_to_buffer */ -void slice_set_in (FILE * in_str ) +void slice_set_in (FILE * _in_str ) { - slice_in = in_str ; + slice_in = _in_str ; } -void slice_set_out (FILE * out_str ) +void slice_set_out (FILE * _out_str ) { - slice_out = out_str ; + slice_out = _out_str ; } int slice_get_debug (void) @@ -2297,9 +2377,9 @@ int slice_get_debug (void) return slice__flex_debug; } -void slice_set_debug (int bdebug ) +void slice_set_debug (int _bdebug ) { - slice__flex_debug = bdebug ; + slice__flex_debug = _bdebug ; } static int yy_init_globals (void) @@ -2308,10 +2388,10 @@ static int yy_init_globals (void) * This function is called from slice_lex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; @@ -2320,8 +2400,8 @@ static int yy_init_globals (void) slice_in = stdin; slice_out = stdout; #else - slice_in = (FILE *) 0; - slice_out = (FILE *) 0; + slice_in = NULL; + slice_out = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2357,18 +2437,19 @@ int slice_lex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2378,11 +2459,12 @@ static int yy_flex_strlen (yyconst char * s ) void *slice_alloc (yy_size_t size ) { - return (void *) malloc( size ); + return malloc(size); } void *slice_realloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2390,12 +2472,12 @@ void *slice_realloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } void slice_free (void * ptr ) { - free( (char *) ptr ); /* see slice_realloc() for (char *) cast */ + free( (char *) ptr ); /* see slice_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" @@ -2403,7 +2485,6 @@ void slice_free (void * ptr ) #line 526 "src/Slice/Scanner.l" - namespace Slice { // diff --git a/cpp/src/slice2confluence/Gen.cpp b/cpp/src/slice2confluence/Gen.cpp index 678ab4bfda6..0edd89991fc 100644 --- a/cpp/src/slice2confluence/Gen.cpp +++ b/cpp/src/slice2confluence/Gen.cpp @@ -2088,7 +2088,7 @@ TOCGenerator::writeEntry(const ContainedPtr& c) EnumPtr en = EnumPtr::dynamicCast(c); if(en) { - EnumeratorList enumerators = en->getEnumerators(); + EnumeratorList enumerators = en->enumerators(); for(EnumeratorList::const_iterator i = enumerators.begin(); i != enumerators.end(); ++i) { cl.push_back(*i); @@ -3199,7 +3199,7 @@ Slice::EnumGenerator::generate(const EnumPtr& e) printComment(e, e->container(), deprecateReason, false); - EnumeratorList enumerators = e->getEnumerators(); + EnumeratorList enumerators = e->enumerators(); if(!enumerators.empty()) { diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 0173509b925..5756dc90dcc 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -146,28 +146,32 @@ writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, const Synt else { EnumPtr ep = EnumPtr::dynamicCast(type); - if(ep) + if(ep && valueType) { - bool unscoped = findMetaData(ep->getMetaData(), cpp11 ? TypeContextCpp11 : 0) == "%unscoped"; - if(!cpp11 || unscoped) + EnumeratorPtr enumerator = EnumeratorPtr::dynamicCast(valueType); + assert(enumerator); + + bool unscoped = (cpp11 && findMetaData(ep->getMetaData(), TypeContextCpp11) == "%unscoped") || + (!cpp11 && findMetaData(ep->getMetaData()) != "%scoped"); + + if(unscoped) { - out << fixKwd(value); + out << fixKwd(ep->scope() + enumerator->name()); } else { - string v = value; - string scope; - size_t pos = value.rfind("::"); - if(pos != string::npos) + if(cpp11) { - v = value.substr(pos + 2); - scope = value.substr(0, value.size() - v.size()); + out << fixKwd(enumerator->scoped()); + } + else + { + out << fixKwd(ep->scope() + ep->name() + enumerator->name()) +; } - - out << fixKwd(scope + ep->name() + "::" + v); } } - else + else if(!ep) { out << value; } @@ -1506,7 +1510,9 @@ void Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) { string name = fixKwd(p->name()); - EnumeratorList enumerators = p->getEnumerators(); + EnumeratorList enumerators = p->enumerators(); + + string enumeratorPrefix = findMetaData(p->getMetaData()) == "%scoped" ? name : ""; // // Check if any of the enumerators were assigned an explicit value. @@ -1519,7 +1525,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) EnumeratorList::const_iterator en = enumerators.begin(); while(en != enumerators.end()) { - H << nl << fixKwd((*en)->name()); + H << nl << fixKwd(enumeratorPrefix + (*en)->name()); // // If any of the enumerators were assigned an explicit value, we emit // an explicit value for *all* enumerators. @@ -3822,7 +3828,7 @@ Slice::Gen::ImplVisitor::defaultValue(const TypePtr& type, const StringList& met EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - EnumeratorList enumerators = en->getEnumerators(); + EnumeratorList enumerators = en->enumerators(); return fixKwd(en->scope() + enumerators.front()->name()); } @@ -4811,7 +4817,11 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin { continue; } - if(!cpp98 && EnumPtr::dynamicCast(cont) && ss == "unscoped") + if(EnumPtr::dynamicCast(cont) && ss == "scoped") + { + continue; + } + if(EnumPtr::dynamicCast(cont) && ss == "unscoped") { continue; } @@ -4986,6 +4996,7 @@ Slice::Gen::NormalizeMetaDataVisitor::normalize(const StringList& metaData) "const", "ice_print", "range", + "scoped", "type:", "unscoped", "view-type:", @@ -6243,7 +6254,7 @@ Slice::Gen::Cpp11TypesVisitor::visitEnum(const EnumPtr& p) } H << sb; - EnumeratorList enumerators = p->getEnumerators(); + EnumeratorList enumerators = p->enumerators(); // // Check if any of the enumerators were assigned an explicit value. // @@ -7719,7 +7730,7 @@ Slice::Gen::Cpp11ImplVisitor::defaultValue(const TypePtr& type, const StringList EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - EnumeratorList enumerators = en->getEnumerators(); + EnumeratorList enumerators = en->enumerators(); return fixKwd(en->scoped() + "::" + enumerators.front()->name()); } diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp index f575eb3025e..9d62ae21ed9 100644 --- a/cpp/src/slice2cs/CsUtil.cpp +++ b/cpp/src/slice2cs/CsUtil.cpp @@ -1029,7 +1029,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out, EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - size_t sz = en->getEnumerators().size(); + size_t sz = en->enumerators().size(); if(marshal) { out << nl << "if(" << param << ".HasValue)"; diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 0008249211a..5584e48390f 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -1282,7 +1282,7 @@ Slice::CsVisitor::writeValue(const TypePtr& type) EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - return fixId(en->scoped()) + "." + fixId((*en->getEnumerators().begin())->name()); + return fixId(en->scoped()) + "." + fixId((*en->enumerators().begin())->name()); } StructPtr st = StructPtr::dynamicCast(type); @@ -1305,7 +1305,6 @@ Slice::CsVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePt else { BuiltinPtr bp = BuiltinPtr::dynamicCast(type); - EnumPtr ep; if(bp && bp->kind() == Builtin::KindString) { _out << "\"" << toStringLiteral(value, "\a\b\f\n\r\t\v\0", "", UCN, 0) << "\""; @@ -1318,20 +1317,11 @@ Slice::CsVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePt { _out << value << "F"; } - else if((ep = EnumPtr::dynamicCast(type))) + else if(EnumPtr::dynamicCast(type)) { - string enumName = fixId(ep->scoped()); - string::size_type colon = value.rfind(':'); - string enumerator; - if(colon != string::npos) - { - enumerator = fixId(value.substr(colon + 1)); - } - else - { - enumerator = fixId(value); - } - _out << enumName << '.' << enumerator; + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + _out << fixId(lte->scoped()); } else { @@ -3504,7 +3494,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) { string name = fixId(p->name()); string scoped = fixId(p->scoped()); - EnumeratorList enumerators = p->getEnumerators(); + EnumeratorList enumerators = p->enumerators(); const bool explicitValue = p->explicitValue(); _out << sp; diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp index 54383af7030..e2de448264a 100644 --- a/cpp/src/slice2html/Gen.cpp +++ b/cpp/src/slice2html/Gen.cpp @@ -1956,7 +1956,7 @@ TOCGenerator::writeEntry(const ContainedPtr& c) EnumPtr en = EnumPtr::dynamicCast(c); if(en) { - EnumeratorList enumerators = en->getEnumerators(); + EnumeratorList enumerators = en->enumerators(); for(EnumeratorList::const_iterator i = enumerators.begin(); i != enumerators.end(); ++i) { cl.push_back(*i); @@ -2944,7 +2944,7 @@ Slice::EnumGenerator::generate(const EnumPtr& e) printComment(e, e, deprecateReason); - EnumeratorList enumerators = e->getEnumerators(); + EnumeratorList enumerators = e->enumerators(); if(!enumerators.empty()) { start("h2"); diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index f79dc1fead6..34237ddc394 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -1678,7 +1678,6 @@ Slice::JavaVisitor::writeConstantValue(Output& out, const TypePtr& type, const S else { BuiltinPtr bp; - EnumPtr ep; if((bp = BuiltinPtr::dynamicCast(type))) { switch(bp->kind()) @@ -1723,15 +1722,11 @@ Slice::JavaVisitor::writeConstantValue(Output& out, const TypePtr& type, const S } } - else if((ep = EnumPtr::dynamicCast(type))) + else if(EnumPtr::dynamicCast(type)) { - string val = value; - string::size_type pos = val.rfind(':'); - if(pos != string::npos) - { - val.erase(0, pos + 1); - } - out << getAbsolute(ep, package) << '.' << fixKwd(val); + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + out << getAbsolute(lte, package); } else { @@ -1774,7 +1769,7 @@ Slice::JavaVisitor::writeDataMemberInitializers(Output& out, const DataMemberLis EnumPtr en = EnumPtr::dynamicCast(t); if(en) { - string firstEnum = fixKwd(en->getEnumerators().front()->name()); + string firstEnum = fixKwd(en->enumerators().front()->name()); out << nl << "this." << fixKwd((*p)->name()) << " = " << getAbsolute(en, package) << '.' << firstEnum << ';'; } @@ -3991,7 +3986,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) { string name = fixKwd(p->name()); string absolute = getAbsolute(p); - EnumeratorList enumerators = p->getEnumerators(); + EnumeratorList enumerators = p->enumerators(); open(absolute, p->file()); @@ -5310,7 +5305,7 @@ Slice::Gen::ImplVisitor::getDefaultValue(const string& package, const TypePtr& t EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - EnumeratorList enumerators = en->getEnumerators(); + EnumeratorList enumerators = en->enumerators(); return getAbsolute(en, package) + '.' + fixKwd(enumerators.front()->name()); } } diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp index e407f34745e..4b5dacaf2e4 100644 --- a/cpp/src/slice2java/GenCompat.cpp +++ b/cpp/src/slice2java/GenCompat.cpp @@ -1764,7 +1764,6 @@ Slice::JavaCompatVisitor::writeConstantValue(Output& out, const TypePtr& type, c else { BuiltinPtr bp; - EnumPtr ep; if((bp = BuiltinPtr::dynamicCast(type))) { switch(bp->kind()) @@ -1809,15 +1808,11 @@ Slice::JavaCompatVisitor::writeConstantValue(Output& out, const TypePtr& type, c } } - else if((ep = EnumPtr::dynamicCast(type))) + else if(EnumPtr::dynamicCast(type)) { - string val = value; - string::size_type pos = val.rfind(':'); - if(pos != string::npos) - { - val.erase(0, pos + 1); - } - out << getAbsolute(ep, package) << '.' << fixKwd(val); + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + out << getAbsolute(lte, package); } else { @@ -1860,7 +1855,7 @@ Slice::JavaCompatVisitor::writeDataMemberInitializers(Output& out, const DataMem EnumPtr en = EnumPtr::dynamicCast(t); if(en) { - string firstEnum = fixKwd(en->getEnumerators().front()->name()); + string firstEnum = fixKwd(en->enumerators().front()->name()); out << nl << "this." << fixKwd((*p)->name()) << " = " << getAbsolute(en, package) << '.' << firstEnum << ';'; } @@ -4058,7 +4053,7 @@ Slice::GenCompat::TypesVisitor::visitEnum(const EnumPtr& p) { string name = fixKwd(p->name()); string absolute = getAbsolute(p); - EnumeratorList enumerators = p->getEnumerators(); + EnumeratorList enumerators = p->enumerators(); open(absolute, p->file()); @@ -5947,7 +5942,7 @@ Slice::GenCompat::BaseImplVisitor::writeDecl(Output& out, const string& package, EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - EnumeratorList enumerators = en->getEnumerators(); + EnumeratorList enumerators = en->enumerators(); out << " = " << getAbsolute(en, package) << '.' << fixKwd(enumerators.front()->name()); } else diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp index 29c1c9f47dc..5f80870769c 100644 --- a/cpp/src/slice2js/Gen.cpp +++ b/cpp/src/slice2js/Gen.cpp @@ -185,7 +185,7 @@ Slice::JsVisitor::getValue(const string& scope, const TypePtr& type) EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - return getReference(scope, en->scoped()) + '.' + fixId((*en->getEnumerators().begin())->name()); + return getReference(scope, en->scoped()) + '.' + fixId((*en->enumerators().begin())->name()); } StructPtr st = StructPtr::dynamicCast(type); @@ -238,17 +238,9 @@ Slice::JsVisitor::writeConstantValue(const string& scope, const TypePtr& type, c } else if((ep = EnumPtr::dynamicCast(type))) { - string::size_type colon = value.rfind(':'); - string enumerator; - if(colon != string::npos) - { - enumerator = fixId(value.substr(colon + 1)); - } - else - { - enumerator = fixId(value); - } - os << getReference(scope, ep->scoped()) << '.' << enumerator; + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + os << getReference(scope, ep->scoped()) << '.' << fixId(lte->name()); } else { @@ -1723,7 +1715,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) _out.inc(); _out << nl; - const EnumeratorList enumerators = p->getEnumerators(); + const EnumeratorList enumerators = p->enumerators(); int i = 0; for(EnumeratorList::const_iterator en = enumerators.begin(); en != enumerators.end(); ++en) { diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index 7ad7d9883e6..290a87d268f 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -1523,7 +1523,9 @@ void Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) { string name = fixName(p); - EnumeratorList enumerators = p->getEnumerators(); + EnumeratorList enumerators = p->enumerators(); + string enumeratorPrefix = p->hasMetaData("objc:scoped") ? name : ""; + _H << sp; // @@ -1536,7 +1538,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) EnumeratorList::const_iterator en = enumerators.begin(); while(en != enumerators.end()) { - _H << nl << fixName(*en); + _H << nl << moduleName(findModule(*en)) << enumeratorPrefix << (*en)->name(); // // If any of the enumerators were assigned an explicit value, we emit // an explicit value for *all* enumerators. @@ -1566,12 +1568,13 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) _H << nl << "static const " << typeToString(p->type()); } _H << " " << fixName(p) << " = "; - writeConstantValue(_H, p->type(), p->value()); + writeConstantValue(_H, p->type(), p->valueType(), p->value()); _H << ';'; } void -Slice::Gen::TypesVisitor::writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, const string& val) const +Slice::Gen::TypesVisitor::writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, + const SyntaxTreeBasePtr& valueType, const string& val) const { if(isString(type)) { @@ -1582,7 +1585,10 @@ Slice::Gen::TypesVisitor::writeConstantValue(IceUtilInternal::Output& out, const EnumPtr ep = EnumPtr::dynamicCast(type); if(ep) { - out << moduleName(findModule(ep)) << val; + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + string enumeratorPrefix = ep->hasMetaData("objc:scoped") ? ep->name() : ""; + out << moduleName(findModule(ep)) << enumeratorPrefix << lte->name(); } else { @@ -1868,7 +1874,7 @@ Slice::Gen::TypesVisitor::writeMemberDefaultValueInit(const DataMemberList& data _M << nl << "self->has_" << name << "__ = YES;"; } _M << nl << "self->" << name << " = "; - writeConstantValue(_M, (*p)->type(), (*p)->defaultValue()); + writeConstantValue(_M, (*p)->type(), (*p)->defaultValueType(), (*p)->defaultValue()); _M << ";"; } else @@ -1882,7 +1888,7 @@ Slice::Gen::TypesVisitor::writeMemberDefaultValueInit(const DataMemberList& data EnumPtr en = EnumPtr::dynamicCast((*p)->type()); if(en) { - string firstEnum = fixName(en->getEnumerators().front()); + string firstEnum = fixName(en->enumerators().front()); _M << nl << "self->" << name << " = " << firstEnum << ';'; } diff --git a/cpp/src/slice2objc/Gen.h b/cpp/src/slice2objc/Gen.h index 0c9ef639e7d..bb4b63752d9 100644 --- a/cpp/src/slice2objc/Gen.h +++ b/cpp/src/slice2objc/Gen.h @@ -131,7 +131,7 @@ private: enum Escape { NoEscape, WithEscape }; enum ContainerType { LocalException, Other }; - void writeConstantValue(IceUtilInternal::Output&, const TypePtr&, const std::string&) const; + void writeConstantValue(IceUtilInternal::Output&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&) const; void writeInit(const ContainedPtr&, const DataMemberList&, const DataMemberList&, const DataMemberList&, bool, int, ContainerType) const; void writeFactory(const ContainedPtr&, const DataMemberList&, int, ContainerType) const; diff --git a/cpp/src/slice2objc/ObjCUtil.cpp b/cpp/src/slice2objc/ObjCUtil.cpp index 6cd8afd835a..8e011306c89 100644 --- a/cpp/src/slice2objc/ObjCUtil.cpp +++ b/cpp/src/slice2objc/ObjCUtil.cpp @@ -1222,9 +1222,7 @@ Slice::ObjCGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) bool foundPrefix = false; StringList meta = getMetaData(m); - StringList::const_iterator p; - - for(p = meta.begin(); p != meta.end();) + for(StringList::iterator p = meta.begin(); p != meta.end();) { string s = *p++; const string prefix = "objc:prefix:"; @@ -1235,10 +1233,8 @@ Slice::ObjCGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) name = trim(s.substr(prefix.size())); if(name.empty()) { - string file = m->definitionContext()->filename(); - ostringstream os; - os << _msg << " `" << s << "'" << endl; - emitWarning(file, m->line(), os.str()); + m->definitionContext()->warning(InvalidMetaData, m->definitionContext()->filename(), + m->line(), _msg + " `" + s + "'"); meta.remove(s); error = true; } @@ -1252,10 +1248,8 @@ Slice::ObjCGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) } else { - string file = m->definitionContext()->filename(); - ostringstream os; - os << _msg << " `" << s << "'" << endl; - emitWarning(file, m->line(), os.str()); + m->definitionContext()->warning(InvalidMetaData, m->definitionContext()->filename(), + m->line(), _msg + " `" + s + "'"); meta.remove(s); error = true; } @@ -1276,6 +1270,27 @@ Slice::ObjCGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) } } } + + EnumPtr en = EnumPtr::dynamicCast(cont); + if(en) + { + StringList meta = getMetaData(en); + for(StringList::iterator p = meta.begin(); p != meta.end();) + { + string s = *p; + if(s != "objc:scoped") + { + en->definitionContext()->warning(InvalidMetaData, en->definitionContext()->filename(), + en->line(), _msg + " `" + s + "'"); + meta.erase(p++); + } + else + { + ++p; + } + } + setMetaData(en, meta); + } } StringList @@ -1333,5 +1348,5 @@ Slice::ObjCGenerator::MetaDataVisitor::modulePrefixError(const ModulePtr& m, con } os << line; os << " as `" << mp.name << "'" << endl; - emitWarning(file, line, os.str()); + m->definitionContext()->warning(All, file, line, os.str()); } diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index b0167d6a150..a948a8ad746 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -1021,7 +1021,7 @@ CodeVisitor::visitEnum(const EnumPtr& p) string name = getName(p); string type = getTypeVar(p); string abs = getAbsolute(p, _ns); - EnumeratorList enums = p->getEnumerators(); + EnumeratorList enums = p->enumerators(); startNamespace(p); @@ -1271,7 +1271,7 @@ CodeVisitor::writeDefaultValue(const DataMemberPtr& m) EnumPtr en = EnumPtr::dynamicCast(p); if(en) { - EnumeratorList enums = en->getEnumerators(); + EnumeratorList enums = en->enumerators(); _out << getAbsolute(en, _ns) << "::" << fixIdent(enums.front()->name()); return; } @@ -1369,21 +1369,9 @@ CodeVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePtr& va } else if(en) { - string val = value; - string::size_type colon = val.rfind(':'); - if(colon != string::npos) - { - val = val.substr(colon + 1); - } - Slice::EnumeratorList l = en->getEnumerators(); - for(Slice::EnumeratorList::iterator q = l.begin(); q != l.end(); ++q) - { - if((*q)->name() == val) - { - _out << getAbsolute(en, _ns) << "::" << fixIdent(val); - break; - } - } + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + _out << getAbsolute(en, _ns) << "::" << fixIdent(lte->name()); } else { |