57 lines
1.8 KiB
BNF
57 lines
1.8 KiB
BNF
|
|
||
|
// Object Path BNF
|
||
|
// ================
|
||
|
|
||
|
// The first part of the grammar is the ns path.
|
||
|
// =============================================
|
||
|
|
||
|
<Parse> ::= BACKSLASH <ns_or_server>;
|
||
|
<Parse> ::= IDENT <ns_or_class>; // Save initial IDENT, since we don't know what it is
|
||
|
<Parse> ::= COLON <objref>;
|
||
|
|
||
|
// In the case of a server or ns prefix, we allow the objref portion to be missing.
|
||
|
// ================================================================================
|
||
|
|
||
|
<ns_or_server> ::= BACKSLASH <dot_or_ident> BACKSLASH <ns_list> <optional_objref>;
|
||
|
<ns_or_server> ::= <ns_list> <optional_objref>;
|
||
|
|
||
|
<dot_or_ident> ::= IDENT;
|
||
|
<dot_or_ident> ::= DOT;
|
||
|
|
||
|
<optional_objref> ::= COLON <objref>;
|
||
|
<optional_objref> ::= <>;
|
||
|
|
||
|
<ns_or_class> ::= COLON <ident_becomes_ns> <objref>;
|
||
|
<ns_or_class> ::= BACKSLASH <ident_becomes_ns> <ns_list> COLON <objref>;
|
||
|
<ns_or_class> ::= <ident_becomes_class> <objref_rest>;
|
||
|
|
||
|
<ns_list> ::= IDENT <ns_list_rest>;
|
||
|
<ns_list_rest> ::= BACKSLASH <ns_list>;
|
||
|
<ns_list_rest> ::= <>;
|
||
|
|
||
|
<ident_becomes_ns> ::= <>; // <initial_ident> becomes a namespace
|
||
|
<ident_becomes_class> ::= <>; // <initial_ident> becomes the class
|
||
|
|
||
|
// The following portion is the object reference within the namespace.
|
||
|
// ===================================================================
|
||
|
|
||
|
<objref> ::= IDENT <objref_rest>; // IDENT is classname
|
||
|
|
||
|
<objref_rest> ::= EQUALS <key_const>;
|
||
|
<objref_rest> ::= DOT <keyref_list>;
|
||
|
<objref_rest> ::= <>;
|
||
|
|
||
|
<keyref_list> ::= <keyref> <keyref_term>;
|
||
|
|
||
|
<keyref_term> ::= COMMA <keyref_list>; // Used for compound keys
|
||
|
<keyref_term> ::= <>;
|
||
|
|
||
|
<keyref> ::= <propname> EQUALS <key_const>;
|
||
|
|
||
|
<propname> ::= IDENT;
|
||
|
|
||
|
<key_const> ::= STRING_CONST;
|
||
|
<key_const> ::= INTEGRAL_CONST;
|
||
|
<key_const> ::= REAL_CONST;
|
||
|
<key_const> ::= IDENT; // Where IDENT is "OBJECT"
|
||
|
// This is for singleton classes
|