// BNF used to write the JJT file
// $Id: bnf_ejbql_2_0.txt 15428 2008-10-07 11:20:29Z sauthieg $
// @author Christophe Ney [cney@batisseurs.com]
EJB_QL ::= select_clause from_clause  [ where_clause ] <EOF>
from_clause ::= FROM identification_variable_declaration  [ , identification_variable_declaration ] *
identification_variable_declaration ::= collection_member_declaration | range_variable_declaration
collection_member_declaration ::= IN (collection_valued_path_expression) [ AS ] identifier
range_variable_declaration ::= abstract_schema_name  [ AS ] identifier
//single_valued_path_expression ::= {single_valued_navigation  | identification_variable}.cmp_field | single_valued_navigation
single_valued_path_expression ::= path
//single_valued_navigation ::= identification_variable. [ single_valued_cmr_field. ] * single_valued_cmr_field
single_valued_navigation ::= path
// collection_valued_path_expression ::= identification_variable. [ single_valued_cmr_field. ] *collection_valued_cmr_field
collection_valued_path_expression ::= path
select_clause ::= SELECT  [ DISTINCT ] {single_valued_path_expression | OBJECT (identification_variable)}
where_clause ::= WHERE conditional_expression
conditional_expression ::= conditional_term [ OR conditional_term ]*
conditional_term ::= conditional_factor [ AND conditional_factor ]*
conditional_factor ::= [ NOT ] conditional_test
conditional_test ::= conditional_primary
conditional_primary ::= simple_cond_expression | (conditional_expression)
simple_cond_expression ::= comparison_expression
  | between_expression | like_expression
  | in_expression | null_comparison_expression
  | empty_collection_comparison_expression | collection_member_expression
between_expression ::= arithmetic_expression  [ NOT ] BETWEEN arithmetic_expression AND arithmetic_expression
in_expression ::= single_valued_path_expression  [ NOT ] IN (string_literal  [ , string_literal ] * )
like_expression ::= single_valued_path_expression  [ NOT ] LIKE pattern_value  [ ESCAPE escape_character ]
null_comparison_expression ::= single_valued_path_expression IS  [ NOT ] NULL
empty_collection_comparison_expression ::= collection_valued_path_expression IS  [ NOT ] EMPTY
collection_member_expression ::= {single_valued_navigation | identification_variable | input_parameter}
  [ NOT ] MEMBER  [ OF ] collection_valued_path_expression
comparison_expression ::= string_value { =|<>} string_expression
  | boolean_value { =|<>} boolean_expression
  | datetime_value { = | <> | > | < } datetime_expression
  | entity_bean_value { = | <> } entity_bean_expression
  | arithmetic_value { = | > | >= | < | <= | <> } single_value_designator
arithmetic_value ::= single_valued_path_expression | functions_returning_numerics
single_value_designator ::= scalar_expression
scalar_expression ::= arithmetic_expression
arithmetic_expression ::= arithmetic_term [ { + | - } arithmetic_term ] *
arithmetic_term ::= arithmetic_factor [ { * | / } arithmetic_factor ]*
arithmetic_factor ::= [ + |- ] arithmetic_primary
arithmetic_primary ::= single_valued_path_expression | arithmetic_literal | (arithmetic_expression)
  | input_parameter | functions_returning_numerics
string_value ::= single_valued_path_expression | functions_returning_strings
string_expression ::= string_primary | input_parameter
string_primary ::= single_valued_path_expression | string_literal | (string_expression) | functions_returning_strings
datetime_value ::= single_valued_path_expression
datetime_expression ::= datetime_value | input_parameter
boolean_value ::= single_valued_path_expression
boolean_expression ::= single_valued_path_expression | boolean_literal | input_parameter
entity_bean_value ::= single_valued_navigation | identification_variable
entity_bean_expression ::= entity_bean_value | input_parameter
functions_returning_strings ::= CONCAT (string_expression, string_expression)
  | SUBSTRING (string_expression, arithmetic_expression, arithmetic_expression)
functions_returning_numerics ::= LENGTH (string_expression)
  | LOCATE (string_expression, string_expression [ , arithmetic_expression ] )
  | ABS (arithmetic_expression) | SQRT (arithmetic_expression)
// additional definitions
pattern_value ::= string_literal | input_parameter
boolean_literal ::= TRUE|FALSE
abstract_schema_name ::= id
identification_variable ::= id
identifier ::= id
