Java Reference
In-Depth Information
int
,
char
and
String
Literals
An escape (
ESC
) character in j-- is a
\
followed by
n
,
r
,
t
,
b
,
f
,
'
,
"
, or
\
. In addition to
the
true
,
false
, and
null
literals, j-- supports
int
,
char
, and
String
literals as described
by the following regular expressions:
<int_literal>=0|(1-9){0-9}
<char_literal>='(ESC|~('|\|LF|CR))'
<string_literal>="{ESC|~("|\|LF|CR)}"
B.6.2 Syntactic Grammar
compilationUnit ::= [
package
qualiedIdentier
;
]
f
import
qualiedIdentier
;
g
ftypeDeclarationg
EOF
qualiedIdentier ::=
<identifier>
f
.<identifier>
g
typeDeclaration ::= modifiers classDeclaration
modifiers ::= f
public
j
protected
j
private
j
static
j
abstract
g
classDeclaration ::= class
<identifier>
[
extends
qualiedIdentier] classBody
classBody ::=
{
fmodiers memberDeclg
}
memberDecl ::=
<identifier>
// constructor
formalParameters block
j (
void
j type)
<identifier>
// method
formalParameters (block j
;
)
j type variableDeclarators
;
// field
block ::=
{
fblockStatementg
}
blockStatement ::= localVariableDeclarationStatement
j statement
statement ::= block
j
<identifier>:
statement
j
if
parExpression statement [
else
statement]
j
while
parExpression statement
j
return
[expression]
;
j
;
j statementExpression
;
formalParameters ::=
(
[formalParameter f
,
formalParameterg]
)
formalParameter ::= type
<identifier>
parExpression ::=
(
expression
)
localVariableDeclarationStatement ::= type variableDeclarators
;
Search WWH ::
Custom Search