C.1 Grammar Notation


The grammar notation is taken from the Java Language Specification:

  • Terminal symbols are shown in bold in the productions of the lexical and syntactic grammars, and throughout this specification whenever the text is directly referring to such a terminal symbol. These are to appear in a program exactly as written.

  • Non-terminal symbols are shown in italic type. The definition of a non-terminal is introduced by the name of the non-terminal being defined, followed by a colon . One or more alternative right sides for the non-terminal then follow on succeeding lines.

  • The suffix "opt," which may appear after a terminal or non-terminal, indicates an optional symbol. The alternative containing the optional symbol actually specifies two right sides, one that omits the optional element and one that includes it.

  • When the words "one of" follow the colon in a grammar definition, they signify that each of the terminal symbols on the following line or lines is an alternative definition.

C.1.1 Parameter declaration

This section describes the syntax of the declareParameters argument.

 
 DeclareParameters:     Parameters ,opt Parameters:     Parameter     Parameters , Parameter Parameter:     Type Identifier 

C.1.2 Variable declaration

This section describes the syntax of the declareVariables argument.

 
 DeclareVariables:     Variables ;opt Variables:     Variable     Variables ; Variable Variable:     Type Identifier 

C.1.3 Import declaration

This section describes the syntax of the declareImports argument.

 
 DeclareImports:     ImportDeclarations ;opt ImportDeclarations:     ImportDeclaration     ImportDeclarations ; ImportDeclaration ImportDeclaration:     import Name     import Name.* 

C.1.4 Ordering specification

This section describes the syntax of the setOrdering argument.

 
 SetOrdering:     OrderSpecifications ,opt OrderSpecifications:     OrderSpecification     OrderSpecifications , OrderSpecification OrderSpecification:     Expression ascending     Expression descending 

C.1.5 Filter expression

This section describes the syntax of the setFilter argument.

Basically, the query filter expression is a Java boolean expression, where some Java expressions are not permitted. Specifically, pre- and post- increment and decrement (++ and - -), shift (>> and <<), and assignment expressions (+=, -=, and so on) are not permitted.

The description is bottom-up; in other words, the last rule Expression is the root of the filter expression syntax.

Please note that the grammar allows arbitrary method calls ( MethodInvocation ), where JDO permits calls only to the methods contains() , isEmpty() , and a number of String methods. This restriction cannot be expressed in terms of the syntax and must be ensured by a semantic check.

 
 Primary:     Literal     this     ( Expression )     FieldAccess     MethodInvocation ArgumentList:     Expression     ArgumentList  ,  Expression FieldAccess:     Primary  .  Identifier MethodInvocation:     Name ( ArgumentListopt )     Primary  .  Identifier ( ArgumentListopt ) PostfixExpression:     Primary     Name UnaryExpression:  +  UnaryExpression  -  UnaryExpression     UnaryExpressionNotPlusMinus UnaryExpressionNotPlusMinus:     PostfixExpression     ~ UnaryExpression     ! UnaryExpression     CastExpression CastExpression:     ( Type ) UnaryExpression MultiplicativeExpression:     UnaryExpression     MultiplicativeExpression * UnaryExpression     MultiplicativeExpression / UnaryExpression AdditiveExpression:     MultiplicativeExpression     AdditiveExpression  +  MultiplicativeExpression     AdditiveExpression  -  MultiplicativeExpression RelationalExpression:     AdditiveExpression     RelationalExpression  <  AdditiveExpression     RelationalExpression  >  AdditiveExpression     RelationalExpression  <=  AdditiveExpression     RelationalExpression  >=  AdditiveExpression EqualityExpression:     RelationalExpression     EqualityExpression == RelationalExpression     EqualityExpression != RelationalExpression AndExpression:     EqualityExpression     AndExpression & EqualityExpression ExclusiveOrExpression:     AndExpression     ExclusiveOrExpression ^ AndExpression InclusiveOrExpression:     ExclusiveOrExpression     InclusiveOrExpression  ExclusiveOrExpression ConditionalAndExpression:     InclusiveOrExpression     ConditionalAndExpression  &&  InclusiveOrExpression ConditionalOrExpression:     ConditionalAndExpression     ConditionalOrExpression   ConditionalAndExpression Expression:     ConditionalOrExpression 

C.1.6 Types

This section describes a type specification used in a parameter or variable declaration or in a cast expression.

 
 Type PrimitiveType Name PrimitiveType:     NumericType  boolean  NumericType:     IntegralType     FloatingPointType IntegralType: one of  byte short int long char  FloatingPointType: one of  float double  

C.1.7 Literals

A literal is the source code representation of a value of a primitive type, the String type, or the null type. Please refer to the Java Language Specification for the lexical structure of IntegerLiterals , FloatingPointLiterals , CharacterLiterals , and StringLiterals .

 
 IntegerLiteral: ... FloatingPointLiteral: ... BooleanLiteral: one of           true false CharacterLiteral: ... StringLiteral: ... NullLiteral:           null Literal:     IntegerLiteral     FloatingPointLiteral     BooleanLiteral     CharacterLiteral     StringLiteral     NullLiteral 

C.1.8 Names

A name is a possible qualified identifier. Please refer to the Java Language Specification for the lexical structure of an identifier.

 
 Name:     Identifier     QualifiedName QualifiedName:     Name  .  Identifier 


Core Java Data Objects
Core Java Data Objects
ISBN: 0131407317
EAN: 2147483647
Year: 2003
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net