windows-nt/Source/XPSP1/NT/admin/wmi/wbem/winmgmt/mofcompiler/mof.bnf

333 lines
9.2 KiB
BNF
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
//***************************************************************************
//
// (c) 1995-2001 by Microsoft Corp.
//
// MOF.BNF
//
// BNF definition for MOF syntax. This grammar is suitable for
// recursive descent or LL(1) parsing. Terminals are in upper case,
// nonterminals are enclosed in angle brackets.
//
// a-raymcc 03-Oct-95 Created.
// a-raymcc 26-Jan-96 New syntax for references, aliases, and
// 'Interface' declarations
//
//***************************************************************************
// Start symbol.
// =============
<Parse> ::= <top_level_decl><Parse>;
<Parse> ::= <qualifier_default><Parse>;
<Parse> ::= <preprocessor_command><Parse>;
<Parse> ::= <>;
// Preprocessor commands
// =====================
<preprocessor_command> ::= <pound_include>;
<preprocessor_command> ::= <pound_define>;
<preprocessor_command> ::= TOK_PRAGMA <pound_pragma>;
<preprocessor_command> ::= TOK_LINE TOK_UNSIGNED_NUMERIC_CONST TOK_LPWSTR;
<pound_include> ::= TOK_INCLUDE <const_string>;
<pound_define> ::= TOK_DEFINE TOK_SIMPLE_IDENT <const_value>;
// where the string is always "namespace"
<pound_pragma> ::= TOK_SIMPLE_IDENT
TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_AMENDMENT
TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_CLASSFLAGS
TOK_OPEN_PAREN <flag_list> TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_INSTANCEFLAGS
TOK_OPEN_PAREN <flag_list> TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_AUTORECOVER;
<pound_pragma> ::= TOK_DELETECLASS
TOK_OPEN_PAREN TOK_LPWSTR TOK_COMMA <FailOrNoFail> TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_INSTANCELOCALE
TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_LOCALE
TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_NONLOCALTYPE
TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_NONLOCAL
TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_SOURCE
TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
<pound_pragma> ::= TOK_SOURCETYPE
TOK_OPEN_PAREN TOK_LPWSTR TOK_CLOSE_PAREN;
<FailOrNoFail> ::= FAIL;
<FailOrNoFail> ::= NOFAIL;
<flag_list> ::= TOK_LPWSTR <string_list>;
<flag_list> ::= TOK_UNSIGNED_NUMERIC_CONST;
<flag_list> ::= <>;
<string_list> ::= <>;
<string_list> ::= TOK_COMMA TOK_LPWSTR <string_list>;
<top_level_decl> ::= <qualifier_decl> <decl_type>;
<decl_type> ::= <typedef>;
<decl_type> ::= <instance_decl>TOK_SEMI;
<decl_type> ::= <class_decl>TOK_SEMI;
/////////////////////////////////////////
//
// Typedef support
//
<typedef> ::= TOK_TYPEDEF <complete_type>
TOK_SIMPLE_IDENT <opt_subrange> TOK_SEMI;
<complete_type> ::= <type> <opt_ref>;
<complete_type> ::= <enum>;
<enum> ::= TOK_ENUM TOK_OPEN_BRACE <enum_data> TOK_CLOSE_BRACE;
<enum_data> ::= <opt_name><enum_data_rest>;
<enum_data_rest> ::= <const_int> <int_enum_data_rest>;
<enum_data_rest> ::= TOK_LPWSTR <string_enum_data_rest>;
<int_enum_data_rest> ::= <>;
<int_enum_data_rest> ::= TOK_COMMA <int_enum_datum> <int_enum_data_rest>;
<int_enum_datum> ::= <opt_name><const_int>;
<string_enum_data_rest> ::= <>;
<string_enum_data_rest> ::= TOK_COMMA <string_enum_datum>
<string_enum_data_rest>;
<string_enum_datum> ::= <opt_name>TOK_LPWSTR;
<opt_name> ::= <>;
<opt_name> ::= TOK_SIMPLE_IDENT TOK_EQUALS;
<opt_subrange> ::= <>;
<opt_subrange> ::= TOK_SUBRANGE TOK_OPEN_PAREN <const_value> TOK_DOT TOK_DOT
<const_value> TOK_CLOSE_PAREN;
////////////////////////////////////////////////////////////
//
// Class declaration
//
<class_decl> ::=
TOK_CLASS
TOK_SIMPLE_IDENT // Class name
<class_def>;
<class_def> ::=
<as_alias>
<opt_parent_class>
TOK_OPEN_BRACE
<property_decl_list>
TOK_CLOSE_BRACE;
<class_def> ::= <>;
<property_decl_list> ::= <PropOrMeth_decl> <property_decl_list>;
<property_decl_list> ::= <>;
<opt_parent_class> ::= TOK_COLON <SYS_OR_REGULAR>;
<opt_parent_class> ::= <>;
<SYS_OR_REGULAR> ::= TOK_SIMPLE_IDENT;
<SYS_OR_REGULAR> ::= TOK_SYSTEM_IDENT;
////////////////////////////////////////////////////////////
//
// Property/Method declarations.
//
<PropOrMeth_decl> ::= <qualifier_decl><PropOrMeth_decl2>;
<PropOrMeth_decl2> ::= <TypeAndName> <finish_PropOrMeth>;
<PropOrMeth_decl2> ::= TOK_VOID TOK_SIMPLE_IDENT <finish_meth>;
<finish_PropOrMeth> ::= <finish_prop>;
<finish_PropOrMeth> ::= <finish_meth>;
<finish_prop> ::=
<opt_array>
<default_value>
TOK_SEMI;
<finish_meth> ::=
TOK_OPEN_PAREN
<arg_list>
TOK_CLOSE_PAREN
TOK_SEMI;
<TypeAndName> ::= <type> <opt_ref> TOK_SIMPLE_IDENT;
<arg_list> ::= <arg_decl> <rest_of_args>;
<arg_list> ::= <>;
<arg_decl> ::= <qualifier_decl><TypeAndName><opt_array><default_value>;
<rest_of_args> ::= TOK_COMMA <arg_decl> <rest_of_args>;
<rest_of_args> ::= <>;
<opt_ref> ::= TOK_REF;
<opt_ref> ::= <>;
<opt_array> ::= TOK_OPEN_BRACKET <opt_array_detail>;
<opt_array> ::= <>;
<opt_array_detail> ::= TOK_UNSIGNED_NUMERIC_CONST TOK_CLOSE_BRACKET;
<opt_array_detail> ::= TOK_CLOSE_BRACKET;
<default_value> ::= <>;
<default_value> ::= TOK_EQUALS <initializer>;
////////////////////////////////////////////////////////////
//
// Instances.
//
<instance_decl> ::=
TOK_INSTANCE TOK_OF
<type>
<as_alias>
TOK_OPEN_BRACE
<prop_init_list>
TOK_CLOSE_BRACE;
<prop_init_list> ::= <prop_init><prop_init_list>;
<prop_init_list> ::= <>;
<prop_init> ::= <qualifier_decl> TOK_SIMPLE_IDENT TOK_EQUALS <initializer> TOK_SEMI;
<as_alias> ::= TOK_AS <alias>;
<as_alias> ::= <>;
////////////////////////////////////////////////////////////
//
// Qualifiers.
//
// This allows comma delimited identifiers, or identifiers
// in functional notation with a const parm list.
//
<qualifier_decl> ::= TOK_OPEN_BRACKET <qualifier_list> TOK_CLOSE_BRACKET;
<qualifier_decl> ::= <>;
<qualifier_list> ::= <qualifier><qualifier_list_rest>;
<qualifier_list_rest> ::= TOK_COMMA <qualifier><qualifier_list_rest>;
<qualifier_list_rest> ::= <>;
<qualifier> ::= TOK_SIMPLE_IDENT <qualifier_parm>;
<qualifier> ::= TOK_EXTERNAL;
<qualifier_parm> ::= TOK_OPEN_PAREN <simple_initializer> TOK_CLOSE_PAREN TOK_COLON <flavor_param>;
<qualifier_parm> ::= TOK_OPEN_BRACE <initializer_list> TOK_CLOSE_BRACE TOK_COLON <flavor_param>;
<qualifier_parm> ::= <flavor_param>;
<flavor_param> ::= TOK_COLON <flavor_list> ;
<flavor_param> ::= <>;
<flavor_list> ::= <flavor_value> <flavor_list_rest>;
<flavor_list_rest> ::= <FLAVOR_VALUE> <flavor_list_rest>;
<flavor_list_rest> ::= <>;
<flavor_value> ::= TOK_TOINSTANCE;
<flavor_value> ::= TOK_NOTTOINSTANCE;
<flavor_value> ::= TOK_TOSUBCLASS;
<flavor_value> ::= TOK_NOTTOSUBCLASS;
<flavor_value> ::= TOK_ENABLEOVERRIDE;
<flavor_value> ::= TOK_DISABLEOVERRIDE;
<flavor_value> ::= TOK_RESTRICTED;
<flavor_value> ::= TOK_AMENDED;
/////////////////////////////////////////////////////////////////////////////
//
<plus_sign> ::= TOK_PLUS;
<plus_sign> ::= <>;
<type> ::= <SYS_OR_REGULAR>;
<const_int> ::= TOK_SIGNED_NUMERIC_CONST;
<const_int> ::= TOK_UNSIGNED_NUMERIC_CONST;
<const_int> ::= TOK_SIGNED64_NUMERIC_CONST;
<const_int> ::= TOK_UNSIGNED64_NUMERIC_CONST;
<const_string> ::= TOK_LPSTR;
<const_string> ::= TOK_LPWSTR;
<const_char> ::= TOK_CHAR;
<const_char> ::= TOK_WCHAR;
<const_value> ::= <const_string>;
<const_value> ::= <plus_sign><const_int>;
<const_value> ::= <const_char>;
<const_value> ::= TOK_UUID;
<const_value> ::= TOK_KEYWORD_NULL;
<initializer> ::= <simple_initializer>;
<initializer> ::= TOK_EXTERNAL;
<initializer> ::= TOK_OPEN_BRACE <initializer_list> TOK_CLOSE_BRACE;
<initializer> ::= <class_decl>;
<simple_initializer> ::= <qualifier_decl><instance_decl>;
<simple_initializer> ::= <const_value>;
<simple_initializer> ::= <alias>;
<initializer_list> ::= <simple_initializer><initializer_list>;
<initializer_list> ::= TOK_COMMA <simple_initializer><initializer_list>;
<initializer_list> ::= <>;
<alias> ::= TOK_DOLLAR_SIGN TOK_SIMPLE_IDENT;
/////////////////////////////////////////////////////////////////////////
//
// Qualifier defaults
//
<qualifier_default> ::= TOK_QUALIFIER TOK_SIMPLE_IDENT TOK_COLON <finish_qualifier_default>;
<finish_qualifier_default> ::= <flavor_list>;
<finish_qualifier_default> ::= <type> TOK_EQUALS <default_value> TOK_COMMA TOK_SCOPE TOK_OPEN_PAREN <scope_list> TOK_CLOSE_PAREN <finish_qualifier_end>;
<finish_qualifier_end> ::= TOK_COMMA TOK_FLAVOR OK_OPEN_PAREN <def_flavor_list> TOK_CLOSE_PAREN;
<finish_qualifier_end> ::= <>;
<scope_list> ::= <scope_value> <scope_list_rest>;
<scope_list_rest> ::= TOK_COMMA <scope_value> <scope_list_rest>;
<scope_list_rest> ::= <>;
<scope_value> ::= TOK_ANY;
<scope_value> ::= TOK_ASSOCIATION;
<scope_value> ::= TOK_INSTANCE;
<scope_value> ::= TOK_CLASS;
<scope_value> ::= TOK_METHOD;
<scope_value> ::= TOK_PARAMETER;
<scope_value> ::= TOK_PROPERTY;
<def_flavor_list> ::= <flavor_value> <def_flavor_list_rest>;
<def_flavor_list_rest> ::= TOK_COMMA <FLAVOR_VALUE> <def_flavor_list_rest>;
<def_flavor_list_rest> ::= <>;