/*
 * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

/*
 *    COMPONENT_NAME:  idl.parser
 *
 *    ORIGINS: 27
 *
 *    5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
 *
 */

(1) <specification>	<imports> <definition> <specification'> // CORBA3

(1) <imports>		e   // CORBA3
			<import> <imports>  // CORBA3

(1) <import>		"import" <imported_scope> ";"	// CORBA3

(1) <imported_scope>	<scoped_name>	// CORBA3
			<string_literal>    // CORBA3

(1) <specification'>	e
			<definition><specification'>

(2) <definition>	<type_dcl> ";"
			<const_dcl> ";"
			<except_dcl> ";"
			<interface> ";"
			<module> ";"
			<value> ";"
			<type_id_dcl> ";" // CORBA3
			<type_prefix_dcl> ";"  // CORBA3
			<component> ";"	// CORBA3
			<home_dcl> ";"	    // CORBA3

(2) <type_id_dcl>	"typeId" <scoped_name> <string_literal> // CORBA3

(2) <type_prefix_dcl>	"typePrefix" <scoped_name> <string_literal> // CORBA3

(3) <module>		"module" <id> "{" <module'> "}"

(3) <module'>		<definition><module''>

(3) <module''>		<definition><module''>
                        e

(4) <interface>		<interface_dcl>
			<forward_dcl>

(5) <interface_dcl>	<interface_header> "{" <interface_body> "}"

(6) <forward_dcl>	"abstract" "interface" <id>
			"local" "interface" <id>	// CORBA3
			"interface" <id>

(7) <interface_header>	"abstract" "interface" <id> <interface_header'>
			"local" "interface" <id> <interface_header'> // CORBA3
			"interface" <id> <interface_header'>

(7) <interface_header'>	e
			<interface_inheritance_spec>

(8) <interface_body>	<export><interface_body'>

(8) <interface_body'>	e
			<export><interface_body'>

(9) <export>		<type_dcl> ";"
			<const_dcl> ";"
			<except_dcl> ";"
			<attr_dcl> ";"
			<op_dcl> ";"
			<type_id_dcl> ";" // CORBA3
			<type_prefix_dcl> ";"  // CORBA3

(10) <interface_inheritance_spec>	":" <scoped_name> <inheritance_spec'>

(10) <interface_inheritance_spec'>	e
			"," <scoped_name> <inheritance_spec'>

(12) <scoped_name>	<id> <scoped_name'>
			"::" <id> <scoped_name'>

(12) <scoped_name'>	e
			"::" <id> <scoped_name'>

(13) <value>		<value_dcl>
			<value_abs_dcl>
			<value_box_dcl>
			<value_forward_dcl>

(14) <value_forward_dcl>    "abstract" "valuetype" <id>
			"valuetype" <id>

(15) <value_box_dcl>	"valuetype" <id> <type_spec>

(16) <value_abs_dcl>	"abstract" "valuetype" <id> <value_inheritance_spec> "{" <export> <vad> "}"
			"abstract" "valuetype" <id> "{" <export> <vad> "}"

(16) <vad>		e
			<export> <vad>

(17) <value_dcl>	<value_header> "{" <value_element> <ve> "}"

(17) <ve>		e
			<value_element> <ve>

(18) <value_header>	"custom" "valuetype" <id> <value_inheritance_spec>
			"valuetype" <id> <value_inheritance_spec>
			"custom" "valuetype" <id>
			"valuetype" <id>

(19) <value_inheritance_spec>	<opt_inherits> <opt_supports>

(19) <opt_inherits>	e
			":" "truncatable" <value_name> <value_name_list>
			":" <value_name> <value_name_list>

(19) <value_name_list>	e
			"," <value_name> <value_name_list>

(19) <opt_supports>	e
			"supports" <interface_name> <interface_name_list>

(19) <interface_name_list>  e
			"," <interface_name> <interface_name_list>

(20) <value_name>	<scoped_name>

(21) <value_element>	<export>
			<state_member>
			<init_dcl>

(22) <state_member>	"public" <type_spec> <declarators> ";"
			"private" <type_spec> <declarators> ";"

(23) <init_dcl>		"factory" <id> "(" ")"
			"factory" <id> "(" <init_param_dcls> ")"

(24) <init_param_dcls>	<init_param_dcl>
			<init_param_dcl> "," <init_param_dcls>

(25) <init_param_dcl>	<init_param_attribute> <param_type_spec> <simple_declarator>

(26) <init_param_attribute> "in"

(27) <const_dcl>	"const" <const_type> <id> "=" <const_exp>

(28) <const_type>	<integer_type>
			<char_type>
			<wide_char_type>
			<boolean_type>
			<floating_pt_type>
			<string_type>
			<wide_string_type>
			<scoped_name>
			<octet_type>

(29) <const_exp>	<or_expr>

(30) <or_expr>		<xor_expr> <or_expr'>

(30) <or_expr'>		e
			"|" <xor_expr> <or_expr'>

(31) <xor_expr>		<and_expr> <xor_expr'>

(31) <xor_expr'>	e
			"^" <and_expr> <xor_expr'>

(32) <and_expr>		<shift_expr><and_expr'>

(32) <and_expr'>	e
			"&" <shift_expr> <and_expr'>

(33) <shift_expr>	<add_expr> <shift_expr'>

(33) <shift_expr'>	e
			">>" <add_expr> <shift_expr'>
			"<<" <add_expr> <shift_expr'>

(34) <add_expr>		<mult_expr> <add_expr'>

(34) <add_expr'>	e
			"+" <mult_expr> <add_expr'>
			"-" <mult_expr> <add_expr'>

(35) <mult_expr>	<unary_expr> <mult_expr'>

(35) <mult_expr'>	e
			"*" <unary_expr> <mult_expr'>
			"/" <unary_expr> <mult_expr'>
			"%" <unary_expr> <mult_expr'>

(36) <unary_expr>	<unary_operator> <primary_expr>
			<primary_expr>

(37) <unary_operator>	"-"
			"+"
			"~"

(38) <primary_expr>	<scoped_name>
			<literal>
			"(" <const_exp> ")"

(39) <literal>		<<integer_literal>>
			<<string_literal>>>
			<<wide_string_literal>>>
			<<character_literal>>
			<<wide_character_literal>>
			<<fixed_pt_literal>>
			<<floating_pt_literal>>
			<<boolean_literal>>

(40) <boolean_literal>	"TRUE"
			"FALSE"

(41) <positive_int_const>   <const_exp>

(42) <type_dcl>		"typedef" <type_declarator>
			<struct_type>
			<union_type>
			<enum_type>
			"native" <simple_declarator>

(43) <type_declarator>	<type_spec> <declarators>

(44) <type_spec>	<simple_type_spec>
			<constr_type_spec>

(45) <simple_type_spec>	<base_type_spec>
			<template_type_spec>
			<scoped_name>

(46) <base_type_spec>	<floating_pt_type>
			<integer_type>
			<char_type>
			<wide_char_type>
			<boolean_type>
			<octet_type>
			<any_type>
			<object_type>
			<value_base_type>

(47) <template_type_spec> <sequence_type>
			<string_type>
			<wide_string_type>
			<fixed_pt_type>

(48) <constr_type_spec>	<struct_type>
			<union_type>
			<enum_type>

(49) <declarators>	<declarator> <declarators'>

(49) <declarators'>	e
			"," <declarator> <declarators'>

(50) <declarator>	<simple_declarator>
			<complex_declarator>

(51) <simple_declarator> <id>

(52) <complex_declarator>   <array_declarator>

(53) <floating_pt_type>	"float"
			"double"
			"long" "double"

(54) <integer_type>	<signed_int>
			<unsigned_int>

(55) <signed_int>	"long"
			"short"
			"long" "long"

// 56-58 omitted

(59) <unsigned_int>	"unsigned" <signed_int>

// 60-62 omitted

(63) <char_type>	"char"

(64) <wide_char_type>	"wchar"

(65) <boolean_type>	"boolean"

(66) <octet_type>	"octet"

(67) <any_type>		"any"

(68) <object_type>	"Object"

(69) <struct_type>	"struct" <id> "{" <member_list> "}"

(70) <member_list>	<member> <member_list'>

(70) <member_list'>	e
			<member> <member_list'>

(71) <member>		<type_spec> <declarators> ";"

(72) <union_type>	"union" <id> "switch" "(" <switch_type_spec> ")" "{" <switch_body> "}"

(73) <switch_type_spec>	<integer_type>
			<char_type>
			<boolean_type>
			<enum_type>
			<scoped_name>

(74) <switch_body>	<case> <switch_body'>

(74) <switch_body'>	e
			<case> <switch_body'>

(75) <case>		<case_label> <case'> <element_spec> ";"

(75) <case'>		e
			<case_label> <case'>

(76) <case_label>	"case" <const_exp> ":"
			"default" ":"

(77) <element_spec>	<type_spec> <declarator>

(78) <enum_type>	"enum" <id> "{" <id> <enum_type'> "}"

(78) <enum_type'>	e
			"," <id> <enum_type'>

// 79 omitted

(80) <sequence_type>	"sequence" "<" <simple_type_spec> <sequence_type'>

(80) <sequence_type'>	"," <positive_int_const> ">"
			">"

(81) <string_type>	"string"
			"string" "<" <positive_int_const> ">"

(82) <wide_string_type>	"wstring"
			"wstring" "<" <positive_int_const> ">"

(83) <array_declarator>	<id> <fixed_array_size>

(84) <fixed_array_size>	"[" <positive_int_const> "]"

(85) <attr_dcl>		<readonly_attr_spec>	// CORBA3
			<attr_spec> // CORBA3

(85) <readonly_attr_spec>   <readonly_attr_header> <readonly_attr_declarator>	// CORBA3

(85) <readonly_attr_header> "readonly" "attribute" <param_type_spec>	// CORBA3

(85) <readonly_attr_declarator> <simple_declarator> <get_excep_expr>	// CORBA3
			<simple_declarator> <sds>   // CORBA3

(85) <sds>		e   // CORBA3
			<simple_declarator> <sds>   // CORBA3

(85) <attr_spec>	"attribute" <param_type_spec> <attr_declarator>	// CORBA3

(85) <attr_declarator>	<simple_declarator> <attr_raises_expr>	// CORBA3
			<simple_declarator> <sds>   // CORBA3

(85) <attr_raises_expr>	<get_excep_expr>    // CORBA3
			<get_excep_expr> <set_excep_expr>   // CORBA3
			<set_excep_expr>    // CORBA3

(85) <get_excep_expr>	"getRaises" <exception_list>	// CORBA3

(85) <set_excep_expr>	"setRaises" <exception_list>	// CORBA3

(85) <exception_list>	"(" <scoped_name> <els> ")" // CORBA3

(85) <els>		e   // CORBA3
			"," <scoped_name> <els>	    // CORBA3

(86) <except_dcl>	"exception" <id> "{" <except_dcl'> "}"

(86) <except_dcl'>	e
			<member> <except_dcl'>

(87) <op_dcl>		<op_attribute> <op_type_spec> <op_dcl'>
			<op_type_spec> <op_dcl'>

(87) <op_dcl'>		<id> <parameter_dcls> <op_dcl''>
			<macroID> <parameter_dcls'> <op_dcl''>

(87) <op_dcl''>		e
			<context_expr>
			<raises_expr>
			<raises_expr> <context_expr>

(88) <op_attribute>	"oneway"

(89) <op_type_spec>	<param_type_spec>
			"void"

(90) <parameter_dcls>	"(" <parameter_dcls'>

(90) <parameter_dcls'>	<param_dcl> <parameter_dcls''> ")"
			")"

(90) <parameter_dcls''>	e
			"," <param_dcl> <parameter_dcls''>

(91) <param_dcl>	<param_attribute> <param_type_spec> <id>

(92) <param_attribute>	"in"
			"out"
			"inout"

(93) <raises_expr>	"raises" "(" <scoped_name> <raises_expr'> ")"

(93) <raises_expr'>	e
			"," <scoped_name> <raises_expr'>

(94) <context_expr>	"context" "(" <string_literal> <context_expr'> ")"

(94) <context_expr'>        e
			"," <string_literal> <context_expr'>

(95) <param_type_spec>	<base_type_spec>
			<string_type>
			<wide_string_type>
			<scoped_name>

(96) <fixed_pt_type>	"fixed" "<" <positive_int_const> "," <positive_int_const> ">"

(97) <fixed_pt_const_type> "fixed"

(98) <value_base_type>	"ValueBase"

// CORBA3 Component and Home IDL

(200) <component>	<component_dcl>
			<component_forward_dcl>

(201) <component_forward_dcl>	"component" <id>

(202) <component_dcl>	<component_header> "{" <component_body> "}"

(203) <component_header> "component" <id>
			"component" <id> <component_inheritance_spec>
			"component" <id> <supported_interface_spec>
			"component" <id> <component_inheritance_spec> <supported_interface_spec>

(204) <supported_interface_spec> "supports" <scoped_name> <snames>

(204) <snames>		e
			"," <scoped_name> <snames>

(205) <component_inheritance_spec> ":" <scoped_name>

(206) <component_body>	<component_export> <ces>

(206) <ces>		e
			<component_export> <ces>

(207) <component_export>    <provides_dcl> ";"
			<uses_dcl> ";"
			<emits_dcl> ";"
			<publishes_dcl> ";"
			<consumes_dcl> ";"
			<attr_dcl> ";"

(208) <provides_dcl>	"provides" <interface_type> <id>

(209) <interface_type>	<scoped_name>
			"Object"

(210) <uses_dcl>	"uses" <interface_type> <id>
			"uses" "multiple" <interface_type> <id>

(211) <emits_dcl>	"emits" <scoped_name> <id>

(212) <publishes_dcl>	"publishes" <scoped_name> <id>

(213) <consumes_dcl>	"consumes" <scoped_name> <id>

(214) <home_dcl>	<home_header> <home_body>

(215) <home_header>	"home" <id> <home_inheritance_spec> "manages" <scoped_name>
			"home" <id> "manages" <scoped_name>
			"home" <id> <home_inheritance_spec> "manages" <scoped_name> <primary_key_spec>
			"home" <id> "manages" <scoped_name> <primary_key_spec>

(216) <home_inheritance_spec> ":" <scoped_name>

(217) <primary_key_spec>    "primaryKey" <scoped_name>

(218) <home_body>	"{" <home_export> <hes> "}"

(218) <hes>		e
			<home_export> <hes>

(219) <home_export>	<export>
			<factory_dcl> ";"
			<finder_dcl> ";"

(220) <factory_dcl>	"factory" <id> "(" <init_param_dcls> ")" <raises_expr>
			"factory" <id> "("  ")" <raises_expr>
			"factory" <id> "(" <init_param_dcls> ")"
			"factory" <id> "("  ")"

(221) <finder_dcl>	"finder" <id> "(" <init_param_dcls> ")" <raises_expr>
			"finder" <id> "("  ")" <raises_expr>
			"finder" <id> "(" <init_param_dcls> ")"
			"finder" <id> "("  ")"

NOTES:

- #define id(id, id, ...) token-string is a macro definition.  There can be no space between the first id and the left paren.  Since id( must be treated as a token and id( can also appear in op_dcl, see that production for the effect of this token.

