diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-05-16 17:06:00 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-05-16 17:06:00 -0700 |
commit | 1c6024e41f697d61b2727dc60c8aa6f62e9f5660 (patch) | |
tree | a1fe8e5ff322f02adef32c3edaf48b3d947cd6f0 | |
parent | * Ruby port of sliced/compact/preserved (diff) | |
download | ice-1c6024e41f697d61b2727dc60c8aa6f62e9f5660.tar.bz2 ice-1c6024e41f697d61b2727dc60c8aa6f62e9f5660.tar.xz ice-1c6024e41f697d61b2727dc60c8aa6f62e9f5660.zip |
parser support for optional data members
-rw-r--r-- | cpp/include/Slice/Parser.h | 28 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.cpp | 1641 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.h | 26 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.y | 180 | ||||
-rw-r--r-- | cpp/src/Slice/GrammarUtil.h | 14 | ||||
-rwxr-xr-x | cpp/src/Slice/Parser.cpp | 90 | ||||
-rw-r--r-- | cpp/src/Slice/Scanner.cpp | 39 | ||||
-rw-r--r-- | cpp/src/Slice/Scanner.l | 15 | ||||
-rw-r--r-- | cpp/test/Slice/errorDetection/OptionalMembers.err | 13 | ||||
-rw-r--r-- | cpp/test/Slice/errorDetection/OptionalMembers.ice | 37 |
10 files changed, 1290 insertions, 793 deletions
diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h index e65bb3784a4..0705639a0b0 100644 --- a/cpp/include/Slice/Parser.h +++ b/cpp/include/Slice/Parser.h @@ -157,6 +157,14 @@ struct ConstDef std::string valueAsLiteral; }; +struct DataMemberDef +{ + TypePtr type; + std::string name; + bool optional; + int tag; +}; + // ---------------------------------------------------------------------- // CICompare -- function object to do case-insensitive string comparison. // ---------------------------------------------------------------------- @@ -623,8 +631,8 @@ public: virtual void destroy(); OperationPtr createOperation(const std::string&, const TypePtr&, Operation::Mode = Operation::Normal); - DataMemberPtr createDataMember(const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, - const std::string&); + DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, + const std::string&, const std::string&); ClassDeclPtr declaration() const; ClassList bases() const; ClassList allBases() const; @@ -694,8 +702,8 @@ class SLICE_API Exception : virtual public Container, virtual public Contained public: virtual void destroy(); - DataMemberPtr createDataMember(const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, - const std::string&); + DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, + const std::string&, const std::string&); DataMemberList dataMembers() const; DataMemberList allDataMembers() const; DataMemberList classDataMembers() const; @@ -729,8 +737,8 @@ class SLICE_API Struct : virtual public Container, virtual public Constructed { public: - DataMemberPtr createDataMember(const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, - const std::string&); + DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, + const std::string&, const std::string&); DataMemberList dataMembers() const; DataMemberList classDataMembers() const; virtual ContainedType containedType() const; @@ -926,6 +934,8 @@ class SLICE_API DataMember : virtual public Contained public: TypePtr type() const; + bool optional() const; + int tag() const; std::string defaultValue() const; std::string defaultLiteral() const; SyntaxTreeBasePtr defaultValueType() const; @@ -936,13 +946,15 @@ public: protected: - DataMember(const ContainerPtr&, const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, - const std::string&); + DataMember(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, + const std::string&, const std::string&); friend class ClassDef; friend class Struct; friend class Exception; TypePtr _type; + bool _optional; + int _tag; SyntaxTreeBasePtr _defaultValueType; std::string _defaultValue; std::string _defaultLiteral; diff --git a/cpp/src/Slice/Grammar.cpp b/cpp/src/Slice/Grammar.cpp index cf01a1c4b44..97aef00aed5 100644 --- a/cpp/src/Slice/Grammar.cpp +++ b/cpp/src/Slice/Grammar.cpp @@ -89,6 +89,7 @@ // ********************************************************************** #include <Slice/GrammarUtil.h> +#include <IceUtil/InputUtil.h> #include <IceUtil/UUID.h> #include <cstring> @@ -122,7 +123,7 @@ slice_error(const char* s) /* Line 189 of yacc.c */ -#line 126 "Grammar.tab.c" +#line 127 "Grammar.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -177,18 +178,20 @@ slice_error(const char* s) ICE_FALSE = 283, ICE_TRUE = 284, ICE_IDEMPOTENT = 285, - ICE_SCOPE_DELIMITER = 286, - ICE_IDENTIFIER = 287, - ICE_STRING_LITERAL = 288, - ICE_INTEGER_LITERAL = 289, - ICE_FLOATING_POINT_LITERAL = 290, - ICE_IDENT_OP = 291, - ICE_KEYWORD_OP = 292, - ICE_METADATA_OPEN = 293, - ICE_METADATA_CLOSE = 294, - ICE_GLOBAL_METADATA_OPEN = 295, - ICE_GLOBAL_METADATA_CLOSE = 296, - BAD_CHAR = 297 + ICE_OPTIONAL = 286, + ICE_SCOPE_DELIMITER = 287, + ICE_IDENTIFIER = 288, + ICE_STRING_LITERAL = 289, + ICE_INTEGER_LITERAL = 290, + ICE_FLOATING_POINT_LITERAL = 291, + ICE_IDENT_OP = 292, + ICE_KEYWORD_OP = 293, + ICE_OPTIONAL_OP = 294, + ICE_METADATA_OPEN = 295, + ICE_METADATA_CLOSE = 296, + ICE_GLOBAL_METADATA_OPEN = 297, + ICE_GLOBAL_METADATA_CLOSE = 298, + BAD_CHAR = 299 }; #endif @@ -206,7 +209,7 @@ typedef int YYSTYPE; /* Line 264 of yacc.c */ -#line 210 "Grammar.tab.c" +#line 213 "Grammar.tab.c" #ifdef short # undef short @@ -421,20 +424,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 13 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 797 +#define YYLAST 860 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 52 +#define YYNTOKENS 54 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 67 +#define YYNNTS 68 /* YYNRULES -- Number of rules. */ -#define YYNRULES 182 +#define YYNRULES 188 /* YYNRULES -- Number of states. */ -#define YYNSTATES 266 +#define YYNSTATES 280 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 297 +#define YYMAXUTOK 299 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -446,15 +449,15 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 47, 51, 2, 48, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 43, - 49, 46, 50, 2, 2, 2, 2, 2, 2, 2, + 2, 48, 53, 2, 50, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 45, + 51, 49, 52, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 44, 2, 45, 2, 2, 2, 2, + 2, 2, 2, 46, 2, 47, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -471,7 +474,7 @@ static const yytype_uint8 yytranslate[] = 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, - 35, 36, 37, 38, 39, 40, 41, 42 + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 }; #if YYDEBUG @@ -483,103 +486,105 @@ static const yytype_uint16 yyprhs[] = 26, 27, 32, 35, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 63, 70, 73, 76, 79, 80, 88, 91, 92, 97, 101, 104, - 105, 108, 110, 113, 116, 119, 120, 127, 132, 136, - 139, 140, 142, 145, 148, 151, 152, 161, 164, 165, - 168, 169, 174, 178, 181, 182, 184, 188, 191, 193, - 195, 197, 200, 204, 207, 211, 212, 218, 219, 225, - 227, 229, 232, 235, 238, 239, 247, 251, 253, 255, - 258, 259, 264, 268, 271, 272, 274, 278, 280, 282, - 284, 292, 300, 311, 322, 325, 328, 329, 336, 342, - 346, 348, 350, 352, 353, 355, 356, 357, 361, 367, - 372, 379, 383, 389, 392, 393, 395, 398, 402, 404, - 406, 408, 410, 412, 414, 416, 418, 420, 423, 425, - 427, 430, 433, 435, 439, 441, 443, 444, 446, 448, - 450, 452, 454, 456, 463, 469, 471, 473, 475, 477, - 479, 481, 483, 485, 487, 489, 491, 493, 495, 497, - 499, 501, 503, 505, 507, 509, 511, 513, 515, 517, - 519, 521, 523 + 105, 108, 113, 118, 122, 125, 127, 129, 132, 135, + 138, 139, 146, 151, 155, 158, 159, 161, 164, 167, + 170, 171, 180, 183, 184, 187, 188, 193, 197, 200, + 201, 203, 207, 210, 212, 214, 216, 219, 223, 226, + 230, 231, 237, 238, 244, 246, 248, 251, 254, 257, + 258, 266, 270, 272, 274, 277, 278, 283, 287, 290, + 291, 293, 297, 299, 301, 303, 311, 319, 330, 341, + 344, 347, 348, 355, 361, 365, 367, 369, 371, 372, + 374, 375, 376, 380, 386, 391, 398, 402, 408, 411, + 412, 414, 417, 421, 423, 425, 427, 429, 431, 433, + 435, 437, 439, 442, 444, 446, 449, 452, 454, 458, + 460, 462, 463, 465, 467, 469, 471, 473, 475, 482, + 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, + 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, + 528, 530, 532, 534, 536, 538, 540, 542, 544 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 53, 0, -1, 56, -1, 40, 114, 41, -1, 38, - 114, 39, -1, -1, -1, 54, 57, 56, -1, -1, - 55, 60, 58, 43, 56, -1, -1, 1, 43, 59, - 56, -1, 55, 60, -1, -1, 61, -1, 78, -1, - 79, -1, 92, -1, 93, -1, 64, -1, 65, -1, - 72, -1, 73, -1, 101, -1, 102, -1, 104, -1, - 117, -1, -1, 3, 32, 62, 44, 56, 45, -1, - 6, 32, -1, 6, 118, -1, 115, 63, -1, -1, - 115, 63, 67, 66, 44, 68, 45, -1, 12, 111, - -1, -1, 55, 70, 43, 68, -1, 1, 43, 68, - -1, 55, 70, -1, -1, 112, 32, -1, 84, -1, - 7, 32, -1, 7, 118, -1, 115, 71, -1, -1, - 115, 71, 74, 44, 75, 45, -1, 55, 76, 43, - 75, -1, 1, 43, 75, -1, 55, 76, -1, -1, - 84, -1, 4, 32, -1, 4, 118, -1, 115, 77, - -1, -1, 115, 77, 81, 82, 80, 44, 83, 45, - -1, 12, 111, -1, -1, 13, 95, -1, -1, 55, - 90, 43, 83, -1, 1, 43, 83, -1, 55, 90, - -1, -1, 69, -1, 69, 46, 116, -1, 112, 118, - -1, 112, -1, 112, -1, 15, -1, 85, 36, -1, - 30, 85, 36, -1, 85, 37, -1, 30, 85, 37, - -1, -1, 86, 109, 47, 88, 110, -1, -1, 86, - 1, 47, 89, 110, -1, 84, -1, 87, -1, 5, - 32, -1, 5, 118, -1, 115, 91, -1, -1, 115, - 91, 96, 94, 44, 97, 45, -1, 111, 48, 95, - -1, 111, -1, 24, -1, 12, 95, -1, -1, 55, - 98, 43, 97, -1, 1, 43, 97, -1, 55, 98, - -1, -1, 87, -1, 100, 48, 99, -1, 100, -1, - 111, -1, 118, -1, 115, 8, 49, 55, 112, 50, - 32, -1, 115, 8, 49, 55, 112, 50, 118, -1, - 115, 9, 49, 55, 112, 48, 55, 112, 50, 32, - -1, 115, 9, 49, 55, 112, 48, 55, 112, 50, - 118, -1, 10, 32, -1, 10, 118, -1, -1, 115, - 103, 105, 44, 106, 45, -1, 115, 10, 44, 106, - 45, -1, 107, 48, 106, -1, 107, -1, 32, -1, - 118, -1, -1, 11, -1, -1, -1, 108, 55, 69, - -1, 109, 48, 108, 55, 69, -1, 108, 55, 112, - 118, -1, 109, 48, 108, 55, 112, 118, -1, 108, - 55, 112, -1, 109, 48, 108, 55, 112, -1, 14, - 99, -1, -1, 32, -1, 31, 32, -1, 111, 31, - 32, -1, 16, -1, 17, -1, 18, -1, 19, -1, - 20, -1, 21, -1, 22, -1, 23, -1, 24, -1, - 24, 51, -1, 25, -1, 111, -1, 111, 51, -1, - 33, 113, -1, 33, -1, 114, 48, 113, -1, 113, - -1, 26, -1, -1, 34, -1, 35, -1, 111, -1, - 33, -1, 28, -1, 29, -1, 27, 55, 112, 32, - 46, 116, -1, 27, 55, 112, 46, 116, -1, 3, - -1, 4, -1, 5, -1, 6, -1, 7, -1, 8, - -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, - -1, 14, -1, 15, -1, 16, -1, 17, -1, 18, - -1, 19, -1, 20, -1, 21, -1, 22, -1, 23, - -1, 24, -1, 25, -1, 26, -1, 27, -1, 28, - -1, 29, -1, 30, -1 + 55, 0, -1, 58, -1, 42, 117, 43, -1, 40, + 117, 41, -1, -1, -1, 56, 59, 58, -1, -1, + 57, 62, 60, 45, 58, -1, -1, 1, 45, 61, + 58, -1, 57, 62, -1, -1, 63, -1, 81, -1, + 82, -1, 95, -1, 96, -1, 66, -1, 67, -1, + 75, -1, 76, -1, 104, -1, 105, -1, 107, -1, + 120, -1, -1, 3, 33, 64, 46, 58, 47, -1, + 6, 33, -1, 6, 121, -1, 118, 65, -1, -1, + 118, 65, 69, 68, 46, 70, 47, -1, 12, 114, + -1, -1, 57, 73, 45, 70, -1, 1, 45, 70, + -1, 57, 73, -1, -1, 115, 33, -1, 39, 35, + 48, 71, -1, 39, 114, 48, 71, -1, 39, 48, + 71, -1, 31, 71, -1, 71, -1, 87, -1, 7, + 33, -1, 7, 121, -1, 118, 74, -1, -1, 118, + 74, 77, 46, 78, 47, -1, 57, 79, 45, 78, + -1, 1, 45, 78, -1, 57, 79, -1, -1, 87, + -1, 4, 33, -1, 4, 121, -1, 118, 80, -1, + -1, 118, 80, 84, 85, 83, 46, 86, 47, -1, + 12, 114, -1, -1, 13, 98, -1, -1, 57, 93, + 45, 86, -1, 1, 45, 86, -1, 57, 93, -1, + -1, 72, -1, 72, 49, 119, -1, 115, 121, -1, + 115, -1, 115, -1, 15, -1, 88, 37, -1, 30, + 88, 37, -1, 88, 38, -1, 30, 88, 38, -1, + -1, 89, 112, 48, 91, 113, -1, -1, 89, 1, + 48, 92, 113, -1, 87, -1, 90, -1, 5, 33, + -1, 5, 121, -1, 118, 94, -1, -1, 118, 94, + 99, 97, 46, 100, 47, -1, 114, 50, 98, -1, + 114, -1, 24, -1, 12, 98, -1, -1, 57, 101, + 45, 100, -1, 1, 45, 100, -1, 57, 101, -1, + -1, 90, -1, 103, 50, 102, -1, 103, -1, 114, + -1, 121, -1, 118, 8, 51, 57, 115, 52, 33, + -1, 118, 8, 51, 57, 115, 52, 121, -1, 118, + 9, 51, 57, 115, 50, 57, 115, 52, 33, -1, + 118, 9, 51, 57, 115, 50, 57, 115, 52, 121, + -1, 10, 33, -1, 10, 121, -1, -1, 118, 106, + 108, 46, 109, 47, -1, 118, 10, 46, 109, 47, + -1, 110, 50, 109, -1, 110, -1, 33, -1, 121, + -1, -1, 11, -1, -1, -1, 111, 57, 71, -1, + 112, 50, 111, 57, 71, -1, 111, 57, 115, 121, + -1, 112, 50, 111, 57, 115, 121, -1, 111, 57, + 115, -1, 112, 50, 111, 57, 115, -1, 14, 102, + -1, -1, 33, -1, 32, 33, -1, 114, 32, 33, + -1, 16, -1, 17, -1, 18, -1, 19, -1, 20, + -1, 21, -1, 22, -1, 23, -1, 24, -1, 24, + 53, -1, 25, -1, 114, -1, 114, 53, -1, 34, + 116, -1, 34, -1, 117, 50, 116, -1, 116, -1, + 26, -1, -1, 35, -1, 36, -1, 114, -1, 34, + -1, 28, -1, 29, -1, 27, 57, 115, 33, 49, + 119, -1, 27, 57, 115, 49, 119, -1, 3, -1, + 4, -1, 5, -1, 6, -1, 7, -1, 8, -1, + 9, -1, 10, -1, 11, -1, 12, -1, 13, -1, + 14, -1, 15, -1, 16, -1, 17, -1, 18, -1, + 19, -1, 20, -1, 21, -1, 22, -1, 23, -1, + 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, + 29, -1, 30, -1, 31, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 104, 104, 112, 121, 126, 135, 134, 144, 143, - 154, 153, 158, 163, 170, 174, 178, 182, 186, 190, - 194, 198, 202, 206, 210, 214, 218, 228, 227, 261, - 265, 276, 287, 286, 313, 322, 330, 339, 342, 347, - 354, 367, 373, 377, 388, 399, 398, 434, 443, 446, - 451, 458, 464, 468, 479, 493, 492, 532, 567, 575, - 580, 588, 597, 600, 605, 612, 635, 660, 682, 708, - 709, 718, 742, 766, 790, 820, 819, 842, 841, 864, - 865, 871, 875, 886, 901, 900, 935, 970, 1005, 1015, - 1020, 1028, 1037, 1040, 1045, 1052, 1058, 1065, 1077, 1089, - 1100, 1109, 1124, 1135, 1152, 1156, 1168, 1167, 1191, 1206, - 1212, 1220, 1232, 1240, 1249, 1256, 1267, 1269, 1287, 1305, - 1317, 1329, 1340, 1356, 1361, 1369, 1372, 1378, 1391, 1395, - 1399, 1403, 1407, 1411, 1415, 1419, 1423, 1427, 1431, 1435, - 1454, 1495, 1501, 1509, 1516, 1528, 1535, 1545, 1558, 1571, - 1617, 1628, 1639, 1655, 1664, 1678, 1681, 1684, 1687, 1690, - 1693, 1696, 1699, 1702, 1705, 1708, 1711, 1714, 1717, 1720, - 1723, 1726, 1729, 1732, 1735, 1738, 1741, 1744, 1747, 1750, - 1753, 1756, 1759 + 0, 107, 107, 115, 124, 129, 138, 137, 147, 146, + 157, 156, 161, 166, 173, 177, 181, 185, 189, 193, + 197, 201, 205, 209, 213, 217, 221, 231, 230, 264, + 268, 279, 290, 289, 316, 325, 333, 342, 345, 350, + 357, 370, 393, 466, 477, 488, 503, 509, 513, 524, + 535, 534, 570, 579, 582, 587, 594, 600, 604, 615, + 629, 628, 668, 703, 711, 716, 724, 733, 736, 741, + 748, 770, 797, 819, 845, 846, 855, 879, 903, 927, + 957, 956, 979, 978, 1001, 1002, 1008, 1012, 1023, 1038, + 1037, 1072, 1107, 1142, 1152, 1157, 1165, 1174, 1177, 1182, + 1189, 1195, 1202, 1214, 1226, 1237, 1246, 1261, 1272, 1289, + 1293, 1305, 1304, 1328, 1343, 1349, 1357, 1369, 1377, 1386, + 1393, 1404, 1406, 1424, 1442, 1454, 1466, 1477, 1493, 1498, + 1506, 1509, 1515, 1528, 1532, 1536, 1540, 1544, 1548, 1552, + 1556, 1560, 1564, 1568, 1572, 1591, 1632, 1638, 1646, 1653, + 1665, 1672, 1682, 1695, 1708, 1754, 1765, 1776, 1792, 1801, + 1815, 1818, 1821, 1824, 1827, 1830, 1833, 1836, 1839, 1842, + 1845, 1848, 1851, 1854, 1857, 1860, 1863, 1866, 1869, 1872, + 1875, 1878, 1881, 1884, 1887, 1890, 1893, 1896, 1899 }; #endif @@ -594,21 +599,22 @@ static const char *const yytname[] = "ICE_THROWS", "ICE_VOID", "ICE_BYTE", "ICE_BOOL", "ICE_SHORT", "ICE_INT", "ICE_LONG", "ICE_FLOAT", "ICE_DOUBLE", "ICE_STRING", "ICE_OBJECT", "ICE_LOCAL_OBJECT", "ICE_LOCAL", "ICE_CONST", "ICE_FALSE", "ICE_TRUE", - "ICE_IDEMPOTENT", "ICE_SCOPE_DELIMITER", "ICE_IDENTIFIER", - "ICE_STRING_LITERAL", "ICE_INTEGER_LITERAL", + "ICE_IDEMPOTENT", "ICE_OPTIONAL", "ICE_SCOPE_DELIMITER", + "ICE_IDENTIFIER", "ICE_STRING_LITERAL", "ICE_INTEGER_LITERAL", "ICE_FLOATING_POINT_LITERAL", "ICE_IDENT_OP", "ICE_KEYWORD_OP", - "ICE_METADATA_OPEN", "ICE_METADATA_CLOSE", "ICE_GLOBAL_METADATA_OPEN", - "ICE_GLOBAL_METADATA_CLOSE", "BAD_CHAR", "';'", "'{'", "'}'", "'='", - "')'", "','", "'<'", "'>'", "'*'", "$accept", "start", - "global_meta_data", "meta_data", "definitions", "$@1", "$@2", "$@3", - "definition", "module_def", "@4", "exception_id", "exception_decl", - "exception_def", "@5", "exception_extends", "exception_exports", - "type_id", "exception_export", "struct_id", "struct_decl", "struct_def", - "@6", "struct_exports", "struct_export", "class_id", "class_decl", - "class_def", "@7", "class_extends", "implements", "class_exports", - "data_member", "return_type", "operation_preamble", "operation", "@8", - "@9", "class_export", "interface_id", "interface_decl", "interface_def", - "@10", "interface_list", "interface_extends", "interface_exports", + "ICE_OPTIONAL_OP", "ICE_METADATA_OPEN", "ICE_METADATA_CLOSE", + "ICE_GLOBAL_METADATA_OPEN", "ICE_GLOBAL_METADATA_CLOSE", "BAD_CHAR", + "';'", "'{'", "'}'", "')'", "'='", "','", "'<'", "'>'", "'*'", "$accept", + "start", "global_meta_data", "meta_data", "definitions", "$@1", "$@2", + "$@3", "definition", "module_def", "@4", "exception_id", + "exception_decl", "exception_def", "@5", "exception_extends", + "exception_exports", "type_id", "data_member_type_id", + "exception_export", "struct_id", "struct_decl", "struct_def", "@6", + "struct_exports", "struct_export", "class_id", "class_decl", "class_def", + "@7", "class_extends", "implements", "class_exports", "data_member", + "return_type", "operation_preamble", "operation", "@8", "@9", + "class_export", "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", "enumerator", "out_qualifier", "parameters", "throws", "scoped_name", @@ -626,33 +632,33 @@ static const yytype_uint16 yytoknum[] = 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 59, 123, 125, 61, 41, 44, 60, - 62, 42 + 295, 296, 297, 298, 299, 59, 123, 125, 41, 61, + 44, 60, 62, 42 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 52, 53, 54, 55, 55, 57, 56, 58, 56, - 59, 56, 56, 56, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 62, 61, 63, - 63, 64, 66, 65, 67, 67, 68, 68, 68, 68, - 69, 70, 71, 71, 72, 74, 73, 75, 75, 75, - 75, 76, 77, 77, 78, 80, 79, 81, 81, 82, - 82, 83, 83, 83, 83, 84, 84, 84, 84, 85, - 85, 86, 86, 86, 86, 88, 87, 89, 87, 90, - 90, 91, 91, 92, 94, 93, 95, 95, 95, 96, - 96, 97, 97, 97, 97, 98, 99, 99, 100, 100, - 101, 101, 102, 102, 103, 103, 105, 104, 104, 106, - 106, 107, 107, 107, 108, 108, 109, 109, 109, 109, - 109, 109, 109, 110, 110, 111, 111, 111, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 113, 113, 114, 114, 115, 115, 116, 116, 116, - 116, 116, 116, 117, 117, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118 + 0, 54, 55, 56, 57, 57, 59, 58, 60, 58, + 61, 58, 58, 58, 62, 62, 62, 62, 62, 62, + 62, 62, 62, 62, 62, 62, 62, 64, 63, 65, + 65, 66, 68, 67, 69, 69, 70, 70, 70, 70, + 71, 72, 72, 72, 72, 72, 73, 74, 74, 75, + 77, 76, 78, 78, 78, 78, 79, 80, 80, 81, + 83, 82, 84, 84, 85, 85, 86, 86, 86, 86, + 87, 87, 87, 87, 88, 88, 89, 89, 89, 89, + 91, 90, 92, 90, 93, 93, 94, 94, 95, 97, + 96, 98, 98, 98, 99, 99, 100, 100, 100, 100, + 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, + 106, 108, 107, 107, 109, 109, 110, 110, 110, 111, + 111, 112, 112, 112, 112, 112, 112, 112, 113, 113, + 114, 114, 114, 115, 115, 115, 115, 115, 115, 115, + 115, 115, 115, 115, 115, 115, 116, 116, 117, 117, + 118, 118, 119, 119, 119, 119, 119, 119, 120, 120, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -662,21 +668,21 @@ static const yytype_uint8 yyr2[] = 0, 4, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 6, 2, 2, 2, 0, 7, 2, 0, 4, 3, 2, 0, - 2, 1, 2, 2, 2, 0, 6, 4, 3, 2, - 0, 1, 2, 2, 2, 0, 8, 2, 0, 2, - 0, 4, 3, 2, 0, 1, 3, 2, 1, 1, - 1, 2, 3, 2, 3, 0, 5, 0, 5, 1, - 1, 2, 2, 2, 0, 7, 3, 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, 1, 0, 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, - 2, 2, 1, 3, 1, 1, 0, 1, 1, 1, - 1, 1, 1, 6, 5, 1, 1, 1, 1, 1, + 2, 4, 4, 3, 2, 1, 1, 2, 2, 2, + 0, 6, 4, 3, 2, 0, 1, 2, 2, 2, + 0, 8, 2, 0, 2, 0, 4, 3, 2, 0, + 1, 3, 2, 1, 1, 1, 2, 3, 2, 3, + 0, 5, 0, 5, 1, 1, 2, 2, 2, 0, + 7, 3, 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, 1, 0, 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, 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 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -684,297 +690,314 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 0, 0, 0, 0, 6, 146, 2, 10, 142, - 144, 0, 0, 1, 0, 0, 145, 5, 12, 14, + 0, 0, 0, 0, 0, 6, 151, 2, 10, 147, + 149, 0, 0, 1, 0, 0, 150, 5, 12, 14, 19, 20, 21, 22, 15, 16, 17, 18, 23, 24, - 25, 0, 26, 0, 141, 4, 0, 3, 7, 27, + 25, 0, 26, 0, 146, 4, 0, 3, 7, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, - 44, 54, 83, 106, 11, 143, 0, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 138, 0, 125, 139, - 0, 0, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 52, 53, 81, 82, 29, 30, 42, 43, 5, 5, - 104, 113, 105, 0, 32, 0, 0, 60, 0, 84, - 0, 0, 137, 126, 0, 140, 0, 0, 9, 0, - 0, 111, 0, 110, 112, 34, 0, 0, 57, 0, - 55, 88, 89, 87, 0, 113, 0, 127, 0, 151, - 152, 150, 147, 148, 149, 154, 0, 0, 108, 113, - 0, 0, 0, 0, 59, 0, 0, 0, 0, 28, - 153, 0, 5, 109, 0, 0, 0, 0, 65, 49, - 51, 68, 46, 0, 86, 0, 0, 0, 107, 100, - 101, 0, 0, 38, 41, 33, 48, 0, 0, 40, - 67, 0, 0, 0, 0, 70, 0, 0, 0, 95, - 93, 69, 85, 0, 37, 0, 66, 47, 0, 79, - 80, 63, 68, 56, 92, 0, 71, 73, 0, 114, - 5, 0, 0, 0, 36, 62, 0, 72, 74, 77, - 0, 75, 115, 91, 102, 103, 61, 124, 117, 121, - 124, 5, 0, 78, 119, 76, 0, 123, 97, 98, - 99, 118, 122, 0, 120, 96 + 49, 59, 88, 111, 11, 148, 0, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 143, 0, 130, 144, + 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 57, 58, 86, 87, 29, 30, 47, 48, 5, + 5, 109, 118, 110, 0, 32, 0, 0, 65, 0, + 89, 0, 0, 142, 131, 0, 145, 0, 0, 9, + 0, 0, 116, 0, 115, 117, 34, 0, 0, 62, + 0, 60, 93, 94, 92, 0, 118, 0, 132, 0, + 156, 157, 155, 152, 153, 154, 159, 0, 0, 113, + 118, 0, 0, 0, 0, 64, 0, 0, 0, 0, + 28, 158, 0, 5, 114, 0, 0, 0, 0, 0, + 0, 45, 70, 54, 56, 73, 51, 0, 91, 0, + 0, 0, 112, 105, 106, 0, 0, 38, 46, 33, + 53, 44, 0, 0, 0, 0, 0, 0, 40, 72, + 0, 0, 0, 0, 75, 0, 0, 0, 100, 98, + 74, 90, 0, 37, 0, 0, 43, 0, 71, 52, + 0, 84, 85, 68, 73, 61, 97, 0, 76, 78, + 0, 119, 5, 0, 0, 0, 36, 41, 42, 67, + 0, 77, 79, 82, 0, 80, 120, 96, 107, 108, + 66, 129, 122, 126, 129, 5, 0, 83, 124, 81, + 0, 128, 102, 103, 104, 123, 127, 0, 125, 101 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 4, 5, 6, 7, 14, 41, 33, 18, 19, - 56, 49, 20, 21, 136, 114, 176, 178, 193, 50, - 22, 23, 115, 163, 179, 51, 24, 25, 165, 117, - 140, 203, 180, 207, 208, 209, 250, 247, 221, 52, - 26, 27, 144, 142, 119, 187, 210, 257, 258, 28, - 29, 53, 30, 120, 132, 133, 230, 231, 253, 69, - 181, 10, 11, 31, 155, 32, 134 + 56, 49, 20, 21, 137, 115, 177, 181, 182, 197, + 50, 22, 23, 116, 164, 183, 51, 24, 25, 166, + 118, 141, 212, 184, 216, 217, 218, 264, 261, 233, + 52, 26, 27, 145, 143, 120, 191, 219, 271, 272, + 28, 29, 53, 30, 121, 133, 134, 242, 243, 267, + 69, 202, 10, 11, 31, 156, 32, 135 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -224 +#define YYPACT_NINF -189 static const yytype_int16 yypact[] = { - 435, -12, -11, -11, 70, -224, 63, -224, -224, -11, - -224, -21, -22, -224, 78, 33, -224, 35, 54, -224, - -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, - -224, 128, -224, 78, -224, -224, -11, -224, -224, -224, - 765, 60, 538, 568, 598, 628, 26, 62, 402, -5, - 68, 12, -1, -224, -224, -224, 69, -224, -224, -224, - -224, -224, -224, -224, -224, 66, -224, 82, -224, 43, - 64, 78, -224, -224, -224, -224, -224, -224, -224, -224, - -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, - -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, - -224, -224, -224, -224, -224, -224, -224, -224, 35, 35, - -224, 658, -224, -3, -224, 71, -3, 106, 40, -224, - 85, 359, -224, -224, 98, -224, 94, 93, -224, 765, - 765, -224, 97, 91, -224, 113, 101, 284, 113, 40, - -224, -224, -224, -10, 102, 658, 104, -224, 93, -224, - -224, -224, -224, -224, 113, -224, 103, 99, -224, 658, - 316, 108, 765, 107, -224, 110, 40, 220, 112, -224, - -224, 688, 35, -224, 115, 765, 117, 284, 118, 120, - -224, 718, -224, 252, -224, 122, 357, 123, -224, -224, - -224, 765, 316, 124, -224, -224, -224, 93, 284, -224, - -224, 126, 357, 125, 220, -224, 432, 32, 29, -224, - 130, -224, -224, 121, -224, 316, -224, -224, 252, -224, - -224, 131, 473, -224, -224, 65, -224, -224, 132, -224, - 35, 59, 220, 748, -224, -224, 252, -224, -224, -224, - 765, -224, 166, -224, -224, -224, -224, 164, -224, 718, - 164, 35, 508, -224, -224, -224, 765, -224, 135, 113, - -224, -224, 718, 508, -224, -224 + 423, 33, -6, -6, 74, -189, 62, -189, -189, -6, + -189, -23, -19, -189, 246, 49, -189, 46, 52, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, 130, -189, 246, -189, -189, -6, -189, -189, -189, + 827, 54, 530, 561, 592, 623, 75, 78, 389, 11, + 85, 9, 17, -189, -189, -189, 96, -189, -189, -189, + -189, -189, -189, -189, -189, 77, -189, 114, -189, -15, + -14, 246, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -189, -189, -189, 46, + 46, -189, 654, -189, 1, -189, 103, 1, 137, 90, + -189, 106, 101, -189, -189, 120, -189, 105, 84, -189, + 827, 827, -189, 108, 107, -189, 127, 116, 278, 127, + 90, -189, -189, -189, 35, 117, 654, 119, -189, 84, + -189, -189, -189, -189, -189, 127, -189, 112, 118, -189, + 654, 311, 122, 765, 124, -189, 126, 90, 344, 128, + -189, -189, 685, 46, -189, 129, 765, 131, 278, 827, + 48, -189, 133, 132, -189, 716, -189, 244, -189, 135, + 790, 136, -189, -189, -189, 827, 311, 139, -189, -189, + -189, -189, 140, 138, 827, 36, 84, 278, -189, -189, + 142, 421, 141, 344, -189, 809, 57, 29, -189, 144, + -189, -189, 143, -189, 311, 827, -189, 827, -189, -189, + 244, -189, -189, 146, 463, -189, -189, 87, -189, -189, + 145, -189, 46, 25, 344, 747, -189, -189, -189, -189, + 244, -189, -189, -189, 827, -189, 165, -189, -189, -189, + -189, 178, -189, 716, 178, 46, 499, -189, -189, -189, + 827, -189, 147, 127, -189, -189, 716, 499, -189, -189 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -224, -224, -224, -17, -13, -224, -224, -224, -224, -224, - -224, -224, -224, -224, -224, -224, -158, -223, -224, -224, - -224, -224, -224, -161, -224, -224, -224, -224, -224, -224, - -224, -138, -160, -26, -224, -18, -224, -224, -224, -224, - -224, -224, -224, -107, -224, -191, -224, -78, -224, -224, - -224, -224, -224, -224, -50, -224, -56, -224, -62, -104, - -30, 27, 186, -224, -142, -224, -40 + -189, -189, -189, -17, -7, -189, -189, -189, -189, -189, + -189, -189, -189, -189, -189, -189, -180, -167, -189, -189, + -189, -189, -189, -189, -164, -189, -189, -189, -189, -189, + -189, -189, -159, -175, -16, -189, -13, -189, -189, -189, + -189, -189, -189, -189, -125, -189, -188, -189, -77, -189, + -189, -189, -189, -189, -189, -70, -189, -55, -189, -62, + -108, -30, 30, 200, -189, -136, -189, -40 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -117 +#define YYTABLE_NINF -122 static const yytype_int16 yytable[] = { - 40, 38, 101, 103, 105, 107, 170, 113, 112, 135, - 70, 118, 138, 224, 143, 194, 196, 248, 35, 37, - 54, 124, 9, 154, 116, -58, 36, 36, 67, 68, - 228, 8, 164, 261, 214, 143, 34, 217, 166, -35, - 229, 243, 219, -90, 154, -115, -115, -115, -115, -115, - -115, -115, -115, -115, -115, 216, -58, 234, 128, 184, - -115, -115, 143, 55, 141, 39, 15, -115, 226, 227, - 13, 67, 68, 2, 124, 108, -116, -116, -13, 1, - 235, -5, -5, -5, -5, -5, -5, -5, -5, 16, - 17, 129, 130, 154, 125, 168, 126, -8, 246, 156, - 157, 237, 238, 71, -5, -5, 241, 242, 146, 173, - 127, 109, -45, 121, 123, 137, 2, 122, 3, 139, - 162, 149, 150, -13, 67, 68, 151, 152, 153, 145, - 147, 190, 42, 43, 44, 45, 46, 47, 48, 159, - 148, 200, 158, 175, 124, 160, 167, 172, 259, 169, - 186, 177, 182, 171, 183, 191, 211, 188, 192, 259, - 162, 213, 195, 198, 197, 204, 202, 215, 212, 218, - 223, 233, 222, 232, 236, 175, 211, 229, 252, 239, - 225, 162, 200, 263, 220, 265, 251, 186, 255, 12, - 0, 0, 0, 245, 0, 0, 0, 0, 175, 0, - 0, 202, 0, 0, 0, 0, 0, 0, 0, 254, - 249, 0, 260, 240, 0, 186, 0, 0, 0, 202, - 0, 185, 264, 260, 0, 0, 262, 0, 0, 0, - 0, 0, 0, 0, 256, -5, -5, -5, -5, -5, - -5, -5, -5, -5, -5, -5, 0, 0, 0, 0, - -5, -5, -5, 201, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, -94, 0, -5, -5, -5, - -5, -5, -5, -5, -5, -5, -5, -5, 0, 0, - 0, 0, -5, -5, -5, 161, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, -64, 0, 0, + 40, 198, 102, 104, 106, 108, 136, 38, 113, 139, + 70, 144, 201, 171, 200, 165, 223, 125, 35, 127, + 155, 117, -63, 114, 37, 236, 54, 36, 9, 119, + 240, 36, 144, 67, 68, 128, 231, 226, 126, 34, + 241, 155, 188, 229, 246, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -63, 257, -35, 247, 144, + 248, -120, -120, -95, 129, 15, 55, 125, 125, -120, + 228, 249, 205, 255, 13, 256, 169, -121, 8, -121, + 67, 68, 39, 203, 227, 167, 2, 262, 16, 17, + 174, 260, 130, 131, 238, 239, 204, -8, 155, 71, + 157, 158, 1, 275, -5, -5, -5, -5, -5, -5, + -5, -5, 150, 151, 142, 147, 67, 68, 152, 153, + 154, 163, 67, 68, 251, 252, 109, -5, -5, 110, + 123, -50, 194, 185, 42, 43, 44, 45, 46, 47, + 48, 2, 122, 3, 176, 209, 185, 124, -13, 138, + 140, 190, 146, 148, 149, 159, 195, 160, 273, 125, + 220, 163, 161, 168, 172, 222, 170, 178, 173, 273, + 211, 186, 187, 208, 196, 192, 241, 207, 199, 176, + 213, 234, 206, 221, 224, 220, 225, 230, 235, 244, + 163, 250, 266, 253, 209, 245, 190, 277, 232, 237, + 279, 265, 269, 12, 0, 259, 0, 176, 0, 0, + 0, 0, 0, 211, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 268, 263, 254, 274, 190, 0, 0, + 0, 0, 0, 211, 0, 0, 278, 274, 0, 0, + 276, 0, 0, 0, 0, 210, -13, 1, 270, -5, + -5, -5, -5, -5, -5, -5, -5, 0, 0, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, - 0, 0, 0, 0, 0, -5, -5, 174, 0, 0, - 0, 0, 2, 0, 0, 0, 0, 0, 0, -50, - 0, 0, -5, -5, -5, -5, -5, -5, -5, -5, - -5, -5, 0, 0, 0, 0, 0, -5, -5, 0, + 0, 0, -5, -5, -5, -5, -5, -5, 0, 162, + 0, 0, 0, -5, 2, 0, 2, 0, 3, 0, + 0, -69, 0, -13, -5, -5, -5, -5, -5, -5, + -5, -5, -5, -5, 0, 0, 0, 0, 0, -5, + -5, -5, 175, 0, 0, 0, 0, -5, 2, 0, + 0, 0, 0, 0, 0, -55, 0, -5, -5, -5, + -5, -5, -5, -5, -5, -5, -5, 0, 0, 0, + 0, 0, -5, -5, -5, 189, 0, 0, 0, 0, + -5, 2, 0, 0, 0, 0, 0, 0, -39, -5, + -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, + 0, 0, 0, 0, -5, 0, -5, -5, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, - 1, -39, -5, -5, -5, -5, -5, -5, -5, -5, - 0, 0, 205, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 0, 0, -5, -5, 206, 67, 68, - 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, - 0, 0, 0, 0, -13, 72, 73, 74, 75, 76, + 0, -99, 72, 73, 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, 0, 111, -13, 1, 0, -5, -5, -5, -5, + -5, -5, -5, -5, 0, 112, 214, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 0, 0, -5, + -5, 215, 179, 67, 68, 0, 0, 0, 0, 0, + 180, 0, 0, 2, 0, 3, 72, 73, 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, 0, 208, 0, 0, 0, + -74, -74, 72, 73, 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, 67, 68, 72, 73, 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, 0, 101, 72, 73, 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, 0, 103, 72, 73, 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, 0, 110, -13, 1, 0, -5, -5, - -5, -5, -5, -5, -5, -5, 111, 205, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, - 0, -5, -5, 67, 68, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 0, 3, 72, 73, 74, 75, + 97, 98, 99, 100, 0, 105, 72, 73, 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, 0, 199, 0, 0, 0, -69, - -69, 72, 73, 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, 67, - 68, 72, 73, 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, 0, - 100, 72, 73, 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, 0, - 102, 72, 73, 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, 0, - 104, 72, 73, 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, 0, - 106, 72, 73, 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, 0, - 131, 72, 73, 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, 0, - 189, 72, 73, 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, 0, - 199, 72, 73, 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, 0, - 244, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 0, 0, 0, 0, 0, 67, 68 + 96, 97, 98, 99, 100, 0, 107, 72, 73, 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, 0, 132, 72, 73, + 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, 0, 193, 72, + 73, 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, 0, 208, + 72, 73, 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, 0, + 258, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 0, 0, 0, 0, 0, 179, 67, 68, 0, + 0, 0, 0, 0, 180, 214, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, + 215, 0, 67, 68, 214, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, + 0, 67, 68, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 0, 0, 0, 0, 0, 0, 67, + 68 }; static const yytype_int16 yycheck[] = { - 17, 14, 42, 43, 44, 45, 148, 12, 48, 113, - 40, 12, 116, 204, 118, 175, 177, 240, 39, 41, - 33, 31, 33, 127, 12, 13, 48, 48, 31, 32, - 1, 43, 139, 256, 192, 139, 9, 198, 48, 44, - 11, 232, 202, 44, 148, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 197, 44, 215, 71, 166, - 31, 32, 166, 36, 24, 32, 3, 38, 36, 37, - 0, 31, 32, 38, 31, 49, 47, 48, 0, 1, - 218, 3, 4, 5, 6, 7, 8, 9, 10, 26, - 27, 108, 109, 197, 51, 145, 32, 43, 236, 129, - 130, 36, 37, 43, 26, 27, 47, 48, 121, 159, - 46, 49, 44, 44, 32, 44, 38, 51, 40, 13, - 137, 28, 29, 45, 31, 32, 33, 34, 35, 44, - 32, 171, 4, 5, 6, 7, 8, 9, 10, 48, - 46, 181, 45, 160, 31, 44, 44, 48, 252, 45, - 167, 43, 45, 50, 44, 172, 186, 45, 43, 263, - 177, 191, 45, 43, 46, 43, 183, 43, 45, 43, - 45, 50, 202, 43, 43, 192, 206, 11, 14, 47, - 206, 198, 222, 48, 202, 263, 242, 204, 250, 3, - -1, -1, -1, 233, -1, -1, -1, -1, 215, -1, - -1, 218, -1, -1, -1, -1, -1, -1, -1, 249, - 240, -1, 252, 230, -1, 232, -1, -1, -1, 236, - -1, 1, 262, 263, -1, -1, 256, -1, -1, -1, - -1, -1, -1, -1, 251, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, - 30, 31, 32, 1, -1, -1, -1, -1, 38, -1, - -1, -1, -1, -1, -1, 45, -1, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, - -1, -1, 30, 31, 32, 1, -1, -1, -1, -1, - 38, -1, -1, -1, -1, -1, -1, 45, -1, -1, + 17, 176, 42, 43, 44, 45, 114, 14, 48, 117, + 40, 119, 179, 149, 178, 140, 196, 32, 41, 33, + 128, 12, 13, 12, 43, 213, 33, 50, 34, 12, + 1, 50, 140, 32, 33, 49, 211, 204, 53, 9, + 11, 149, 167, 207, 224, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 46, 244, 46, 225, 167, + 227, 32, 33, 46, 71, 3, 36, 32, 32, 40, + 206, 230, 180, 48, 0, 50, 146, 48, 45, 50, + 32, 33, 33, 35, 48, 50, 40, 254, 26, 27, + 160, 250, 109, 110, 37, 38, 48, 45, 206, 45, + 130, 131, 1, 270, 3, 4, 5, 6, 7, 8, + 9, 10, 28, 29, 24, 122, 32, 33, 34, 35, + 36, 138, 32, 33, 37, 38, 51, 26, 27, 51, + 53, 46, 172, 163, 4, 5, 6, 7, 8, 9, + 10, 40, 46, 42, 161, 185, 176, 33, 47, 46, + 13, 168, 46, 33, 49, 47, 173, 50, 266, 32, + 190, 178, 46, 46, 52, 195, 47, 45, 50, 277, + 187, 47, 46, 33, 45, 47, 11, 45, 47, 196, + 45, 211, 49, 47, 45, 215, 48, 45, 47, 45, + 207, 45, 14, 48, 234, 52, 213, 50, 211, 215, + 277, 256, 264, 3, -1, 245, -1, 224, -1, -1, + -1, -1, -1, 230, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 263, 254, 242, 266, 244, -1, -1, + -1, -1, -1, 250, -1, -1, 276, 277, -1, -1, + 270, -1, -1, -1, -1, 1, 0, 1, 265, 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, -1, 1, + -1, -1, -1, 39, 40, -1, 40, -1, 42, -1, + -1, 47, -1, 47, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, -1, -1, -1, -1, -1, 31, + 32, 33, 1, -1, -1, -1, -1, 39, 40, -1, + -1, -1, -1, -1, -1, 47, -1, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, + -1, -1, 31, 32, 33, 1, -1, -1, -1, -1, + 39, 40, -1, -1, -1, -1, -1, -1, 47, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - -1, -1, -1, -1, -1, 31, 32, 1, -1, -1, - -1, -1, 38, -1, -1, -1, -1, -1, -1, 45, - -1, -1, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, -1, -1, -1, -1, -1, 31, 32, -1, - -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, - 1, 45, 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, - -1, -1, -1, -1, -1, -1, -1, 38, -1, 40, - -1, -1, -1, -1, 45, 3, 4, 5, 6, 7, + -1, -1, -1, -1, 30, -1, 32, 33, -1, -1, + -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, + -1, 47, 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, -1, 33, 0, 1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, -1, 46, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, -1, -1, 26, + 27, 30, 31, 32, 33, -1, -1, -1, -1, -1, + 39, -1, -1, 40, -1, 42, 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, -1, 33, -1, -1, -1, + 37, 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, 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, -1, 33, 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, -1, 33, 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, -1, 32, 0, 1, -1, 3, 4, - 5, 6, 7, 8, 9, 10, 44, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, - -1, 26, 27, 31, 32, -1, -1, -1, -1, -1, - -1, -1, -1, 38, -1, 40, 3, 4, 5, 6, + 28, 29, 30, 31, -1, 33, 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, -1, 32, -1, -1, -1, 36, - 37, 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, 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, -1, - 32, 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, -1, - 32, 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, -1, - 32, 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, -1, - 32, 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, -1, - 32, 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, -1, - 32, 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, -1, - 32, 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, -1, - 32, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, -1, -1, -1, -1, -1, 31, 32 + 27, 28, 29, 30, 31, -1, 33, 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, -1, 33, 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, -1, 33, 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, -1, 33, + 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, -1, + 33, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, -1, -1, -1, -1, -1, 31, 32, 33, -1, + -1, -1, -1, -1, 39, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, + 30, -1, 32, 33, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, + -1, 32, 33, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, -1, -1, -1, -1, -1, -1, 32, + 33 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 1, 38, 40, 53, 54, 55, 56, 43, 33, - 113, 114, 114, 0, 57, 3, 26, 27, 60, 61, - 64, 65, 72, 73, 78, 79, 92, 93, 101, 102, - 104, 115, 117, 59, 113, 39, 48, 41, 56, 32, - 55, 58, 4, 5, 6, 7, 8, 9, 10, 63, - 71, 77, 91, 103, 56, 113, 62, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 31, 32, 111, - 112, 43, 3, 4, 5, 6, 7, 8, 9, 10, + 0, 1, 40, 42, 55, 56, 57, 58, 45, 34, + 116, 117, 117, 0, 59, 3, 26, 27, 62, 63, + 66, 67, 75, 76, 81, 82, 95, 96, 104, 105, + 107, 118, 120, 61, 116, 41, 50, 43, 58, 33, + 57, 60, 4, 5, 6, 7, 8, 9, 10, 65, + 74, 80, 94, 106, 58, 116, 64, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 32, 33, 114, + 115, 45, 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, - 32, 118, 32, 118, 32, 118, 32, 118, 49, 49, - 32, 44, 118, 12, 67, 74, 12, 81, 12, 96, - 105, 44, 51, 32, 31, 51, 32, 46, 56, 55, - 55, 32, 106, 107, 118, 111, 66, 44, 111, 13, - 82, 24, 95, 111, 94, 44, 56, 32, 46, 28, - 29, 33, 34, 35, 111, 116, 112, 112, 45, 48, - 44, 1, 55, 75, 95, 80, 48, 44, 106, 45, - 116, 50, 48, 106, 1, 55, 68, 43, 69, 76, - 84, 112, 45, 44, 95, 1, 55, 97, 45, 32, - 118, 55, 43, 70, 84, 45, 75, 46, 43, 32, - 118, 1, 55, 83, 43, 15, 30, 85, 86, 87, - 98, 112, 45, 112, 68, 43, 116, 75, 43, 84, - 87, 90, 112, 45, 97, 85, 36, 37, 1, 11, - 108, 109, 43, 50, 68, 83, 43, 36, 37, 47, - 55, 47, 48, 97, 32, 118, 83, 89, 69, 112, - 88, 108, 14, 110, 118, 110, 55, 99, 100, 111, - 118, 69, 112, 48, 118, 99 + 31, 33, 121, 33, 121, 33, 121, 33, 121, 51, + 51, 33, 46, 121, 12, 69, 77, 12, 84, 12, + 99, 108, 46, 53, 33, 32, 53, 33, 49, 58, + 57, 57, 33, 109, 110, 121, 114, 68, 46, 114, + 13, 85, 24, 98, 114, 97, 46, 58, 33, 49, + 28, 29, 34, 35, 36, 114, 119, 115, 115, 47, + 50, 46, 1, 57, 78, 98, 83, 50, 46, 109, + 47, 119, 52, 50, 109, 1, 57, 70, 45, 31, + 39, 71, 72, 79, 87, 115, 47, 46, 98, 1, + 57, 100, 47, 33, 121, 57, 45, 73, 87, 47, + 78, 71, 115, 35, 48, 114, 49, 45, 33, 121, + 1, 57, 86, 45, 15, 30, 88, 89, 90, 101, + 115, 47, 115, 70, 45, 48, 71, 48, 119, 78, + 45, 87, 90, 93, 115, 47, 100, 88, 37, 38, + 1, 11, 111, 112, 45, 52, 70, 71, 71, 86, + 45, 37, 38, 48, 57, 48, 50, 100, 33, 121, + 86, 92, 71, 115, 91, 111, 14, 113, 121, 113, + 57, 102, 103, 114, 121, 71, 115, 50, 121, 102 }; #define yyerrok (yyerrstatus = 0) @@ -1787,7 +1810,7 @@ yyreduce: case 2: /* Line 1455 of yacc.c */ -#line 105 "../Slice/Grammar.y" +#line 108 "../Slice/Grammar.y" { ;} break; @@ -1795,7 +1818,7 @@ yyreduce: case 3: /* Line 1455 of yacc.c */ -#line 113 "../Slice/Grammar.y" +#line 116 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (3)]); ;} @@ -1804,7 +1827,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 122 "../Slice/Grammar.y" +#line 125 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (3)]); ;} @@ -1813,7 +1836,7 @@ yyreduce: case 5: /* Line 1455 of yacc.c */ -#line 126 "../Slice/Grammar.y" +#line 129 "../Slice/Grammar.y" { (yyval) = new StringListTok; ;} @@ -1822,7 +1845,7 @@ yyreduce: case 6: /* Line 1455 of yacc.c */ -#line 135 "../Slice/Grammar.y" +#line 138 "../Slice/Grammar.y" { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[(1) - (1)])); if(!metaData->v.empty()) @@ -1835,7 +1858,7 @@ yyreduce: case 8: /* Line 1455 of yacc.c */ -#line 144 "../Slice/Grammar.y" +#line 147 "../Slice/Grammar.y" { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[(1) - (2)])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -1849,7 +1872,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 154 "../Slice/Grammar.y" +#line 157 "../Slice/Grammar.y" { yyerrok; ;} @@ -1858,7 +1881,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 159 "../Slice/Grammar.y" +#line 162 "../Slice/Grammar.y" { unit->error("`;' missing after definition"); ;} @@ -1867,7 +1890,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 163 "../Slice/Grammar.y" +#line 166 "../Slice/Grammar.y" { ;} break; @@ -1875,7 +1898,7 @@ yyreduce: case 14: /* Line 1455 of yacc.c */ -#line 171 "../Slice/Grammar.y" +#line 174 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || ModulePtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1884,7 +1907,7 @@ yyreduce: case 15: /* Line 1455 of yacc.c */ -#line 175 "../Slice/Grammar.y" +#line 178 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || ClassDeclPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1893,7 +1916,7 @@ yyreduce: case 16: /* Line 1455 of yacc.c */ -#line 179 "../Slice/Grammar.y" +#line 182 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || ClassDefPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1902,7 +1925,7 @@ yyreduce: case 17: /* Line 1455 of yacc.c */ -#line 183 "../Slice/Grammar.y" +#line 186 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || ClassDeclPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1911,7 +1934,7 @@ yyreduce: case 18: /* Line 1455 of yacc.c */ -#line 187 "../Slice/Grammar.y" +#line 190 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || ClassDefPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1920,7 +1943,7 @@ yyreduce: case 19: /* Line 1455 of yacc.c */ -#line 191 "../Slice/Grammar.y" +#line 194 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0); ;} @@ -1929,7 +1952,7 @@ yyreduce: case 20: /* Line 1455 of yacc.c */ -#line 195 "../Slice/Grammar.y" +#line 198 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || ExceptionPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1938,7 +1961,7 @@ yyreduce: case 21: /* Line 1455 of yacc.c */ -#line 199 "../Slice/Grammar.y" +#line 202 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0); ;} @@ -1947,7 +1970,7 @@ yyreduce: case 22: /* Line 1455 of yacc.c */ -#line 203 "../Slice/Grammar.y" +#line 206 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || StructPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1956,7 +1979,7 @@ yyreduce: case 23: /* Line 1455 of yacc.c */ -#line 207 "../Slice/Grammar.y" +#line 210 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || SequencePtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1965,7 +1988,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 211 "../Slice/Grammar.y" +#line 214 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || DictionaryPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1974,7 +1997,7 @@ yyreduce: case 25: /* Line 1455 of yacc.c */ -#line 215 "../Slice/Grammar.y" +#line 218 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || EnumPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1983,7 +2006,7 @@ yyreduce: case 26: /* Line 1455 of yacc.c */ -#line 219 "../Slice/Grammar.y" +#line 222 "../Slice/Grammar.y" { assert((yyvsp[(1) - (1)]) == 0 || ConstPtr::dynamicCast((yyvsp[(1) - (1)]))); ;} @@ -1992,7 +2015,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 228 "../Slice/Grammar.y" +#line 231 "../Slice/Grammar.y" { unit->setSeenDefinition(); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2014,7 +2037,7 @@ yyreduce: case 28: /* Line 1455 of yacc.c */ -#line 245 "../Slice/Grammar.y" +#line 248 "../Slice/Grammar.y" { if((yyvsp[(3) - (6)])) { @@ -2031,7 +2054,7 @@ yyreduce: case 29: /* Line 1455 of yacc.c */ -#line 262 "../Slice/Grammar.y" +#line 265 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); ;} @@ -2040,7 +2063,7 @@ yyreduce: case 30: /* Line 1455 of yacc.c */ -#line 266 "../Slice/Grammar.y" +#line 269 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); unit->error("keyword `" + ident->v + "' cannot be used as exception name"); @@ -2051,7 +2074,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 277 "../Slice/Grammar.y" +#line 280 "../Slice/Grammar.y" { unit->error("exceptions cannot be forward declared"); (yyval) = 0; @@ -2061,7 +2084,7 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 287 "../Slice/Grammar.y" +#line 290 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (3)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (3)])); @@ -2080,7 +2103,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 301 "../Slice/Grammar.y" +#line 304 "../Slice/Grammar.y" { if((yyvsp[(4) - (7)])) { @@ -2093,7 +2116,7 @@ yyreduce: case 34: /* Line 1455 of yacc.c */ -#line 314 "../Slice/Grammar.y" +#line 317 "../Slice/Grammar.y" { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); ContainerPtr cont = unit->currentContainer(); @@ -2106,7 +2129,7 @@ yyreduce: case 35: /* Line 1455 of yacc.c */ -#line 322 "../Slice/Grammar.y" +#line 325 "../Slice/Grammar.y" { (yyval) = 0; ;} @@ -2115,7 +2138,7 @@ yyreduce: case 36: /* Line 1455 of yacc.c */ -#line 331 "../Slice/Grammar.y" +#line 334 "../Slice/Grammar.y" { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[(1) - (4)])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[(2) - (4)])); @@ -2129,7 +2152,7 @@ yyreduce: case 37: /* Line 1455 of yacc.c */ -#line 340 "../Slice/Grammar.y" +#line 343 "../Slice/Grammar.y" { ;} break; @@ -2137,7 +2160,7 @@ yyreduce: case 38: /* Line 1455 of yacc.c */ -#line 343 "../Slice/Grammar.y" +#line 346 "../Slice/Grammar.y" { unit->error("`;' missing after definition"); ;} @@ -2146,7 +2169,7 @@ yyreduce: case 39: /* Line 1455 of yacc.c */ -#line 347 "../Slice/Grammar.y" +#line 350 "../Slice/Grammar.y" { ;} break; @@ -2154,7 +2177,7 @@ yyreduce: case 40: /* Line 1455 of yacc.c */ -#line 355 "../Slice/Grammar.y" +#line 358 "../Slice/Grammar.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (2)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2164,19 +2187,172 @@ yyreduce: ;} break; + case 41: + +/* Line 1455 of yacc.c */ +#line 371 "../Slice/Grammar.y" + { + IntegerTokPtr i = IntegerTokPtr::dynamicCast((yyvsp[(2) - (4)])); + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[(4) - (4)])); + + int tag; + if(i->v < 0 || i->v > Int32Max) + { + unit->error("tag for optional member `" + ts->v.second + "' is out of range"); + tag = -1; + } + else + { + tag = static_cast<int>(i->v); + } + + DataMemberDefTokPtr m = new DataMemberDefTok; + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = tag >= 0; + m->v.tag = tag; + (yyval) = m; +;} + break; + case 42: /* Line 1455 of yacc.c */ -#line 374 "../Slice/Grammar.y" +#line 394 "../Slice/Grammar.y" { - (yyval) = (yyvsp[(2) - (2)]); + StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(2) - (4)])); + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[(4) - (4)])); + + ContainerPtr cont = unit->currentContainer(); + assert(cont); + ContainedList cl = cont->lookupContained(scoped->v); + if(cl.empty()) + { + YYERROR; // Can't continue, jump to next yyerrok + } + cont->checkIntroduced(scoped->v); + + int tag = -1; + EnumeratorPtr enumerator = EnumeratorPtr::dynamicCast(cl.front()); + ConstPtr constant = ConstPtr::dynamicCast(cl.front()); + if(constant) + { + BuiltinPtr b = BuiltinPtr::dynamicCast(constant->type()); + if(b) + { + switch(b->kind()) + { + case Builtin::KindByte: + case Builtin::KindShort: + case Builtin::KindInt: + case Builtin::KindLong: + { + IceUtil::Int64 l = IceUtilInternal::strToInt64(constant->value().c_str(), 0, 0); + if(l < 0 || l > Int32Max) + { + unit->error("tag for optional member `" + ts->v.second + "' is out of range"); + } + tag = static_cast<int>(l); + break; + } + default: + break; + } + } + } + else if(enumerator) + { + // + // TODO: When this code is merged with ICE-4619, we need to fix the + // loop below to consider the enumerator's value instead of its ordinal + // position. + // + EnumeratorList el = enumerator->type()->getEnumerators(); + int i = 0; + for(EnumeratorList::iterator p = el.begin(); p != el.end(); ++p, ++i) + { + if(enumerator == *p) + { + break; + } + } + tag = i; + } + + if(tag < 0) + { + unit->error("invalid tag `" + scoped->v + "' for optional member `" + ts->v.second + "'"); + } + + DataMemberDefTokPtr m = new DataMemberDefTok; + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = tag >= 0; + m->v.tag = tag; + (yyval) = m; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 378 "../Slice/Grammar.y" +#line 467 "../Slice/Grammar.y" + { + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[(3) - (3)])); + unit->error("missing tag for optional member `" + ts->v.second + "'"); + DataMemberDefTokPtr m = new DataMemberDefTok; // Dummy + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = false; + m->v.tag = -1; + (yyval) = m; +;} + break; + + case 44: + +/* Line 1455 of yacc.c */ +#line 478 "../Slice/Grammar.y" + { + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[(2) - (2)])); + unit->error("missing tag for optional member `" + ts->v.second + "'"); + DataMemberDefTokPtr m = new DataMemberDefTok; // Dummy + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = false; + m->v.tag = -1; + (yyval) = m; +;} + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 489 "../Slice/Grammar.y" + { + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast((yyvsp[(1) - (1)])); + DataMemberDefTokPtr m = new DataMemberDefTok; + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = false; + m->v.tag = -1; + (yyval) = m; +;} + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 510 "../Slice/Grammar.y" + { + (yyval) = (yyvsp[(2) - (2)]); +;} + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 514 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); unit->error("keyword `" + ident->v + "' cannot be used as struct name"); @@ -2184,20 +2360,20 @@ yyreduce: ;} break; - case 44: + case 49: /* Line 1455 of yacc.c */ -#line 389 "../Slice/Grammar.y" +#line 525 "../Slice/Grammar.y" { unit->error("structs cannot be forward declared"); (yyval) = 0; // Dummy ;} break; - case 45: + case 50: /* Line 1455 of yacc.c */ -#line 399 "../Slice/Grammar.y" +#line 535 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (2)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2212,10 +2388,10 @@ yyreduce: ;} break; - case 46: + case 51: /* Line 1455 of yacc.c */ -#line 412 "../Slice/Grammar.y" +#line 548 "../Slice/Grammar.y" { if((yyvsp[(3) - (6)])) { @@ -2235,10 +2411,10 @@ yyreduce: ;} break; - case 47: + case 52: /* Line 1455 of yacc.c */ -#line 435 "../Slice/Grammar.y" +#line 571 "../Slice/Grammar.y" { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[(1) - (4)])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[(2) - (4)])); @@ -2249,44 +2425,44 @@ yyreduce: ;} break; - case 48: + case 53: /* Line 1455 of yacc.c */ -#line 444 "../Slice/Grammar.y" +#line 580 "../Slice/Grammar.y" { ;} break; - case 49: + case 54: /* Line 1455 of yacc.c */ -#line 447 "../Slice/Grammar.y" +#line 583 "../Slice/Grammar.y" { unit->error("`;' missing after definition"); ;} break; - case 50: + case 55: /* Line 1455 of yacc.c */ -#line 451 "../Slice/Grammar.y" +#line 587 "../Slice/Grammar.y" { ;} break; - case 52: + case 57: /* Line 1455 of yacc.c */ -#line 465 "../Slice/Grammar.y" +#line 601 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; - case 53: + case 58: /* Line 1455 of yacc.c */ -#line 469 "../Slice/Grammar.y" +#line 605 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); unit->error("keyword `" + ident->v + "' cannot be used as class name"); @@ -2294,10 +2470,10 @@ yyreduce: ;} break; - case 54: + case 59: /* Line 1455 of yacc.c */ -#line 480 "../Slice/Grammar.y" +#line 616 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (2)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2307,10 +2483,10 @@ yyreduce: ;} break; - case 55: + case 60: /* Line 1455 of yacc.c */ -#line 493 "../Slice/Grammar.y" +#line 629 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (4)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (4)])); @@ -2335,10 +2511,10 @@ yyreduce: ;} break; - case 56: + case 61: /* Line 1455 of yacc.c */ -#line 516 "../Slice/Grammar.y" +#line 652 "../Slice/Grammar.y" { if((yyvsp[(5) - (8)])) { @@ -2352,10 +2528,10 @@ yyreduce: ;} break; - case 57: + case 62: /* Line 1455 of yacc.c */ -#line 533 "../Slice/Grammar.y" +#line 669 "../Slice/Grammar.y" { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); ContainerPtr cont = unit->currentContainer(); @@ -2391,37 +2567,37 @@ yyreduce: ;} break; - case 58: + case 63: /* Line 1455 of yacc.c */ -#line 567 "../Slice/Grammar.y" +#line 703 "../Slice/Grammar.y" { (yyval) = 0; ;} break; - case 59: + case 64: /* Line 1455 of yacc.c */ -#line 576 "../Slice/Grammar.y" +#line 712 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; - case 60: + case 65: /* Line 1455 of yacc.c */ -#line 580 "../Slice/Grammar.y" +#line 716 "../Slice/Grammar.y" { (yyval) = new ClassListTok; ;} break; - case 61: + case 66: /* Line 1455 of yacc.c */ -#line 589 "../Slice/Grammar.y" +#line 725 "../Slice/Grammar.y" { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[(1) - (4)])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[(2) - (4)])); @@ -2432,155 +2608,156 @@ yyreduce: ;} break; - case 62: + case 67: /* Line 1455 of yacc.c */ -#line 598 "../Slice/Grammar.y" +#line 734 "../Slice/Grammar.y" { ;} break; - case 63: + case 68: /* Line 1455 of yacc.c */ -#line 601 "../Slice/Grammar.y" +#line 737 "../Slice/Grammar.y" { unit->error("`;' missing after definition"); ;} break; - case 64: + case 69: /* Line 1455 of yacc.c */ -#line 605 "../Slice/Grammar.y" +#line 741 "../Slice/Grammar.y" { ;} break; - case 65: + case 70: /* Line 1455 of yacc.c */ -#line 613 "../Slice/Grammar.y" +#line 749 "../Slice/Grammar.y" { - TypePtr type = TypeStringTokPtr::dynamicCast((yyvsp[(1) - (1)]))->v.first; - string name = TypeStringTokPtr::dynamicCast((yyvsp[(1) - (1)]))->v.second; + DataMemberDefTokPtr def = DataMemberDefTokPtr::dynamicCast((yyvsp[(1) - (1)])); ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); DataMemberPtr dm; if(cl) { - dm = cl->createDataMember(name, type, 0, "", ""); + dm = cl->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, 0, "", ""); } StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); if(st) { - dm = st->createDataMember(name, type, 0, "", ""); + dm = st->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, 0, "", ""); } ExceptionPtr ex = ExceptionPtr::dynamicCast(unit->currentContainer()); if(ex) { - dm = ex->createDataMember(name, type, 0, "", ""); + dm = ex->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, 0, "", ""); } - unit->currentContainer()->checkIntroduced(name, dm); + unit->currentContainer()->checkIntroduced(def->v.name, dm); (yyval) = dm; ;} break; - case 66: + case 71: /* Line 1455 of yacc.c */ -#line 636 "../Slice/Grammar.y" +#line 771 "../Slice/Grammar.y" { - TypePtr type = TypeStringTokPtr::dynamicCast((yyvsp[(1) - (3)]))->v.first; - string name = TypeStringTokPtr::dynamicCast((yyvsp[(1) - (3)]))->v.second; + DataMemberDefTokPtr def = DataMemberDefTokPtr::dynamicCast((yyvsp[(1) - (3)])); ConstDefTokPtr value = ConstDefTokPtr::dynamicCast((yyvsp[(3) - (3)])); ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); DataMemberPtr dm; if(cl) { - dm = cl->createDataMember(name, type, value->v.value, value->v.valueAsString, value->v.valueAsLiteral); + dm = cl->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, value->v.value, + value->v.valueAsString, value->v.valueAsLiteral); } StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); if(st) { - dm = st->createDataMember(name, type, value->v.value, value->v.valueAsString, value->v.valueAsLiteral); + dm = st->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, value->v.value, + value->v.valueAsString, value->v.valueAsLiteral); } ExceptionPtr ex = ExceptionPtr::dynamicCast(unit->currentContainer()); if(ex) { - dm = ex->createDataMember(name, type, value->v.value, value->v.valueAsString, value->v.valueAsLiteral); + dm = ex->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, value->v.value, + value->v.valueAsString, value->v.valueAsLiteral); } - unit->currentContainer()->checkIntroduced(name, dm); + unit->currentContainer()->checkIntroduced(def->v.name, dm); (yyval) = dm; ;} break; - case 67: + case 72: /* Line 1455 of yacc.c */ -#line 661 "../Slice/Grammar.y" +#line 798 "../Slice/Grammar.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (2)])); string name = StringTokPtr::dynamicCast((yyvsp[(2) - (2)]))->v; ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); if(cl) { - (yyval) = cl->createDataMember(name, type, 0, "", ""); // Dummy + (yyval) = cl->createDataMember(name, type, false, 0, 0, "", ""); // Dummy } StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); if(st) { - (yyval) = st->createDataMember(name, type, 0, "", ""); // Dummy + (yyval) = st->createDataMember(name, type, false, 0, 0, "", ""); // Dummy } ExceptionPtr ex = ExceptionPtr::dynamicCast(unit->currentContainer()); if(ex) { - (yyval) = ex->createDataMember(name, type, 0, "", ""); // Dummy + (yyval) = ex->createDataMember(name, type, false, 0, 0, "", ""); // Dummy } assert((yyval)); unit->error("keyword `" + name + "' cannot be used as data member name"); ;} break; - case 68: + case 73: /* Line 1455 of yacc.c */ -#line 683 "../Slice/Grammar.y" +#line 820 "../Slice/Grammar.y" { TypePtr type = TypePtr::dynamicCast((yyvsp[(1) - (1)])); ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); if(cl) { - (yyval) = cl->createDataMember(IceUtil::generateUUID(), type, 0, "", ""); // Dummy + (yyval) = cl->createDataMember(IceUtil::generateUUID(), type, false, 0, 0, "", ""); // Dummy } StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); if(st) { - (yyval) = st->createDataMember(IceUtil::generateUUID(), type, 0, "", ""); // Dummy + (yyval) = st->createDataMember(IceUtil::generateUUID(), type, false, 0, 0, "", ""); // Dummy } ExceptionPtr ex = ExceptionPtr::dynamicCast(unit->currentContainer()); if(ex) { - (yyval) = ex->createDataMember(IceUtil::generateUUID(), type, 0, "", ""); // Dummy + (yyval) = ex->createDataMember(IceUtil::generateUUID(), type, false, 0, 0, "", ""); // Dummy } assert((yyval)); unit->error("missing data member name"); ;} break; - case 70: + case 75: /* Line 1455 of yacc.c */ -#line 710 "../Slice/Grammar.y" +#line 847 "../Slice/Grammar.y" { (yyval) = 0; ;} break; - case 71: + case 76: /* Line 1455 of yacc.c */ -#line 719 "../Slice/Grammar.y" +#line 856 "../Slice/Grammar.y" { TypePtr returnType = TypePtr::dynamicCast((yyvsp[(1) - (2)])); string name = StringTokPtr::dynamicCast((yyvsp[(2) - (2)]))->v; @@ -2606,10 +2783,10 @@ yyreduce: ;} break; - case 72: + case 77: /* Line 1455 of yacc.c */ -#line 743 "../Slice/Grammar.y" +#line 880 "../Slice/Grammar.y" { TypePtr returnType = TypePtr::dynamicCast((yyvsp[(2) - (3)])); string name = StringTokPtr::dynamicCast((yyvsp[(3) - (3)]))->v; @@ -2635,10 +2812,10 @@ yyreduce: ;} break; - case 73: + case 78: /* Line 1455 of yacc.c */ -#line 767 "../Slice/Grammar.y" +#line 904 "../Slice/Grammar.y" { TypePtr returnType = TypePtr::dynamicCast((yyvsp[(1) - (2)])); string name = StringTokPtr::dynamicCast((yyvsp[(2) - (2)]))->v; @@ -2664,10 +2841,10 @@ yyreduce: ;} break; - case 74: + case 79: /* Line 1455 of yacc.c */ -#line 791 "../Slice/Grammar.y" +#line 928 "../Slice/Grammar.y" { TypePtr returnType = TypePtr::dynamicCast((yyvsp[(2) - (3)])); string name = StringTokPtr::dynamicCast((yyvsp[(3) - (3)]))->v; @@ -2693,10 +2870,10 @@ yyreduce: ;} break; - case 75: + case 80: /* Line 1455 of yacc.c */ -#line 820 "../Slice/Grammar.y" +#line 957 "../Slice/Grammar.y" { if((yyvsp[(1) - (3)])) { @@ -2710,10 +2887,10 @@ yyreduce: ;} break; - case 76: + case 81: /* Line 1455 of yacc.c */ -#line 832 "../Slice/Grammar.y" +#line 969 "../Slice/Grammar.y" { OperationPtr op = OperationPtr::dynamicCast((yyvsp[(4) - (5)])); ExceptionListTokPtr el = ExceptionListTokPtr::dynamicCast((yyvsp[(5) - (5)])); @@ -2725,10 +2902,10 @@ yyreduce: ;} break; - case 77: + case 82: /* Line 1455 of yacc.c */ -#line 842 "../Slice/Grammar.y" +#line 979 "../Slice/Grammar.y" { if((yyvsp[(1) - (3)])) { @@ -2738,10 +2915,10 @@ yyreduce: ;} break; - case 78: + case 83: /* Line 1455 of yacc.c */ -#line 850 "../Slice/Grammar.y" +#line 987 "../Slice/Grammar.y" { OperationPtr op = OperationPtr::dynamicCast((yyvsp[(4) - (5)])); ExceptionListTokPtr el = ExceptionListTokPtr::dynamicCast((yyvsp[(5) - (5)])); @@ -2753,19 +2930,19 @@ yyreduce: ;} break; - case 81: + case 86: /* Line 1455 of yacc.c */ -#line 872 "../Slice/Grammar.y" +#line 1009 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; - case 82: + case 87: /* Line 1455 of yacc.c */ -#line 876 "../Slice/Grammar.y" +#line 1013 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); unit->error("keyword `" + ident->v + "' cannot be used as interface name"); @@ -2773,10 +2950,10 @@ yyreduce: ;} break; - case 83: + case 88: /* Line 1455 of yacc.c */ -#line 887 "../Slice/Grammar.y" +#line 1024 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (2)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -2787,10 +2964,10 @@ yyreduce: ;} break; - case 84: + case 89: /* Line 1455 of yacc.c */ -#line 901 "../Slice/Grammar.y" +#line 1038 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (3)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (3)])); @@ -2810,10 +2987,10 @@ yyreduce: ;} break; - case 85: + case 90: /* Line 1455 of yacc.c */ -#line 919 "../Slice/Grammar.y" +#line 1056 "../Slice/Grammar.y" { if((yyvsp[(4) - (7)])) { @@ -2827,10 +3004,10 @@ yyreduce: ;} break; - case 86: + case 91: /* Line 1455 of yacc.c */ -#line 936 "../Slice/Grammar.y" +#line 1073 "../Slice/Grammar.y" { ClassListTokPtr intfs = ClassListTokPtr::dynamicCast((yyvsp[(3) - (3)])); StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(1) - (3)])); @@ -2867,10 +3044,10 @@ yyreduce: ;} break; - case 87: + case 92: /* Line 1455 of yacc.c */ -#line 971 "../Slice/Grammar.y" +#line 1108 "../Slice/Grammar.y" { ClassListTokPtr intfs = new ClassListTok; StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -2907,38 +3084,38 @@ yyreduce: ;} break; - case 88: + case 93: /* Line 1455 of yacc.c */ -#line 1006 "../Slice/Grammar.y" +#line 1143 "../Slice/Grammar.y" { unit->error("illegal inheritance from type Object"); (yyval) = new ClassListTok; // Dummy ;} break; - case 89: + case 94: /* Line 1455 of yacc.c */ -#line 1016 "../Slice/Grammar.y" +#line 1153 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; - case 90: + case 95: /* Line 1455 of yacc.c */ -#line 1020 "../Slice/Grammar.y" +#line 1157 "../Slice/Grammar.y" { (yyval) = new ClassListTok; ;} break; - case 91: + case 96: /* Line 1455 of yacc.c */ -#line 1029 "../Slice/Grammar.y" +#line 1166 "../Slice/Grammar.y" { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[(1) - (4)])); ContainedPtr contained = ContainedPtr::dynamicCast((yyvsp[(2) - (4)])); @@ -2949,35 +3126,35 @@ yyreduce: ;} break; - case 92: + case 97: /* Line 1455 of yacc.c */ -#line 1038 "../Slice/Grammar.y" +#line 1175 "../Slice/Grammar.y" { ;} break; - case 93: + case 98: /* Line 1455 of yacc.c */ -#line 1041 "../Slice/Grammar.y" +#line 1178 "../Slice/Grammar.y" { unit->error("`;' missing after definition"); ;} break; - case 94: + case 99: /* Line 1455 of yacc.c */ -#line 1045 "../Slice/Grammar.y" +#line 1182 "../Slice/Grammar.y" { ;} break; - case 96: + case 101: /* Line 1455 of yacc.c */ -#line 1059 "../Slice/Grammar.y" +#line 1196 "../Slice/Grammar.y" { ExceptionPtr exception = ExceptionPtr::dynamicCast((yyvsp[(1) - (3)])); ExceptionListTokPtr exceptionList = ExceptionListTokPtr::dynamicCast((yyvsp[(3) - (3)])); @@ -2986,10 +3163,10 @@ yyreduce: ;} break; - case 97: + case 102: /* Line 1455 of yacc.c */ -#line 1066 "../Slice/Grammar.y" +#line 1203 "../Slice/Grammar.y" { ExceptionPtr exception = ExceptionPtr::dynamicCast((yyvsp[(1) - (1)])); ExceptionListTokPtr exceptionList = new ExceptionListTok; @@ -2998,10 +3175,10 @@ yyreduce: ;} break; - case 98: + case 103: /* Line 1455 of yacc.c */ -#line 1078 "../Slice/Grammar.y" +#line 1215 "../Slice/Grammar.y" { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); ContainerPtr cont = unit->currentContainer(); @@ -3015,10 +3192,10 @@ yyreduce: ;} break; - case 99: + case 104: /* Line 1455 of yacc.c */ -#line 1090 "../Slice/Grammar.y" +#line 1227 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); unit->error("keyword `" + ident->v + "' cannot be used as exception name"); @@ -3026,10 +3203,10 @@ yyreduce: ;} break; - case 100: + case 105: /* Line 1455 of yacc.c */ -#line 1101 "../Slice/Grammar.y" +#line 1238 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (7)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(7) - (7)])); @@ -3040,10 +3217,10 @@ yyreduce: ;} break; - case 101: + case 106: /* Line 1455 of yacc.c */ -#line 1110 "../Slice/Grammar.y" +#line 1247 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (7)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(7) - (7)])); @@ -3055,10 +3232,10 @@ yyreduce: ;} break; - case 102: + case 107: /* Line 1455 of yacc.c */ -#line 1125 "../Slice/Grammar.y" +#line 1262 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (10)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(10) - (10)])); @@ -3071,10 +3248,10 @@ yyreduce: ;} break; - case 103: + case 108: /* Line 1455 of yacc.c */ -#line 1136 "../Slice/Grammar.y" +#line 1273 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (10)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(10) - (10)])); @@ -3088,19 +3265,19 @@ yyreduce: ;} break; - case 104: + case 109: /* Line 1455 of yacc.c */ -#line 1153 "../Slice/Grammar.y" +#line 1290 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; - case 105: + case 110: /* Line 1455 of yacc.c */ -#line 1157 "../Slice/Grammar.y" +#line 1294 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); unit->error("keyword `" + ident->v + "' cannot be used as enumeration name"); @@ -3108,10 +3285,10 @@ yyreduce: ;} break; - case 106: + case 111: /* Line 1455 of yacc.c */ -#line 1168 "../Slice/Grammar.y" +#line 1305 "../Slice/Grammar.y" { BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (2)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -3122,10 +3299,10 @@ yyreduce: ;} break; - case 107: + case 112: /* Line 1455 of yacc.c */ -#line 1177 "../Slice/Grammar.y" +#line 1314 "../Slice/Grammar.y" { EnumPtr en = EnumPtr::dynamicCast((yyvsp[(3) - (6)])); if(en) @@ -3141,10 +3318,10 @@ yyreduce: ;} break; - case 108: + case 113: /* Line 1455 of yacc.c */ -#line 1192 "../Slice/Grammar.y" +#line 1329 "../Slice/Grammar.y" { unit->error("missing enumeration name"); BoolTokPtr local = BoolTokPtr::dynamicCast((yyvsp[(1) - (5)])); @@ -3156,10 +3333,10 @@ yyreduce: ;} break; - case 109: + case 114: /* Line 1455 of yacc.c */ -#line 1207 "../Slice/Grammar.y" +#line 1344 "../Slice/Grammar.y" { EnumeratorListTokPtr ens = EnumeratorListTokPtr::dynamicCast((yyvsp[(1) - (3)])); ens->v.splice(ens->v.end(), EnumeratorListTokPtr::dynamicCast((yyvsp[(3) - (3)]))->v); @@ -3167,18 +3344,18 @@ yyreduce: ;} break; - case 110: + case 115: /* Line 1455 of yacc.c */ -#line 1213 "../Slice/Grammar.y" +#line 1350 "../Slice/Grammar.y" { ;} break; - case 111: + case 116: /* Line 1455 of yacc.c */ -#line 1221 "../Slice/Grammar.y" +#line 1358 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); EnumeratorListTokPtr ens = new EnumeratorListTok; @@ -3192,10 +3369,10 @@ yyreduce: ;} break; - case 112: + case 117: /* Line 1455 of yacc.c */ -#line 1233 "../Slice/Grammar.y" +#line 1370 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); unit->error("keyword `" + ident->v + "' cannot be used as enumerator"); @@ -3204,20 +3381,20 @@ yyreduce: ;} break; - case 113: + case 118: /* Line 1455 of yacc.c */ -#line 1240 "../Slice/Grammar.y" +#line 1377 "../Slice/Grammar.y" { EnumeratorListTokPtr ens = new EnumeratorListTok; (yyval) = ens; // Dummy ;} break; - case 114: + case 119: /* Line 1455 of yacc.c */ -#line 1250 "../Slice/Grammar.y" +#line 1387 "../Slice/Grammar.y" { BoolTokPtr out = new BoolTok; out->v = true; @@ -3225,10 +3402,10 @@ yyreduce: ;} break; - case 115: + case 120: /* Line 1455 of yacc.c */ -#line 1256 "../Slice/Grammar.y" +#line 1393 "../Slice/Grammar.y" { BoolTokPtr out = new BoolTok; out->v = false; @@ -3236,18 +3413,18 @@ yyreduce: ;} break; - case 116: + case 121: /* Line 1455 of yacc.c */ -#line 1267 "../Slice/Grammar.y" +#line 1404 "../Slice/Grammar.y" { ;} break; - case 117: + case 122: /* Line 1455 of yacc.c */ -#line 1270 "../Slice/Grammar.y" +#line 1407 "../Slice/Grammar.y" { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[(1) - (3)])); TypeStringTokPtr tsp = TypeStringTokPtr::dynamicCast((yyvsp[(3) - (3)])); @@ -3267,10 +3444,10 @@ yyreduce: ;} break; - case 118: + case 123: /* Line 1455 of yacc.c */ -#line 1288 "../Slice/Grammar.y" +#line 1425 "../Slice/Grammar.y" { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[(3) - (5)])); TypeStringTokPtr tsp = TypeStringTokPtr::dynamicCast((yyvsp[(5) - (5)])); @@ -3290,10 +3467,10 @@ yyreduce: ;} break; - case 119: + case 124: /* Line 1455 of yacc.c */ -#line 1306 "../Slice/Grammar.y" +#line 1443 "../Slice/Grammar.y" { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[(1) - (4)])); TypePtr type = TypePtr::dynamicCast((yyvsp[(3) - (4)])); @@ -3307,10 +3484,10 @@ yyreduce: ;} break; - case 120: + case 125: /* Line 1455 of yacc.c */ -#line 1318 "../Slice/Grammar.y" +#line 1455 "../Slice/Grammar.y" { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[(3) - (6)])); TypePtr type = TypePtr::dynamicCast((yyvsp[(5) - (6)])); @@ -3324,10 +3501,10 @@ yyreduce: ;} break; - case 121: + case 126: /* Line 1455 of yacc.c */ -#line 1330 "../Slice/Grammar.y" +#line 1467 "../Slice/Grammar.y" { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[(1) - (3)])); TypePtr type = TypePtr::dynamicCast((yyvsp[(3) - (3)])); @@ -3340,10 +3517,10 @@ yyreduce: ;} break; - case 122: + case 127: /* Line 1455 of yacc.c */ -#line 1341 "../Slice/Grammar.y" +#line 1478 "../Slice/Grammar.y" { BoolTokPtr isOutParam = BoolTokPtr::dynamicCast((yyvsp[(3) - (5)])); TypePtr type = TypePtr::dynamicCast((yyvsp[(5) - (5)])); @@ -3356,36 +3533,36 @@ yyreduce: ;} break; - case 123: + case 128: /* Line 1455 of yacc.c */ -#line 1357 "../Slice/Grammar.y" +#line 1494 "../Slice/Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); ;} break; - case 124: + case 129: /* Line 1455 of yacc.c */ -#line 1361 "../Slice/Grammar.y" +#line 1498 "../Slice/Grammar.y" { (yyval) = new ExceptionListTok; ;} break; - case 125: + case 130: /* Line 1455 of yacc.c */ -#line 1370 "../Slice/Grammar.y" +#line 1507 "../Slice/Grammar.y" { ;} break; - case 126: + case 131: /* Line 1455 of yacc.c */ -#line 1373 "../Slice/Grammar.y" +#line 1510 "../Slice/Grammar.y" { StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); ident->v = "::" + ident->v; @@ -3393,10 +3570,10 @@ yyreduce: ;} break; - case 127: + case 132: /* Line 1455 of yacc.c */ -#line 1379 "../Slice/Grammar.y" +#line 1516 "../Slice/Grammar.y" { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(1) - (3)])); StringTokPtr ident = StringTokPtr::dynamicCast((yyvsp[(3) - (3)])); @@ -3406,109 +3583,109 @@ yyreduce: ;} break; - case 128: + case 133: /* Line 1455 of yacc.c */ -#line 1392 "../Slice/Grammar.y" +#line 1529 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindByte); ;} break; - case 129: + case 134: /* Line 1455 of yacc.c */ -#line 1396 "../Slice/Grammar.y" +#line 1533 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindBool); ;} break; - case 130: + case 135: /* Line 1455 of yacc.c */ -#line 1400 "../Slice/Grammar.y" +#line 1537 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindShort); ;} break; - case 131: + case 136: /* Line 1455 of yacc.c */ -#line 1404 "../Slice/Grammar.y" +#line 1541 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindInt); ;} break; - case 132: + case 137: /* Line 1455 of yacc.c */ -#line 1408 "../Slice/Grammar.y" +#line 1545 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindLong); ;} break; - case 133: + case 138: /* Line 1455 of yacc.c */ -#line 1412 "../Slice/Grammar.y" +#line 1549 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindFloat); ;} break; - case 134: + case 139: /* Line 1455 of yacc.c */ -#line 1416 "../Slice/Grammar.y" +#line 1553 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindDouble); ;} break; - case 135: + case 140: /* Line 1455 of yacc.c */ -#line 1420 "../Slice/Grammar.y" +#line 1557 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindString); ;} break; - case 136: + case 141: /* Line 1455 of yacc.c */ -#line 1424 "../Slice/Grammar.y" +#line 1561 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindObject); ;} break; - case 137: + case 142: /* Line 1455 of yacc.c */ -#line 1428 "../Slice/Grammar.y" +#line 1565 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindObjectProxy); ;} break; - case 138: + case 143: /* Line 1455 of yacc.c */ -#line 1432 "../Slice/Grammar.y" +#line 1569 "../Slice/Grammar.y" { (yyval) = unit->builtin(Builtin::KindLocalObject); ;} break; - case 139: + case 144: /* Line 1455 of yacc.c */ -#line 1436 "../Slice/Grammar.y" +#line 1573 "../Slice/Grammar.y" { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); ContainerPtr cont = unit->currentContainer(); @@ -3529,10 +3706,10 @@ yyreduce: ;} break; - case 140: + case 145: /* Line 1455 of yacc.c */ -#line 1455 "../Slice/Grammar.y" +#line 1592 "../Slice/Grammar.y" { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(1) - (2)])); ContainerPtr cont = unit->currentContainer(); @@ -3570,10 +3747,10 @@ yyreduce: ;} break; - case 141: + case 146: /* Line 1455 of yacc.c */ -#line 1496 "../Slice/Grammar.y" +#line 1633 "../Slice/Grammar.y" { StringTokPtr str1 = StringTokPtr::dynamicCast((yyvsp[(1) - (2)])); StringTokPtr str2 = StringTokPtr::dynamicCast((yyvsp[(2) - (2)])); @@ -3581,18 +3758,18 @@ yyreduce: ;} break; - case 142: + case 147: /* Line 1455 of yacc.c */ -#line 1502 "../Slice/Grammar.y" +#line 1639 "../Slice/Grammar.y" { ;} break; - case 143: + case 148: /* Line 1455 of yacc.c */ -#line 1510 "../Slice/Grammar.y" +#line 1647 "../Slice/Grammar.y" { StringTokPtr str = StringTokPtr::dynamicCast((yyvsp[(3) - (3)])); StringListTokPtr stringList = StringListTokPtr::dynamicCast((yyvsp[(1) - (3)])); @@ -3601,10 +3778,10 @@ yyreduce: ;} break; - case 144: + case 149: /* Line 1455 of yacc.c */ -#line 1517 "../Slice/Grammar.y" +#line 1654 "../Slice/Grammar.y" { StringTokPtr str = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); StringListTokPtr stringList = new StringListTok; @@ -3613,10 +3790,10 @@ yyreduce: ;} break; - case 145: + case 150: /* Line 1455 of yacc.c */ -#line 1529 "../Slice/Grammar.y" +#line 1666 "../Slice/Grammar.y" { BoolTokPtr local = new BoolTok; local->v = true; @@ -3624,10 +3801,10 @@ yyreduce: ;} break; - case 146: + case 151: /* Line 1455 of yacc.c */ -#line 1535 "../Slice/Grammar.y" +#line 1672 "../Slice/Grammar.y" { BoolTokPtr local = new BoolTok; local->v = false; @@ -3635,10 +3812,10 @@ yyreduce: ;} break; - case 147: + case 152: /* Line 1455 of yacc.c */ -#line 1546 "../Slice/Grammar.y" +#line 1683 "../Slice/Grammar.y" { BuiltinPtr type = unit->builtin(Builtin::KindLong); IntegerTokPtr intVal = IntegerTokPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -3653,10 +3830,10 @@ yyreduce: ;} break; - case 148: + case 153: /* Line 1455 of yacc.c */ -#line 1559 "../Slice/Grammar.y" +#line 1696 "../Slice/Grammar.y" { BuiltinPtr type = unit->builtin(Builtin::KindDouble); FloatingTokPtr floatVal = FloatingTokPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -3671,10 +3848,10 @@ yyreduce: ;} break; - case 149: + case 154: /* Line 1455 of yacc.c */ -#line 1572 "../Slice/Grammar.y" +#line 1709 "../Slice/Grammar.y" { StringTokPtr scoped = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); ConstDefTokPtr def = new ConstDefTok; @@ -3722,10 +3899,10 @@ yyreduce: ;} break; - case 150: + case 155: /* Line 1455 of yacc.c */ -#line 1618 "../Slice/Grammar.y" +#line 1755 "../Slice/Grammar.y" { BuiltinPtr type = unit->builtin(Builtin::KindString); StringTokPtr literal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -3738,10 +3915,10 @@ yyreduce: ;} break; - case 151: + case 156: /* Line 1455 of yacc.c */ -#line 1629 "../Slice/Grammar.y" +#line 1766 "../Slice/Grammar.y" { BuiltinPtr type = unit->builtin(Builtin::KindBool); StringTokPtr literal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -3754,10 +3931,10 @@ yyreduce: ;} break; - case 152: + case 157: /* Line 1455 of yacc.c */ -#line 1640 "../Slice/Grammar.y" +#line 1777 "../Slice/Grammar.y" { BuiltinPtr type = unit->builtin(Builtin::KindBool); StringTokPtr literal = StringTokPtr::dynamicCast((yyvsp[(1) - (1)])); @@ -3770,10 +3947,10 @@ yyreduce: ;} break; - case 153: + case 158: /* Line 1455 of yacc.c */ -#line 1656 "../Slice/Grammar.y" +#line 1793 "../Slice/Grammar.y" { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[(2) - (6)])); TypePtr const_type = TypePtr::dynamicCast((yyvsp[(3) - (6)])); @@ -3784,10 +3961,10 @@ yyreduce: ;} break; - case 154: + case 159: /* Line 1455 of yacc.c */ -#line 1665 "../Slice/Grammar.y" +#line 1802 "../Slice/Grammar.y" { StringListTokPtr metaData = StringListTokPtr::dynamicCast((yyvsp[(2) - (5)])); TypePtr const_type = TypePtr::dynamicCast((yyvsp[(3) - (5)])); @@ -3798,226 +3975,234 @@ yyreduce: ;} break; - case 155: + case 160: /* Line 1455 of yacc.c */ -#line 1679 "../Slice/Grammar.y" +#line 1816 "../Slice/Grammar.y" { ;} break; - case 156: + case 161: /* Line 1455 of yacc.c */ -#line 1682 "../Slice/Grammar.y" +#line 1819 "../Slice/Grammar.y" { ;} break; - case 157: + case 162: /* Line 1455 of yacc.c */ -#line 1685 "../Slice/Grammar.y" +#line 1822 "../Slice/Grammar.y" { ;} break; - case 158: + case 163: /* Line 1455 of yacc.c */ -#line 1688 "../Slice/Grammar.y" +#line 1825 "../Slice/Grammar.y" { ;} break; - case 159: + case 164: /* Line 1455 of yacc.c */ -#line 1691 "../Slice/Grammar.y" +#line 1828 "../Slice/Grammar.y" { ;} break; - case 160: + case 165: /* Line 1455 of yacc.c */ -#line 1694 "../Slice/Grammar.y" +#line 1831 "../Slice/Grammar.y" { ;} break; - case 161: + case 166: /* Line 1455 of yacc.c */ -#line 1697 "../Slice/Grammar.y" +#line 1834 "../Slice/Grammar.y" { ;} break; - case 162: + case 167: /* Line 1455 of yacc.c */ -#line 1700 "../Slice/Grammar.y" +#line 1837 "../Slice/Grammar.y" { ;} break; - case 163: + case 168: /* Line 1455 of yacc.c */ -#line 1703 "../Slice/Grammar.y" +#line 1840 "../Slice/Grammar.y" { ;} break; - case 164: + case 169: /* Line 1455 of yacc.c */ -#line 1706 "../Slice/Grammar.y" +#line 1843 "../Slice/Grammar.y" { ;} break; - case 165: + case 170: /* Line 1455 of yacc.c */ -#line 1709 "../Slice/Grammar.y" +#line 1846 "../Slice/Grammar.y" { ;} break; - case 166: + case 171: /* Line 1455 of yacc.c */ -#line 1712 "../Slice/Grammar.y" +#line 1849 "../Slice/Grammar.y" { ;} break; - case 167: + case 172: /* Line 1455 of yacc.c */ -#line 1715 "../Slice/Grammar.y" +#line 1852 "../Slice/Grammar.y" { ;} break; - case 168: + case 173: /* Line 1455 of yacc.c */ -#line 1718 "../Slice/Grammar.y" +#line 1855 "../Slice/Grammar.y" { ;} break; - case 169: + case 174: /* Line 1455 of yacc.c */ -#line 1721 "../Slice/Grammar.y" +#line 1858 "../Slice/Grammar.y" { ;} break; - case 170: + case 175: /* Line 1455 of yacc.c */ -#line 1724 "../Slice/Grammar.y" +#line 1861 "../Slice/Grammar.y" { ;} break; - case 171: + case 176: /* Line 1455 of yacc.c */ -#line 1727 "../Slice/Grammar.y" +#line 1864 "../Slice/Grammar.y" { ;} break; - case 172: + case 177: /* Line 1455 of yacc.c */ -#line 1730 "../Slice/Grammar.y" +#line 1867 "../Slice/Grammar.y" { ;} break; - case 173: + case 178: /* Line 1455 of yacc.c */ -#line 1733 "../Slice/Grammar.y" +#line 1870 "../Slice/Grammar.y" { ;} break; - case 174: + case 179: /* Line 1455 of yacc.c */ -#line 1736 "../Slice/Grammar.y" +#line 1873 "../Slice/Grammar.y" { ;} break; - case 175: + case 180: /* Line 1455 of yacc.c */ -#line 1739 "../Slice/Grammar.y" +#line 1876 "../Slice/Grammar.y" { ;} break; - case 176: + case 181: /* Line 1455 of yacc.c */ -#line 1742 "../Slice/Grammar.y" +#line 1879 "../Slice/Grammar.y" { ;} break; - case 177: + case 182: /* Line 1455 of yacc.c */ -#line 1745 "../Slice/Grammar.y" +#line 1882 "../Slice/Grammar.y" { ;} break; - case 178: + case 183: /* Line 1455 of yacc.c */ -#line 1748 "../Slice/Grammar.y" +#line 1885 "../Slice/Grammar.y" { ;} break; - case 179: + case 184: /* Line 1455 of yacc.c */ -#line 1751 "../Slice/Grammar.y" +#line 1888 "../Slice/Grammar.y" { ;} break; - case 180: + case 185: /* Line 1455 of yacc.c */ -#line 1754 "../Slice/Grammar.y" +#line 1891 "../Slice/Grammar.y" { ;} break; - case 181: + case 186: /* Line 1455 of yacc.c */ -#line 1757 "../Slice/Grammar.y" +#line 1894 "../Slice/Grammar.y" { ;} break; - case 182: + case 187: + +/* Line 1455 of yacc.c */ +#line 1897 "../Slice/Grammar.y" + { +;} + break; + + case 188: /* Line 1455 of yacc.c */ -#line 1760 "../Slice/Grammar.y" +#line 1900 "../Slice/Grammar.y" { ;} break; @@ -4025,7 +4210,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4029 "Grammar.tab.c" +#line 4214 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4237,6 +4422,6 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 1764 "../Slice/Grammar.y" +#line 1904 "../Slice/Grammar.y" diff --git a/cpp/src/Slice/Grammar.h b/cpp/src/Slice/Grammar.h index 75429263633..0ee3d141315 100644 --- a/cpp/src/Slice/Grammar.h +++ b/cpp/src/Slice/Grammar.h @@ -67,18 +67,20 @@ ICE_FALSE = 283, ICE_TRUE = 284, ICE_IDEMPOTENT = 285, - ICE_SCOPE_DELIMITER = 286, - ICE_IDENTIFIER = 287, - ICE_STRING_LITERAL = 288, - ICE_INTEGER_LITERAL = 289, - ICE_FLOATING_POINT_LITERAL = 290, - ICE_IDENT_OP = 291, - ICE_KEYWORD_OP = 292, - ICE_METADATA_OPEN = 293, - ICE_METADATA_CLOSE = 294, - ICE_GLOBAL_METADATA_OPEN = 295, - ICE_GLOBAL_METADATA_CLOSE = 296, - BAD_CHAR = 297 + ICE_OPTIONAL = 286, + ICE_SCOPE_DELIMITER = 287, + ICE_IDENTIFIER = 288, + ICE_STRING_LITERAL = 289, + ICE_INTEGER_LITERAL = 290, + ICE_FLOATING_POINT_LITERAL = 291, + ICE_IDENT_OP = 292, + ICE_KEYWORD_OP = 293, + ICE_OPTIONAL_OP = 294, + ICE_METADATA_OPEN = 295, + ICE_METADATA_CLOSE = 296, + ICE_GLOBAL_METADATA_OPEN = 297, + ICE_GLOBAL_METADATA_CLOSE = 298, + BAD_CHAR = 299 }; #endif diff --git a/cpp/src/Slice/Grammar.y b/cpp/src/Slice/Grammar.y index 0b8b4191852..9d127bf115b 100644 --- a/cpp/src/Slice/Grammar.y +++ b/cpp/src/Slice/Grammar.y @@ -10,6 +10,7 @@ // ********************************************************************** #include <Slice/GrammarUtil.h> +#include <IceUtil/InputUtil.h> #include <IceUtil/UUID.h> #include <cstring> @@ -77,6 +78,7 @@ slice_error(const char* s) %token ICE_FALSE %token ICE_TRUE %token ICE_IDEMPOTENT +%token ICE_OPTIONAL // // Other tokens. @@ -88,6 +90,7 @@ slice_error(const char* s) %token ICE_FLOATING_POINT_LITERAL %token ICE_IDENT_OP %token ICE_KEYWORD_OP +%token ICE_OPTIONAL_OP %token ICE_METADATA_OPEN %token ICE_METADATA_CLOSE %token ICE_GLOBAL_METADATA_OPEN @@ -362,6 +365,139 @@ type_id ; // ---------------------------------------------------------------------- +data_member_type_id +// ---------------------------------------------------------------------- +: ICE_OPTIONAL_OP ICE_INTEGER_LITERAL ')' type_id +{ + IntegerTokPtr i = IntegerTokPtr::dynamicCast($2); + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast($4); + + int tag; + if(i->v < 0 || i->v > Int32Max) + { + unit->error("tag for optional member `" + ts->v.second + "' is out of range"); + tag = -1; + } + else + { + tag = static_cast<int>(i->v); + } + + DataMemberDefTokPtr m = new DataMemberDefTok; + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = tag >= 0; + m->v.tag = tag; + $$ = m; +} +| ICE_OPTIONAL_OP scoped_name ')' type_id +{ + StringTokPtr scoped = StringTokPtr::dynamicCast($2); + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast($4); + + ContainerPtr cont = unit->currentContainer(); + assert(cont); + ContainedList cl = cont->lookupContained(scoped->v); + if(cl.empty()) + { + YYERROR; // Can't continue, jump to next yyerrok + } + cont->checkIntroduced(scoped->v); + + int tag = -1; + EnumeratorPtr enumerator = EnumeratorPtr::dynamicCast(cl.front()); + ConstPtr constant = ConstPtr::dynamicCast(cl.front()); + if(constant) + { + BuiltinPtr b = BuiltinPtr::dynamicCast(constant->type()); + if(b) + { + switch(b->kind()) + { + case Builtin::KindByte: + case Builtin::KindShort: + case Builtin::KindInt: + case Builtin::KindLong: + { + IceUtil::Int64 l = IceUtilInternal::strToInt64(constant->value().c_str(), 0, 0); + if(l < 0 || l > Int32Max) + { + unit->error("tag for optional member `" + ts->v.second + "' is out of range"); + } + tag = static_cast<int>(l); + break; + } + default: + break; + } + } + } + else if(enumerator) + { + // + // TODO: When this code is merged with ICE-4619, we need to fix the + // loop below to consider the enumerator's value instead of its ordinal + // position. + // + EnumeratorList el = enumerator->type()->getEnumerators(); + int i = 0; + for(EnumeratorList::iterator p = el.begin(); p != el.end(); ++p, ++i) + { + if(enumerator == *p) + { + break; + } + } + tag = i; + } + + if(tag < 0) + { + unit->error("invalid tag `" + scoped->v + "' for optional member `" + ts->v.second + "'"); + } + + DataMemberDefTokPtr m = new DataMemberDefTok; + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = tag >= 0; + m->v.tag = tag; + $$ = m; +} +| ICE_OPTIONAL_OP ')' type_id +{ + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast($3); + unit->error("missing tag for optional member `" + ts->v.second + "'"); + DataMemberDefTokPtr m = new DataMemberDefTok; // Dummy + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = false; + m->v.tag = -1; + $$ = m; +} +| ICE_OPTIONAL type_id +{ + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast($2); + unit->error("missing tag for optional member `" + ts->v.second + "'"); + DataMemberDefTokPtr m = new DataMemberDefTok; // Dummy + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = false; + m->v.tag = -1; + $$ = m; +} +| type_id +{ + TypeStringTokPtr ts = TypeStringTokPtr::dynamicCast($1); + DataMemberDefTokPtr m = new DataMemberDefTok; + m->v.type = ts->v.first; + m->v.name = ts->v.second; + m->v.optional = false; + m->v.tag = -1; + $$ = m; +} +; + +// ---------------------------------------------------------------------- exception_export // ---------------------------------------------------------------------- : data_member @@ -609,52 +745,53 @@ class_exports // ---------------------------------------------------------------------- data_member // ---------------------------------------------------------------------- -: type_id +: data_member_type_id { - TypePtr type = TypeStringTokPtr::dynamicCast($1)->v.first; - string name = TypeStringTokPtr::dynamicCast($1)->v.second; + DataMemberDefTokPtr def = DataMemberDefTokPtr::dynamicCast($1); ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); DataMemberPtr dm; if(cl) { - dm = cl->createDataMember(name, type, 0, "", ""); + dm = cl->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, 0, "", ""); } StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); if(st) { - dm = st->createDataMember(name, type, 0, "", ""); + dm = st->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, 0, "", ""); } ExceptionPtr ex = ExceptionPtr::dynamicCast(unit->currentContainer()); if(ex) { - dm = ex->createDataMember(name, type, 0, "", ""); + dm = ex->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, 0, "", ""); } - unit->currentContainer()->checkIntroduced(name, dm); + unit->currentContainer()->checkIntroduced(def->v.name, dm); $$ = dm; } -| type_id '=' const_initializer +| data_member_type_id '=' const_initializer { - TypePtr type = TypeStringTokPtr::dynamicCast($1)->v.first; - string name = TypeStringTokPtr::dynamicCast($1)->v.second; + DataMemberDefTokPtr def = DataMemberDefTokPtr::dynamicCast($1); ConstDefTokPtr value = ConstDefTokPtr::dynamicCast($3); ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); DataMemberPtr dm; if(cl) { - dm = cl->createDataMember(name, type, value->v.value, value->v.valueAsString, value->v.valueAsLiteral); + dm = cl->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, value->v.value, + value->v.valueAsString, value->v.valueAsLiteral); } StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); if(st) { - dm = st->createDataMember(name, type, value->v.value, value->v.valueAsString, value->v.valueAsLiteral); + dm = st->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, value->v.value, + value->v.valueAsString, value->v.valueAsLiteral); } ExceptionPtr ex = ExceptionPtr::dynamicCast(unit->currentContainer()); if(ex) { - dm = ex->createDataMember(name, type, value->v.value, value->v.valueAsString, value->v.valueAsLiteral); + dm = ex->createDataMember(def->v.name, def->v.type, def->v.optional, def->v.tag, value->v.value, + value->v.valueAsString, value->v.valueAsLiteral); } - unit->currentContainer()->checkIntroduced(name, dm); + unit->currentContainer()->checkIntroduced(def->v.name, dm); $$ = dm; } | type keyword @@ -664,17 +801,17 @@ data_member ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); if(cl) { - $$ = cl->createDataMember(name, type, 0, "", ""); // Dummy + $$ = cl->createDataMember(name, type, false, 0, 0, "", ""); // Dummy } StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); if(st) { - $$ = st->createDataMember(name, type, 0, "", ""); // Dummy + $$ = st->createDataMember(name, type, false, 0, 0, "", ""); // Dummy } ExceptionPtr ex = ExceptionPtr::dynamicCast(unit->currentContainer()); if(ex) { - $$ = ex->createDataMember(name, type, 0, "", ""); // Dummy + $$ = ex->createDataMember(name, type, false, 0, 0, "", ""); // Dummy } assert($$); unit->error("keyword `" + name + "' cannot be used as data member name"); @@ -685,17 +822,17 @@ data_member ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); if(cl) { - $$ = cl->createDataMember(IceUtil::generateUUID(), type, 0, "", ""); // Dummy + $$ = cl->createDataMember(IceUtil::generateUUID(), type, false, 0, 0, "", ""); // Dummy } StructPtr st = StructPtr::dynamicCast(unit->currentContainer()); if(st) { - $$ = st->createDataMember(IceUtil::generateUUID(), type, 0, "", ""); // Dummy + $$ = st->createDataMember(IceUtil::generateUUID(), type, false, 0, 0, "", ""); // Dummy } ExceptionPtr ex = ExceptionPtr::dynamicCast(unit->currentContainer()); if(ex) { - $$ = ex->createDataMember(IceUtil::generateUUID(), type, 0, "", ""); // Dummy + $$ = ex->createDataMember(IceUtil::generateUUID(), type, false, 0, 0, "", ""); // Dummy } assert($$); unit->error("missing data member name"); @@ -1759,6 +1896,9 @@ keyword | ICE_IDEMPOTENT { } +| ICE_OPTIONAL +{ +} ; %% diff --git a/cpp/src/Slice/GrammarUtil.h b/cpp/src/Slice/GrammarUtil.h index 378901df888..f71e0dc961f 100644 --- a/cpp/src/Slice/GrammarUtil.h +++ b/cpp/src/Slice/GrammarUtil.h @@ -26,6 +26,7 @@ class ExceptionListTok; class ClassListTok; class EnumeratorListTok; class ConstDefTok; +class DataMemberDefTok; typedef ::IceUtil::Handle<StringTok> StringTokPtr; typedef ::IceUtil::Handle<StringListTok> StringListTokPtr; @@ -38,6 +39,7 @@ typedef ::IceUtil::Handle<ExceptionListTok> ExceptionListTokPtr; typedef ::IceUtil::Handle<ClassListTok> ClassListTokPtr; typedef ::IceUtil::Handle<EnumeratorListTok> EnumeratorListTokPtr; typedef ::IceUtil::Handle<ConstDefTok> ConstDefTokPtr; +typedef ::IceUtil::Handle<DataMemberDefTok> DataMemberDefTokPtr; // ---------------------------------------------------------------------- // StringTok @@ -174,6 +176,18 @@ public: ConstDef v; }; +// ---------------------------------------------------------------------- +// DataMemberDefTok +// ---------------------------------------------------------------------- + +class SLICE_API DataMemberDefTok : public GrammarBase +{ +public: + + DataMemberDefTok() { } + DataMemberDef v; +}; + } // diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 96260809ef8..50b1e68101d 100755 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -3043,8 +3043,9 @@ Slice::ClassDef::createOperation(const string& name, } DataMemberPtr -Slice::ClassDef::createDataMember(const string& name, const TypePtr& type, const SyntaxTreeBasePtr& defaultValueType, - const string& defaultValue, const string& defaultLiteral) +Slice::ClassDef::createDataMember(const string& name, const TypePtr& type, bool optional, int tag, + const SyntaxTreeBasePtr& defaultValueType, const string& defaultValue, + const string& defaultLiteral) { checkIdentifier(name); @@ -3186,8 +3187,25 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type, const } } + if(optional) + { + // + // Validate the tag. + // + DataMemberList dml = allDataMembers(); + for(DataMemberList::iterator q = dml.begin(); q != dml.end(); ++q) + { + if((*q)->optional() && tag == (*q)->tag()) + { + string msg = "tag for optional data member `" + name + "' is already in use"; + _unit->error(msg); + break; + } + } + } + _hasDataMembers = true; - DataMemberPtr member = new DataMember(this, name, type, dlt, dv, dl); + DataMemberPtr member = new DataMember(this, name, type, optional, tag, dlt, dv, dl); _contents.push_back(member); return member; } @@ -3565,8 +3583,9 @@ Slice::Exception::destroy() } DataMemberPtr -Slice::Exception::createDataMember(const string& name, const TypePtr& type, const SyntaxTreeBasePtr& defaultValueType, - const string& defaultValue, const string& defaultLiteral) +Slice::Exception::createDataMember(const string& name, const TypePtr& type, bool optional, int tag, + const SyntaxTreeBasePtr& defaultValueType, const string& defaultValue, + const string& defaultLiteral) { checkIdentifier(name); @@ -3697,7 +3716,24 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type, cons } } - DataMemberPtr p = new DataMember(this, name, type, dlt, dv, dl); + if(optional) + { + // + // Validate the tag. + // + DataMemberList dml = allDataMembers(); + for(DataMemberList::iterator q = dml.begin(); q != dml.end(); ++q) + { + if((*q)->optional() && tag == (*q)->tag()) + { + string msg = "tag for optional data member `" + name + "' is already in use"; + _unit->error(msg); + break; + } + } + } + + DataMemberPtr p = new DataMember(this, name, type, optional, tag, dlt, dv, dl); _contents.push_back(p); return p; } @@ -3917,8 +3953,9 @@ Slice::Exception::Exception(const ContainerPtr& container, const string& name, c // ---------------------------------------------------------------------- DataMemberPtr -Slice::Struct::createDataMember(const string& name, const TypePtr& type, const SyntaxTreeBasePtr& defaultValueType, - const string& defaultValue, const string& defaultLiteral) +Slice::Struct::createDataMember(const string& name, const TypePtr& type, bool optional, int tag, + const SyntaxTreeBasePtr& defaultValueType, const string& defaultValue, + const string& defaultLiteral) { checkIdentifier(name); @@ -4031,7 +4068,24 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type, const S } } - DataMemberPtr p = new DataMember(this, name, type, dlt, dv, dl); + if(optional) + { + // + // Validate the tag. + // + DataMemberList dml = dataMembers(); + for(DataMemberList::iterator q = dml.begin(); q != dml.end(); ++q) + { + if((*q)->optional() && tag == (*q)->tag()) + { + string msg = "tag for optional data member `" + name + "' is already in use"; + _unit->error(msg); + break; + } + } + } + + DataMemberPtr p = new DataMember(this, name, type, optional, tag, dlt, dv, dl); _contents.push_back(p); return p; } @@ -5160,6 +5214,18 @@ Slice::DataMember::type() const return _type; } +bool +Slice::DataMember::optional() const +{ + return _optional; +} + +int +Slice::DataMember::tag() const +{ + return _tag; +} + string Slice::DataMember::defaultValue() const { @@ -5209,11 +5275,13 @@ Slice::DataMember::visit(ParserVisitor* visitor, bool) } Slice::DataMember::DataMember(const ContainerPtr& container, const string& name, const TypePtr& type, - const SyntaxTreeBasePtr& defaultValueType, const string& defaultValue, - const string& defaultLiteral) : + bool optional, int tag, const SyntaxTreeBasePtr& defaultValueType, + const string& defaultValue, const string& defaultLiteral) : SyntaxTreeBase(container->unit()), Contained(container, name), _type(type), + _optional(optional), + _tag(tag), _defaultValueType(defaultValueType), _defaultValue(defaultValue), _defaultLiteral(defaultLiteral) diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp index 7cf7bd5ce4e..40aafc1f528 100644 --- a/cpp/src/Slice/Scanner.cpp +++ b/cpp/src/Slice/Scanner.cpp @@ -1035,12 +1035,24 @@ YY_RULE_SETUP { return ICE_IDENT_OP; } - return checkKeyword(ident->v) == ICE_IDENTIFIER ? ICE_IDENT_OP : ICE_KEYWORD_OP; + int st = checkKeyword(ident->v); + if(st == ICE_IDENTIFIER) + { + return ICE_IDENT_OP; + } + else if(st == ICE_OPTIONAL) + { + return ICE_OPTIONAL_OP; + } + else + { + return ICE_KEYWORD_OP; + } } YY_BREAK case 13: YY_RULE_SETUP -#line 191 "Scanner.l" +#line 203 "Scanner.l" { BEGIN(MAINSCAN); StringTokPtr ident = new StringTok; @@ -1051,7 +1063,7 @@ YY_RULE_SETUP YY_BREAK case 14: YY_RULE_SETUP -#line 199 "Scanner.l" +#line 211 "Scanner.l" { BEGIN(MAINSCAN); StringTokPtr str = new StringTok; @@ -1215,7 +1227,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 360 "Scanner.l" +#line 372 "Scanner.l" { BEGIN(MAINSCAN); IntegerTokPtr itp = new IntegerTok; @@ -1234,7 +1246,7 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 376 "Scanner.l" +#line 388 "Scanner.l" { BEGIN(MAINSCAN); errno = 0; @@ -1268,7 +1280,7 @@ YY_RULE_SETUP case 17: /* rule 17 can match eol */ YY_RULE_SETUP -#line 406 "Scanner.l" +#line 418 "Scanner.l" { // Ignore white-space @@ -1284,7 +1296,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 419 "Scanner.l" +#line 431 "Scanner.l" { // Ignore UTF-8 BOM, rule only active when parsing start of file. @@ -1293,7 +1305,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 425 "Scanner.l" +#line 437 "Scanner.l" { BEGIN(MAINSCAN); if(slice_text[0] < 32 || slice_text[0] > 126) @@ -1312,10 +1324,10 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 441 "Scanner.l" +#line 453 "Scanner.l" ECHO; YY_BREAK -#line 1318 "lex.yy.c" +#line 1330 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(BOMSCAN): case YY_STATE_EOF(MAINSCAN): @@ -1396,7 +1408,7 @@ case YY_STATE_EOF(MAINSCAN): { (yy_did_buffer_switch_on_eof) = 0; - if ( slice_wrap( ) ) + if ( slice_wrap(0) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1732,7 +1744,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { - if ( slice_wrap( ) ) + if ( slice_wrap(0) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) @@ -2315,7 +2327,7 @@ void slice_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 441 "Scanner.l" +#line 453 "Scanner.l" @@ -2356,6 +2368,7 @@ initScanner() keywordMap["false"] = ICE_FALSE; keywordMap["true"] = ICE_TRUE; keywordMap["idempotent"] = ICE_IDEMPOTENT; + keywordMap["optional"] = ICE_OPTIONAL; } // diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l index 24ee3543b04..f9a5df88a42 100644 --- a/cpp/src/Slice/Scanner.l +++ b/cpp/src/Slice/Scanner.l @@ -185,7 +185,19 @@ floating_literal (({fractional_constant}{exponent_part}?)|((\+|-)?[[:digit:]]+{e { return ICE_IDENT_OP; } - return checkKeyword(ident->v) == ICE_IDENTIFIER ? ICE_IDENT_OP : ICE_KEYWORD_OP; + int st = checkKeyword(ident->v); + if(st == ICE_IDENTIFIER) + { + return ICE_IDENT_OP; + } + else if(st == ICE_OPTIONAL) + { + return ICE_OPTIONAL_OP; + } + else + { + return ICE_KEYWORD_OP; + } } {identifier} { @@ -477,6 +489,7 @@ initScanner() keywordMap["false"] = ICE_FALSE; keywordMap["true"] = ICE_TRUE; keywordMap["idempotent"] = ICE_IDEMPOTENT; + keywordMap["optional"] = ICE_OPTIONAL; } // diff --git a/cpp/test/Slice/errorDetection/OptionalMembers.err b/cpp/test/Slice/errorDetection/OptionalMembers.err new file mode 100644 index 00000000000..d75ab25a5ec --- /dev/null +++ b/cpp/test/Slice/errorDetection/OptionalMembers.err @@ -0,0 +1,13 @@ +OptionalMembers.ice:23: missing tag for optional member `m1' +OptionalMembers.ice:24: missing tag for optional member `m2' +OptionalMembers.ice:25: `abc' is not defined +OptionalMembers.ice:26: tag for optional member `m4' is out of range +OptionalMembers.ice:27: tag for optional member `m5' is out of range +OptionalMembers.ice:28: tag for optional member `m6' is out of range +OptionalMembers.ice:30: tag for optional data member `m8' is already in use +OptionalMembers.ice:31: tag for optional member `m9' is out of range +OptionalMembers.ice:31: invalid tag `C3' for optional member `m9' +OptionalMembers.ice:32: tag for optional member `m10' is out of range +OptionalMembers.ice:32: invalid tag `C4' for optional member `m10' +OptionalMembers.ice:33: invalid tag `C5' for optional member `m11' +OptionalMembers.ice:34: tag for optional data member `m12' is already in use diff --git a/cpp/test/Slice/errorDetection/OptionalMembers.ice b/cpp/test/Slice/errorDetection/OptionalMembers.ice new file mode 100644 index 00000000000..ff7239d0300 --- /dev/null +++ b/cpp/test/Slice/errorDetection/OptionalMembers.ice @@ -0,0 +1,37 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +module Test +{ + +const byte C1 = 0; +const short C2 = 0; +const int C3 = -1; +const long C4 = 0x80000001; +const float C5 = 1.1; + +enum E { e1, e2, e3 }; + +class C +{ + optional string m1; // missing tag + optional() int m2; // missing tag + optional(abc) bool m3; // invalid tag + optional(0x80000000) short m4; // out of range + optional(-0x80000001) long m5; // out of range + optional(-1) float m6; // out of range + optional(C1) string m7; // ok + optional(C2) string m8; // duplicate tag + optional(C3) double m9; // out of range + optional(C4) byte m10; // out of range + optional(C5) bool m11; // invalid tag + optional(e1) int m12; // duplicate tag +}; + +}; |