DCType -> DCParameter, also parsing and formatting of values

This commit is contained in:
David Rose 2004-06-17 19:18:18 +00:00
parent 439d1b200e
commit ec4539137a

View File

@ -47,6 +47,8 @@
# define KW_CLRECV 291 # define KW_CLRECV 291
# define KW_OWNSEND 292 # define KW_OWNSEND 292
# define KW_AIRECV 293 # define KW_AIRECV 293
# define START_DC 294
# define START_PARAMETER_VALUE 295
#line 6 "dcParser.yxx" #line 6 "dcParser.yxx"
@ -72,7 +74,9 @@ static DCClass *current_class = (DCClass *)NULL;
static DCAtomicField *current_atomic = (DCAtomicField *)NULL; static DCAtomicField *current_atomic = (DCAtomicField *)NULL;
static DCMolecularField *current_molecular = (DCMolecularField *)NULL; static DCMolecularField *current_molecular = (DCMolecularField *)NULL;
static DCAtomicField::ElementType atomic_element(new DCSimpleParameter(ST_invalid)); static DCAtomicField::ElementType atomic_element(new DCSimpleParameter(ST_invalid));
static DCPacker default_value_packer; static DCParameter *current_parameter = (DCParameter *)NULL;
static DCPacker default_packer;
static DCPacker *current_packer;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Defining the interface to the parser. // Defining the interface to the parser.
@ -84,6 +88,15 @@ dc_init_parser(istream &in, const string &filename, DCFile &file) {
dc_init_lexer(in, filename); dc_init_lexer(in, filename);
} }
void
dc_init_parser_parameter_value(istream &in, const string &filename,
DCPacker &packer) {
dc_file = NULL;
current_packer = &packer;
dc_init_lexer(in, filename);
dc_start_parameter_value();
}
void void
dc_cleanup_parser() { dc_cleanup_parser() {
dc_file = (DCFile *)NULL; dc_file = (DCFile *)NULL;
@ -95,12 +108,12 @@ dc_cleanup_parser() {
#define YYFINAL 121 #define YYFINAL 135
#define YYFLAG -32768 #define YYFLAG -32768
#define YYNTBASE 51 #define YYNTBASE 55
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= 293 ? yytranslate[x] : 84) #define YYTRANSLATE(x) ((unsigned)(x) <= 295 ? yytranslate[x] : 92)
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
static const char yytranslate[] = static const char yytranslate[] =
@ -109,15 +122,15 @@ static const char 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, 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,
48, 49, 45, 2, 46, 2, 44, 43, 2, 2, 50, 51, 47, 2, 48, 2, 46, 45, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 47, 40, 2, 2, 2, 2, 2, 2, 2, 2, 49, 42,
2, 50, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 53, 2, 54, 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, 43, 2, 44, 2, 2, 2, 2,
2, 2, 2, 41, 2, 42, 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, 2, 2, 2, 2,
@ -134,48 +147,51 @@ static const char yytranslate[] =
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39 36, 37, 38, 39, 40, 41
}; };
#if YYDEBUG #if YYDEBUG
static const short yyprhs[] = static const short yyprhs[] =
{ {
0, 0, 2, 5, 8, 11, 12, 20, 22, 24, 0, 0, 3, 6, 8, 11, 14, 17, 18, 26,
28, 30, 34, 37, 38, 44, 46, 48, 50, 54, 28, 30, 34, 36, 40, 43, 44, 50, 52, 54,
56, 59, 61, 65, 67, 70, 73, 76, 77, 84, 56, 60, 62, 65, 67, 71, 73, 76, 79, 82,
86, 88, 90, 92, 96, 97, 101, 103, 107, 110, 83, 90, 92, 94, 96, 98, 102, 104, 105, 110,
111, 116, 118, 120, 122, 124, 125, 130, 134, 138, 111, 115, 117, 121, 124, 126, 128, 130, 132, 133,
142, 144, 147, 149, 151, 153, 157, 159, 161, 163, 138, 139, 144, 145, 150, 154, 158, 162, 164, 167,
165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 169, 171, 173, 177, 179, 181, 183, 185, 187, 189,
185, 187, 189, 191, 193, 195, 197, 200, 203, 206, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209,
209, 212, 215, 218, 221, 224, 225, 230, 232, 236 211, 213, 215, 217, 220, 223, 226, 229, 232, 235,
238, 241, 244, 245, 250, 252, 256
}; };
static const short yyrhs[] = static const short yyrhs[] =
{ {
83, 0, 51, 40, 0, 51, 52, 0, 51, 57, 40, 56, 0, 41, 79, 0, 91, 0, 56, 42,
0, 0, 8, 7, 53, 61, 41, 63, 42, 0, 0, 56, 57, 0, 56, 62, 0, 0, 8, 7,
7, 0, 7, 0, 55, 43, 7, 0, 55, 0, 58, 66, 43, 68, 44, 0, 7, 0, 7, 0,
56, 44, 55, 0, 10, 56, 0, 0, 9, 56, 60, 45, 7, 0, 60, 0, 61, 46, 60, 0,
10, 58, 59, 0, 60, 0, 45, 0, 55, 0, 10, 61, 0, 0, 9, 61, 10, 63, 64, 0,
60, 46, 55, 0, 83, 0, 47, 62, 0, 54, 65, 0, 47, 0, 60, 0, 65, 48, 60, 0,
0, 62, 46, 54, 0, 83, 0, 63, 40, 0, 91, 0, 49, 67, 0, 59, 0, 67, 48, 59,
63, 64, 0, 63, 80, 0, 0, 7, 48, 65, 0, 91, 0, 68, 42, 0, 68, 69, 0, 68,
67, 49, 79, 0, 7, 0, 83, 0, 68, 0, 88, 0, 0, 7, 50, 70, 72, 51, 87, 0,
69, 0, 68, 46, 69, 0, 0, 78, 70, 71, 7, 0, 91, 0, 73, 0, 74, 0, 73, 48,
0, 83, 0, 71, 43, 3, 0, 71, 7, 0, 74, 0, 76, 0, 0, 76, 52, 75, 79, 0,
0, 71, 50, 72, 73, 0, 3, 0, 4, 0, 0, 86, 77, 78, 0, 91, 0, 78, 45, 3,
5, 0, 6, 0, 0, 41, 74, 75, 42, 0, 0, 78, 7, 0, 3, 0, 4, 0, 5, 0,
3, 45, 3, 0, 4, 45, 3, 0, 6, 45, 6, 0, 0, 43, 80, 83, 44, 0, 0, 53,
3, 0, 83, 0, 77, 76, 0, 83, 0, 46, 81, 83, 54, 0, 0, 50, 82, 83, 51, 0,
0, 73, 0, 77, 46, 73, 0, 11, 0, 12, 3, 47, 3, 0, 4, 47, 3, 0, 6, 47,
3, 0, 84, 0, 85, 84, 0, 91, 0, 48,
0, 79, 0, 85, 48, 79, 0, 11, 0, 12,
0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17,
0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22,
0, 23, 0, 24, 0, 25, 0, 26, 0, 27, 0, 23, 0, 24, 0, 25, 0, 26, 0, 27,
0, 28, 0, 29, 0, 83, 0, 79, 31, 0, 0, 28, 0, 29, 0, 91, 0, 87, 31, 0,
79, 32, 0, 79, 33, 0, 79, 34, 0, 79, 87, 32, 0, 87, 33, 0, 87, 34, 0, 87,
35, 0, 79, 36, 0, 79, 37, 0, 79, 38, 35, 0, 87, 36, 0, 87, 37, 0, 87, 38,
0, 79, 39, 0, 0, 7, 47, 81, 82, 0, 0, 87, 39, 0, 0, 7, 49, 89, 90, 0,
66, 0, 82, 46, 66, 0, 0 71, 0, 90, 48, 71, 0, 0
}; };
#endif #endif
@ -184,15 +200,16 @@ static const short yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] = static const short yyrline[] =
{ {
0, 96, 98, 99, 100, 103, 103, 119, 133, 135, 0, 114, 116, 119, 121, 122, 123, 126, 126, 142,
141, 143, 149, 154, 154, 161, 163, 169, 174, 180, 156, 158, 164, 166, 172, 177, 177, 184, 186, 192,
182, 185, 192, 200, 202, 203, 204, 207, 207, 218, 197, 203, 205, 208, 215, 223, 225, 226, 227, 230,
234, 236, 239, 241, 244, 244, 255, 257, 266, 270, 230, 241, 257, 259, 262, 264, 267, 273, 273, 291,
270, 285, 290, 294, 298, 302, 302, 310, 316, 322, 291, 302, 304, 313, 319, 324, 328, 332, 336, 336,
330, 332, 335, 337, 340, 342, 345, 350, 354, 358, 344, 344, 352, 352, 360, 366, 372, 380, 382, 385,
362, 366, 370, 374, 378, 382, 386, 390, 394, 398, 387, 390, 392, 395, 400, 404, 408, 412, 416, 420,
402, 406, 410, 414, 418, 424, 426, 430, 434, 438, 424, 428, 432, 436, 440, 444, 448, 452, 456, 460,
442, 446, 450, 454, 458, 464, 464, 475, 482, 495 464, 468, 474, 476, 480, 484, 488, 492, 496, 500,
504, 508, 514, 514, 525, 532, 545
}; };
#endif #endif
@ -210,44 +227,47 @@ static const char *const yytname[] =
"KW_UINT8ARRAY", "KW_UINT16ARRAY", "KW_UINT32ARRAY", "KW_UINT8ARRAY", "KW_UINT16ARRAY", "KW_UINT32ARRAY",
"KW_UINT32UINT8ARRAY", "KW_MOL", "KW_REQUIRED", "KW_BROADCAST", "KW_UINT32UINT8ARRAY", "KW_MOL", "KW_REQUIRED", "KW_BROADCAST",
"KW_P2P", "KW_RAM", "KW_DB", "KW_CLSEND", "KW_CLRECV", "KW_OWNSEND", "KW_P2P", "KW_RAM", "KW_DB", "KW_CLSEND", "KW_CLRECV", "KW_OWNSEND",
"KW_AIRECV", "';'", "'{'", "'}'", "'/'", "'.'", "'*'", "','", "':'", "KW_AIRECV", "START_DC", "START_PARAMETER_VALUE", "';'", "'{'", "'}'",
"'('", "')'", "'='", "dc", "dclass", "@1", "dclass_name", "'/'", "'.'", "'*'", "','", "':'", "'('", "')'", "'='", "'['", "']'",
"slash_identifier", "import_identifier", "import", "@2", "grammar", "dc", "dclass", "@1", "dclass_name", "slash_identifier",
"import_symbol_list_or_star", "import_symbol_list", "dclass_derivation", "import_identifier", "import", "@2", "import_symbol_list_or_star",
"base_list", "dclass_fields", "atomic_field", "@3", "atomic_name", "import_symbol_list", "dclass_derivation", "base_list", "dclass_fields",
"parameter_list", "nonempty_parameter_list", "atomic_element", "@4", "atomic_field", "@3", "atomic_name", "parameter_list",
"atomic_element_definition", "@5", "default_value", "@6", "nonempty_parameter_list", "atomic_element", "@4", "parameter", "@5",
"default_array", "maybe_comma", "default_array_def", "type_token", "parameter_definition", "parameter_value", "@6", "@7", "@8", "array",
"atomic_flags", "molecular_field", "@7", "molecular_atom_list", "empty", 0 "maybe_comma", "array_def", "type_token", "atomic_flags",
"molecular_field", "@9", "molecular_atom_list", "empty", 0
}; };
#endif #endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const short yyr1[] = static const short yyr1[] =
{ {
0, 51, 51, 51, 51, 53, 52, 54, 55, 55, 0, 55, 55, 56, 56, 56, 56, 58, 57, 59,
56, 56, 57, 58, 57, 59, 59, 60, 60, 61, 60, 60, 61, 61, 62, 63, 62, 64, 64, 65,
61, 62, 62, 63, 63, 63, 63, 65, 64, 66, 65, 66, 66, 67, 67, 68, 68, 68, 68, 70,
67, 67, 68, 68, 70, 69, 71, 71, 71, 72, 69, 71, 72, 72, 73, 73, 74, 75, 74, 77,
71, 73, 73, 73, 73, 74, 73, 73, 73, 73, 76, 78, 78, 78, 79, 79, 79, 79, 80, 79,
75, 75, 76, 76, 77, 77, 78, 78, 78, 78, 81, 79, 82, 79, 79, 79, 79, 83, 83, 84,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 84, 85, 85, 86, 86, 86, 86, 86, 86, 86,
78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
79, 79, 79, 79, 79, 81, 80, 82, 82, 83 86, 86, 87, 87, 87, 87, 87, 87, 87, 87,
87, 87, 89, 88, 90, 90, 91
}; };
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const short yyr2[] = static const short yyr2[] =
{ {
0, 1, 2, 2, 2, 0, 7, 1, 1, 3, 0, 2, 2, 1, 2, 2, 2, 0, 7, 1,
1, 3, 2, 0, 5, 1, 1, 1, 3, 1, 1, 3, 1, 3, 2, 0, 5, 1, 1, 1,
2, 1, 3, 1, 2, 2, 2, 0, 6, 1, 3, 1, 2, 1, 3, 1, 2, 2, 2, 0,
1, 1, 1, 3, 0, 3, 1, 3, 2, 0, 6, 1, 1, 1, 1, 3, 1, 0, 4, 0,
4, 1, 1, 1, 1, 0, 4, 3, 3, 3, 3, 1, 3, 2, 1, 1, 1, 1, 0, 4,
1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 0, 4, 0, 4, 3, 3, 3, 1, 2, 1,
1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 0, 4, 1, 3, 0 2, 2, 0, 4, 1, 3, 0
}; };
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
@ -255,84 +275,90 @@ static const short yyr2[] =
error. */ error. */
static const short yydefact[] = static const short yydefact[] =
{ {
89, 0, 1, 0, 0, 0, 2, 3, 4, 5, 0, 96, 0, 1, 3, 44, 45, 46, 47, 48,
8, 10, 0, 12, 89, 0, 13, 0, 0, 0, 52, 50, 2, 0, 0, 0, 4, 5, 6, 0,
19, 9, 0, 11, 7, 21, 20, 89, 16, 17, 0, 0, 96, 96, 96, 7, 10, 12, 0, 14,
14, 15, 0, 0, 23, 0, 22, 0, 24, 6, 54, 55, 56, 60, 61, 0, 57, 96, 59, 0,
25, 26, 18, 85, 27, 0, 89, 29, 87, 86, 0, 96, 0, 15, 0, 49, 60, 58, 53, 51,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 0, 0, 21, 11, 0, 13, 62, 9, 23, 22,
66, 67, 68, 69, 70, 71, 72, 73, 74, 0, 96, 18, 19, 16, 17, 0, 0, 25, 0, 24,
31, 32, 34, 30, 0, 89, 0, 89, 88, 28, 0, 26, 8, 27, 28, 20, 92, 29, 0, 96,
75, 33, 35, 36, 76, 77, 78, 79, 80, 81, 31, 94, 93, 63, 64, 65, 66, 67, 68, 69,
82, 83, 84, 38, 0, 39, 37, 0, 41, 42, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
43, 44, 45, 40, 0, 0, 0, 89, 47, 48, 80, 81, 0, 33, 34, 36, 39, 32, 0, 96,
49, 54, 0, 89, 50, 46, 53, 51, 52, 55, 0, 37, 96, 95, 30, 82, 35, 0, 40, 41,
0, 0 83, 84, 85, 86, 87, 88, 89, 90, 91, 38,
43, 0, 42, 0, 0, 0
}; };
static const short yydefgoto[] = static const short yydefgoto[] =
{ {
1, 7, 14, 25, 11, 12, 8, 22, 30, 31, 133, 3, 17, 41, 58, 27, 28, 18, 54, 63,
19, 26, 33, 40, 46, 48, 69, 70, 71, 77, 64, 51, 59, 66, 73, 79, 81, 102, 103, 104,
82, 97, 103, 107, 112, 117, 113, 72, 79, 41, 117, 105, 112, 118, 34, 22, 24, 23, 35, 36,
45, 49, 2 37, 106, 114, 74, 78, 82, 38
}; };
static const short yypact[] = static const short yypact[] =
{ {
-32768, 2,-32768, 12, 23, 23,-32768,-32768,-32768,-32768, -19,-32768, 3, 6,-32768, -37, -30,-32768, -28,-32768,
-32768, -12, -1, -9, -13, 29,-32768, 23, 31, 4, -32768,-32768,-32768, 31, 32, 32,-32768,-32768,-32768, 37,
-32768,-32768, 1, -12,-32768,-32768, -7,-32768,-32768, -12, 40, 42, -1, -1, -1,-32768,-32768, 14, 8, 15,
-32768, 5, 31, 7,-32768, 23,-32768, -30,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 18,-32768, 10,-32768, 16,
-32768,-32768, -12,-32768,-32768, 33, 53,-32768,-32768, 6, 9, 17, 57,-32768, 32,-32768, 3,-32768,-32768,-32768,
58, 25,-32768,-32768, 4, 14,-32768,-32768,-32768, 21,
-32768,-32768, 14,-32768, 22, 58, 13,-32768, 32,-32768,
-16,-32768,-32768,-32768,-32768, 14,-32768,-32768, 64, 69,
-32768,-32768, 24,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 8, -32768,-32768, 23, 27,-32768, 26,-32768,-32768, 64,-32768,
9,-32768,-32768,-32768, 33,-32768, 53,-32768,-32768, -10, 69,-32768,-32768,-32768, -7,-32768,-32768, 3, 5,-32768,
-32768,-32768, -6,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768, 45,-32768,-32768, 0, 11, 13, -32768, 70,-32768, 76, 77,-32768
-32768, 14,-32768,-32768, 47, 50, 51, 0,-32768,-32768,
-32768,-32768, 18, 16,-32768,-32768, 0,-32768,-32768,-32768,
83,-32768
}; };
static const short yypgoto[] = static const short yypgoto[] =
{ {
-32768,-32768,-32768, 52, -2, 80,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 34, -31, 85,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768, 15,-32768,-32768, 10,-32768, -32768,-32768,-32768,-32768,-32768,-32768, -6,-32768,-32768, -9,
-32768,-32768, -100,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, -2,-32768,-32768,-32768, 12, 66,
-32768,-32768, -14 -32768,-32768,-32768,-32768,-32768,-32768, 0
}; };
#define YYLAST 99 #define YYLAST 115
static const short yytable[] = static const short yytable[] =
{ {
20, 93, 120, 98, 99, 100, 101, 111, 10, 16, 12, 4, 5, 6, 7, 8, 5, 6, 7, 8,
3, 4, 5, 34, 37, 23, 119, 43, 44, 9, 19, 26, 130, 55, 13, 14, 15, 20, 43, 21,
29, 84, 85, 86, 87, 88, 89, 90, 91, 92, 70, 1, 2, 62, 120, 121, 122, 123, 124, 125,
10, 15, 73, 42, 18, 17, 21, 94, 24, 32, 126, 127, 128, 76, 77, 39, 40, 75, 25, 26,
47, 102, 6, 17, 95, 27, 28, 38, 96, 39, 30, 52, 9, 31, 56, 32, 9, 33, 16, 10,
108, 35, 74, 109, 110, 76, 104, 75, 105, 106, 131, 61, 11, 10, 44, 71, 11, 72, 46, 42,
115, 80, 116, 83, 50, 51, 52, 53, 54, 55, 67, 44, 45, 49, 53, 57, 50, 48, 60, 65,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 68, 80, 108, 132, 109, 110, 134, 135, 111, 107,
66, 67, 68, 121, 36, 13, 81, 0, 0, 78, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
0, 0, 0, 114, 0, 0, 0, 0, 0, 118 93, 94, 95, 96, 97, 98, 99, 100, 101, 69,
29, 116, 113, 47, 0, 0, 0, 0, 0, 115,
0, 0, 119, 0, 0, 129
}; };
static const short yycheck[] = static const short yycheck[] =
{ {
14, 7, 0, 3, 4, 5, 6, 107, 7, 10, 2, 1, 3, 4, 5, 6, 3, 4, 5, 6,
8, 9, 10, 27, 7, 17, 116, 47, 48, 7, 47, 7, 7, 44, 8, 9, 10, 47, 10, 47,
22, 31, 32, 33, 34, 35, 36, 37, 38, 39, 7, 40, 41, 54, 31, 32, 33, 34, 35, 36,
7, 43, 46, 35, 47, 44, 7, 43, 7, 46, 37, 38, 39, 49, 50, 23, 24, 68, 7, 7,
7, 41, 40, 44, 50, 41, 45, 40, 3, 42, 3, 41, 43, 3, 46, 3, 43, 48, 42, 50,
3, 46, 46, 3, 3, 46, 45, 49, 45, 45, 45, 47, 53, 50, 46, 42, 53, 44, 48, 45,
42, 75, 46, 77, 11, 12, 13, 14, 15, 16, 60, 46, 44, 54, 7, 7, 49, 51, 43, 48,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 48, 7, 48, 3, 51, 48, 0, 0, 52, 79,
27, 28, 29, 0, 32, 5, 76, -1, -1, 74, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
-1, -1, -1, 107, -1, -1, -1, -1, -1, 113 21, 22, 23, 24, 25, 26, 27, 28, 29, 65,
15, 110, 108, 37, -1, -1, -1, -1, -1, 109,
-1, -1, 112, -1, -1, 117
}; };
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/share/bison/bison.simple" #line 3 "/usr/share/bison/bison.simple"
@ -1041,8 +1067,8 @@ yyreduce:
switch (yyn) { switch (yyn) {
case 5: case 7:
#line 105 "dcParser.yxx" #line 128 "dcParser.yxx"
{ {
current_class = new DCClass(yyvsp[0].str); current_class = new DCClass(yyvsp[0].str);
if (!dc_file->add_class(current_class)) { if (!dc_file->add_class(current_class)) {
@ -1055,8 +1081,8 @@ case 5:
} }
} }
break; break;
case 7: case 9:
#line 121 "dcParser.yxx" #line 144 "dcParser.yxx"
{ {
DCFile::ClassesByName::const_iterator ni; DCFile::ClassesByName::const_iterator ni;
ni = dc_file->_classes_by_name.find(yyvsp[0].str); ni = dc_file->_classes_by_name.find(yyvsp[0].str);
@ -1068,66 +1094,66 @@ case 7:
} }
} }
break; break;
case 9: case 11:
#line 136 "dcParser.yxx" #line 159 "dcParser.yxx"
{ {
yyval.str = yyvsp[-2].str + string("/") + yyvsp[0].str; yyval.str = yyvsp[-2].str + string("/") + yyvsp[0].str;
} }
break; break;
case 11: case 13:
#line 144 "dcParser.yxx" #line 167 "dcParser.yxx"
{ {
yyval.str = yyvsp[-2].str + string(".") + yyvsp[0].str; yyval.str = yyvsp[-2].str + string(".") + yyvsp[0].str;
} }
break; break;
case 12: case 14:
#line 151 "dcParser.yxx" #line 174 "dcParser.yxx"
{ {
dc_file->add_import_module(yyvsp[0].str); dc_file->add_import_module(yyvsp[0].str);
} }
break; break;
case 13: case 15:
#line 155 "dcParser.yxx" #line 178 "dcParser.yxx"
{ {
dc_file->add_import_module(yyvsp[-1].str); dc_file->add_import_module(yyvsp[-1].str);
} }
break; break;
case 16: case 18:
#line 164 "dcParser.yxx" #line 187 "dcParser.yxx"
{ {
dc_file->add_import_symbol("*"); dc_file->add_import_symbol("*");
} }
break; break;
case 17: case 19:
#line 171 "dcParser.yxx" #line 194 "dcParser.yxx"
{ {
dc_file->add_import_symbol(yyvsp[0].str); dc_file->add_import_symbol(yyvsp[0].str);
} }
break; break;
case 18: case 20:
#line 175 "dcParser.yxx" #line 198 "dcParser.yxx"
{ {
dc_file->add_import_symbol(yyvsp[0].str); dc_file->add_import_symbol(yyvsp[0].str);
} }
break; break;
case 21: case 23:
#line 187 "dcParser.yxx" #line 210 "dcParser.yxx"
{ {
if (yyvsp[0].u.dclass != (DCClass *)NULL) { if (yyvsp[0].u.dclass != (DCClass *)NULL) {
current_class->add_parent(yyvsp[0].u.dclass); current_class->add_parent(yyvsp[0].u.dclass);
} }
} }
break; break;
case 22: case 24:
#line 193 "dcParser.yxx" #line 216 "dcParser.yxx"
{ {
if (yyvsp[0].u.dclass != (DCClass *)NULL) { if (yyvsp[0].u.dclass != (DCClass *)NULL) {
current_class->add_parent(yyvsp[0].u.dclass); current_class->add_parent(yyvsp[0].u.dclass);
} }
} }
break; break;
case 27: case 29:
#line 209 "dcParser.yxx" #line 232 "dcParser.yxx"
{ {
current_atomic = new DCAtomicField(yyvsp[-1].str); current_atomic = new DCAtomicField(yyvsp[-1].str);
if (!current_class->add_field(current_atomic)) { if (!current_class->add_field(current_atomic)) {
@ -1135,8 +1161,8 @@ case 27:
} }
} }
break; break;
case 29: case 31:
#line 220 "dcParser.yxx" #line 243 "dcParser.yxx"
{ {
DCField *field = current_class->get_field_by_name(yyvsp[0].str); DCField *field = current_class->get_field_by_name(yyvsp[0].str);
yyval.u.atomic = (DCAtomicField *)NULL; yyval.u.atomic = (DCAtomicField *)NULL;
@ -1150,282 +1176,316 @@ case 29:
} }
} }
break; break;
case 34: case 36:
#line 246 "dcParser.yxx" #line 269 "dcParser.yxx"
{
atomic_element = DCAtomicField::ElementType(new DCSimpleParameter(yyvsp[0].u.subatomic));
}
break;
case 35:
#line 250 "dcParser.yxx"
{ {
atomic_element = DCAtomicField::ElementType(yyvsp[0].u.parameter);
current_atomic->_elements.push_back(atomic_element); current_atomic->_elements.push_back(atomic_element);
} }
break; break;
case 37: case 37:
#line 258 "dcParser.yxx" #line 274 "dcParser.yxx"
{ {
if (atomic_element._type->as_simple_type() == NULL) { current_packer = &default_packer;
yyerror("Invalid divisor on complex type"); current_packer->begin_pack(yyvsp[-1].u.parameter);
} else {
atomic_element._type->as_simple_type()->set_divisor(yyvsp[0].u.integer);
}
} }
break; break;
case 38: case 38:
#line 267 "dcParser.yxx" #line 279 "dcParser.yxx"
{ {
atomic_element._name = yyvsp[0].str; if (!current_packer->end_pack()) {
}
break;
case 39:
#line 271 "dcParser.yxx"
{
default_value_packer.begin_pack(atomic_element._type);
}
break;
case 40:
#line 275 "dcParser.yxx"
{
if (!default_value_packer.end_pack()) {
yyerror("Invalid default value for type"); yyerror("Invalid default value for type");
} else { } else {
atomic_element.set_default_value(default_value_packer.get_string()); atomic_element = DCAtomicField::ElementType(yyvsp[-3].u.parameter);
atomic_element.set_default_value(current_packer->get_string());
current_atomic->_elements.push_back(atomic_element);
} }
} }
break; break;
case 41: case 39:
#line 287 "dcParser.yxx" #line 293 "dcParser.yxx"
{ {
default_value_packer.pack_int(yyvsp[0].u.integer); current_parameter = new DCSimpleParameter(yyvsp[0].u.subatomic);
}
break;
case 40:
#line 297 "dcParser.yxx"
{
yyval.u.parameter = current_parameter;
} }
break; break;
case 42: case 42:
#line 291 "dcParser.yxx" #line 305 "dcParser.yxx"
{ {
default_value_packer.pack_double(yyvsp[0].u.real); if (current_parameter->as_simple_parameter() == NULL) {
yyerror("Invalid divisor on complex type");
} else {
current_parameter->as_simple_parameter()->set_divisor(yyvsp[0].u.integer);
}
} }
break; break;
case 43: case 43:
#line 295 "dcParser.yxx" #line 314 "dcParser.yxx"
{ {
default_value_packer.pack_string(yyvsp[0].str); current_parameter->set_name(yyvsp[0].str);
} }
break; break;
case 44: case 44:
#line 299 "dcParser.yxx" #line 321 "dcParser.yxx"
{ {
default_value_packer.pack_literal_value(yyvsp[0].str); current_packer->pack_int(yyvsp[0].u.integer);
} }
break; break;
case 45: case 45:
#line 303 "dcParser.yxx" #line 325 "dcParser.yxx"
{ {
default_value_packer.push(); current_packer->pack_double(yyvsp[0].u.real);
} }
break; break;
case 46: case 46:
#line 307 "dcParser.yxx" #line 329 "dcParser.yxx"
{ {
default_value_packer.pop(); current_packer->pack_string(yyvsp[0].str);
} }
break; break;
case 47: case 47:
#line 311 "dcParser.yxx" #line 333 "dcParser.yxx"
{ {
for (int i = 0; i < yyvsp[0].u.integer; i++) { current_packer->pack_literal_value(yyvsp[0].str);
default_value_packer.pack_int(yyvsp[-2].u.integer);
}
} }
break; break;
case 48: case 48:
#line 317 "dcParser.yxx" #line 337 "dcParser.yxx"
{ {
for (int i = 0; i < yyvsp[0].u.integer; i++) { current_packer->push();
default_value_packer.pack_double(yyvsp[-2].u.real);
}
} }
break; break;
case 49: case 49:
#line 323 "dcParser.yxx" #line 341 "dcParser.yxx"
{
current_packer->pop();
}
break;
case 50:
#line 345 "dcParser.yxx"
{
current_packer->push();
}
break;
case 51:
#line 349 "dcParser.yxx"
{
current_packer->pop();
}
break;
case 52:
#line 353 "dcParser.yxx"
{
current_packer->push();
}
break;
case 53:
#line 357 "dcParser.yxx"
{
current_packer->pop();
}
break;
case 54:
#line 361 "dcParser.yxx"
{ {
for (int i = 0; i < yyvsp[0].u.integer; i++) { for (int i = 0; i < yyvsp[0].u.integer; i++) {
default_value_packer.pack_literal_value(yyvsp[-2].str); current_packer->pack_int(yyvsp[-2].u.integer);
}
}
break;
case 55:
#line 367 "dcParser.yxx"
{
for (int i = 0; i < yyvsp[0].u.integer; i++) {
current_packer->pack_double(yyvsp[-2].u.real);
} }
} }
break; break;
case 56: case 56:
#line 347 "dcParser.yxx" #line 373 "dcParser.yxx"
{
for (int i = 0; i < yyvsp[0].u.integer; i++) {
current_packer->pack_literal_value(yyvsp[-2].str);
}
}
break;
case 63:
#line 397 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_int8; yyval.u.subatomic = ST_int8;
} }
break; break;
case 57: case 64:
#line 351 "dcParser.yxx" #line 401 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_int16; yyval.u.subatomic = ST_int16;
} }
break; break;
case 58: case 65:
#line 355 "dcParser.yxx" #line 405 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_int32; yyval.u.subatomic = ST_int32;
} }
break; break;
case 59: case 66:
#line 359 "dcParser.yxx" #line 409 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_int64; yyval.u.subatomic = ST_int64;
} }
break; break;
case 60: case 67:
#line 363 "dcParser.yxx" #line 413 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_uint8; yyval.u.subatomic = ST_uint8;
} }
break; break;
case 61: case 68:
#line 367 "dcParser.yxx" #line 417 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_uint16; yyval.u.subatomic = ST_uint16;
} }
break; break;
case 62: case 69:
#line 371 "dcParser.yxx" #line 421 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_uint32; yyval.u.subatomic = ST_uint32;
} }
break; break;
case 63: case 70:
#line 375 "dcParser.yxx" #line 425 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_uint64; yyval.u.subatomic = ST_uint64;
} }
break; break;
case 64: case 71:
#line 379 "dcParser.yxx" #line 429 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_float64; yyval.u.subatomic = ST_float64;
} }
break; break;
case 65: case 72:
#line 383 "dcParser.yxx" #line 433 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_string; yyval.u.subatomic = ST_string;
} }
break; break;
case 66: case 73:
#line 387 "dcParser.yxx" #line 437 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_blob; yyval.u.subatomic = ST_blob;
} }
break; break;
case 67: case 74:
#line 391 "dcParser.yxx" #line 441 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_blob32; yyval.u.subatomic = ST_blob32;
} }
break; break;
case 68: case 75:
#line 395 "dcParser.yxx" #line 445 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_int8array; yyval.u.subatomic = ST_int8array;
} }
break; break;
case 69: case 76:
#line 399 "dcParser.yxx" #line 449 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_int16array; yyval.u.subatomic = ST_int16array;
} }
break; break;
case 70: case 77:
#line 403 "dcParser.yxx" #line 453 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_int32array; yyval.u.subatomic = ST_int32array;
} }
break; break;
case 71: case 78:
#line 407 "dcParser.yxx" #line 457 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_uint8array; yyval.u.subatomic = ST_uint8array;
} }
break; break;
case 72: case 79:
#line 411 "dcParser.yxx" #line 461 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_uint16array; yyval.u.subatomic = ST_uint16array;
} }
break; break;
case 73: case 80:
#line 415 "dcParser.yxx" #line 465 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_uint32array; yyval.u.subatomic = ST_uint32array;
} }
break; break;
case 74: case 81:
#line 419 "dcParser.yxx" #line 469 "dcParser.yxx"
{ {
yyval.u.subatomic = ST_uint32uint8array; yyval.u.subatomic = ST_uint32uint8array;
} }
break; break;
case 76: case 83:
#line 427 "dcParser.yxx" #line 477 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_required; current_atomic->_flags |= DCAtomicField::F_required;
} }
break; break;
case 77: case 84:
#line 431 "dcParser.yxx" #line 481 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_broadcast; current_atomic->_flags |= DCAtomicField::F_broadcast;
} }
break; break;
case 78: case 85:
#line 435 "dcParser.yxx" #line 485 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_p2p; current_atomic->_flags |= DCAtomicField::F_p2p;
} }
break; break;
case 79: case 86:
#line 439 "dcParser.yxx" #line 489 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_ram; current_atomic->_flags |= DCAtomicField::F_ram;
} }
break; break;
case 80: case 87:
#line 443 "dcParser.yxx" #line 493 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_db; current_atomic->_flags |= DCAtomicField::F_db;
} }
break; break;
case 81: case 88:
#line 447 "dcParser.yxx" #line 497 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_clsend; current_atomic->_flags |= DCAtomicField::F_clsend;
} }
break; break;
case 82: case 89:
#line 451 "dcParser.yxx" #line 501 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_clrecv; current_atomic->_flags |= DCAtomicField::F_clrecv;
} }
break; break;
case 83: case 90:
#line 455 "dcParser.yxx" #line 505 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_ownsend; current_atomic->_flags |= DCAtomicField::F_ownsend;
} }
break; break;
case 84: case 91:
#line 459 "dcParser.yxx" #line 509 "dcParser.yxx"
{ {
current_atomic->_flags |= DCAtomicField::F_airecv; current_atomic->_flags |= DCAtomicField::F_airecv;
} }
break; break;
case 85: case 92:
#line 466 "dcParser.yxx" #line 516 "dcParser.yxx"
{ {
current_molecular = new DCMolecularField(yyvsp[-1].str); current_molecular = new DCMolecularField(yyvsp[-1].str);
if (!current_class->add_field(current_molecular)) { if (!current_class->add_field(current_molecular)) {
@ -1433,16 +1493,16 @@ case 85:
} }
} }
break; break;
case 87: case 94:
#line 477 "dcParser.yxx" #line 527 "dcParser.yxx"
{ {
if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) {
current_molecular->add_atomic(yyvsp[0].u.atomic); current_molecular->add_atomic(yyvsp[0].u.atomic);
} }
} }
break; break;
case 88: case 95:
#line 483 "dcParser.yxx" #line 533 "dcParser.yxx"
{ {
if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) {
current_molecular->add_atomic(yyvsp[0].u.atomic); current_molecular->add_atomic(yyvsp[0].u.atomic);
@ -1687,4 +1747,4 @@ yyreturn:
#endif #endif
return yyresult; return yyresult;
} }
#line 497 "dcParser.yxx" #line 548 "dcParser.yxx"