第19章 構文

この章では、第4章、第6-10章、第14章および第15章に示されている構文文法と、第3章の字句文法の重要な部分を、第2.4項の表記を使用して繰り返します。

§3 (Lexical Structure)からのプロダクション

識別子:
IdentifierChars ではなく ReservedKeyword または BooleanLiteral または NullLiteral
IdentifierChars:
JavaLetter:
「Javaの文字」である任意のUnicode文字
JavaLetterOrDigit:
「Javaの文字または数字」である任意のUnicode文字
TypeIdentifier:
permitsrecordsealedvarまたはyieldではない識別子
UnqualifiedMethodIdentifier:
yieldではなく識別子

§4 (Types、 Values、 and Variables)からのプロダクション

次のように入力します。
PrimitiveType:
IntegralType:
(いずれか)
byte short int long char
FloatingPointType:
(いずれか)
float double
ClassOrInterfaceType:
InterfaceType:
TypeVariable:
ディメンション:
{注釈} [ ] {{注釈} [ ]}
TypeParameterModifier:
TypeBound:
AdditionalBound:
TypeArguments:
TypeArgumentList:
ワイルドカード:
WildcardBounds:

§6 (名前)からのプロダクション

ExpressionName:
PackageOrTypeName:
AmbiguousName:

§7 (Packages and Modules)からのプロダクション

ModularCompilationUnit:
PackageDeclaration:
PackageModifier:
SingleTypeImportDeclaration:
import タイプ名 ;
TypeImportOnDemandDeclaration:
import PackageOrTypeName . * ;
SingleStaticImportDeclaration:
import static タイプ名 . 識別子 ;
StaticImportOnDemandDeclaration:
import static TypeName . * ;
TopLevelClassOrInterfaceDeclaration:
ModuleDeclaration:
{Annotation} [open] module Identifier {. 識別子} { {ModuleDirective} }
ModuleDirective:
requires {RequiresModifier} ModuleName ;
exports PackageName [to ModuleName {, ModuleName}] ;
opens PackageName [to ModuleName {, ModuleName}] ;
uses TypeName ;
provides TypeName with TypeName {, TypeName} ;
RequiresModifier:
(いずれか)
transitive static

§8 (Classes)のプロダクション

ClassModifier:
(いずれか)
注釈 public protected private
abstract static final sealed non-sealed strictfp
TypeParameters:
TypeParameterList:
ClassExtends:
extends ClassType
ClassImplements:
implements InterfaceTypeList
InterfaceTypeList:
ClassPermits:
permits TypeName {, TypeName}
ClassBody:
FieldModifier:
(いずれか)
Annotation public protected private
static final transient volatile
VariableDeclaratorList:
VariableDeclarator:
VariableDeclaratorId:
VariableInitializer:
UnannPrimitiveType:
NumericType
boolean
UnannClassOrInterfaceType:
UnannInterfaceType:
UnannTypeVariable:
MethodDeclaration:
MethodModifier:
(いずれか)
注釈 public protected private
abstract static final synchronized native strictfp
結果:
UnannType
void
MethodDeclarator:
ReceiverParameter:
FormalParameterList:
VariableArityParameter:
VariableModifier:
注釈
final
スロー:
ExceptionTypeList:
ExceptionType:
MethodBody:
InstanceInitializer:
StaticInitializer:
static ブロック
ConstructorModifier:
(いずれか)
Annotation public protected private
SimpleTypeName:
ConstructorInvocation:
EnumBody:
EnumConstantList:
EnumConstantModifier:
EnumBodyDeclarations:
RecordHeader:
RecordComponentList:
VariableArityRecordComponent:
RecordComponentModifier:
RecordBody:
CompactConstructorDeclaration:

§9 (Interfaces)からのプロダクション

InterfaceModifier:
(いずれか)
注釈 public protected private
abstract static sealed non-sealed strictfp
InterfaceExtends:
InterfacePermits:
permits TypeName {, TypeName}
InterfaceBody:
ConstantModifier:
(いずれか)
Annotation public
static final
InterfaceMethodDeclaration:
InterfaceMethodModifier:
(いずれか)
Annotation public private
abstract default static strictfp
AnnotationInterfaceDeclaration:
AnnotationInterfaceBody:
AnnotationInterfaceElementDeclaration:
AnnotationInterfaceElementModifier:
(いずれか)
注釈 public
abstract
DefaultValue:
defaultElementValue
NormalAnnotation:
ElementValuePairList:
ElementValuePair:
ElementValueArrayInitializer:
{ [ElementValueList] [,] }
ElementValueList:
MarkerAnnotation:
SingleElementAnnotation:

§10 (配列)からのプロダクション

ArrayInitializer:
VariableInitializerList:

§14 (Blocks、 Statements、 and Patterns)からの作品

Block:
BlockStatements:
LocalClassOrInterfaceDeclaration:
LocalVariableDeclarationStatement:
LocalVariableType:
UnannType
var
EmptyStatement:
;
LabeledStatement:
LabeledStatementNoShortIf:
ExpressionStatement:
IfThenStatement:
if ( )
IfThenElseStatement:
if ( ) StatementNoShortIf else
IfThenElseStatementNoShortIf:
AssertStatement:
assert;
assert:;
SwitchStatement:
switch ( ) SwitchBlock
SwitchBlockStatementGroup:
SwitchLabel:
case CaseConstant {, CaseConstant}
case null [, default]
case CasePattern {, CasePattern} [Guard]
default
CaseConstant:
CasePattern:
Guard:
when
WhileStatement:
while ( )
WhileStatementNoShortIf:
DoStatement:
do while ( ) ;
BasicForStatement:
BasicForStatementNoShortIf:
StatementExpressionList:
EnhancedForStatement:
EnhancedForStatementNoShortIf:
BreakStatement:
break [識別子] ;
YieldStatement:
yield ;
ContinueStatement:
continue [識別子] ;
ReturnStatement:
return [] ;
ThrowStatement:
throw ;
SynchronizedStatement:
synchronized ( ) ブロック
CatchClause:
CatchType:
最後に:
finally ブロック
TryWithResourcesStatement:
ResourceSpecification:
( ResourceList [;] )
ResourceList:
VariableAccess:
パターン:
RecordPattern:
ComponentPatternList:
ComponentPattern:
MatchAllPattern:
_

§15 (Expressions)からのプロダクション

ClassLiteral:
TypeName {[ ]} . class
NumericType {[ ]} . class
boolean {[ ]} . class
void . class
UnqualifiedClassInstanceCreationExpression:
ClassOrInterfaceTypeToInstantiate:
TypeArgumentsOrDiamond:
ArrayCreationExpressionWithoutInitializer:
ArrayCreationExpressionWithInitializer:
DimExprs:
DimExpr:
{Annotation} [ ]
FieldAccess:
ArgumentList:
{, }
LambdaExpression:
LambdaParameterType:
UnannType
var
ConciseLambdaParameter:
LambdaBody:
AssignmentExpression:
アサイメント:
AssignmentOperator:
(次のうちの1つ)
=  *=  /=  %=  +=  -=  <<=  >>=  >>>=  &=  ^=  |=
ConditionalOrExpression:
InstanceofExpression:
PreIncrementExpression:
PreDecrementExpression:
PostIncrementExpression:
PostDecrementExpression:
SwitchExpression:
switch ( ) SwitchBlock