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.
75 lines
2.5 KiB
75 lines
2.5 KiB
/////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Provider SQL Level 1 Syntax (LL1)
|
|
//
|
|
// 21-Jun-96 Created
|
|
// 01-Jul-96 Instrinsic functions on constants
|
|
//
|
|
// Simple SQL subset for unary queries to be implemented within individual
|
|
// providers.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
<parse> ::= SELECT <prop_list> FROM <class_name> <opt_where>;
|
|
|
|
<opt_where> ::= WHERE <expr>;
|
|
<opt_where> ::= <>;
|
|
|
|
<prop_list> ::= <property_name> <prop_list_2>;
|
|
<prop_list_2> ::= COMMA <prop_list>;
|
|
<prop_list_2> ::= <>;
|
|
|
|
<property_name> ::= IDENTIFIER;
|
|
<property_name> ::= ASTERISK;
|
|
<class_name> ::= IDENTIFIER;
|
|
|
|
// Subexpression nesting. This particular sequence gives
|
|
// a series of AND clauses precedence over OR clauses.
|
|
|
|
<expr> ::= <term> <expr2>;
|
|
<expr2> ::= OR <term> <expr2>;
|
|
<expr2> ::= <>;
|
|
|
|
<term> ::= <simple_expr> <term2>;
|
|
<term2> ::= AND <simple_expr> <term2>;
|
|
<term2> ::= <>;
|
|
|
|
// Simple expression types.
|
|
// ========================
|
|
|
|
<simple_expr> ::= NOT <expr>;
|
|
<simple_expr> ::= OPEN_PAREN <expr> CLOSE_PAREN;
|
|
<simple_expr> ::= IDENTIFIER <leading_ident_expr> <finalize>;
|
|
<simple_expr> ::= VARIANT <rel_operator> <trailing_prop_expr> <finalize>;
|
|
|
|
<trailing_prop_expr> ::= IDENTIFIER <trailing_prop_expr2>;
|
|
<trailing_prop_expr2> ::= OPEN_PAREN IDENTIFIER CLOSE_PAREN;
|
|
<trailing_prop_expr2> ::= <>;
|
|
|
|
<leading_ident_expr> ::= OPEN_PAREN <unknown_func_expr>;
|
|
<leading_ident_expr> ::= <comp_operator> <trailing_const_expr>;
|
|
<leading_ident_expr> ::= <equiv_operator> <trailing_or_null>;
|
|
<leading_ident_expr> ::= <is_operator> NULL;
|
|
|
|
<unknown_func_expr> ::= IDENTIFIER CLOSE_PAREN <rel_operator> <trailing_const_expr>;
|
|
<unknown_func_expr> ::= <typed_constant> CLOSE_PAREN <rel_operator> <trailing_prop_expr>;
|
|
|
|
<trailing_or_null> ::= NULL;
|
|
<trailing_or_null> ::= <trailing_const_expr>;
|
|
<trailing_or_null> ::= <trailing_prop_expr>;
|
|
|
|
<trailing_const_expr> ::= <typed_constant>;
|
|
<trailing_const_expr> ::= IDENTIFIER OPEN_PAREN <typed_constant> CLOSE_PAREN;
|
|
|
|
<typed_constant> ::= VARIANT; // VT_R8, VT_I4, VT_BSTR
|
|
|
|
<finalize> ::= <>;
|
|
// This is just a semantic production in the parser to allow
|
|
// all the important code to be located in one place.
|
|
|
|
<rel_operator> ::= <equiv_operator>;
|
|
<rel_operator> ::= <comp_operator>;
|
|
|
|
<equiv_operator> ::= EQUIVALENT_OPERATOR; // =, !=
|
|
<comp_operator> ::= COMPARE_OPERATOR; // <=, >=, <, >, like
|
|
<is_operator> ::= ISNOT_OPERATOR; // IS, IS NOT
|