1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 1997-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20%%------------------------------------------------------------ 21%% Yecc spec for IDL 22%% 23%% 24%% 25%% Implementation Detail: 26%% OorM_ means OneORMany and is used instead of 27%% the "+" BNF notation 28%% ZorM_ means ZeroORMany and is used instead of 29%% the "*" BNF notation 30%% 31%% All the reverse/1 calls are because yecc+lists naturally leads 32%% to reversed lists, which then have to be reversed. Maybe fix 33%% this? 34%% 35%% Implementation history 36%% 37%% The IDL language supported is not the complete IDL. We skipped 38%% the multiple declarator syntax allowed (i.e. typedef long T1, 39%% T2). This also applies to attributes members in structs, 40%% unions and exceptions, and to case labels in unions. The cases 41%% where IDL has been altered is marked with comments containing 42%% NIY. 43%% 44%% Above is chaging. Whenever we change a clause, we put (FIXED) in 45%% its comment. 46%% 47%%------------------------------------------------------------ 48 49 50 51 52 53Nonterminals 54 '<op_type_spec>' 55 '<enumerator>' 56 '<switch_body>' 57 'OorM_<case>' 58 '<member_list>' 59 '<struct_type>' 60 '<unsigned_int>' 61 '<constr_type_spec>' 62 '<shift_expr>' 63 '<or_expr>' 64 '<inheritance_spec>' 65 'ZorM_<param_dcl>' 66 'Opt_<context_expr>' 67 '<attr_dcl>' 68 '<array_declarator>' 69 '<element_spec>' 70 '<signed_int>' 71 '<primary_expr>' 72 '<interface_dcl>' 73 'ZorM_<string_literal>' 74 'Opt_<raises_expr>' 75 '<integer_type>' 76 '<signed_long_int>' 77 '<literal>' 78 '<export>' 79 '<forward_dcl>' 80 'OorM_<definition>' 81 '<base_type_spec>' 82 '<op_dcl>' 83 '<const_exp>' 84 '<case>' 85 '<any_type>' 86 '<signed_short_int>' 87 '<unary_expr>' 88 '<context_expr>' 89 'ZorM_<scoped_name>' 90 '<switch_type_spec>' 91 '<complex_declarator>' 92 '<declarators>' 93 'OorM_<member>' 94 '<interface>' 95 '<parameter_dcls>' 96 '<op_attribute>' 97 '<positive_int_const>' 98 'OorM_<fixed_array_size>' 99 '<sequence_type>' 100 '<case_label>' 101 '<octet_type>' 102 '<type_dcl>' 103 '<module>' 104 '<specification>' 105 '<declarator>' 106 '<boolean_type>' 107 '<union_type>' 108 '<add_expr>' 109 '<interface_body>' 110 '<except_dcl>' 111 '<fixed_array_size>' 112 '<unsigned_short_int>' 113 '<boolean_literal>' 114 '<and_expr>' 115 'Opt_<inheritance_spec>' 116 '<scoped_name>' 117 '<param_type_spec>' 118 'ZorM_<member>' 119 '<char_type>' 120 '<const_dcl>' 121 '<param_dcl>' 122 'ZorM_<simple_declarator>' 123 'ZorM_<declarator>' 124 '<const_type>' 125 '<definition>' 126 '<param_attribute>' 127 '<simple_declarator>' 128 'Opt_readonly' 129 '<simple_type_spec>' 130 '<enum_type>' 131 '<type_spec>' 132 'OorM_<case_label>' 133 '<floating_pt_type>' 134 '<template_type_spec>' 135 '<mult_expr>' 136 '<xor_expr>' 137 '<string_type>' 138 '<raises_expr>' 139 'Opt_<op_attribute>' 140 'ZorM_<enumerator>' 141 '<member>' 142 '<unsigned_long_int>' 143 '<type_declarator>' 144 '<unary_operator>' 145 'ZorM_<export>' 146 '<interface_header>' 147 'OE_preproc' % NON standard 148 'OE_pragma' % NON standard 149 'Ugly_pragmas' % NON standard 150 'ZorM_<integer_literal>' 151 '<fixed_pt_type>' 152 '<fixed_pt_const_type>' 153 '<constr_forward_decl>' 154 . 155 156 157Terminals 158 '#' 159 'in' 160 '[' 161 'interface' 162 '(' 163 'case' 164 'union' 165 'struct' 166 '<character_literal>' 167 '<wcharacter_literal>' 168 ')' 169 ']' 170 'any' 171 'long' 172 'float' 173 'out' 174 '*' 175 '^' 176 'enum' 177 'double' 178 '+' 179 'context' 180 'oneway' 181 'sequence' 182 ',' 183 'FALSE' 184 '<identifier>' 185 '{' 186 'readonly' 187 ':' 188 '-' 189 'void' 190 ';' 191 'char' 192 'wchar' %% WCHAR 193 '|' 194 'inout' 195 '}' 196 'attribute' 197 '<' 198 'octet' 199 '/' 200 'TRUE' 201 '~' 202 '=' 203 '>' 204 'switch' 205 'unsigned' 206 'typedef' 207 '>>' 208 'const' 209 '<string_literal>' 210 '<wstring_literal>' 211 'raises' 212 'string' 213 'wstring' 214 'fixed' 215 'default' 216 'short' 217 '%' 218 '<<' 219 'module' 220 'exception' 221 'boolean' 222 '<integer_literal>' 223 '<fixed_pt_literal>' 224 '<floating_pt_literal>' 225 '&' 226 '::' 227 'Object' 228 . 229 230 231Rootsymbol '<specification>'. 232 233 234Expect 9. 235 236 237%%------------------------------------------------------------ 238%% Clauses 239%% 240 241%% Handling of pragmas. 242%% Pragma prefix, id and version are not standard. 243 244%% pragma prefix, or codeopt 245OE_pragma -> '#' '<integer_literal>' '<identifier>' 246 '<identifier>' '<string_literal>' '#' 247 : #pragma{type='$4', to=followed, apply='$5'} . 248 249%% pragma id 250OE_pragma -> '#' '<integer_literal>' '<identifier>' 251 '<identifier>' '<identifier>' '<string_literal>' '#' 252 : #pragma{type='$4', to='$5', apply='$6'} . 253 254%% pragma version 255OE_pragma -> '#' '<integer_literal>' '<identifier>' 256 '<identifier>' '<identifier>' '<floating_pt_literal>' '#' 257 : #pragma{type='$4', to='$5', apply=ic_options:float_to_version('$6')} . 258 259 260 261 262 263 264 265%% Ugly pragmas 266Ugly_pragmas -> '$empty' : []. 267Ugly_pragmas -> 'Ugly_pragmas' 'OE_pragma' : ['$2'|'$1']. 268 269 270 271%% (0) Handling of preprocessor stuff. 272 273OE_preproc -> '#' '#' . 274 275OE_preproc -> '#' '<integer_literal>' '<string_literal>' 276 'ZorM_<integer_literal>' '#' 277 : case '$4' of 278 [] -> 279 case '$2' of 280 {_,_,"1"} -> 281 #preproc{cat=line_nr, id='$3', aux='$4'}; 282 _ -> 283 [] 284 end; 285 _ -> 286 #preproc{cat=line_nr, id='$3', aux='$4'} 287 end. 288 289%% (0b) Non-standard 290'ZorM_<integer_literal>' -> '$empty' : [] . 291'ZorM_<integer_literal>' -> '<integer_literal>' 'ZorM_<integer_literal>' 292 : ['$1' | '$2'] . 293 294%% (1) 295'<specification>' -> 'OorM_<definition>' : reverse('$1') . 296 297 298%% Added clause 299'OorM_<definition>' -> '<definition>' : ['$1'] . 300'OorM_<definition>' -> 'OorM_<definition>' '<definition>' 301: ['$2' | '$1'] . 302 303 304%% (2) 305'<definition>' -> '<type_dcl>' ';' : '$1' . 306'<definition>' -> '<const_dcl>' ';' : '$1' . 307'<definition>' -> '<except_dcl>' ';' : '$1' . 308'<definition>' -> '<interface>' ';' : '$1' . 309'<definition>' -> '<module>' ';' : '$1' . 310'<definition>' -> 'OE_preproc' : '$1' . 311'<definition>' -> 'OE_pragma' : '$1' . 312 313 314%% (3) 315'<module>' -> 'module' '<identifier>' '{' 'OorM_<definition>' '}' 316: #module{ id='$2', body=reverse('$4')}. 317 318 319%% (4) 320'<interface>' -> '<interface_dcl>' : '$1' . 321'<interface>' -> '<forward_dcl>' : '$1' . 322 323 324%% (5) 325'<interface_dcl>' -> '<interface_header>' '{' '<interface_body>' '}' 326 : #interface{id=element(1, '$1'), inherit=element(2, '$1'), 327 body=lists:reverse('$3')} . 328 329 330%% (6) 331'<forward_dcl>' -> 'interface' '<identifier>' 332: #forward{id='$2'} . 333 334 335%% (7) 336'<interface_header>' -> 'interface' '<identifier>' 'Opt_<inheritance_spec>' 337: {'$2', '$3'} . 338 339 340%% (8) 341'<interface_body>' -> 'ZorM_<export>' : '$1' . 342 343 344%% Added clause 345'ZorM_<export>' -> '$empty' : [] . 346'ZorM_<export>' -> 'ZorM_<export>' '<export>' 347 %% Complicated because <export> might be a list (of type defs for instance) 348 : if is_list('$2') -> '$2' ++ '$1'; 349 true -> ['$2' | '$1'] 350 end . 351 352 353%% (9) 354'<export>' -> '<type_dcl>' ';' : '$1' . 355'<export>' -> '<const_dcl>' ';' : '$1' . 356'<export>' -> '<except_dcl>' ';' : '$1' . 357'<export>' -> '<attr_dcl>' ';' : '$1' . 358'<export>' -> '<op_dcl>' ';' : '$1' . 359'<export>' -> 'OE_preproc' : '$1' . 360'<export>' -> 'OE_pragma' : '$1' . 361 362%% Added clause 363'Opt_<inheritance_spec>' -> '$empty' : []. 364'Opt_<inheritance_spec>' -> '<inheritance_spec>' : '$1'. 365 366%% (10) 367'<inheritance_spec>' -> ':' '<scoped_name>' 'ZorM_<scoped_name>' 368 : ['$2' | reverse('$3')] . 369 370 371%% Added clause 372'ZorM_<scoped_name>' -> '$empty' : [] . 373'ZorM_<scoped_name>' -> 'ZorM_<scoped_name>' ',' '<scoped_name>' 374 : ['$3' | '$1'] . 375 376 377%% (11) 378'<scoped_name>' -> '<identifier>' : ic_symtab:scoped_id_new('$1') . 379'<scoped_name>' -> '::' '<identifier>' : ic_symtab:scoped_id_new_global('$2') . 380'<scoped_name>' -> '<scoped_name>' '::' '<identifier>' 381 : ic_symtab:scoped_id_add('$1', '$3') . 382 383 384%% (12) 385'<const_dcl>' -> 'const' '<const_type>' '<identifier>' '=' '<const_exp>' 386 : #const{type='$2', id='$3', val='$5'} . 387 388 389%% (13) 390'<const_type>' -> '<integer_type>' : '$1' . 391'<const_type>' -> '<char_type>' : '$1' . 392'<const_type>' -> '<boolean_type>' : '$1' . 393'<const_type>' -> '<floating_pt_type>' : '$1' . 394'<const_type>' -> '<string_type>' : '$1' . 395'<const_type>' -> '<fixed_pt_const_type>' : '$1' . 396'<const_type>' -> '<scoped_name>' : '$1' . 397'<const_type>' -> '<octet_type>' : '$1' . 398 399 400%% (14) 401'<const_exp>' -> '<or_expr>' : '$1' . 402 403 404%% (15) 405'<or_expr>' -> '<xor_expr>' : '$1' . 406'<or_expr>' -> '<or_expr>' '|' '<xor_expr>' : {'or', '$1', '$3'} . 407 408 409%% (16) 410'<xor_expr>' -> '<and_expr>' : '$1' . 411'<xor_expr>' -> '<xor_expr>' '^' '<and_expr>' : {'xor', '$1', '$3'} . 412 413 414%% (17) 415'<and_expr>' -> '<shift_expr>' : '$1' . 416'<and_expr>' -> '<and_expr>' '&' '<shift_expr>' : {'and', '$1', '$3'} . 417 418 419%% (18) 420'<shift_expr>' -> '<add_expr>' : '$1' . 421'<shift_expr>' -> '<shift_expr>' '>>' '<add_expr>' : {'rshift', '$1', '$3'} . 422'<shift_expr>' -> '<shift_expr>' '<<' '<add_expr>' : {'lshift', '$1', '$3'} . 423 424 425%% (19) 426'<add_expr>' -> '<mult_expr>' : '$1' . 427'<add_expr>' -> '<add_expr>' '+' '<mult_expr>' : {'+', '$1', '$3'} . 428'<add_expr>' -> '<add_expr>' '-' '<mult_expr>' : {'-', '$1', '$3'} . 429 430 431%% (20) 432'<mult_expr>' -> '<unary_expr>' : '$1' . 433'<mult_expr>' -> '<mult_expr>' '*' '<unary_expr>' : {'*', '$1', '$3'} . 434'<mult_expr>' -> '<mult_expr>' '/' '<unary_expr>' : {'/', '$1', '$3'} . 435'<mult_expr>' -> '<mult_expr>' '%' '<unary_expr>' : {'%', '$1', '$3'} . 436 437 438%% (21) 439'<unary_expr>' -> '<unary_operator>' '<primary_expr>' : {'$1', '$2'} . 440'<unary_expr>' -> '<primary_expr>' : '$1' . 441 442 443%% (22) 444'<unary_operator>' -> '-' : '$1' . 445'<unary_operator>' -> '+' : '$1' . 446'<unary_operator>' -> '~' : '$1' . 447 448 449%% (23) 450'<primary_expr>' -> '<scoped_name>' : '$1' . 451'<primary_expr>' -> '<literal>' : '$1' . 452'<primary_expr>' -> '(' '<const_exp>' ')' : '$2' . 453 454 455%% (24) 456'<literal>' -> '<integer_literal>' : '$1' . 457'<literal>' -> '<wstring_literal>' : '$1' . 458'<literal>' -> '<string_literal>' : '$1' . 459'<literal>' -> '<character_literal>' : '$1' . 460'<literal>' -> '<wcharacter_literal>' : '$1' . 461'<literal>' -> '<fixed_pt_literal>' : '$1' . 462'<literal>' -> '<floating_pt_literal>' : '$1' . 463'<literal>' -> '<boolean_literal>' : '$1' . 464 465 466%% (25) 467'<boolean_literal>' -> 'TRUE' : '$1' . 468'<boolean_literal>' -> 'FALSE' : '$1' . 469 470 471%% (26) 472'<positive_int_const>' -> '<const_exp>' : '$1' . 473 474 475%% (27) 476'<type_dcl>' -> 'typedef' '<type_declarator>' : '$2' . 477'<type_dcl>' -> '<struct_type>' : '$1' . 478'<type_dcl>' -> '<union_type>' : '$1' . 479'<type_dcl>' -> '<enum_type>' : '$1' . 480'<type_dcl>' -> '<constr_forward_decl>' : '$1' . 481 482%% (28) NIY multiple declarators (FIXED) 483'<type_declarator>' -> '<type_spec>' '<declarators>' 484 : #typedef{type='$1', id='$2'} . %%%ic:unfold(#typedef{type='$1', id='$2'}) . 485%%'<type_declarator>' -> '<type_spec>' '<declarator>' 486%% : #typedef{type='$1', id='$2'} . 487 488%% (29) 489'<type_spec>' -> '<simple_type_spec>' : '$1' . 490'<type_spec>' -> '<constr_type_spec>' : '$1' . 491 492 493%% (30) 494'<simple_type_spec>' -> '<base_type_spec>' : '$1' . 495'<simple_type_spec>' -> '<template_type_spec>' : '$1' . 496'<simple_type_spec>' -> '<scoped_name>' : '$1' . 497 498 499%% (31) 500'<base_type_spec>' -> '<floating_pt_type>' : '$1' . 501'<base_type_spec>' -> '<integer_type>' : '$1' . 502'<base_type_spec>' -> '<char_type>' : '$1' . 503'<base_type_spec>' -> '<boolean_type>' : '$1' . 504'<base_type_spec>' -> '<octet_type>' : '$1' . 505'<base_type_spec>' -> '<any_type>' : '$1' . 506'<base_type_spec>' -> 'Object' : '$1' . %% NON Standard, isn't a base type 507 508 509%% (32) 510'<template_type_spec>' -> '<sequence_type>' : '$1' . 511'<template_type_spec>' -> '<string_type>' : '$1' . 512'<template_type_spec>' -> '<fixed_pt_type>' : '$1' . 513 514 515%% (33) 516'<constr_type_spec>' -> '<struct_type>' : '$1' . 517'<constr_type_spec>' -> '<union_type>' : '$1' . 518'<constr_type_spec>' -> '<enum_type>' : '$1' . 519 520 521%% (34) 522'<declarators>' -> '<declarator>' 'ZorM_<declarator>' 523: ['$1' | reverse('$2')] . 524 525%% Added clause 526'ZorM_<declarator>' -> '$empty' : [] . 527'ZorM_<declarator>' -> 'ZorM_<declarator>' ',' '<declarator>' 528: ['$3' | '$1'] . 529 530 531%% (35) 532'<declarator>' -> '<simple_declarator>' : '$1' . 533'<declarator>' -> '<complex_declarator>' : '$1' . 534 535 536%% (36) 537'<simple_declarator>' -> '<identifier>' : '$1' . 538 539 540%% (37) 541'<complex_declarator>' -> '<array_declarator>' : '$1' . 542 543 544%% (38) 545'<floating_pt_type>' -> 'float' : '$1' . 546'<floating_pt_type>' -> 'double' : '$1' . 547 548 549%% (39) 550'<integer_type>' -> '<signed_int>' : '$1' . 551'<integer_type>' -> '<unsigned_int>' : {'unsigned', '$1'} . 552 553 554%% (40) 555'<signed_int>' -> '<signed_long_int>' : '$1' . 556'<signed_int>' -> '<signed_short_int>' : '$1' . 557 558 559%% (41) 560'<signed_long_int>' -> 'long' : '$1' . 561'<signed_long_int>' -> 'long' 'long': {'long long', element(2,'$2')} . 562 563 564%% (42) 565'<signed_short_int>' -> 'short' : '$1' . 566 567 568%% (43) 569'<unsigned_int>' -> '<unsigned_long_int>' : '$1' . 570'<unsigned_int>' -> '<unsigned_short_int>' : '$1' . 571 572 573%% (44) 574'<unsigned_long_int>' -> 'unsigned' 'long' : '$2' . 575'<unsigned_long_int>' -> 'unsigned' 'long' 'long' : {'long long', element(2,'$2')} . %% ULLONG 576 577 578%% (45) 579'<unsigned_short_int>' -> 'unsigned' 'short' : '$2' . 580 581 582%% (46) 583'<char_type>' -> 'char' : '$1' . 584'<char_type>' -> 'wchar' : '$1' . %% WCHAR 585 586 587%% (47) 588'<boolean_type>' -> 'boolean' : '$1' . 589 590 591%% (48) 592'<octet_type>' -> 'octet' : '$1' . 593 594 595%% (49) 596'<any_type>' -> 'any' : '$1' . 597 598%% 599'<fixed_pt_const_type>' -> 'fixed' : '$1'. 600 601%% (50) NIY: unfolding of struct decls (FIXED) 602%%'<struct_type>' -> 'struct' '<identifier>' '{' '<member_list>' '}' 603%% : #struct{id='$2', body=ic:unfold('$4')} . 604'<struct_type>' -> 'struct' '<identifier>' '{' '<member_list>' '}' 605 : #struct{id='$2', body='$4'} . 606 607 608%% (51) 609'<member_list>' -> 'OorM_<member>' : reverse('$1') . 610 611 612%% Added clause 613%%'OorM_<member>' -> '<member>' : ['$1'] . 614%%'OorM_<member>' -> 'OorM_<member>' '<member>' 615%% : ['$2' | '$1'] . 616 617'OorM_<member>' -> '<member>' : '$1' . 618'OorM_<member>' -> 'OorM_<member>' '<member>' 619 : '$2' ++ '$1' . 620 621 622 623%% (52) NIY: member multiple declarators (FIXED) 624%%'<member>' -> '<type_spec>' '<declarators>' ';' 625%% : #member{type='$1', id='$2'} . 626 627'<member>' -> 'Ugly_pragmas' '<type_spec>' '<declarators>' 'Ugly_pragmas' ';' 'Ugly_pragmas' 628 : '$1' ++ '$4' ++ '$6' ++ [#member{type='$2', id='$3'}] . 629 630 631%% (53) NIY: unfolding of union cases (FIXED) 632%%'<union_type>' -> 'union' '<identifier>' 'switch' 633%% '(' '<switch_type_spec>' ')' '{' '<switch_body>' '}' 634%% : #union{id='$2', type='$5', body=ic:unfold('$8')} . 635'<union_type>' -> 'union' '<identifier>' 'switch' 636 '(' '<switch_type_spec>' ')' '{' '<switch_body>' '}' 637 : #union{id='$2', type='$5', body='$8'} . 638 639 640%% (54) 641'<switch_type_spec>' -> '<integer_type>' : '$1' . 642'<switch_type_spec>' -> '<char_type>' : '$1' . 643'<switch_type_spec>' -> '<boolean_type>' : '$1' . 644'<switch_type_spec>' -> '<enum_type>' : '$1' . 645'<switch_type_spec>' -> '<scoped_name>' : '$1' . 646 647 648%% (55) 649'<switch_body>' -> 'OorM_<case>' : reverse(lists:flatten('$1')) . 650 651%%'<switch_body>' -> 'OorM_<case>' : '$1' . 652 653 654%% Added clause 655'OorM_<case>' -> '<case>' : ['$1'] . 656'OorM_<case>' -> 'OorM_<case>' '<case>' : ['$2' | '$1'] . 657 658 659%% (56) NIY thing: multiple case labels (FIXED) 660%%'<case>' -> 'OorM_<case_label>' '<element_spec>' ';' 661%% : '$2'#case_dcl{label=reverse('$1')} . 662 663'<case>' -> 664 'Ugly_pragmas' 'OorM_<case_label>' 665 'Ugly_pragmas' '<element_spec>' 666 'Ugly_pragmas' ';' 'Ugly_pragmas' 667 : '$1' ++ '$3' ++ '$5' ++ '$7' ++ [ '$4'#case_dcl{label=reverse('$2')} ] . 668 669 670%% Added clause 671%%'OorM_<case_label>' -> '<case_label>' : ['$1'] . 672%%'OorM_<case_label>' -> 'OorM_<case_label>' '<case_label>' : ['$2' | '$1'] . 673 674'OorM_<case_label>' -> 'Ugly_pragmas' '<case_label>' 'Ugly_pragmas' 675 : '$1' ++ ['$2'] ++ '$3' . 676'OorM_<case_label>' -> 'OorM_<case_label>' 'Ugly_pragmas' '<case_label>' 'Ugly_pragmas' 677 : '$2' ++ ['$3'|'$1'] ++ '$4'. 678 679 680%% (57) 681'<case_label>' -> 'case' '<const_exp>' ':' : '$2' . 682'<case_label>' -> 'default' ':' : '$1' . 683 684 685%% (58) 686'<element_spec>' -> '<type_spec>' '<declarator>' 687: #case_dcl{type='$1', id='$2'} . 688 689 690%% (59) 691%%'<enum_type>' -> 'enum' '<identifier>' 692%%'{' '<enumerator>' 'ZorM_<enumerator>' '}' 693%%: #enum{id='$2', body=['$4' | reverse('$5')]} . 694 695'<enum_type>' -> 'enum' '<identifier>' 696'{' 'Ugly_pragmas' '<enumerator>' 'Ugly_pragmas' 'ZorM_<enumerator>' 'Ugly_pragmas' '}' 697: #enum{id='$2', body='$4'++'$6'++'$8'++['$5' | reverse('$7')]} . 698 699 700 701%% Added clause 702%%'ZorM_<enumerator>' -> '$empty' : [] . 703%%'ZorM_<enumerator>' -> 'ZorM_<enumerator>' ',' '<enumerator>' : ['$3' | '$1'] . 704 705'ZorM_<enumerator>' -> '$empty' : [] . 706'ZorM_<enumerator>' -> 'ZorM_<enumerator>' 'Ugly_pragmas' ',' 'Ugly_pragmas' '<enumerator>' 707 : '$2'++'$4'++['$5' | '$1'] . 708 709%% (60) 710'<enumerator>' -> '<identifier>' : #enumerator{id='$1'} . 711 712 713%% (61) 714'<sequence_type>' -> 'sequence' '<' '<simple_type_spec>' ',' 715 '<positive_int_const>' '>' 716 : #sequence{type='$3', length='$5'} . 717'<sequence_type>' -> 'sequence' '<' '<simple_type_spec>' '>' 718 : #sequence{type='$3'} . 719 720 721%% (62) 722'<string_type>' -> 'string' '<' '<positive_int_const>' '>' 723 : #string{length='$3'} . 724'<string_type>' -> 'string' : #string{} . 725 726'<string_type>' -> 'wstring' '<' '<positive_int_const>' '>' %% WSTRING 727 : #wstring{length='$3'} . 728'<string_type>' -> 'wstring' : #wstring{} . %% WSTRING 729 730 731%% (63) 732'<array_declarator>' -> '<identifier>' 'OorM_<fixed_array_size>' 733 : #array{id='$1', size=reverse('$2')} . 734 735 736%% Added clause 737'OorM_<fixed_array_size>' -> '<fixed_array_size>' : ['$1'] . 738'OorM_<fixed_array_size>' -> 'OorM_<fixed_array_size>' '<fixed_array_size>' 739 : ['$2' | '$1'] . 740 741 742%% (64) 743'<fixed_array_size>' -> '[' '<positive_int_const>' ']' : '$2' . 744 745 746%% (65) NIY: multiple attribute declarators (FIXED) 747'<attr_dcl>' -> 'Opt_readonly' 'attribute' '<param_type_spec>' 748 '<simple_declarator>' 'ZorM_<simple_declarator>' 749 : #attr{readonly='$1', type='$3', id=['$4' | reverse('$5')]} . 750%% : ic:unfold(#attr{readonly='$1', type='$3', id=['$4' | reverse('$5')]}) . 751%%'<attr_dcl>' -> 'Opt_readonly' 'attribute' '<param_type_spec>' 752%% '<simple_declarator>' 753 754 755%% (66) NIY: unfolding of exception bodies (FIXED) 756%%'<except_dcl>' -> 'exception' '<identifier>' '{' 'ZorM_<member>' '}' 757%% : #except{id='$2', body=ic:unfold('$4')} . 758'<except_dcl>' -> 'exception' '<identifier>' '{' 'ZorM_<member>' '}' 759 : #except{id='$2', body=reverse('$4')} . 760 761%% (67) 762'<op_dcl>' -> 'Opt_<op_attribute>' '<op_type_spec>' '<identifier>' '<parameter_dcls>' 'Opt_<raises_expr>' 'Opt_<context_expr>' 763 : #op{oneway='$1', type='$2', id='$3', params='$4', raises='$5', ctx='$6'} . 764 765%% Added clause 766'Opt_<op_attribute>' -> '$empty' : nil. 767'Opt_<op_attribute>' -> '<op_attribute>' : '$1'. 768 769%% (68) 770'<op_attribute>' -> 'oneway' : '$1' . 771 772 773%% (69) 774'<op_type_spec>' -> '<param_type_spec>' : '$1' . 775'<op_type_spec>' -> 'void' : '$1' . 776 777 778%% (70) Rewritten 779%'<parameter_dcls>' -> '(' '<param_dcl>' 'ZorM_<param_dcl>' ')' 780% : ['$2' | reverse('$3')] . 781%'<parameter_dcls>' -> '(' ')' : [] . 782 783'<parameter_dcls>' -> '(' 'Ugly_pragmas' '<param_dcl>' 'ZorM_<param_dcl>' ')' 784 : '$2' ++ ['$3' | reverse('$4')] . 785'<parameter_dcls>' -> '(' 'Ugly_pragmas' ')' : '$2' . 786 787 788%% Added clause 789%'ZorM_<param_dcl>' -> '$empty' : [] . 790%'ZorM_<param_dcl>' -> 'ZorM_<param_dcl>' ',' '<param_dcl>' : ['$3' | '$1'] . 791 792 793'ZorM_<param_dcl>' -> 'Ugly_pragmas' : '$1' . 794'ZorM_<param_dcl>' -> 'ZorM_<param_dcl>' 'Ugly_pragmas' ',' 'Ugly_pragmas' '<param_dcl>' 'Ugly_pragmas' 795 : '$2' ++ '$4' ++ '$6' ++ ['$5' | '$1'] . 796 797 798 799 800%% (71) 801'<param_dcl>' -> '<param_attribute>' '<param_type_spec>' '<simple_declarator>' 802 : #param{inout='$1', type='$2', id='$3'} . 803 804 805%% (72) 806'<param_attribute>' -> 'in' : '$1' . 807'<param_attribute>' -> 'out' : '$1' . 808'<param_attribute>' -> 'inout' : '$1' . 809 810 811%% Added clause 812'Opt_<raises_expr>' -> '$empty' : [] . 813'Opt_<raises_expr>' -> '<raises_expr>' : '$1' . 814 815%% (73) 816'<raises_expr>' -> 'raises' '(' '<scoped_name>' 'ZorM_<scoped_name>' ')' 817 : ['$3'| reverse('$4')] . 818 819 820%% Added clause 821'Opt_<context_expr>' -> '$empty' : [] . 822'Opt_<context_expr>' -> '<context_expr>' : '$1'. 823 824%% (74) 825'<context_expr>' -> 'context' '(' '<string_literal>' 'ZorM_<string_literal>'')' 826 : ['$3' | reverse('$4')] . 827 828 829 830%% (75) 831'<param_type_spec>' -> '<base_type_spec>' : '$1' . 832'<param_type_spec>' -> '<string_type>' : '$1' . 833'<param_type_spec>' -> '<scoped_name>' : '$1' . 834 835 836%% (96) 837'<fixed_pt_type>' -> 'fixed' '<' '<positive_int_const>' ',' '<positive_int_const>' '>' 838 : #fixed{digits='$3',scale='$5'} . 839 840%% (99) 841'<constr_forward_decl>' -> 'struct' '<identifier>' : #constr_forward{id='$2', tk=tk_struct} . 842'<constr_forward_decl>' -> 'union' '<identifier>' : #constr_forward{id='$2', tk=tk_union} . 843 844%% Added clause 845'ZorM_<string_literal>' -> '$empty' : [] . 846'ZorM_<string_literal>' -> 'ZorM_<string_literal>' ',' '<string_literal>' 847 : ['$3' | '$1'] . 848 849%% Added clause 850'ZorM_<simple_declarator>' -> '$empty' : [] . 851'ZorM_<simple_declarator>' -> 'ZorM_<simple_declarator>' ',' 852'<simple_declarator>' : ['$3' | '$1'] . 853 854%% Added clause 855%%'ZorM_<member>' -> '$empty' : [] . 856%%'ZorM_<member>' -> 'ZorM_<member>' '<member>' : ['$2' | '$1'] . 857 858'ZorM_<member>' -> 'Ugly_pragmas' : '$1' . 859'ZorM_<member>' -> 'ZorM_<member>' '<member>' : '$2' ++ '$1' . 860 861 862%% Added clause 863'Opt_readonly' -> '$empty' : nil. 864'Opt_readonly' -> 'readonly' : '$1'. 865 866 867 868Erlang code. 869%%----------------------------------------------------------- 870 871 872 873