Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

332 lines
9.5 KiB

  1. //***************************************************************************
  2. //
  3. // (c) 1995-2001 by Microsoft Corp.
  4. //
  5. // MOF.BNF
  6. //
  7. // BNF definition for MOF syntax. This grammar is suitable for
  8. // recursive descent or LL(1) parsing. Terminals are in upper case,
  9. // nonterminals are enclosed in angle brackets.
  10. //
  11. // a-raymcc 03-Oct-95 Created.
  12. // a-raymcc 26-Jan-96 New syntax for references, aliases, and
  13. // 'Interface' declarations
  14. //
  15. //***************************************************************************
  16. // Start symbol.
  17. // =============
  18. <Parse> ::= <top_level_decl><Parse>;
  19. <Parse> ::= <qualifier_default><Parse>;
  20. <Parse> ::= <preprocessor_command><Parse>;
  21. <Parse> ::= <>;
  22. // Preprocessor commands
  23. // =====================
  24. <preprocessor_command> ::= <pound_include>;
  25. <preprocessor_command> ::= <pound_define>;
  26. <preprocessor_command> ::= TOK_PRAGMA <pound_pragma>;
  27. <preprocessor_command> ::= TOK_LINE TOK_UNSIGNED_NUMERIC_CONST TOK_LPWSTR;
  28. <pound_include> ::= TOK_INCLUDE <const_string>;
  29. <pound_define> ::= TOK_DEFINE TOK_SIMPLE_IDENT <const_value>;
  30. // where the string is always "namespace"
  31. <pound_pragma> ::= TOK_SIMPLE_IDENT
  32. TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
  33. <pound_pragma> ::= TOK_AMENDMENT
  34. TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
  35. <pound_pragma> ::= TOK_CLASSFLAGS
  36. TOK_OPEN_PAREN <flag_list> TOK_CLOSE_PAREN;
  37. <pound_pragma> ::= TOK_INSTANCEFLAGS
  38. TOK_OPEN_PAREN <flag_list> TOK_CLOSE_PAREN;
  39. <pound_pragma> ::= TOK_AUTORECOVER;
  40. <pound_pragma> ::= TOK_DELETECLASS
  41. TOK_OPEN_PAREN TOK_LPWSTR TOK_COMMA <FailOrNoFail> TOK_CLOSE_PAREN;
  42. <pound_pragma> ::= TOK_INSTANCELOCALE
  43. TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
  44. <pound_pragma> ::= TOK_LOCALE
  45. TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
  46. <pound_pragma> ::= TOK_NONLOCALTYPE
  47. TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
  48. <pound_pragma> ::= TOK_NONLOCAL
  49. TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
  50. <pound_pragma> ::= TOK_SOURCE
  51. TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
  52. <pound_pragma> ::= TOK_SOURCETYPE
  53. TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
  54. <FailOrNoFail> ::= FAIL;
  55. <FailOrNoFail> ::= NOFAIL;
  56. <flag_list> ::= TOK_LPWSTR <string_list>;
  57. <flag_list> ::= TOK_UNSIGNED_NUMERIC_CONST;
  58. <flag_list> ::= <>;
  59. <string_list> ::= <>;
  60. <string_list> ::= TOK_COMMA TOK_LPWSTR <string_list>;
  61. <top_level_decl> ::= <qualifier_decl> <decl_type>;
  62. <decl_type> ::= <typedef>;
  63. <decl_type> ::= <instance_decl>TOK_SEMI;
  64. <decl_type> ::= <class_decl>TOK_SEMI;
  65. /////////////////////////////////////////
  66. //
  67. // Typedef support
  68. //
  69. <typedef> ::= TOK_TYPEDEF <complete_type>
  70. TOK_SIMPLE_IDENT <opt_subrange> TOK_SEMI;
  71. <complete_type> ::= <type> <opt_ref>;
  72. <complete_type> ::= <enum>;
  73. <enum> ::= TOK_ENUM TOK_OPEN_BRACE <enum_data> TOK_CLOSE_BRACE;
  74. <enum_data> ::= <opt_name><enum_data_rest>;
  75. <enum_data_rest> ::= <const_int> <int_enum_data_rest>;
  76. <enum_data_rest> ::= TOK_LPWSTR <string_enum_data_rest>;
  77. <int_enum_data_rest> ::= <>;
  78. <int_enum_data_rest> ::= TOK_COMMA <int_enum_datum> <int_enum_data_rest>;
  79. <int_enum_datum> ::= <opt_name><const_int>;
  80. <string_enum_data_rest> ::= <>;
  81. <string_enum_data_rest> ::= TOK_COMMA <string_enum_datum>
  82. <string_enum_data_rest>;
  83. <string_enum_datum> ::= <opt_name>TOK_LPWSTR;
  84. <opt_name> ::= <>;
  85. <opt_name> ::= TOK_SIMPLE_IDENT TOK_EQUALS;
  86. <opt_subrange> ::= <>;
  87. <opt_subrange> ::= TOK_SUBRANGE TOK_OPEN_PAREN <const_value> TOK_DOT TOK_DOT
  88. <const_value> TOK_CLOSE_PAREN;
  89. ////////////////////////////////////////////////////////////
  90. //
  91. // Class declaration
  92. //
  93. <class_decl> ::=
  94. TOK_CLASS
  95. TOK_SIMPLE_IDENT // Class name
  96. <class_def>;
  97. <class_def> ::=
  98. <as_alias>
  99. <opt_parent_class>
  100. TOK_OPEN_BRACE
  101. <property_decl_list>
  102. TOK_CLOSE_BRACE;
  103. <class_def> ::= <>;
  104. <property_decl_list> ::= <PropOrMeth_decl> <property_decl_list>;
  105. <property_decl_list> ::= <>;
  106. <opt_parent_class> ::= TOK_COLON <SYS_OR_REGULAR>;
  107. <opt_parent_class> ::= <>;
  108. <SYS_OR_REGULAR> ::= TOK_SIMPLE_IDENT;
  109. <SYS_OR_REGULAR> ::= TOK_SYSTEM_IDENT;
  110. ////////////////////////////////////////////////////////////
  111. //
  112. // Property/Method declarations.
  113. //
  114. <PropOrMeth_decl> ::= <qualifier_decl><PropOrMeth_decl2>;
  115. <PropOrMeth_decl2> ::= <TypeAndName> <finish_PropOrMeth>;
  116. <PropOrMeth_decl2> ::= TOK_VOID TOK_SIMPLE_IDENT <finish_meth>;
  117. <finish_PropOrMeth> ::= <finish_prop>;
  118. <finish_PropOrMeth> ::= <finish_meth>;
  119. <finish_prop> ::=
  120. <opt_array>
  121. <default_value>
  122. TOK_SEMI;
  123. <finish_meth> ::=
  124. TOK_OPEN_PAREN
  125. <arg_list>
  126. TOK_CLOSE_PAREN
  127. TOK_SEMI;
  128. <TypeAndName> ::= <type> <opt_ref> TOK_SIMPLE_IDENT;
  129. <arg_list> ::= <arg_decl> <rest_of_args>;
  130. <arg_list> ::= <>;
  131. <arg_decl> ::= <qualifier_decl><TypeAndName><opt_array><default_value>;
  132. <rest_of_args> ::= TOK_COMMA <arg_decl> <rest_of_args>;
  133. <rest_of_args> ::= <>;
  134. <opt_ref> ::= TOK_REF;
  135. <opt_ref> ::= <>;
  136. <opt_array> ::= TOK_OPEN_BRACKET <opt_array_detail>;
  137. <opt_array> ::= <>;
  138. <opt_array_detail> ::= TOK_UNSIGNED_NUMERIC_CONST TOK_CLOSE_BRACKET;
  139. <opt_array_detail> ::= TOK_CLOSE_BRACKET;
  140. <default_value> ::= <>;
  141. <default_value> ::= TOK_EQUALS <initializer>;
  142. ////////////////////////////////////////////////////////////
  143. //
  144. // Instances.
  145. //
  146. <instance_decl> ::=
  147. TOK_INSTANCE TOK_OF
  148. <type>
  149. <as_alias>
  150. TOK_OPEN_BRACE
  151. <prop_init_list>
  152. TOK_CLOSE_BRACE;
  153. <prop_init_list> ::= <prop_init><prop_init_list>;
  154. <prop_init_list> ::= <>;
  155. <prop_init> ::= <qualifier_decl> TOK_SIMPLE_IDENT TOK_EQUALS <initializer> TOK_SEMI;
  156. <as_alias> ::= TOK_AS <alias>;
  157. <as_alias> ::= <>;
  158. ////////////////////////////////////////////////////////////
  159. //
  160. // Qualifiers.
  161. //
  162. // This allows comma delimited identifiers, or identifiers
  163. // in functional notation with a const parm list.
  164. //
  165. <qualifier_decl> ::= TOK_OPEN_BRACKET <qualifier_list> TOK_CLOSE_BRACKET;
  166. <qualifier_decl> ::= <>;
  167. <qualifier_list> ::= <qualifier><qualifier_list_rest>;
  168. <qualifier_list_rest> ::= TOK_COMMA <qualifier><qualifier_list_rest>;
  169. <qualifier_list_rest> ::= <>;
  170. <qualifier> ::= TOK_SIMPLE_IDENT <qualifier_parm>;
  171. <qualifier> ::= TOK_EXTERNAL;
  172. <qualifier_parm> ::= TOK_OPEN_PAREN <simple_initializer> TOK_CLOSE_PAREN TOK_COLON <flavor_param>;
  173. <qualifier_parm> ::= TOK_OPEN_BRACE <initializer_list> TOK_CLOSE_BRACE TOK_COLON <flavor_param>;
  174. <qualifier_parm> ::= <flavor_param>;
  175. <flavor_param> ::= TOK_COLON <flavor_list> ;
  176. <flavor_param> ::= <>;
  177. <flavor_list> ::= <flavor_value> <flavor_list_rest>;
  178. <flavor_list_rest> ::= <FLAVOR_VALUE> <flavor_list_rest>;
  179. <flavor_list_rest> ::= <>;
  180. <flavor_value> ::= TOK_TOINSTANCE;
  181. <flavor_value> ::= TOK_NOTTOINSTANCE;
  182. <flavor_value> ::= TOK_TOSUBCLASS;
  183. <flavor_value> ::= TOK_NOTTOSUBCLASS;
  184. <flavor_value> ::= TOK_ENABLEOVERRIDE;
  185. <flavor_value> ::= TOK_DISABLEOVERRIDE;
  186. <flavor_value> ::= TOK_RESTRICTED;
  187. <flavor_value> ::= TOK_AMENDED;
  188. /////////////////////////////////////////////////////////////////////////////
  189. //
  190. <plus_sign> ::= TOK_PLUS;
  191. <plus_sign> ::= <>;
  192. <type> ::= <SYS_OR_REGULAR>;
  193. <const_int> ::= TOK_SIGNED_NUMERIC_CONST;
  194. <const_int> ::= TOK_UNSIGNED_NUMERIC_CONST;
  195. <const_int> ::= TOK_SIGNED64_NUMERIC_CONST;
  196. <const_int> ::= TOK_UNSIGNED64_NUMERIC_CONST;
  197. <const_string> ::= TOK_LPSTR;
  198. <const_string> ::= TOK_LPWSTR;
  199. <const_char> ::= TOK_CHAR;
  200. <const_char> ::= TOK_WCHAR;
  201. <const_value> ::= <const_string>;
  202. <const_value> ::= <plus_sign><const_int>;
  203. <const_value> ::= <const_char>;
  204. <const_value> ::= TOK_UUID;
  205. <const_value> ::= TOK_KEYWORD_NULL;
  206. <initializer> ::= <simple_initializer>;
  207. <initializer> ::= TOK_EXTERNAL;
  208. <initializer> ::= TOK_OPEN_BRACE <initializer_list> TOK_CLOSE_BRACE;
  209. <initializer> ::= <class_decl>;
  210. <simple_initializer> ::= <qualifier_decl><instance_decl>;
  211. <simple_initializer> ::= <const_value>;
  212. <simple_initializer> ::= <alias>;
  213. <initializer_list> ::= <simple_initializer><initializer_list>;
  214. <initializer_list> ::= TOK_COMMA <simple_initializer><initializer_list>;
  215. <initializer_list> ::= <>;
  216. <alias> ::= TOK_DOLLAR_SIGN TOK_SIMPLE_IDENT;
  217. /////////////////////////////////////////////////////////////////////////
  218. //
  219. // Qualifier defaults
  220. //
  221. <qualifier_default> ::= TOK_QUALIFIER TOK_SIMPLE_IDENT TOK_COLON <finish_qualifier_default>;
  222. <finish_qualifier_default> ::= <flavor_list>;
  223. <finish_qualifier_default> ::= <type> TOK_EQUALS <default_value> TOK_COMMA TOK_SCOPE TOK_OPEN_PAREN <scope_list> TOK_CLOSE_PAREN <finish_qualifier_end>;
  224. <finish_qualifier_end> ::= TOK_COMMA TOK_FLAVOR OK_OPEN_PAREN <def_flavor_list> TOK_CLOSE_PAREN;
  225. <finish_qualifier_end> ::= <>;
  226. <scope_list> ::= <scope_value> <scope_list_rest>;
  227. <scope_list_rest> ::= TOK_COMMA <scope_value> <scope_list_rest>;
  228. <scope_list_rest> ::= <>;
  229. <scope_value> ::= TOK_ANY;
  230. <scope_value> ::= TOK_ASSOCIATION;
  231. <scope_value> ::= TOK_INSTANCE;
  232. <scope_value> ::= TOK_CLASS;
  233. <scope_value> ::= TOK_METHOD;
  234. <scope_value> ::= TOK_PARAMETER;
  235. <scope_value> ::= TOK_PROPERTY;
  236. <def_flavor_list> ::= <flavor_value> <def_flavor_list_rest>;
  237. <def_flavor_list_rest> ::= TOK_COMMA <FLAVOR_VALUE> <def_flavor_list_rest>;
  238. <def_flavor_list_rest> ::= <>;