com.github.javaparser.GeneratedJavaParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javaparser-core Show documentation
Show all versions of javaparser-core Show documentation
The core parser functionality. This may be all you need.
The newest version!
/* GeneratedJavaParser.java */
/* Generated by: ParserGeneratorCC: Do not edit this line. GeneratedJavaParser.java */
/*
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
* Copyright (C) 2011, 2013-2024 The JavaParser Team.
*
* This file is part of JavaParser.
*
* JavaParser can be used either under the terms of
* a) the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* b) the terms of the Apache License
*
* You should have received a copy of both licenses in LICENCE.LGPL and
* LICENCE.APACHE. Please refer to those files for details.
*
* JavaParser is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
package com.github.javaparser;
import java.io.*;
import java.util.*;
import com.github.javaparser.ast.*;
import com.github.javaparser.ast.body.*;
import com.github.javaparser.ast.comments.*;
import com.github.javaparser.ast.modules.*;
import com.github.javaparser.ast.expr.*;
import com.github.javaparser.ast.stmt.*;
import com.github.javaparser.ast.type.*;
import com.github.javaparser.utils.*;
import static com.github.javaparser.JavaToken.INVALID;
import static com.github.javaparser.ast.Node.Parsedness.UNPARSABLE;
import static com.github.javaparser.utils.Utils.*;
import static com.github.javaparser.ast.NodeList.*;
import static com.github.javaparser.GeneratedJavaParser.*;
import static com.github.javaparser.Range.*;
import static com.github.javaparser.Position.*;
import static com.github.javaparser.ast.type.ArrayType.*;
import static com.github.javaparser.GeneratedJavaParserTokenManagerBase.*;
import static com.github.javaparser.ast.stmt.SwitchEntry.Type.*;
@Generated("JavaCC")
final class GeneratedJavaParser extends GeneratedJavaParserBase implements GeneratedJavaParserConstants {
/* Returns the JavaParser specific token type of the last matched token */
JavaToken token() {
return token.javaToken;
}
/* Returns the last matched token */
Token getCurrentToken() {
return token;
}
/* Changes the amount by which the horizontal position is increased when a tab character is encountered.
One by default.*/
void setTabSize(int size) {
jj_input_stream.setTabSize(size);
}
@Override
GeneratedJavaParserTokenManager getTokenSource() {
return token_source;
}
final public CompilationUnit CompilationUnit() throws ParseException {PackageDeclaration packageDeclaration = null;
NodeList imports = emptyNodeList();
ImportDeclaration in = null;
NodeList> types = emptyNodeList();
ModifierHolder modifier;
TypeDeclaration> typeDeclaration = null;
ModuleDeclaration module = null;
try {
label_1:
while (true) {
if (jj_2_1(2)) {
} else {
break label_1;
}
jj_consume_token(SEMICOLON);
}
if (jj_2_2(2147483647)) {
packageDeclaration = PackageDeclaration();
} else {
;
}
label_2:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case CLASS:
case _DEFAULT:
case ENUM:
case FINAL:
case IMPORT:
case INTERFACE:
case NATIVE:
case NON_SEALED:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOLATILE:
case OPEN:
case MODULE:
case TRANSITIVE:
case SEMICOLON:
case AT:{
break;
}
default:
jj_la1[0] = jj_gen;
break label_2;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case IMPORT:{
in = ImportDeclaration();
imports = add(imports, in);
break;
}
case ABSTRACT:
case CLASS:
case _DEFAULT:
case ENUM:
case FINAL:
case INTERFACE:
case NATIVE:
case NON_SEALED:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOLATILE:
case OPEN:
case MODULE:
case TRANSITIVE:
case SEMICOLON:
case AT:{
modifier = Modifiers();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case CLASS:
case INTERFACE:{
typeDeclaration = ClassOrInterfaceDeclaration(modifier);
types = add(types, typeDeclaration);
break;
}
case RECORD:{
typeDeclaration = RecordDeclaration(modifier);
types = add(types, typeDeclaration);
break;
}
case ENUM:{
typeDeclaration = EnumDeclaration(modifier);
types = add(types, typeDeclaration);
break;
}
case AT:{
typeDeclaration = AnnotationTypeDeclaration(modifier);
types = add(types, typeDeclaration);
break;
}
case OPEN:
case MODULE:{
module = ModuleDeclaration(modifier);
break;
}
case SEMICOLON:{
jj_consume_token(SEMICOLON);
break;
}
default:
jj_la1[1] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
default:
jj_la1[2] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case 0:{
jj_consume_token(0);
break;
}
case CTRL_Z:{
jj_consume_token(CTRL_Z);
break;
}
default:
jj_la1[3] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return new CompilationUnit(range(token_source.getHomeToken(), token()), packageDeclaration, imports, types, module);}
} catch (ParseException e) {
recover(EOF, e);
final CompilationUnit compilationUnit = new CompilationUnit(range(token_source.getHomeToken(), token()), null, new NodeList(), new NodeList>(), null);
compilationUnit.setParsed(UNPARSABLE);
{if ("" != null) return compilationUnit;}
}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-7.html#jls-7.4.1
* {@code
* PackageDeclaration:
* {PackageModifier} package Identifier {. Identifier} ;
* PackageModifier:
* Annotation
* }
*/
final public PackageDeclaration PackageDeclaration() throws ParseException {NodeList annotations = new NodeList();
Name name;
JavaToken begin = INVALID;
AnnotationExpr ann;
label_3:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case AT:{
break;
}
default:
jj_la1[4] = jj_gen;
break label_3;
}
ann = Annotation();
annotations = add(annotations, ann); begin = orIfInvalid(begin, ann);
}
jj_consume_token(PACKAGE);
begin = orIfInvalid(begin, token());
name = Name();
jj_consume_token(SEMICOLON);
{if ("" != null) return new PackageDeclaration(range(begin, token()), annotations, name);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Import declaration types are not differentiated in the class hierarchy.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-7.html#jls-7.5
* {@code
* ImportDeclaration:
* SingleTypeImportDeclaration
* TypeImportOnDemandDeclaration
* SingleStaticImportDeclaration
* StaticImportOnDemandDeclaration
* }
* Note that the JLS terminology "On Demand" and JavaParser terminology "Asterisk" are equivalent
* {@code
* SingleTypeImportDeclaration:
* import TypeName ;
* TypeImportOnDemandDeclaration:
* import PackageOrTypeName . * ;
* SingleStaticImportDeclaration:
* import static TypeName . Identifier ;
* StaticImportOnDemandDeclaration:
* import static TypeName . * ;
* }
*/
final public ImportDeclaration ImportDeclaration() throws ParseException {Name name;
boolean isStatic = false;
boolean isAsterisk = false;
JavaToken begin;
jj_consume_token(IMPORT);
begin = token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case STATIC:{
jj_consume_token(STATIC);
isStatic = true;
break;
}
default:
jj_la1[5] = jj_gen;
;
}
name = Name();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case DOT:{
jj_consume_token(DOT);
jj_consume_token(STAR);
isAsterisk = true;
break;
}
default:
jj_la1[6] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
{if ("" != null) return new ImportDeclaration(range(begin, token()), name, isStatic, isAsterisk);}
throw new IllegalStateException ("Missing return statement in function");
}
/*
* Modifiers. We match all modifiers in a single rule to reduce the chances of
* syntax errors for simple modifier mistakes. It will also enable us to give
* better error messages.
* Class Modifiers: https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.1
* {@code
* ClassModifier:
* (one of)
* Annotation public protected private
* abstract static final strictfp
* }
* Field Modifiers: https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.3.1
* {@code
* FieldModifier:
* (one of)
* Annotation public protected private
* static final transient volatile
* }
* Method Modifiers: https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.4.3
* {@code
* MethodModifier:
* (one of)
* Annotation public protected private
* abstract static final synchronized native strictfp
* }
* Constructor Modifiers: https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.8.3
* {@code
* ConstructorModifier:
* (one of)
* Annotation public protected private
* }
*/
final public ModifierHolder Modifiers() throws ParseException {JavaToken begin = INVALID;
NodeList modifiers = new NodeList();
NodeList annotations = new NodeList();
AnnotationExpr ann;
label_4:
while (true) {
if (jj_2_3(2)) {
} else {
break label_4;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case PUBLIC:{
jj_consume_token(PUBLIC);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.PUBLIC)); begin = orIfInvalid(begin, token());
break;
}
case STATIC:{
jj_consume_token(STATIC);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.STATIC)); begin = orIfInvalid(begin, token());
break;
}
case PROTECTED:{
jj_consume_token(PROTECTED);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.PROTECTED)); begin = orIfInvalid(begin, token());
break;
}
case PRIVATE:{
jj_consume_token(PRIVATE);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.PRIVATE)); begin = orIfInvalid(begin, token());
break;
}
case FINAL:{
jj_consume_token(FINAL);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.FINAL)); begin = orIfInvalid(begin, token());
break;
}
case ABSTRACT:{
jj_consume_token(ABSTRACT);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.ABSTRACT)); begin = orIfInvalid(begin, token());
break;
}
case SYNCHRONIZED:{
jj_consume_token(SYNCHRONIZED);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.SYNCHRONIZED)); begin = orIfInvalid(begin, token());
break;
}
case NATIVE:{
jj_consume_token(NATIVE);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.NATIVE)); begin = orIfInvalid(begin, token());
break;
}
case TRANSIENT:{
jj_consume_token(TRANSIENT);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.TRANSIENT)); begin = orIfInvalid(begin, token());
break;
}
case VOLATILE:{
jj_consume_token(VOLATILE);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.VOLATILE)); begin = orIfInvalid(begin, token());
break;
}
case STRICTFP:{
jj_consume_token(STRICTFP);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.STRICTFP)); begin = orIfInvalid(begin, token());
break;
}
case TRANSITIVE:{
jj_consume_token(TRANSITIVE);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.TRANSITIVE)); begin = orIfInvalid(begin, token());
break;
}
case _DEFAULT:{
jj_consume_token(_DEFAULT);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.DEFAULT)); begin = orIfInvalid(begin, token());
break;
}
case SEALED:{
jj_consume_token(SEALED);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.SEALED)); begin = orIfInvalid(begin, token());
break;
}
case NON_SEALED:{
jj_consume_token(NON_SEALED);
add(modifiers, new Modifier(tokenRange(), Modifier.Keyword.NON_SEALED)); begin = orIfInvalid(begin, token());
break;
}
case AT:{
ann = Annotation();
annotations = add(annotations, ann); begin = orIfInvalid(begin, ann);
break;
}
default:
jj_la1[7] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return new ModifierHolder(begin, modifiers, annotations);}
throw new IllegalStateException ("Missing return statement in function");
}
/*
* Declaration syntax follows.
*/
/**
*
* Note that this grammar is deliberately permissive. As a result, this grammar allows any combinations of
* class/interface and extends/implements (e.g. an interface implementing an interface).
*
* Validations of these combinations are handled at the same time as validating language features used.
* Also note that JavaParser handles the hierarchy/specialisations of classes, interfaces, and enums differently to the JLS.
*
* - This {@code ClassOrInterfaceDeclaration} refers to the {@code NormalClassDeclaration} and {@code NormalInterfaceDeclaration},
* - while {@code AnnotationTypeDeclaration}, {@code EnumDeclaration}, and {@code RecordDeclaration} are handled separately within this grammar.
*
* https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.1
* {@code
* ClassDeclaration:
* NormalClassDeclaration
* EnumDeclaration
* RecordDeclaration
* NormalClassDeclaration:
* {ClassModifier} class TypeIdentifier [TypeParameters] [Superclass] [Superinterfaces] ClassBody
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-9.html#jls-9.1
* {@code
* InterfaceDeclaration:
* NormalInterfaceDeclaration
* AnnotationTypeDeclaration
* NormalInterfaceDeclaration:
* {InterfaceModifier} interface TypeIdentifier [TypeParameters] [ExtendsInterfaces] InterfaceBody
* }
*/
final public ClassOrInterfaceDeclaration ClassOrInterfaceDeclaration(ModifierHolder modifier) throws ParseException {boolean isInterface;
SimpleName name;
RangedList typePar = new RangedList(emptyNodeList());
NodeList extList = emptyNodeList();
NodeList impList = emptyNodeList();
NodeList permitsList = emptyNodeList();
NodeList> members = emptyNodeList();
JavaToken begin = modifier.begin;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case CLASS:{
jj_consume_token(CLASS);
isInterface = false;
break;
}
case INTERFACE:{
jj_consume_token(INTERFACE);
isInterface = true;
break;
}
default:
jj_la1[8] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
begin = orIfInvalid(begin, token());
name = SimpleName();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typePar = TypeParameters();
break;
}
default:
jj_la1[9] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case EXTENDS:{
extList = ExtendsList();
break;
}
default:
jj_la1[10] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case IMPLEMENTS:{
impList = ImplementsList();
break;
}
default:
jj_la1[11] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case PERMITS:{
permitsList = PermitsList();
break;
}
default:
jj_la1[12] = jj_gen;
;
}
members = ClassOrInterfaceBody();
{if ("" != null) return new ClassOrInterfaceDeclaration(range(begin, token()), modifier.modifiers, modifier.annotations, isInterface, name, typePar.list, extList, impList, permitsList, members);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.10
* {@code
* RecordDeclaration:
* {ClassModifier} `record` TypeIdentifier [TypeParameters]
* RecordHeader [ClassImplements] RecordBody
*
* RecordHeader:
* `(` [RecordComponentList] `)`
*
* RecordComponentList:
* RecordComponent { `,` RecordComponent}
*
* RecordComponent:
* {RecordComponentModifier} UnannType Identifier
* VariableArityRecordComponent
*
* VariableArityRecordComponent:
* {RecordComponentModifier} UnannType {Annotation} `...` Identifier
*
* RecordComponentModifier:
* Annotation
*
* RecordBody:
* `{` {RecordBodyDeclaration} `}`
*
* RecordBodyDeclaration:
* ClassBodyDeclaration
* CompactConstructorDeclaration
*
* CompactConstructorDeclaration:
* {ConstructorModifier} SimpleTypeName ConstructorBody
* }
*/
final public
RecordDeclaration RecordDeclaration(ModifierHolder modifier) throws ParseException {SimpleName name;
Pair, ReceiverParameter> parameters;
RangedList typePar = new RangedList(emptyNodeList());
NodeList impList = emptyNodeList();
NodeList> members = emptyNodeList();
JavaToken begin = modifier.begin;
jj_consume_token(RECORD);
begin = orIfInvalid(begin, token());
name = SimpleName();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typePar = TypeParameters();
break;
}
default:
jj_la1[13] = jj_gen;
;
}
parameters = Parameters();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case IMPLEMENTS:{
impList = ImplementsList();
break;
}
default:
jj_la1[14] = jj_gen;
;
}
members = RecordBody();
{if ("" != null) return new RecordDeclaration(range(begin, token()), modifier.modifiers, modifier.annotations, name, parameters.a, typePar.list, impList, members, parameters.b);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.4
* {@code
* Superclass:
* extends ClassType
* }
* For convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.3
* {@code
* ClassOrInterfaceType:
* ClassType
* InterfaceType
* ClassType:
* {Annotation} TypeIdentifier [TypeArguments]
* PackageName . {Annotation} TypeIdentifier [TypeArguments]
* ClassOrInterfaceType . {Annotation} TypeIdentifier [TypeArguments]
* InterfaceType:
* ClassType
* }
*/
final public NodeList ExtendsList() throws ParseException {boolean extendsMoreThanOne = false;
NodeList ret = new NodeList();
ClassOrInterfaceType cit;
jj_consume_token(EXTENDS);
cit = AnnotatedClassOrInterfaceType();
ret.add(cit);
label_5:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[15] = jj_gen;
break label_5;
}
jj_consume_token(COMMA);
cit = AnnotatedClassOrInterfaceType();
ret.add(cit); extendsMoreThanOne = true;
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.5
* {@code
* Superinterfaces:
* implements InterfaceTypeList
* InterfaceTypeList:
* InterfaceType {, InterfaceType}
* }
* For convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.3
* {@code
* ClassOrInterfaceType:
* ClassType
* InterfaceType
* ClassType:
* {Annotation} TypeIdentifier [TypeArguments]
* PackageName . {Annotation} TypeIdentifier [TypeArguments]
* ClassOrInterfaceType . {Annotation} TypeIdentifier [TypeArguments]
* InterfaceType:
* ClassType
* }
*/
final public NodeList ImplementsList() throws ParseException {NodeList ret = new NodeList();
ClassOrInterfaceType cit;
jj_consume_token(IMPLEMENTS);
cit = AnnotatedClassOrInterfaceType();
ret.add(cit);
label_6:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[16] = jj_gen;
break label_6;
}
jj_consume_token(COMMA);
cit = AnnotatedClassOrInterfaceType();
ret.add(cit);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.5
* {@code
* ClassPermits:
* permits TypeName {, TypeName}
* }
* For convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.3
* {@code
* ClassOrInterfaceType:
* ClassType
* InterfaceType
* ClassType:
* {Annotation} TypeIdentifier [TypeArguments]
* PackageName . {Annotation} TypeIdentifier [TypeArguments]
* ClassOrInterfaceType . {Annotation} TypeIdentifier [TypeArguments]
* InterfaceType:
* ClassType
* }
*/
final public NodeList PermitsList() throws ParseException {NodeList ret = new NodeList();
ClassOrInterfaceType cit;
jj_consume_token(PERMITS);
cit = AnnotatedClassOrInterfaceType();
ret.add(cit);
label_7:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[17] = jj_gen;
break label_7;
}
jj_consume_token(COMMA);
cit = AnnotatedClassOrInterfaceType();
ret.add(cit);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.9
* {@code
* EnumDeclaration:
* {ClassModifier} enum TypeIdentifier [Superinterfaces] EnumBody
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.9.1
* {@code
* EnumBody:
* { [EnumConstantList] [,] [EnumBodyDeclarations] }
* EnumConstantList:
* EnumConstant {, EnumConstant}
* EnumConstant:
* {EnumConstantModifier} Identifier [( [ArgumentList] )] [ClassBody]
* EnumConstantModifier:
* Annotation
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.9.2
* {@code
* EnumBodyDeclarations:
* ; {ClassBodyDeclaration}
* }
*/
final public EnumDeclaration EnumDeclaration(ModifierHolder modifier) throws ParseException {SimpleName name;
NodeList impList = emptyNodeList();
EnumConstantDeclaration entry;
NodeList entries = emptyNodeList();
BodyDeclaration> member;
NodeList> members = emptyNodeList();
JavaToken begin = modifier.begin;
jj_consume_token(ENUM);
begin = orIfInvalid(begin, token());
name = SimpleName();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case IMPLEMENTS:{
impList = ImplementsList();
break;
}
default:
jj_la1[18] = jj_gen;
;
}
jj_consume_token(LBRACE);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:{
entry = EnumConstantDeclaration();
entries.add(entry);
label_8:
while (true) {
if (jj_2_4(2)) {
} else {
break label_8;
}
jj_consume_token(COMMA);
entry = EnumConstantDeclaration();
entries.add(entry);
}
break;
}
default:
jj_la1[19] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
jj_consume_token(COMMA);
break;
}
default:
jj_la1[20] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case SEMICOLON:{
jj_consume_token(SEMICOLON);
label_9:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case CLASS:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case INTERFACE:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case LBRACE:
case SEMICOLON:
case AT:
case LT:{
break;
}
default:
jj_la1[21] = jj_gen;
break label_9;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case CLASS:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case INTERFACE:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case LBRACE:
case AT:
case LT:{
member = ClassOrInterfaceBodyDeclaration();
members = add(members, member);
break;
}
case SEMICOLON:{
jj_consume_token(SEMICOLON);
break;
}
default:
jj_la1[22] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
break;
}
default:
jj_la1[23] = jj_gen;
;
}
jj_consume_token(RBRACE);
{if ("" != null) return new EnumDeclaration(range(begin, token()), modifier.modifiers, modifier.annotations, name, impList, entries, members);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note that the {@code EnumConstantModifier} is defined as an {@code Annotation}.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.9.1
* {@code
* EnumConstant:
* {EnumConstantModifier} Identifier [( [ArgumentList] )] [ClassBody]
* EnumConstantModifier:
* Annotation
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.9.2
* {@code
* EnumBodyDeclarations:
* ; {ClassBodyDeclaration}
* }
*/
final public EnumConstantDeclaration EnumConstantDeclaration() throws ParseException {NodeList annotations = new NodeList();
AnnotationExpr ann;
SimpleName name;
NodeList args = emptyNodeList();
NodeList> classBody = emptyNodeList();
JavaToken begin = INVALID;
label_10:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case AT:{
break;
}
default:
jj_la1[24] = jj_gen;
break label_10;
}
ann = Annotation();
annotations = add(annotations, ann); begin = orIfInvalid(begin, ann);
}
name = SimpleName();
begin = orIfInvalid(begin, token());
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LPAREN:{
args = Arguments();
break;
}
default:
jj_la1[25] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LBRACE:{
classBody = ClassOrInterfaceBody();
break;
}
default:
jj_la1[26] = jj_gen;
;
}
{if ("" != null) return new EnumConstantDeclaration(range(begin, token()), annotations, name, args, classBody);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* If the list inside the returned RangedList is null, there are no brackets.
* If it is empty, there are brackets, but nothing is in them <>.
* The normal case is that it contains TypeParameters, like .
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.2
* {@code
* TypeParameters:
* < TypeParameterList >
* TypeParameterList:
* TypeParameter {, TypeParameter}
* }
* For Convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.4
* {@code
* TypeParameter:
* {TypeParameterModifier} TypeIdentifier [TypeBound]
* TypeParameterModifier:
* Annotation
* TypeBound:
* extends TypeVariable
* extends ClassOrInterfaceType {AdditionalBound}
* AdditionalBound:
* & InterfaceType
* }
*/
final public RangedList TypeParameters() throws ParseException {RangedList ret = new RangedList(new NodeList());
TypeParameter tp;
NodeList annotations;
jj_consume_token(LT);
ret.beginAt(token());
annotations = Annotations();
tp = TypeParameter(annotations);
ret.add(tp); annotations = null;
label_11:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[27] = jj_gen;
break label_11;
}
jj_consume_token(COMMA);
annotations = Annotations();
tp = TypeParameter(annotations);
ret.add(tp); annotations = null;
}
jj_consume_token(GT);
ret.endAt(token());
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note that the {@code TypeParameterModifier} is defined as an {@code Annotation}.
* Note that the annotations are passed as a parameter to this grammar entry.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.4
* {@code
* TypeParameter:
* {TypeParameterModifier} TypeIdentifier [TypeBound]
* TypeParameterModifier:
* Annotation
* TypeBound:
* extends TypeVariable
* extends ClassOrInterfaceType {AdditionalBound}
* AdditionalBound:
* & InterfaceType
* }
*/
final public TypeParameter TypeParameter(NodeList annotations) throws ParseException {SimpleName name;
NodeList typeBound = emptyNodeList();
JavaToken begin;
// Annotations are passed as a parameter to this grammar entry.
name = SimpleName();
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case EXTENDS:{
typeBound = TypeBound();
break;
}
default:
jj_la1[28] = jj_gen;
;
}
{if ("" != null) return new TypeParameter(range(begin, token()), name, typeBound, annotations);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.4
* {@code
* TypeBound:
* extends TypeVariable
* extends ClassOrInterfaceType {AdditionalBound}
* AdditionalBound:
* & InterfaceType
* }
* For Convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.3
* {@code
* ClassOrInterfaceType:
* ClassType
* InterfaceType
* ClassType:
* {Annotation} TypeIdentifier [TypeArguments]
* PackageName . {Annotation} TypeIdentifier [TypeArguments]
* ClassOrInterfaceType . {Annotation} TypeIdentifier [TypeArguments]
* InterfaceType:
* ClassType
* TypeVariable:
* {Annotation} TypeIdentifier
* }
*/
final public NodeList TypeBound() throws ParseException {NodeList ret = emptyNodeList();
ClassOrInterfaceType cit;
jj_consume_token(EXTENDS);
cit = AnnotatedClassOrInterfaceType();
ret.add(cit);
label_12:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BIT_AND:{
break;
}
default:
jj_la1[29] = jj_gen;
break label_12;
}
jj_consume_token(BIT_AND);
cit = AnnotatedClassOrInterfaceType();
ret.add(cit);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.6
* {@code
* ClassBody:
* { {ClassBodyDeclaration} }
* ClassBodyDeclaration:
* ClassMemberDeclaration
* InstanceInitializer
* StaticInitializer
* ConstructorDeclaration
* ClassMemberDeclaration:
* FieldDeclaration
* MethodDeclaration
* ClassDeclaration
* InterfaceDeclaration
* ;
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-9.html#jls-9.1.4
* {@code
* InterfaceBody:
* { {InterfaceMemberDeclaration} }
* InterfaceMemberDeclaration:
* ConstantDeclaration
* InterfaceMethodDeclaration
* ClassDeclaration
* InterfaceDeclaration
* ;
* }
*/
final public NodeList> ClassOrInterfaceBody() throws ParseException {NodeList> ret = emptyNodeList();
BodyDeclaration member;
jj_consume_token(LBRACE);
label_13:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case CLASS:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case INTERFACE:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case LBRACE:
case SEMICOLON:
case AT:
case LT:{
break;
}
default:
jj_la1[30] = jj_gen;
break label_13;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case CLASS:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case INTERFACE:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case LBRACE:
case AT:
case LT:{
member = ClassOrInterfaceBodyDeclaration();
ret.add(member);
break;
}
case SEMICOLON:{
jj_consume_token(SEMICOLON);
break;
}
default:
jj_la1[31] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
jj_consume_token(RBRACE);
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Everything that can go into a "regular" class or interface declaration,
* can also (usually) be included within a record.
* Exceptions to this are handled within the validators.
*
* Note: This is HEAVILY based on ClassOrInterfaceBody() and ClassOrInterfaceBodyDeclaration(),
* and there may be some scope/potential to optimise this and merge some parts together.
*
* https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-8.10.2
*/
final public NodeList> RecordBody() throws ParseException {NodeList> ret = emptyNodeList();
BodyDeclaration member;
jj_consume_token(LBRACE);
label_14:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case CLASS:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case INTERFACE:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case LBRACE:
case SEMICOLON:
case AT:
case LT:{
break;
}
default:
jj_la1[32] = jj_gen;
break label_14;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case CLASS:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case INTERFACE:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case LBRACE:
case AT:
case LT:{
member = RecordBodyDeclaration();
ret.add(member);
break;
}
case SEMICOLON:{
jj_consume_token(SEMICOLON);
break;
}
default:
jj_la1[33] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
jj_consume_token(RBRACE);
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Almost identical to ClassOrInterfaceBodyDeclaration, but:
* - with a CompactConstructorDeclaration
* As a result, there may be some scope/potential to optimize this and merge some parts together.
*
* https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-8.10.2
* {@code
* RecordBody:
* { {RecordBodyDeclaration} }
* RecordBodyDeclaration:
* ClassBodyDeclaration
* CompactConstructorDeclaration
* }
*
* For convenience:
* https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-8.10.2
* {@code
* ClassBodyDeclaration:
* ClassMemberDeclaration
* InstanceInitializer
* StaticInitializer
* ConstructorDeclaration
* ClassMemberDeclaration:
* FieldDeclaration
* MethodDeclaration
* ClassDeclaration
* InterfaceDeclaration
* ;
* }
*/
final public BodyDeclaration> RecordBodyDeclaration() throws ParseException {ModifierHolder modifiers;
BodyDeclaration> ret;
if (jj_2_11(2)) {
ret = InitializerDeclaration();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case CLASS:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case INTERFACE:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:
case LT:{
// Just get all the modifiers out of the way. If you want to do
// more checks, pass the modifiers down to the member
modifiers = Modifiers();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case CLASS:
case INTERFACE:{
ret = ClassOrInterfaceDeclaration(modifiers);
break;
}
default:
jj_la1[34] = jj_gen;
if (jj_2_5(2147483647)) {
ret = EnumDeclaration(modifiers);
} else if (jj_2_6(2147483647)) {
ret = RecordDeclaration(modifiers);
} else if (jj_2_7(2147483647)) {
ret = AnnotationTypeDeclaration(modifiers);
} else if (jj_2_8(2147483647)) {
ret = CompactConstructorDeclaration(modifiers);
} else if (jj_2_9(2147483647)) {
ret = ConstructorDeclaration(modifiers);
} else if (jj_2_10(2147483647)) {
ret = FieldDeclaration(modifiers);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FLOAT:
case INT:
case LONG:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:
case LT:{
ret = MethodDeclaration(modifiers);
break;
}
default:
jj_la1[35] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
break;
}
default:
jj_la1[36] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://openjdk.java.net/jeps/359#Grammar
* {@code
* CompactConstructorDeclaration:
* {Annotation} {ConstructorModifier} [TypeParameters] SimpleTypeName
* [Throws] ConstructorBody
* }
*/
final public CompactConstructorDeclaration CompactConstructorDeclaration(ModifierHolder modifier) throws ParseException {RangedList typeParameters = new RangedList(emptyNodeList());
SimpleName name;
Pair, ReceiverParameter> parameters = new Pair, ReceiverParameter>(emptyNodeList(), null);
NodeList throws_ = emptyNodeList();
ExplicitConstructorInvocationStmt exConsInv = null;
NodeList stmts = emptyNodeList();
JavaToken begin = modifier.begin;
JavaToken blockBegin = INVALID;
ReferenceType throwType;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeParameters = TypeParameters();
begin = orIfInvalid(begin, typeParameters.range.getBegin());
break;
}
default:
jj_la1[37] = jj_gen;
;
}
// Modifiers matched in the caller
name = SimpleName();
begin = orIfInvalid(begin, typeParameters.range.getBegin()); begin = orIfInvalid(begin, token());
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case THROWS:{
jj_consume_token(THROWS);
throwType = AnnotatedReferenceType();
throws_ = add(throws_, throwType);
label_15:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[38] = jj_gen;
break label_15;
}
jj_consume_token(COMMA);
throwType = AnnotatedReferenceType();
throws_ = add(throws_, throwType);
}
break;
}
default:
jj_la1[39] = jj_gen;
;
}
jj_consume_token(LBRACE);
blockBegin=token();
if (jj_2_12(2147483647)) {
exConsInv = ExplicitConstructorInvocation();
} else {
;
}
stmts = Statements();
jj_consume_token(RBRACE);
if (exConsInv != null) {
stmts = prepend(stmts, exConsInv);
}
{if ("" != null) return new CompactConstructorDeclaration(range(begin, token()), modifier.modifiers, modifier.annotations, typeParameters.list, name, throws_, new BlockStmt(range(blockBegin, token()), stmts));}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note that {@code ClassDeclaration} and {@code InterfaceDeclaration} (in the JLS) include enum and annotation declarations.
* Note that {@code InstanceInitializer} and {@code StaticInitializer} are treated as an {@code Initializer} with an
* optional {@code static} modifier in JavaParser.
* TODO: Investigate the {@code ClassBodyDeclaration} parts existing within an interface - is permitting this a potential problem?
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.6
* {@code
* ClassBody:
* { {ClassBodyDeclaration} }
* ClassBodyDeclaration:
* ClassMemberDeclaration
* InstanceInitializer
* StaticInitializer
* ConstructorDeclaration
* ClassMemberDeclaration:
* FieldDeclaration
* MethodDeclaration
* ClassDeclaration
* InterfaceDeclaration
* ;
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-9.html#jls-9.1.4
* {@code
* InterfaceBody:
* { {InterfaceMemberDeclaration} }
* InterfaceMemberDeclaration:
* ConstantDeclaration
* InterfaceMethodDeclaration
* ClassDeclaration
* InterfaceDeclaration
* ;
* }
*/
final public BodyDeclaration> ClassOrInterfaceBodyDeclaration() throws ParseException {ModifierHolder modifiers;
BodyDeclaration> ret;
if (jj_2_18(2)) {
ret = InitializerDeclaration();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case CLASS:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case INTERFACE:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:
case LT:{
// Just get all the modifiers out of the way. If you want to do
// more checks, pass the modifiers down to the member
modifiers = Modifiers();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case CLASS:
case INTERFACE:{
ret = ClassOrInterfaceDeclaration(modifiers);
break;
}
default:
jj_la1[40] = jj_gen;
if (jj_2_13(2147483647)) {
ret = RecordDeclaration(modifiers);
} else if (jj_2_14(2147483647)) {
ret = EnumDeclaration(modifiers);
} else if (jj_2_15(2147483647)) {
ret = AnnotationTypeDeclaration(modifiers);
} else if (jj_2_16(2147483647)) {
ret = ConstructorDeclaration(modifiers);
} else if (jj_2_17(2147483647)) {
ret = FieldDeclaration(modifiers);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FLOAT:
case INT:
case LONG:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:
case LT:{
ret = MethodDeclaration(modifiers);
break;
}
default:
jj_la1[41] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
break;
}
default:
jj_la1[42] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.3
* {@code
* FieldDeclaration:
* {FieldModifier} UnannType VariableDeclaratorList ;
* VariableDeclaratorList:
* VariableDeclarator {, VariableDeclarator}
* VariableDeclarator:
* VariableDeclaratorId [= VariableInitializer]
* VariableDeclaratorId:
* Identifier [Dims]
* VariableInitializer:
* Expression
* ArrayInitializer
* }
*/
final public FieldDeclaration FieldDeclaration(ModifierHolder modifier) throws ParseException {Type partialType;
NodeList variables = new NodeList();
VariableDeclarator val;
// Modifiers are already matched in the caller
partialType = Type(emptyNodeList());
val = VariableDeclarator(partialType);
variables.add(val);
label_16:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[43] = jj_gen;
break label_16;
}
jj_consume_token(COMMA);
val = VariableDeclarator(partialType);
variables.add(val);
}
jj_consume_token(SEMICOLON);
JavaToken begin = orIfInvalid(modifier.begin, partialType);
{if ("" != null) return new FieldDeclaration(range(begin, token()), modifier.modifiers, modifier.annotations, variables);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.3
* {@code
* VariableDeclarator:
* VariableDeclaratorId [= VariableInitializer]
* VariableDeclaratorId:
* Identifier [Dims]
* VariableInitializer:
* Expression
* ArrayInitializer
* }
*/
final public VariableDeclarator VariableDeclarator(Type partialType) throws ParseException {Pair> id;
Expression init = null;
id = VariableDeclaratorId();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ASSIGN:{
jj_consume_token(ASSIGN);
init = VariableInitializer();
break;
}
default:
jj_la1[44] = jj_gen;
;
}
{if ("" != null) return new VariableDeclarator(range(id.a, token()), juggleArrayType(partialType, id.b), id.a, init);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.3
* {@code
* VariableDeclaratorId:
* Identifier [Dims]
* }
* For convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-Identifier
* {@code
* Identifier:
* IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral
* IdentifierChars:
* JavaLetter {JavaLetterOrDigit}
* JavaLetter:
* any Unicode character that is a "Java letter"
* JavaLetterOrDigit:
* any Unicode character that is a "Java letter-or-digit"
* }
* For convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-Dims
* {@code
* Dims:
* {Annotation} [ ] {{Annotation} [ ]}
* }
*/
final public Pair> VariableDeclaratorId() throws ParseException {SimpleName name;
JavaToken begin;
ArrayBracketPair arrayBracketPair;
List arrayBracketPairs = new ArrayList(0);
name = SimpleName();
begin=token();
label_17:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LBRACKET:
case AT:{
break;
}
default:
jj_la1[45] = jj_gen;
break label_17;
}
arrayBracketPair = ArrayBracketPair(Origin.NAME);
arrayBracketPairs=add(arrayBracketPairs, arrayBracketPair);
}
if(storeTokens) {
name.setTokenRange(name.getTokenRange().get().withEnd(token()));
}
{if ("" != null) return new Pair(name, arrayBracketPairs);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.3
* {@code
* VariableInitializer:
* Expression
* ArrayInitializer
* }
*/
final public Expression VariableInitializer() throws ParseException {Expression ret;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LBRACE:{
ret = ArrayInitializer();
break;
}
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
ret = Expression();
break;
}
default:
jj_la1[46] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* An array initializer is written as a comma-separated list of expressions, enclosed by braces { and }.
* A trailing comma may appear after the last expression in an array initializer and is ignored.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-10.html#jls-10.6
* {@code
* ArrayInitializer:
* { [VariableInitializerList] [,] }
* VariableInitializerList:
* VariableInitializer {, VariableInitializer}
* }
* {@code
* VariableInitializer:
* Expression
* ArrayInitializer
* }
*/
final public ArrayInitializerExpr ArrayInitializer() throws ParseException {NodeList values = emptyNodeList();
Expression val;
JavaToken begin;
jj_consume_token(LBRACE);
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case LBRACE:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
val = VariableInitializer();
values = add(values, val);
label_18:
while (true) {
if (jj_2_19(2)) {
} else {
break label_18;
}
jj_consume_token(COMMA);
val = VariableInitializer();
values = add(values, val);
}
break;
}
default:
jj_la1[47] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
jj_consume_token(COMMA);
break;
}
default:
jj_la1[48] = jj_gen;
;
}
jj_consume_token(RBRACE);
{if ("" != null) return new ArrayInitializerExpr(range(begin, token()), values);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.4
* {@code
* MethodDeclaration:
* {MethodModifier} MethodHeader MethodBody
* MethodHeader:
* Result MethodDeclarator [Throws]
* TypeParameters {Annotation} Result MethodDeclarator [Throws]
* MethodDeclarator:
* Identifier ( [ReceiverParameter ,] [FormalParameterList] ) [Dims]
* ReceiverParameter:
* {Annotation} UnannType [Identifier .] this
* }
*/
final public MethodDeclaration MethodDeclaration(ModifierHolder modifier) throws ParseException {RangedList typeParameters = new RangedList(emptyNodeList());
Type type;
SimpleName name;
Pair, ReceiverParameter> parameters = new Pair, ReceiverParameter>(emptyNodeList(), null);
ArrayBracketPair arrayBracketPair;
List arrayBracketPairs = new ArrayList(0);
NodeList throws_ = emptyNodeList();
BlockStmt body = null;
NodeList annotations;
JavaToken begin = modifier.begin;
ReferenceType throwType;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeParameters = TypeParameters();
begin = orIfInvalid(begin, typeParameters.range.getBegin());
break;
}
default:
jj_la1[49] = jj_gen;
;
}
annotations = Annotations();
modifier.annotations.addAll(annotations); begin = orIfInvalid(begin, nodeListBegin(annotations));
type = ResultType(emptyNodeList());
begin = orIfInvalid(begin, type);
name = SimpleName();
parameters = Parameters();
label_19:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LBRACKET:
case AT:{
break;
}
default:
jj_la1[50] = jj_gen;
break label_19;
}
arrayBracketPair = ArrayBracketPair(Origin.NAME);
arrayBracketPairs=add(arrayBracketPairs, arrayBracketPair);
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case THROWS:{
jj_consume_token(THROWS);
throwType = AnnotatedReferenceType();
throws_ = add(throws_, throwType);
label_20:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[51] = jj_gen;
break label_20;
}
jj_consume_token(COMMA);
throwType = AnnotatedReferenceType();
throws_ = add(throws_, throwType);
}
break;
}
default:
jj_la1[52] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LBRACE:{
body = Block();
break;
}
case SEMICOLON:{
jj_consume_token(SEMICOLON);
break;
}
default:
jj_la1[53] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
type = juggleArrayType(type, arrayBracketPairs);
{if ("" != null) return new MethodDeclaration(range(begin, token()), modifier.modifiers, modifier.annotations, typeParameters.list, type, name, parameters.a, throws_, body, parameters.b);}
throw new IllegalStateException ("Missing return statement in function");
}
// TODO: JLS Has type and unannotated type, while JavaParser has type and annotated type.
final public ReferenceType AnnotatedReferenceType() throws ParseException {NodeList annotations;
ReferenceType type;
annotations = Annotations();
type = ReferenceType(annotations);
{if ("" != null) return type;}
throw new IllegalStateException ("Missing return statement in function");
}
// TODO: JLS Has type and unannotated type, while JavaParser has type and annotated type.
final public Type AnnotatedType() throws ParseException {NodeList annotations;
Type type;
annotations = Annotations();
type = Type(annotations);
{if ("" != null) return type;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* The JLS refers to parameters as {@code FormalParameter}.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.4.1
* {@code
* FormalParameterList:
* FormalParameter {, FormalParameter}
* FormalParameter:
* {VariableModifier} UnannType VariableDeclaratorId
* VariableArityParameter
* VariableArityParameter:
* {VariableModifier} UnannType {Annotation} ... Identifier
* VariableModifier:
* Annotation
* final
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.4
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-ReceiverParameter
* {@code
* MethodDeclarator:
* Identifier ( [ReceiverParameter ,] [FormalParameterList] ) [Dims]
* ReceiverParameter:
* {Annotation} UnannType [Identifier .] this
* }
*/
final public Pair, ReceiverParameter> Parameters() throws ParseException {NodeList ret = emptyNodeList();
Parameter par;
ReceiverParameter rp = null;
jj_consume_token(LPAREN);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:{
if (jj_2_20(2147483647)) {
rp = ReceiverParameter();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:{
par = Parameter();
ret = add(ret, par);
break;
}
default:
jj_la1[54] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
label_21:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[55] = jj_gen;
break label_21;
}
jj_consume_token(COMMA);
par = Parameter();
ret = add(ret, par);
}
break;
}
default:
jj_la1[56] = jj_gen;
;
}
jj_consume_token(RPAREN);
{if ("" != null) return new Pair(ret, rp);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note: Similar, but not identical to, {@code FormalParameter}.
* Note: Distinction between {@code LambdaParameters} and {@code InferredLambdaParameters} is presence of types.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.27.1
* {@code
* LambdaParameters:
* ( [LambdaParameterList] )
* Identifier
* LambdaParameterList:
* LambdaParameter {, LambdaParameter}
* Identifier {, Identifier}
* LambdaParameter:
* {VariableModifier} LambdaParameterType VariableDeclaratorId
* VariableArityParameter
* LambdaParameterType:
* UnannType
* var
* }
* For Convenience:
* {@code
* VariableArityParameter:
* {VariableModifier} UnannType {Annotation} ... Identifier
* VariableModifier:
* Annotation
* final
* VariableDeclaratorId:
* Identifier [Dims]
* Dims:
* {Annotation} [ ] {{Annotation} [ ]}
* }
*/
final public NodeList LambdaParameters() throws ParseException {NodeList ret = null;
Parameter par;
par = Parameter();
ret = add(ret, par);
label_22:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[57] = jj_gen;
break label_22;
}
jj_consume_token(COMMA);
par = Parameter();
ret = add(ret, par);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note: Similar, but not identical to, {@code FormalParameter}.
* Note: Distinction between {@code LambdaParameters} and {@code InferredLambdaParameters} is presence of types.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.27.1
* {@code
* LambdaParameters:
* ( [LambdaParameterList] )
* Identifier
* LambdaParameterList:
* LambdaParameter {, LambdaParameter}
* Identifier {, Identifier}
* LambdaParameter:
* {VariableModifier} LambdaParameterType VariableDeclaratorId
* VariableArityParameter
* LambdaParameterType:
* UnannType
* var
* }
* For Convenience:
* {@code
* VariableArityParameter:
* {VariableModifier} UnannType {Annotation} ... Identifier
* VariableModifier:
* Annotation
* final
* VariableDeclaratorId:
* Identifier [Dims]
* Dims:
* {Annotation} [ ] {{Annotation} [ ]}
* }
*/
final public NodeList InferredLambdaParameters() throws ParseException {NodeList ret = null;
Pair> id;
id = VariableDeclaratorId();
ret = add(ret, new Parameter(range(id.a, id.a), new NodeList(), emptyNodeList(), new UnknownType(), false, emptyNodeList(), id.a));
label_23:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[58] = jj_gen;
break label_23;
}
jj_consume_token(COMMA);
id = VariableDeclaratorId();
ret = add(ret, new Parameter(range(id.a, id.a), new NodeList(), emptyNodeList(), new UnknownType(), false, emptyNodeList(), id.a));
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.4.1
* {@code
* FormalParameter:
* {VariableModifier} UnannType VariableDeclaratorId
* VariableArityParameter
* VariableArityParameter:
* {VariableModifier} UnannType {Annotation} ... Identifier
* VariableModifier:
* Annotation
* final
* }
*/
final public Parameter Parameter() throws ParseException {ModifierHolder modifier;
Type partialType;
boolean isVarArg = false;
Pair> id;
NodeList varArgAnnotations = emptyNodeList();
modifier = Modifiers();
partialType = Type(emptyNodeList());
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ELLIPSIS:
case AT:{
varArgAnnotations = Annotations();
jj_consume_token(ELLIPSIS);
isVarArg = true;
break;
}
default:
jj_la1[59] = jj_gen;
;
}
id = VariableDeclaratorId();
JavaToken begin = orIfInvalid(modifier.begin, partialType);
{if ("" != null) return new Parameter(range(begin, token()), modifier.modifiers, modifier.annotations, juggleArrayType(partialType, id.b), isVarArg, varArgAnnotations, id.a);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.4
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-ReceiverParameter
* {@code
* MethodDeclarator:
* Identifier ( [ReceiverParameter ,] [FormalParameterList] ) [Dims]
* ReceiverParameter:
* {Annotation} UnannType [Identifier .] this
* }
*/
final public ReceiverParameter ReceiverParameter() throws ParseException {Type partialType;
Name id;
NodeList annotations = emptyNodeList();
annotations = Annotations();
partialType = Type(emptyNodeList());
id = ReceiverParameterId();
{if ("" != null) return new ReceiverParameter(range(partialType, token()), annotations, partialType, id);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.4
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-ReceiverParameter
* {@code
* MethodDeclarator:
* Identifier ( [ReceiverParameter ,] [FormalParameterList] ) [Dims]
* ReceiverParameter:
* {Annotation} UnannType [Identifier .] this
* }
*/
final public Name ReceiverParameterId() throws ParseException {Name ret = null;
if (jj_2_21(2147483647)) {
ret = Name();
jj_consume_token(DOT);
} else {
;
}
jj_consume_token(THIS);
{if ("" != null) return new Name(tokenRange(), ret, token.image);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.8
* {@code
* ConstructorDeclaration:
* {ConstructorModifier} ConstructorDeclarator [Throws] ConstructorBody
* ConstructorDeclarator:
* [TypeParameters] SimpleTypeName ( [ReceiverParameter ,] [FormalParameterList] )
* SimpleTypeName:
* TypeIdentifier
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.8.7
* {@code
* ConstructorBody:
* { [ExplicitConstructorInvocation] [BlockStatements] }
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.8.7.1
* {@code
* ExplicitConstructorInvocation:
* [TypeArguments] this ( [ArgumentList] ) ;
* [TypeArguments] super ( [ArgumentList] ) ;
* ExpressionName . [TypeArguments] super ( [ArgumentList] ) ;
* Primary . [TypeArguments] super ( [ArgumentList] ) ;
* }
*/
final public ConstructorDeclaration ConstructorDeclaration(ModifierHolder modifier) throws ParseException {RangedList typeParameters = new RangedList(emptyNodeList());
SimpleName name;
Pair, ReceiverParameter> parameters = new Pair, ReceiverParameter>(emptyNodeList(), null);
NodeList throws_ = emptyNodeList();
ExplicitConstructorInvocationStmt exConsInv = null;
NodeList stmts = emptyNodeList();
JavaToken begin = modifier.begin;
JavaToken blockBegin = INVALID;
ReferenceType throwType;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeParameters = TypeParameters();
begin = orIfInvalid(begin, typeParameters.range.getBegin());
break;
}
default:
jj_la1[60] = jj_gen;
;
}
// Modifiers matched in the caller
name = SimpleName();
begin = orIfInvalid(begin, typeParameters.range.getBegin()); begin = orIfInvalid(begin, token());
parameters = Parameters();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case THROWS:{
jj_consume_token(THROWS);
throwType = AnnotatedReferenceType();
throws_ = add(throws_, throwType);
label_24:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[61] = jj_gen;
break label_24;
}
jj_consume_token(COMMA);
throwType = AnnotatedReferenceType();
throws_ = add(throws_, throwType);
}
break;
}
default:
jj_la1[62] = jj_gen;
;
}
jj_consume_token(LBRACE);
blockBegin=token();
if (jj_2_22(2147483647)) {
exConsInv = ExplicitConstructorInvocation();
} else {
;
}
stmts = Statements();
jj_consume_token(RBRACE);
if (exConsInv != null) {
stmts = prepend(stmts, exConsInv);
}
{if ("" != null) return new ConstructorDeclaration(range(begin, token()), modifier.modifiers, modifier.annotations, typeParameters.list, name, parameters.a, throws_, new BlockStmt(range(blockBegin, token()), stmts), parameters.b);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.8.7.1
* {@code
* ExplicitConstructorInvocation:
* [TypeArguments] this ( [ArgumentList] ) ;
* [TypeArguments] super ( [ArgumentList] ) ;
* ExpressionName . [TypeArguments] super ( [ArgumentList] ) ;
* Primary . [TypeArguments] super ( [ArgumentList] ) ;
* }
* The same, but aligned on {@code super}, to emphasise how this grammar relates:
* {@code
* ExplicitConstructorInvocation:
* [TypeArguments] this ( [ArgumentList] ) ;
* [TypeArguments] super ( [ArgumentList] ) ;
* ExpressionName . [TypeArguments] super ( [ArgumentList] ) ;
* Primary . [TypeArguments] super ( [ArgumentList] ) ;
* }
*/
final public ExplicitConstructorInvocationStmt ExplicitConstructorInvocation() throws ParseException {boolean isThis = false;
NodeList args;
Expression expr = null;
RangedList typeArgs = new RangedList(null);
JavaToken begin = INVALID;
if (jj_2_24(2147483647)) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeArgs = TypeArguments();
begin=typeArgs.range.getBegin();
break;
}
default:
jj_la1[63] = jj_gen;
;
}
jj_consume_token(THIS);
begin = orIfInvalid(begin, token()); isThis = true;
args = Arguments();
jj_consume_token(SEMICOLON);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case LT:{
if (jj_2_23(2147483647)) {
expr = PrimaryExpressionWithoutSuperSuffix();
jj_consume_token(DOT);
begin = orIfInvalid(begin, expr);
} else {
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeArgs = TypeArguments();
begin = orIfInvalid(begin, typeArgs.range.getBegin());
break;
}
default:
jj_la1[64] = jj_gen;
;
}
jj_consume_token(SUPER);
begin = orIfInvalid(begin, token());
args = Arguments();
jj_consume_token(SEMICOLON);
break;
}
default:
jj_la1[65] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return new ExplicitConstructorInvocationStmt(range(begin, token()),typeArgs.list, isThis, expr, args);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.5
* {@code
* Statement:
* StatementWithoutTrailingSubstatement
* LabeledStatement
* IfThenStatement
* IfThenElseStatement
* WhileStatement
* ForStatement
* StatementNoShortIf:
* StatementWithoutTrailingSubstatement
* LabeledStatementNoShortIf
* IfThenElseStatementNoShortIf
* WhileStatementNoShortIf
* ForStatementNoShortIf
* StatementWithoutTrailingSubstatement:
* Block
* EmptyStatement
* ExpressionStatement
* AssertStatement
* SwitchStatement
* DoStatement
* BreakStatement
* ContinueStatement
* ReturnStatement
* SynchronizedStatement
* ThrowStatement
* TryStatement
* YieldStatement
* }
*/
final public NodeList Statements() throws ParseException {NodeList ret = emptyNodeList();
Statement stmt;
label_25:
while (true) {
if (jj_2_25(2)) {
} else {
break label_25;
}
stmt = BlockStatement();
ret = add(ret, stmt);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.6
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.
* {@code
* InstanceInitializer:
* Block
* }
* {@code
* StaticInitializer:
* static Block
* }
*/
final public InitializerDeclaration InitializerDeclaration() throws ParseException {BlockStmt body;
JavaToken begin = INVALID;
boolean isStatic = false;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case STATIC:{
jj_consume_token(STATIC);
isStatic = true; begin=token();
break;
}
default:
jj_la1[66] = jj_gen;
;
}
body = Block();
begin = orIfInvalid(begin, body);
{if ("" != null) return new InitializerDeclaration(range(begin, token()), isStatic, body);}
throw new IllegalStateException ("Missing return statement in function");
}
/*
* Type, name and expression syntax follows.
*/
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.1
* {@code
* Type:
* PrimitiveType
* ReferenceType
* }
*/
final public Type Type(NodeList annotations) throws ParseException {Type ret;
if (jj_2_26(2147483647)) {
ret = ReferenceType(annotations);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case FLOAT:
case INT:
case LONG:
case SHORT:{
ret = PrimitiveType(annotations);
break;
}
default:
jj_la1[67] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // TODO: JLS Has type and unannotated type, while JavaParser has type and annotated type.
* Note that an array of primitives is considered a reference type.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.1
* {@code
* ReferenceType:
* ClassOrInterfaceType
* TypeVariable
* ArrayType
* ClassOrInterfaceType:
* ClassType
* InterfaceType
* ClassType:
* {Annotation} TypeIdentifier [TypeArguments]
* PackageName . {Annotation} TypeIdentifier [TypeArguments]
* ClassOrInterfaceType . {Annotation} TypeIdentifier [TypeArguments]
* InterfaceType:
* ClassType
* TypeVariable:
* {Annotation} TypeIdentifier
* ArrayType:
* PrimitiveType Dims
* ClassOrInterfaceType Dims
* TypeVariable Dims
* Dims:
* {Annotation} [ ] {{Annotation} [ ]}
* }
*/
final public ReferenceType ReferenceType(NodeList annotations) throws ParseException {Type type;
ArrayBracketPair arrayBracketPair;
List arrayBracketPairs = new ArrayList(0);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case FLOAT:
case INT:
case LONG:
case SHORT:{
// Note that an array of primitives is considered a reference type.
type = PrimitiveType(annotations);
label_26:
while (true) {
arrayBracketPair = ArrayBracketPair(Origin.TYPE);
arrayBracketPairs=add(arrayBracketPairs, arrayBracketPair);
if (jj_2_27(2147483647)) {
} else {
break label_26;
}
}
break;
}
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
type = ClassOrInterfaceType(annotations);
label_27:
while (true) {
if (jj_2_28(2147483647)) {
} else {
break label_27;
}
arrayBracketPair = ArrayBracketPair(Origin.TYPE);
arrayBracketPairs=add(arrayBracketPairs, arrayBracketPair);
}
break;
}
default:
jj_la1[68] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return (ReferenceType)wrapInArrayTypes(type, arrayBracketPairs);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Array bracket pairs is referred to as {@code Dims} within the JLS.
* {@code
* Dims:
* {Annotation} [ ] {{Annotation} [ ]}
* }
*
*/
final public ArrayBracketPair ArrayBracketPair(Origin origin) throws ParseException {NodeList annotations;
JavaToken begin = INVALID;
annotations = Annotations();
jj_consume_token(LBRACKET);
begin = orIfInvalid(begin, token());
jj_consume_token(RBRACKET);
{if ("" != null) return new ArrayBracketPair(range(begin, token()), origin, annotations);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.9
*
* An intersection type takes the form T1 & ... & Tn (n > 0), where Ti (1 ≤ i ≤ n) are types.
*
*/
final public IntersectionType IntersectionType(NodeList annotations) throws ParseException {JavaToken begin = INVALID;
ReferenceType elementType;
NodeList elements = emptyNodeList();
elementType = ReferenceType(annotations);
begin = orIfInvalid(begin, elementType); elements = add(elements, elementType);
jj_consume_token(BIT_AND);
label_28:
while (true) {
elementType = AnnotatedReferenceType();
elements = add(elements, elementType);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FLOAT:
case INT:
case LONG:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:{
break;
}
default:
jj_la1[69] = jj_gen;
break label_28;
}
}
{if ("" != null) return new IntersectionType(range(begin, token()), elements);}
throw new IllegalStateException ("Missing return statement in function");
}
// TODO: JLS Has type and unannotated type, while JavaParser has type and annotated type.
final public ClassOrInterfaceType AnnotatedClassOrInterfaceType() throws ParseException {NodeList annotations = new NodeList();
ClassOrInterfaceType cit;
annotations = Annotations();
cit = ClassOrInterfaceType(annotations);
{if ("" != null) return cit;}
throw new IllegalStateException ("Missing return statement in function");
}
// TODO: JLS Has type and unannotated type, while JavaParser has type and annotated type.
final public ClassOrInterfaceType ClassOrInterfaceType(NodeList firstAnnotations) throws ParseException {ClassOrInterfaceType ret;
SimpleName name;
RangedList typeArgs = new RangedList(null);
JavaToken begin;
NodeList annotations = new NodeList();
name = SimpleName();
begin=token();
if (jj_2_29(2)) {
typeArgs = TypeArguments();
} else {
;
}
ret = new ClassOrInterfaceType(range(begin, token()), null, name, typeArgs.list, firstAnnotations);
typeArgs = new RangedList(null);
label_29:
while (true) {
if (jj_2_30(2)) {
} else {
break label_29;
}
jj_consume_token(DOT);
annotations = Annotations();
name = SimpleName();
if (jj_2_31(2)) {
typeArgs = TypeArguments();
} else {
;
}
ret = new ClassOrInterfaceType(range(begin, token()), ret, name, typeArgs.list, annotations);
typeArgs = new RangedList(null);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.5.1
* {@code
* TypeArguments:
* < TypeArgumentList >
* TypeArgumentList:
* TypeArgument {, TypeArgument}
* TypeArgument:
* ReferenceType
* Wildcard
* }
*/
final public RangedList TypeArguments() throws ParseException {RangedList ret = new RangedList(new NodeList());
Type type;
jj_consume_token(LT);
ret.beginAt(token());
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FLOAT:
case INT:
case LONG:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:
case HOOK:{
type = TypeArgument();
ret.add(type);
label_30:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[70] = jj_gen;
break label_30;
}
jj_consume_token(COMMA);
type = TypeArgument();
ret.add(type);
}
break;
}
default:
jj_la1[71] = jj_gen;
;
}
jj_consume_token(GT);
ret.endAt(token());
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.5.1
* {@code
* TypeArguments:
* < TypeArgumentList >
* TypeArgumentList:
* TypeArgument {, TypeArgument}
* TypeArgument:
* ReferenceType
* Wildcard
* }
*/
final public Type TypeArgument() throws ParseException {Type ret;
NodeList annotations;
annotations = Annotations();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FLOAT:
case INT:
case LONG:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
ret = Type(annotations);
break;
}
case HOOK:{
ret = Wildcard(annotations);
break;
}
default:
jj_la1[72] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.5.1
* {@code
* Wildcard:
* {Annotation} ? [WildcardBounds]
* WildcardBounds:
* extends ReferenceType
* super ReferenceType
* }
*/
final public WildcardType Wildcard(NodeList firstAnnotations) throws ParseException {ReferenceType ext = null;
ReferenceType sup = null;
JavaToken begin;
NodeList annotations = new NodeList();
jj_consume_token(HOOK);
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case EXTENDS:
case SUPER:{
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case EXTENDS:{
jj_consume_token(EXTENDS);
annotations = Annotations();
ext = ReferenceType(annotations);
break;
}
case SUPER:{
jj_consume_token(SUPER);
annotations = Annotations();
sup = ReferenceType(annotations);
break;
}
default:
jj_la1[73] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
default:
jj_la1[74] = jj_gen;
;
}
{if ("" != null) return new WildcardType(range(begin, token()), ext, sup, firstAnnotations);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note that {@code char} and {@code byte} are treated as an {@code IntegralType}, which is a subtype of {@code NumericType}.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.2
* {@code
* PrimitiveType:
* {Annotation} NumericType
* {Annotation} boolean
* NumericType:
* IntegralType
* FloatingPointType
* IntegralType:
* (one of)
* byte short int long char
* FloatingPointType:
* (one of)
* float double
* }
*/
final public PrimitiveType PrimitiveType(NodeList annotations) throws ParseException {PrimitiveType ret;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:{
jj_consume_token(BOOLEAN);
ret = new PrimitiveType(tokenRange(), PrimitiveType.Primitive.BOOLEAN, annotations);
break;
}
case CHAR:{
jj_consume_token(CHAR);
ret = new PrimitiveType(tokenRange(), PrimitiveType.Primitive.CHAR, annotations);
break;
}
case BYTE:{
jj_consume_token(BYTE);
ret = new PrimitiveType(tokenRange(), PrimitiveType.Primitive.BYTE, annotations);
break;
}
case SHORT:{
jj_consume_token(SHORT);
ret = new PrimitiveType(tokenRange(), PrimitiveType.Primitive.SHORT, annotations);
break;
}
case INT:{
jj_consume_token(INT);
ret = new PrimitiveType(tokenRange(), PrimitiveType.Primitive.INT, annotations);
break;
}
case LONG:{
jj_consume_token(LONG);
ret = new PrimitiveType(tokenRange(), PrimitiveType.Primitive.LONG, annotations);
break;
}
case FLOAT:{
jj_consume_token(FLOAT);
ret = new PrimitiveType(tokenRange(), PrimitiveType.Primitive.FLOAT, annotations);
break;
}
case DOUBLE:{
jj_consume_token(DOUBLE);
ret = new PrimitiveType(tokenRange(), PrimitiveType.Primitive.DOUBLE, annotations);
break;
}
default:
jj_la1[75] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.4.5
* {@code
* Result:
* UnannType
* void
* }
*/
final public Type ResultType(NodeList annotations) throws ParseException {Type ret;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case VOID:{
jj_consume_token(VOID);
ret = new VoidType(tokenRange());
break;
}
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FLOAT:
case INT:
case LONG:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
ret = Type(annotations);
break;
}
default:
jj_la1[76] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* A {@code SimpleName} is just an identifier.
* A {@code Name} can be a {@code SimpleName} or a {@code SimpleName} with qualifiers (e.g. a class or object reference).
* Note that no disambiguation is made as to exactly what type of name it is - e.g. whether it is a package, subclass, or field. That happens within JavaParser, rather than the grammar.
*/
final public Name Name() throws ParseException {Name ret;
Identifier();
ret = new Name(tokenRange(), null, token.image);
label_31:
while (true) {
if (jj_2_32(2)) {
} else {
break label_31;
}
jj_consume_token(DOT);
Identifier();
ret = new Name(range(ret, token()), ret, token.image);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* A {@code SimpleName} is just an identifier.
* A {@code Name} can be a {@code SimpleName} or a {@code SimpleName} with qualifiers (e.g. a class or object reference).
* Note that no disambiguation is made as to exactly what type of name it is - e.g. whether it is a package, subclass, or field. That happens within JavaParser, rather than the grammar.
*/
final public SimpleName SimpleName() throws ParseException {SimpleName ret;
Identifier();
ret = new SimpleName(tokenRange(), token.image);
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.8
* {@code
* Identifier:
* IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral
* IdentifierChars:
* JavaLetter {JavaLetterOrDigit}
* JavaLetter:
* any Unicode character that is a "Java letter"
* }
* For Convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.9
*
* 51 character sequences, formed from ASCII letters, are reserved for use as keywords and cannot be used as identifiers (§3.8).
*
* {@code
* Keyword:
* (one of)
*
* abstract continue for new switch
* assert default if package synchronized
* boolean do goto private this
* break double implements protected throw
* byte else import public throws
* case enum instanceof return transient
* catch extends int short try
* char final interface static void
* class finally long strictfp volatile
* const float native super while
* _ (underscore)
* }
*/
final public String Identifier() throws ParseException {String ret;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case MODULE:{
jj_consume_token(MODULE);
break;
}
case REQUIRES:{
jj_consume_token(REQUIRES);
break;
}
case TO:{
jj_consume_token(TO);
break;
}
case WITH:{
jj_consume_token(WITH);
break;
}
case OPEN:{
jj_consume_token(OPEN);
break;
}
case OPENS:{
jj_consume_token(OPENS);
break;
}
case USES:{
jj_consume_token(USES);
break;
}
case EXPORTS:{
jj_consume_token(EXPORTS);
break;
}
case PROVIDES:{
jj_consume_token(PROVIDES);
break;
}
case TRANSITIVE:{
jj_consume_token(TRANSITIVE);
break;
}
case ENUM:{
jj_consume_token(ENUM);
break;
}
case STRICTFP:{
jj_consume_token(STRICTFP);
break;
}
case YIELD:{
jj_consume_token(YIELD);
break;
}
case RECORD:{
jj_consume_token(RECORD);
break;
}
case PERMITS:{
jj_consume_token(PERMITS);
break;
}
case SEALED:{
jj_consume_token(SEALED);
break;
}
case WHEN:{
jj_consume_token(WHEN);
break;
}
case IDENTIFIER:{
jj_consume_token(IDENTIFIER);
break;
}
default:
jj_la1[77] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ret = token.image; setTokenKind(IDENTIFIER);
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/*
* Expression syntax follows.
*/
final public
Expression Expression() throws ParseException {Expression ret;
AssignExpr.Operator op;
Expression value;
Statement lambdaBody = null;
RangedList typeArgs = new RangedList(null);
ret = ConditionalExpression();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case DOUBLECOLON:
case ASSIGN:
case ARROW:
case PLUSASSIGN:
case MINUSASSIGN:
case STARASSIGN:
case SLASHASSIGN:
case ANDASSIGN:
case ORASSIGN:
case XORASSIGN:
case REMASSIGN:
case LSHIFTASSIGN:
case RSIGNEDSHIFTASSIGN:
case RUNSIGNEDSHIFTASSIGN:{
if (jj_2_33(2)) {
op = AssignmentOperator();
value = Expression();
ret = new AssignExpr(range(ret, token()), ret, value, op);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ARROW:{
jj_consume_token(ARROW);
lambdaBody = LambdaBody();
ret = generateLambda(ret, lambdaBody);
break;
}
case DOUBLECOLON:{
jj_consume_token(DOUBLECOLON);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeArgs = TypeArguments();
break;
}
default:
jj_la1[78] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
Identifier();
break;
}
case NEW:{
jj_consume_token(NEW);
break;
}
default:
jj_la1[79] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ret = new MethodReferenceExpr(range(ret, token()), ret, typeArgs.list, token.image);
break;
}
default:
jj_la1[80] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
break;
}
default:
jj_la1[81] = jj_gen;
;
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.26
* {@code
* AssignmentExpression:
* ConditionalExpression
* Assignment
* Assignment:
* LeftHandSide AssignmentOperator Expression
* LeftHandSide:
* ExpressionName
* FieldAccess
* ArrayAccess
* AssignmentOperator:
* (one of)
* = *= /= %= += -= <<= >>= >>>= &= ^= |=
* }
*/
final public AssignExpr.Operator AssignmentOperator() throws ParseException {AssignExpr.Operator ret;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ASSIGN:{
jj_consume_token(ASSIGN);
ret = AssignExpr.Operator.ASSIGN;
break;
}
case STARASSIGN:{
jj_consume_token(STARASSIGN);
ret = AssignExpr.Operator.MULTIPLY;
break;
}
case SLASHASSIGN:{
jj_consume_token(SLASHASSIGN);
ret = AssignExpr.Operator.DIVIDE;
break;
}
case REMASSIGN:{
jj_consume_token(REMASSIGN);
ret = AssignExpr.Operator.REMAINDER;
break;
}
case PLUSASSIGN:{
jj_consume_token(PLUSASSIGN);
ret = AssignExpr.Operator.PLUS;
break;
}
case MINUSASSIGN:{
jj_consume_token(MINUSASSIGN);
ret = AssignExpr.Operator.MINUS;
break;
}
case LSHIFTASSIGN:{
jj_consume_token(LSHIFTASSIGN);
ret = AssignExpr.Operator.LEFT_SHIFT;
break;
}
case RSIGNEDSHIFTASSIGN:{
jj_consume_token(RSIGNEDSHIFTASSIGN);
ret = AssignExpr.Operator.SIGNED_RIGHT_SHIFT;
break;
}
case RUNSIGNEDSHIFTASSIGN:{
jj_consume_token(RUNSIGNEDSHIFTASSIGN);
ret = AssignExpr.Operator.UNSIGNED_RIGHT_SHIFT;
break;
}
case ANDASSIGN:{
jj_consume_token(ANDASSIGN);
ret = AssignExpr.Operator.BINARY_AND;
break;
}
case XORASSIGN:{
jj_consume_token(XORASSIGN);
ret = AssignExpr.Operator.XOR;
break;
}
case ORASSIGN:{
jj_consume_token(ORASSIGN);
ret = AssignExpr.Operator.BINARY_OR;
break;
}
default:
jj_la1[82] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // TODO: Examine further re: missing(?) {@code LambdaExpression} or whether it is permissive enough to include it.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.25
* {@code
* ConditionalExpression:
* ConditionalOrExpression
* ConditionalOrExpression ? Expression : ConditionalExpression
* ConditionalOrExpression ? Expression : LambdaExpression
* }
*/
final public Expression ConditionalExpression() throws ParseException {Expression ret;
Expression left;
Expression right;
ret = ConditionalOrExpression();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case HOOK:{
jj_consume_token(HOOK);
left = Expression();
jj_consume_token(COLON);
right = Expression();
ret = new ConditionalExpr(range(ret, token()), ret, left, right);
break;
}
default:
jj_la1[83] = jj_gen;
;
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
*
* Note subtle distinctions between inclusive and exclusive expressions.
*
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.24
* {@code
* ConditionalOrExpression:
* ConditionalAndExpression
* ConditionalOrExpression || ConditionalAndExpression
* }
*/
final public Expression ConditionalOrExpression() throws ParseException {Expression ret;
Expression right;
// First consider a higher-precedence operator, before considering the token as the left-hand part of this expression.
ret = ConditionalAndExpression();
label_32:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case SC_OR:{
break;
}
default:
jj_la1[84] = jj_gen;
break label_32;
}
jj_consume_token(SC_OR);
right = ConditionalAndExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, BinaryExpr.Operator.OR);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
*
* Note subtle distinctions between inclusive and exclusive expressions.
*
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.23
* {@code
* ConditionalAndExpression:
* InclusiveOrExpression
* ConditionalAndExpression && InclusiveOrExpression
* }
* For Convenience:
* {@code
* AndExpression:
* EqualityExpression
* AndExpression & EqualityExpression
* ExclusiveOrExpression:
* AndExpression
* ExclusiveOrExpression ^ AndExpression
* InclusiveOrExpression:
* ExclusiveOrExpression
* InclusiveOrExpression | ExclusiveOrExpression
* }
*/
final public Expression ConditionalAndExpression() throws ParseException {Expression ret;
Expression right;
// First consider a higher-precedence operator, before considering the token as the left-hand part of this expression.
ret = InclusiveOrExpression();
label_33:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case SC_AND:{
break;
}
default:
jj_la1[85] = jj_gen;
break label_33;
}
jj_consume_token(SC_AND);
right = InclusiveOrExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, BinaryExpr.Operator.AND);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
*
* Note subtle distinctions between inclusive and exclusive expressions.
*
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.22
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-InclusiveOrExpression
* {@code
* AndExpression:
* EqualityExpression
* AndExpression & EqualityExpression
* ExclusiveOrExpression:
* AndExpression
* ExclusiveOrExpression ^ AndExpression
* InclusiveOrExpression:
* ExclusiveOrExpression
* InclusiveOrExpression | ExclusiveOrExpression
* }
*/
final public Expression InclusiveOrExpression() throws ParseException {Expression ret;
Expression right;
// First consider a higher-precedence operator, before considering the token as the left-hand part of this expression.
ret = ExclusiveOrExpression();
label_34:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BIT_OR:{
break;
}
default:
jj_la1[86] = jj_gen;
break label_34;
}
jj_consume_token(BIT_OR);
right = ExclusiveOrExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, BinaryExpr.Operator.BINARY_OR);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
*
* Note subtle distinctions between inclusive and exclusive expressions.
*
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.22
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-ExclusiveOrExpression
* {@code
* AndExpression:
* EqualityExpression
* AndExpression & EqualityExpression
* ExclusiveOrExpression:
* AndExpression
* ExclusiveOrExpression ^ AndExpression
* InclusiveOrExpression:
* ExclusiveOrExpression
* InclusiveOrExpression | ExclusiveOrExpression
* }
*/
final public Expression ExclusiveOrExpression() throws ParseException {Expression ret;
Expression right;
// First consider a higher-precedence operator, before considering the token as the left-hand part of this expression.
ret = AndExpression();
label_35:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case XOR:{
break;
}
default:
jj_la1[87] = jj_gen;
break label_35;
}
jj_consume_token(XOR);
right = AndExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, BinaryExpr.Operator.XOR);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
*
* Note subtle distinctions between inclusive and exclusive expressions.
*
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.22
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-AndExpression
* {@code
* AndExpression:
* EqualityExpression
* AndExpression & EqualityExpression
* ExclusiveOrExpression:
* AndExpression
* ExclusiveOrExpression ^ AndExpression
* InclusiveOrExpression:
* ExclusiveOrExpression
* InclusiveOrExpression | ExclusiveOrExpression
* }
*/
final public Expression AndExpression() throws ParseException {Expression ret;
Expression right;
// First consider a higher-precedence operator, before considering the token as the left-hand part of this expression.
ret = EqualityExpression();
label_36:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BIT_AND:{
break;
}
default:
jj_la1[88] = jj_gen;
break label_36;
}
jj_consume_token(BIT_AND);
right = EqualityExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, BinaryExpr.Operator.BINARY_AND);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // Note that instanceof is a {@code RelationalExpression} within the JLS, which differs from JavaParser
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.21
* {@code
* EqualityExpression:
* RelationalExpression
* EqualityExpression == RelationalExpression
* EqualityExpression != RelationalExpression
* }
* For Convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.20
* {@code
* RelationalExpression:
* ShiftExpression
* RelationalExpression < ShiftExpression
* RelationalExpression > ShiftExpression
* RelationalExpression <= ShiftExpression
* RelationalExpression >= ShiftExpression
* RelationalExpression instanceof ReferenceType
* }
*/
final public Expression EqualityExpression() throws ParseException {Expression ret;
Expression right;
BinaryExpr.Operator op;
// First consider a higher-precedence operator, before considering the token as the left-hand part of this expression.
// Note that instanceof is a {@code RelationalExpression} within the JLS, which differs from JavaParser
ret = InstanceOfExpression();
label_37:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case EQ:
case NE:{
break;
}
default:
jj_la1[89] = jj_gen;
break label_37;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case EQ:{
jj_consume_token(EQ);
op = BinaryExpr.Operator.EQUALS;
break;
}
case NE:{
jj_consume_token(NE);
op = BinaryExpr.Operator.NOT_EQUALS;
break;
}
default:
jj_la1[90] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
right = InstanceOfExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, op);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
final public PatternExpr PatternExpression() throws ParseException {PatternExpr ret;
if (jj_2_34(2147483647)) {
ret = TypePatternExpression();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FINAL:
case FLOAT:
case INT:
case LONG:
case NATIVE:
case NON_SEALED:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SYNCHRONIZED:
case TRANSIENT:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:{
ret = RecordPatternExpression();
break;
}
default:
jj_la1[91] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://openjdk.java.net/jeps/375
* The instanceof grammar is extended accordingly:
* {@code
* Pattern:
* ReferenceType Identifier
* }
*/
final public TypePatternExpr TypePatternExpression() throws ParseException {ModifierHolder modifier;
Type type;
SimpleName name;
modifier = Modifiers();
type = Type(modifier.annotations);
name = SimpleName();
{if ("" != null) return new TypePatternExpr(range(type, token()), modifier.modifiers, type, name);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://openjdk.org/jeps/440
*
* RecordPattern:
* ReferenceType ( [PatternList] )
* PatternList:
* Pattern {, Pattern }
*
*/
final public RecordPatternExpr RecordPatternExpression() throws ParseException {ModifierHolder modifier;
ReferenceType type;
NodeList patternList;
modifier = Modifiers();
type = ReferenceType(modifier.annotations);
patternList = PatternList();
{if ("" != null) return new RecordPatternExpr(range(type, token()), modifier.modifiers, type, patternList);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://openjdk.org/jeps/440
*
* PatternList:
* Pattern {, Pattern }
*
*/
final public NodeList PatternList() throws ParseException {PatternExpr pattern;
NodeList ret = new NodeList<>();
jj_consume_token(LPAREN);
pattern = PatternExpression();
ret.add(pattern);
label_38:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[92] = jj_gen;
break label_38;
}
jj_consume_token(COMMA);
pattern = PatternExpression();
ret.add(pattern);
}
jj_consume_token(RPAREN);
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // Note that instanceof is a {@code RelationalExpression} within the JLS, which differs from JavaParser
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.20
* {@code
* RelationalExpression:
* ShiftExpression
* RelationalExpression < ShiftExpression
* RelationalExpression > ShiftExpression
* RelationalExpression <= ShiftExpression
* RelationalExpression >= ShiftExpression
* RelationalExpression instanceof ReferenceType
* }
*/
final public Expression InstanceOfExpression() throws ParseException {Expression ret;
ReferenceType type;
NodeList annotations;
PatternExpr pattern;
ret = RelationalExpression();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case INSTANCEOF:{
jj_consume_token(INSTANCEOF);
if (jj_2_35(2147483647)) {
pattern = PatternExpression();
ret = new InstanceOfExpr(range(ret, token()), ret, pattern.getType().asReferenceType(), pattern);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FLOAT:
case INT:
case LONG:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:
case AT:{
type = AnnotatedReferenceType();
ret = new InstanceOfExpr(range(ret, token()), ret, type, null);
break;
}
default:
jj_la1[93] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
break;
}
default:
jj_la1[94] = jj_gen;
;
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // Note that instanceof is a {@code RelationalExpression} within the JLS, which differs from JavaParser
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.20
* {@code
* RelationalExpression:
* ShiftExpression
* RelationalExpression < ShiftExpression
* RelationalExpression > ShiftExpression
* RelationalExpression <= ShiftExpression
* RelationalExpression >= ShiftExpression
* RelationalExpression instanceof ReferenceType
* }
* // Note that JDK 13/14 introduce pattern Matching for instanceof
* https://openjdk.java.net/jeps/375
* The instanceof grammar is extended accordingly:
* {@code
* RelationalExpression:
* ...
* RelationalExpression instanceof ReferenceType
* RelationalExpression instanceof Pattern
*
* Pattern:
* ReferenceType Identifier
* }
*/
final public Expression RelationalExpression() throws ParseException {Expression ret;
Expression right;
BinaryExpr.Operator op;
ret = ShiftExpression();
label_39:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:
case GE:
case LE:
case GT:{
break;
}
default:
jj_la1[95] = jj_gen;
break label_39;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
jj_consume_token(LT);
op = BinaryExpr.Operator.LESS;
break;
}
case GT:{
jj_consume_token(GT);
op = BinaryExpr.Operator.GREATER;
break;
}
case LE:{
jj_consume_token(LE);
op = BinaryExpr.Operator.LESS_EQUALS;
break;
}
case GE:{
jj_consume_token(GE);
op = BinaryExpr.Operator.GREATER_EQUALS;
break;
}
default:
jj_la1[96] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
right = ShiftExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, op);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.19
* {@code
* ShiftExpression:
* AdditiveExpression
* ShiftExpression << AdditiveExpression
* ShiftExpression >> AdditiveExpression
* ShiftExpression >>> AdditiveExpression
* }
*/
final public Expression ShiftExpression() throws ParseException {Expression ret;
Expression right;
BinaryExpr.Operator op;
ret = AdditiveExpression();
label_40:
while (true) {
if (jj_2_36(1)) {
} else {
break label_40;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LSHIFT:{
jj_consume_token(LSHIFT);
op = BinaryExpr.Operator.LEFT_SHIFT;
break;
}
default:
jj_la1[97] = jj_gen;
if (jj_2_37(1)) {
RSIGNEDSHIFT();
op = BinaryExpr.Operator.SIGNED_RIGHT_SHIFT;
} else if (jj_2_38(1)) {
RUNSIGNEDSHIFT();
op = BinaryExpr.Operator.UNSIGNED_RIGHT_SHIFT;
} else {
jj_consume_token(-1);
throw new ParseException();
}
}
right = AdditiveExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, op);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.18
* {@code
* AdditiveExpression:
* MultiplicativeExpression
* AdditiveExpression + MultiplicativeExpression
* AdditiveExpression - MultiplicativeExpression
* }
*/
final public Expression AdditiveExpression() throws ParseException {Expression ret;
Expression right;
BinaryExpr.Operator op;
ret = MultiplicativeExpression();
label_41:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case PLUS:
case MINUS:{
break;
}
default:
jj_la1[98] = jj_gen;
break label_41;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case PLUS:{
jj_consume_token(PLUS);
op = BinaryExpr.Operator.PLUS;
break;
}
case MINUS:{
jj_consume_token(MINUS);
op = BinaryExpr.Operator.MINUS;
break;
}
default:
jj_la1[99] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
right = MultiplicativeExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, op);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.17
* {@code
* MultiplicativeExpression:
* UnaryExpression
* MultiplicativeExpression * UnaryExpression
* MultiplicativeExpression / UnaryExpression
* MultiplicativeExpression % UnaryExpression
* }
*/
final public Expression MultiplicativeExpression() throws ParseException {Expression ret;
Expression right;
BinaryExpr.Operator op;
ret = UnaryExpression();
label_42:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case STAR:
case SLASH:
case REM:{
break;
}
default:
jj_la1[100] = jj_gen;
break label_42;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case STAR:{
jj_consume_token(STAR);
op = BinaryExpr.Operator.MULTIPLY;
break;
}
case SLASH:{
jj_consume_token(SLASH);
op = BinaryExpr.Operator.DIVIDE;
break;
}
case REM:{
jj_consume_token(REM);
op = BinaryExpr.Operator.REMAINDER;
break;
}
default:
jj_la1[101] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
right = UnaryExpression();
ret = new BinaryExpr(range(ret, token()), ret, right, op);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.15
* {@code
* UnaryExpression:
* PreIncrementExpression
* PreDecrementExpression
* + UnaryExpression
* - UnaryExpression
* UnaryExpressionNotPlusMinus
* PreIncrementExpression:
* ++ UnaryExpression
* PreDecrementExpression:
* -- UnaryExpression
* UnaryExpressionNotPlusMinus:
* PostfixExpression
* ~ UnaryExpression
* ! UnaryExpression
* CastExpression
* SwitchExpression
* }
*/
final public Expression UnaryExpression() throws ParseException {Expression ret;
UnaryExpr.Operator op;
JavaToken begin = INVALID;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case INCR:{
ret = PreIncrementExpression();
break;
}
case DECR:{
ret = PreDecrementExpression();
break;
}
case PLUS:
case MINUS:{
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case PLUS:{
jj_consume_token(PLUS);
op = UnaryExpr.Operator.PLUS; begin=token();
break;
}
case MINUS:{
jj_consume_token(MINUS);
op = UnaryExpr.Operator.MINUS; begin=token();
break;
}
default:
jj_la1[102] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ret = UnaryExpression();
ret = new UnaryExpr(range(begin, token()), ret, op);
break;
}
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:{
ret = UnaryExpressionNotPlusMinus();
break;
}
default:
jj_la1[103] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.15
* {@code
* PreIncrementExpression:
* ++ UnaryExpression
* }
*/
final public Expression PreIncrementExpression() throws ParseException {Expression ret;
JavaToken begin = INVALID;
jj_consume_token(INCR);
begin=token();
ret = UnaryExpression();
ret = new UnaryExpr(range(begin, token()), ret, UnaryExpr.Operator.PREFIX_INCREMENT);
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.15
* {@code
* PreDecrementExpression:
* -- UnaryExpression
* }
*/
final public Expression PreDecrementExpression() throws ParseException {Expression ret;
JavaToken begin;
jj_consume_token(DECR);
begin=token();
ret = UnaryExpression();
ret = new UnaryExpr(range(begin, token()), ret, UnaryExpr.Operator.PREFIX_DECREMENT);
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.15
* {@code
* UnaryExpressionNotPlusMinus:
* PostfixExpression
* ~ UnaryExpression
* ! UnaryExpression
* CastExpression
* SwitchExpression
* }
*/
final public Expression UnaryExpressionNotPlusMinus() throws ParseException {Expression ret;
UnaryExpr.Operator op;
JavaToken begin = INVALID;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BANG:
case TILDE:{
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case TILDE:{
jj_consume_token(TILDE);
op = UnaryExpr.Operator.BITWISE_COMPLEMENT; begin=token();
break;
}
case BANG:{
jj_consume_token(BANG);
op = UnaryExpr.Operator.LOGICAL_COMPLEMENT; begin=token();
break;
}
default:
jj_la1[104] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ret = UnaryExpression();
ret = new UnaryExpr(range(begin, token()), ret, op);
break;
}
default:
jj_la1[105] = jj_gen;
if (jj_2_39(2147483647)) {
ret = CastExpression();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:{
ret = PostfixExpression();
break;
}
case SWITCH:{
ret = SwitchExpression();
break;
}
default:
jj_la1[106] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.15
* {@code
* PostfixExpression:
* Primary
* ExpressionName
* PostIncrementExpression
* PostDecrementExpression
* }
*/
final public Expression PostfixExpression() throws ParseException {Expression ret;
UnaryExpr.Operator op;
ret = PrimaryExpression();
if (jj_2_40(2)) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case INCR:{
jj_consume_token(INCR);
op = UnaryExpr.Operator.POSTFIX_INCREMENT;
break;
}
case DECR:{
jj_consume_token(DECR);
op = UnaryExpr.Operator.POSTFIX_DECREMENT;
break;
}
default:
jj_la1[107] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ret = new UnaryExpr(range(ret, token()), ret, op);
} else {
;
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.16
* {@code
* CastExpression:
* ( PrimitiveType ) UnaryExpression
* ( ReferenceType {AdditionalBound} ) UnaryExpressionNotPlusMinus
* ( ReferenceType {AdditionalBound} ) LambdaExpression
* }
* For Convenience:
* {@code
* AdditionalBound:
* & InterfaceType
* }
*/
final public Expression CastExpression() throws ParseException {Expression ret;
ReferenceType referenceType;
PrimitiveType primitiveType;
JavaToken begin = INVALID;
NodeList annotations;
NodeList typesOfMultiCast = emptyNodeList();
jj_consume_token(LPAREN);
begin=token();
annotations = Annotations();
if (jj_2_41(2)) {
primitiveType = PrimitiveType(annotations);
jj_consume_token(RPAREN);
ret = UnaryExpression();
ret = new CastExpr(range(begin, token()), primitiveType, ret);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FLOAT:
case INT:
case LONG:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
// ( ReferenceType {AdditionalBound} ) UnaryExpressionNotPlusMinus
// ( ReferenceType {AdditionalBound} ) LambdaExpression
referenceType = ReferenceType(annotations);
typesOfMultiCast = add(typesOfMultiCast, referenceType);
label_43:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BIT_AND:{
break;
}
default:
jj_la1[108] = jj_gen;
break label_43;
}
jj_consume_token(BIT_AND);
referenceType = AnnotatedReferenceType();
typesOfMultiCast = add(typesOfMultiCast, referenceType);
}
jj_consume_token(RPAREN);
ret = UnaryExpressionNotPlusMinus();
if (typesOfMultiCast.size() > 1) {
ret = new CastExpr(range(begin, token()), new IntersectionType(range(typesOfMultiCast.get(0), typesOfMultiCast.get(typesOfMultiCast.size() -1)), typesOfMultiCast), ret);
} else {
ret = new CastExpr(range(begin, token()), referenceType, ret);
}
break;
}
default:
jj_la1[109] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.8
* {@code
* Primary:
* PrimaryNoNewArray
* ArrayCreationExpression
* PrimaryNoNewArray:
* Literal
* ClassLiteral
* this
* TypeName . this
* ( Expression )
* ClassInstanceCreationExpression
* FieldAccess
* ArrayAccess
* MethodInvocation
* MethodReference
* }
*/
final public Expression PrimaryExpression() throws ParseException {Expression ret;
ret = PrimaryPrefix();
label_44:
while (true) {
if (jj_2_42(2)) {
} else {
break label_44;
}
ret = PrimarySuffix(ret);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // TODO: Unclear exactly which part of the JLS this relates to - a JavaParser-specific thing with no 1:1 mapping, perhaps?
*/
final public Expression PrimaryExpressionWithoutSuperSuffix() throws ParseException {Expression ret;
ret = PrimaryPrefix();
label_45:
while (true) {
if (jj_2_43(2147483647)) {
} else {
break label_45;
}
ret = PrimarySuffixWithoutSuper(ret);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // TODO: Unclear exactly which part of the JLS this relates to - a JavaParser-specific thing with no 1:1 mapping, perhaps?
*/
final public Expression PrimaryPrefix() throws ParseException {Expression ret = null;
SimpleName name;
RangedList typeArgs = new RangedList(null);
NodeList args = emptyNodeList();
NodeList params = emptyNodeList();
boolean hasArgs = false;
boolean isLambda = false;
Type type;
JavaToken begin;
Parameter p = null;
SimpleName id = null;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case FALSE:
case NULL:
case TRUE:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:{
ret = Literal();
break;
}
case THIS:{
jj_consume_token(THIS);
ret = new ThisExpr(tokenRange(), null);
break;
}
case SUPER:{
jj_consume_token(SUPER);
ret = new SuperExpr(tokenRange(), null);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case DOT:{
jj_consume_token(DOT);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeArgs = TypeArguments();
break;
}
default:
jj_la1[110] = jj_gen;
;
}
name = SimpleName();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LPAREN:{
args = Arguments();
hasArgs=true;
break;
}
default:
jj_la1[111] = jj_gen;
;
}
if (hasArgs) {
ret = new MethodCallExpr(range(ret, token()), ret, typeArgs.list, name, args);
} else {
ret = new FieldAccessExpr(range(ret, token()), ret, emptyNodeList(), name);
}
break;
}
case DOUBLECOLON:{
jj_consume_token(DOUBLECOLON);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeArgs = TypeArguments();
break;
}
default:
jj_la1[112] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
Identifier();
break;
}
case NEW:{
jj_consume_token(NEW);
break;
}
default:
jj_la1[113] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ret = new MethodReferenceExpr(range(ret, token()), ret, typeArgs.list, token.image);
break;
}
default:
jj_la1[114] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
case LPAREN:{
jj_consume_token(LPAREN);
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case RPAREN:{
jj_consume_token(RPAREN);
ret = new LambdaExpr(range(begin, token()), params, new BlockStmt(), true);
break;
}
default:
jj_la1[115] = jj_gen;
if (jj_2_44(2147483647)) {
params = LambdaParameters();
jj_consume_token(RPAREN);
ret = new LambdaExpr(range(begin, token()), params, new BlockStmt(), true);
} else if (jj_2_45(2147483647)) {
params = InferredLambdaParameters();
jj_consume_token(RPAREN);
ret = new LambdaExpr(range(begin, token()), params, new BlockStmt(), true);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
// This could still be a lambda expression, but this is handled after matching -> elsewhere
ret = Expression();
jj_consume_token(RPAREN);
ret = new EnclosedExpr(range(begin, token()), ret);
break;
}
default:
jj_la1[116] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
break;
}
case NEW:{
ret = AllocationExpression(null);
break;
}
default:
jj_la1[120] = jj_gen;
if (jj_2_46(2147483647)) {
type = ResultType(emptyNodeList());
jj_consume_token(DOT);
jj_consume_token(CLASS);
ret = new ClassExpr(range(type, token()), type);
} else if (jj_2_47(2147483647)) {
type = AnnotatedType();
jj_consume_token(DOUBLECOLON);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeArgs = TypeArguments();
break;
}
default:
jj_la1[117] = jj_gen;
;
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
Identifier();
break;
}
case NEW:{
jj_consume_token(NEW);
break;
}
default:
jj_la1[118] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ret = new TypeExpr(range(type, type), type);
ret = new MethodReferenceExpr(range(ret, token()), ret, typeArgs.list, token.image);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
name = SimpleName();
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LPAREN:{
args = Arguments();
hasArgs=true;
break;
}
default:
jj_la1[119] = jj_gen;
;
}
if (hasArgs) {
ret = new MethodCallExpr(range(begin, token()), null, null, name, args);
} else {
ret = new NameExpr(name);
}
break;
}
default:
jj_la1[121] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // TODO: Unclear exactly which part of the JLS this relates to - a JavaParser-specific thing with no 1:1 mapping, perhaps?
*/
final public Expression PrimarySuffix(Expression scope) throws ParseException {Expression ret;
if (jj_2_48(2)) {
ret = PrimarySuffixWithoutSuper(scope);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case DOT:{
jj_consume_token(DOT);
jj_consume_token(SUPER);
ret = new SuperExpr(range(scope, token()), scopeToName(scope));
break;
}
default:
jj_la1[122] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // TODO: Unclear exactly which part of the JLS this relates to - a JavaParser-specific thing with no 1:1 mapping, perhaps?
*/
final public Expression PrimarySuffixWithoutSuper(Expression scope) throws ParseException {Expression ret;
RangedList typeArgs = new RangedList(null);
NodeList args = emptyNodeList();
boolean hasArgs = false;
SimpleName name;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case DOT:{
jj_consume_token(DOT);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case THIS:{
jj_consume_token(THIS);
ret = new ThisExpr(range(scope, token()), scopeToName(scope));
break;
}
case NEW:{
ret = AllocationExpression(scope);
break;
}
default:
jj_la1[125] = jj_gen;
if (jj_2_49(2147483647)) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeArgs = TypeArguments();
break;
}
default:
jj_la1[123] = jj_gen;
;
}
name = SimpleName();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LPAREN:{
args = Arguments();
hasArgs=true;
break;
}
default:
jj_la1[124] = jj_gen;
;
}
if (hasArgs) {
ret = new MethodCallExpr(range(scope, token()), scope, typeArgs.list, name, args);
} else {
ret = new FieldAccessExpr(range(scope, token()), scope, typeArgs.list, name);
}
} else {
jj_consume_token(-1);
throw new ParseException();
}
}
break;
}
case LBRACKET:{
jj_consume_token(LBRACKET);
ret = Expression();
jj_consume_token(RBRACKET);
ret = new ArrayAccessExpr(range(scope, token()), scope, ret);
break;
}
default:
jj_la1[126] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note that a Long Literal is defined as an {@code IntegerLiteral}, suffixed by "L"
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.10.1
* {@code
* Literal:
* IntegerLiteral
* FloatingPointLiteral
* BooleanLiteral
* CharacterLiteral
* StringLiteral
* TextBlock
* NullLiteral
* }
*/
final public Expression Literal() throws ParseException {Expression ret;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case INTEGER_LITERAL:{
jj_consume_token(INTEGER_LITERAL);
ret = new IntegerLiteralExpr(tokenRange(), token.image);
break;
}
case LONG_LITERAL:{
jj_consume_token(LONG_LITERAL);
ret = new LongLiteralExpr(tokenRange(), token.image);
break;
}
case FLOATING_POINT_LITERAL:{
jj_consume_token(FLOATING_POINT_LITERAL);
ret = new DoubleLiteralExpr(tokenRange(), token.image);
break;
}
case CHARACTER_LITERAL:{
jj_consume_token(CHARACTER_LITERAL);
ret = new CharLiteralExpr(tokenRange(), unquote(token.image));
break;
}
case STRING_LITERAL:{
jj_consume_token(STRING_LITERAL);
ret = new StringLiteralExpr(tokenRange(), unquote(token.image));
break;
}
case TEXT_BLOCK_LITERAL:{
jj_consume_token(TEXT_BLOCK_LITERAL);
ret = new TextBlockLiteralExpr(tokenRange(), unTripleQuote(token.image));
break;
}
case FALSE:
case TRUE:{
ret = BooleanLiteral();
break;
}
case NULL:{
ret = NullLiteral();
break;
}
default:
jj_la1[127] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.10.3
* {@code
* BooleanLiteral:
* (one of)
* true false
* }
*/
final public Expression BooleanLiteral() throws ParseException {Expression ret;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case TRUE:{
jj_consume_token(TRUE);
ret = new BooleanLiteralExpr(tokenRange(), true);
break;
}
case FALSE:{
jj_consume_token(FALSE);
ret = new BooleanLiteralExpr(tokenRange(), false);
break;
}
default:
jj_la1[128] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.10.8
* {@code
* NullLiteral:
* null
* }
*/
final public Expression NullLiteral() throws ParseException {
jj_consume_token(NULL);
{if ("" != null) return new NullLiteralExpr(tokenRange());}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.12
* {@code
* MethodInvocation:
* MethodName ( [ArgumentList] )
* TypeName . [TypeArguments] Identifier ( [ArgumentList] )
* ExpressionName . [TypeArguments] Identifier ( [ArgumentList] )
* Primary . [TypeArguments] Identifier ( [ArgumentList] )
* super . [TypeArguments] Identifier ( [ArgumentList] )
* TypeName . super . [TypeArguments] Identifier ( [ArgumentList] )
* ArgumentList:
* Expression {, Expression}
* }
*/
final public NodeList Arguments() throws ParseException {NodeList ret = emptyNodeList();
jj_consume_token(LPAREN);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
ret = ArgumentList();
break;
}
default:
jj_la1[129] = jj_gen;
;
}
jj_consume_token(RPAREN);
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.12
* {@code
* ArgumentList:
* Expression {, Expression}
* }
*/
final public NodeList ArgumentList() throws ParseException {NodeList ret = emptyNodeList();
Expression expr;
expr = Expression();
ret.add(expr);
label_46:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[130] = jj_gen;
break label_46;
}
jj_consume_token(COMMA);
expr = Expression();
ret.add(expr);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.9
* {@code
* ClassInstanceCreationExpression:
* UnqualifiedClassInstanceCreationExpression
* ExpressionName . UnqualifiedClassInstanceCreationExpression
* Primary . UnqualifiedClassInstanceCreationExpression
* UnqualifiedClassInstanceCreationExpression:
* new [TypeArguments] ClassOrInterfaceTypeToInstantiate ( [ArgumentList] ) [ClassBody]
* ClassOrInterfaceTypeToInstantiate:
* {Annotation} Identifier {. {Annotation} Identifier} [TypeArgumentsOrDiamond]
* TypeArgumentsOrDiamond:
* TypeArguments
* <>
* }
* For Convenience:
* {@code
* ArgumentList:
* Expression {, Expression}
* }
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.10
* {@code
* ArrayCreationExpression:
* new PrimitiveType DimExprs [Dims]
* new ClassOrInterfaceType DimExprs [Dims]
* new PrimitiveType Dims ArrayInitializer
* new ClassOrInterfaceType Dims ArrayInitializer
* DimExprs:
* DimExpr {DimExpr}
* DimExpr:
* {Annotation} [ Expression ]
* }
* For Convenience:
* {@code
* Dims:
* {Annotation} [ ] {{Annotation} [ ]}
* }
*/
final public Expression AllocationExpression(Expression scope) throws ParseException {Expression ret;
Type type;
RangedList typeArgs = new RangedList(null);
NodeList> anonymousBody = null;
NodeList args;
JavaToken begin = INVALID;
NodeList annotations = new NodeList();
jj_consume_token(NEW);
if(scope==null) { begin=token(); } else { begin = orIfInvalid(begin, scope); }
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LT:{
typeArgs = TypeArguments();
break;
}
default:
jj_la1[131] = jj_gen;
;
}
annotations = Annotations();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case FLOAT:
case INT:
case LONG:
case SHORT:{
// new array of primitives
type = PrimitiveType(annotations);
ret = ArrayCreation(begin, type);
break;
}
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
// new reference type e.g. class (or an array of those)
type = ClassOrInterfaceType(annotations);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LBRACKET:
case AT:{
// new Integer[6] -- the array doesn't have parameters.
ret = ArrayCreation(begin, type);
break;
}
case LPAREN:{
// new Integer(6) -- not an array if parameters being passed.
args = Arguments();
if (jj_2_50(2)) {
anonymousBody = ClassOrInterfaceBody();
} else {
;
}
ret = new ObjectCreationExpr(range(begin, token()), scope, (ClassOrInterfaceType) type, typeArgs.list, args, anonymousBody);
break;
}
default:
jj_la1[132] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
default:
jj_la1[133] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.10
* {@code
* ArrayCreationExpression:
* new PrimitiveType DimExprs [Dims]
* new ClassOrInterfaceType DimExprs [Dims]
* new PrimitiveType Dims ArrayInitializer
* new ClassOrInterfaceType Dims ArrayInitializer
* DimExprs:
* DimExpr {DimExpr}
* DimExpr:
* {Annotation} [ Expression ]
* }
* For Convenience:
* {@code
* Dims:
* {Annotation} [ ] {{Annotation} [ ]}
* }
*/
final public ArrayCreationExpr ArrayCreation(JavaToken begin, Type type) throws ParseException {Expression expr = null;
ArrayInitializerExpr arrayInitializerExpr = null;
NodeList inits = emptyNodeList();
List> accum = new ArrayList>();
NodeList annotations = new NodeList();
JavaToken arrayCreationLevelStart = INVALID;
List levelRanges = new ArrayList();
label_47:
while (true) {
annotations = Annotations();
jj_consume_token(LBRACKET);
arrayCreationLevelStart = annotations.isEmpty() ? token() : orIfInvalid(arrayCreationLevelStart, annotations.get(0));
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
expr = Expression();
break;
}
default:
jj_la1[134] = jj_gen;
;
}
accum = add(accum, annotations); inits = add(inits, expr); annotations=null; expr=null;
jj_consume_token(RBRACKET);
levelRanges.add(range(arrayCreationLevelStart, token()));
if (jj_2_51(2)) {
} else {
break label_47;
}
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LBRACE:{
arrayInitializerExpr = ArrayInitializer();
break;
}
default:
jj_la1[135] = jj_gen;
;
}
{if ("" != null) return juggleArrayCreation(range(begin, token()), levelRanges, type, inits, accum, arrayInitializerExpr);}
throw new IllegalStateException ("Missing return statement in function");
}
/*
* Statement syntax follows.
*/
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.5
* {@code
* Statement:
* StatementWithoutTrailingSubstatement
* LabeledStatement
* IfThenStatement
* IfThenElseStatement
* WhileStatement
* ForStatement
* StatementNoShortIf:
* StatementWithoutTrailingSubstatement
* LabeledStatementNoShortIf
* IfThenElseStatementNoShortIf
* WhileStatementNoShortIf
* ForStatementNoShortIf
* StatementWithoutTrailingSubstatement:
* Block
* EmptyStatement
* ExpressionStatement
* AssertStatement
* SwitchStatement
* DoStatement
* BreakStatement
* ContinueStatement
* ReturnStatement
* SynchronizedStatement
* ThrowStatement
* TryStatement
* YieldStatement
* }
*/
final public Statement Statement() throws ParseException {Statement ret;
try {
if (jj_2_52(2)) {
ret = LabeledStatement();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ASSERT:{
ret = AssertStatement();
break;
}
default:
jj_la1[136] = jj_gen;
if (jj_2_53(3)) {
ret = YieldStatement();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LBRACE:{
ret = Block();
break;
}
case SEMICOLON:{
ret = EmptyStatement();
break;
}
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case INCR:
case DECR:{
ret = StatementExpression();
break;
}
case SWITCH:{
ret = SwitchStatement();
break;
}
case IF:{
ret = IfStatement();
break;
}
case WHILE:{
ret = WhileStatement();
break;
}
case DO:{
ret = DoStatement();
break;
}
case FOR:{
ret = ForStatement();
break;
}
case BREAK:{
ret = BreakStatement();
break;
}
case CONTINUE:{
ret = ContinueStatement();
break;
}
case RETURN:{
ret = ReturnStatement();
break;
}
case THROW:{
ret = ThrowStatement();
break;
}
case SYNCHRONIZED:{
ret = SynchronizedStatement();
break;
}
case TRY:{
ret = TryStatement();
break;
}
default:
jj_la1[137] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
}
{if ("" != null) return ret;}
} catch (ParseException e) {
TokenRange errorRange = recoverStatement(SEMICOLON, LBRACE, RBRACE, e);
{if ("" != null) return new UnparsableStmt(errorRange);}
}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.10
* {@code
* AssertStatement:
* assert Expression ;
* assert Expression : Expression ;
* }
*/
final public AssertStmt AssertStatement() throws ParseException {Expression check;
Expression msg = null;
JavaToken begin;
jj_consume_token(ASSERT);
begin=token();
check = Expression();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COLON:{
jj_consume_token(COLON);
msg = Expression();
break;
}
default:
jj_la1[138] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
{if ("" != null) return new AssertStmt(range(begin, token()), check, msg);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // TODO: Examine more closely.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.7
* {@code
* LabeledStatement:
* Identifier : Statement
* LabeledStatementNoShortIf:
* Identifier : StatementNoShortIf
* }
*/
final public LabeledStmt LabeledStatement() throws ParseException {SimpleName label;
Statement stmt;
JavaToken begin;
label = SimpleName();
begin=token();
jj_consume_token(COLON);
stmt = Statement();
{if ("" != null) return new LabeledStmt(range(begin, token()), label, stmt);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.2
* {@code
* Block:
* { [BlockStatements] }
* BlockStatements:
* BlockStatement {BlockStatement}
* BlockStatement:
* LocalVariableDeclarationStatement
* ClassDeclaration
* Statement
* }
*/
final public BlockStmt Block() throws ParseException {NodeList stmts = emptyNodeList();
JavaToken begin;
jj_consume_token(LBRACE);
begin=token();
try {
stmts = Statements();
jj_consume_token(RBRACE);
{if ("" != null) return new BlockStmt(range(begin, token()), stmts);}
} catch (ParseException e) {
recover(RBRACE, e);
BlockStmt block = new BlockStmt(range(begin, token()), new NodeList());
block.setParsed(UNPARSABLE);
{if ("" != null) return block;}
}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Classes inside body statements can only be abstract or final. The semantic checks must check it.
* TODO/FIXME: Note that the JLS specifies {@code ClassDeclaration} (thus {@code NormalClassDeclaration} and {@code EnumDeclaration}, but not interface.
* TODO/FIXME: Is this a bug in the grammar?
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-Statement
* {@code
* Block:
* { [BlockStatements] }
* BlockStatements:
* BlockStatement {BlockStatement}
* BlockStatement:
* LocalVariableDeclarationStatement
* ClassDeclaration
* Statement
* }
* For Convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1
* {@code
* ClassDeclaration:
* NormalClassDeclaration
* EnumDeclaration
* NormalClassDeclaration:
* {ClassModifier} class TypeIdentifier [TypeParameters] [Superclass] [Superinterfaces] ClassBody
* }
* For Convenience:
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.9
* {@code
* EnumDeclaration:
* {ClassModifier} enum TypeIdentifier [Superinterfaces] EnumBody
* }
*
*/
final public Statement BlockStatement() throws ParseException {Statement ret;
Expression expr;
ClassOrInterfaceDeclaration typeDecl;
RecordDeclaration recordDeclaration;
ModifierHolder modifier;
try {
if (jj_2_54(2147483647)) {
// TODO/FIXME: Is this a bug in the grammar? JLS specifies class or enum, not interface.
modifier = Modifiers();
typeDecl = ClassOrInterfaceDeclaration(modifier);
ret = new LocalClassDeclarationStmt(range(typeDecl, token()), typeDecl);
} else if (jj_2_55(2147483647)) {
modifier = Modifiers();
recordDeclaration = RecordDeclaration(modifier);
ret = new LocalRecordDeclarationStmt(range(recordDeclaration, token()), recordDeclaration);
} else if (jj_2_56(2147483647)) {
ret = YieldStatement();
} else if (jj_2_57(2147483647)) {
expr = VariableDeclarationExpression();
jj_consume_token(SEMICOLON);
ret = new ExpressionStmt(range(expr, token()), expr);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ASSERT:
case BOOLEAN:
case BREAK:
case BYTE:
case CHAR:
case CONTINUE:
case DO:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case FOR:
case IF:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case RETURN:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case SYNCHRONIZED:
case THIS:
case THROW:
case TRUE:
case TRY:
case VOID:
case WHILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case LBRACE:
case SEMICOLON:
case AT:
case INCR:
case DECR:{
ret = Statement();
break;
}
default:
jj_la1[139] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return ret;}
} catch (ParseException e) {
TokenRange errorRange = recoverStatement(SEMICOLON, LBRACE, RBRACE, e);
{if ("" != null) return new UnparsableStmt(errorRange);}
}
throw new IllegalStateException ("Missing return statement in function");
}
final public VariableDeclarationExpr VariableDeclarationExpression() throws ParseException {ModifierHolder modifier;
Type partialType;
NodeList variables = new NodeList();
VariableDeclarator var;
modifier = Modifiers();
partialType = Type(emptyNodeList());
var = VariableDeclarator(partialType);
variables.add(var);
label_48:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[140] = jj_gen;
break label_48;
}
jj_consume_token(COMMA);
var = VariableDeclarator(partialType);
variables.add(var);
}
JavaToken begin=orIfInvalid(modifier.begin, partialType);
{if ("" != null) return new VariableDeclarationExpr(range(begin, token()), modifier.modifiers, modifier.annotations, variables);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.6
* {@code
* EmptyStatement:
* ;
* }
*/
final public EmptyStmt EmptyStatement() throws ParseException {
jj_consume_token(SEMICOLON);
{if ("" != null) return new EmptyStmt(tokenRange());}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.27.2
* {@code
* LambdaBody:
* Expression
* Block
* }
*/
final public Statement LambdaBody() throws ParseException {Expression expr;
Statement n = null;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
expr = Expression();
n = new ExpressionStmt(range(expr, token()), expr);
break;
}
case LBRACE:{
n = Block();
break;
}
default:
jj_la1[141] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return n;}
throw new IllegalStateException ("Missing return statement in function");
}
final public ExpressionStmt StatementExpression() throws ParseException {Expression expr;
AssignExpr.Operator op;
Expression value;
RangedList typeArgs = new RangedList(null);
Statement lambdaBody;
if (jj_2_58(2)) {
expr = PreIncrementExpression();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case DECR:{
expr = PreDecrementExpression();
break;
}
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:{
expr = PrimaryExpression();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ASSIGN:
case INCR:
case DECR:
case PLUSASSIGN:
case MINUSASSIGN:
case STARASSIGN:
case SLASHASSIGN:
case ANDASSIGN:
case ORASSIGN:
case XORASSIGN:
case REMASSIGN:
case LSHIFTASSIGN:
case RSIGNEDSHIFTASSIGN:
case RUNSIGNEDSHIFTASSIGN:{
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case INCR:{
jj_consume_token(INCR);
expr = new UnaryExpr(range(expr, token()), expr, UnaryExpr.Operator.POSTFIX_INCREMENT);
break;
}
case DECR:{
jj_consume_token(DECR);
expr = new UnaryExpr(range(expr, token()), expr, UnaryExpr.Operator.POSTFIX_DECREMENT);
break;
}
case ASSIGN:
case PLUSASSIGN:
case MINUSASSIGN:
case STARASSIGN:
case SLASHASSIGN:
case ANDASSIGN:
case ORASSIGN:
case XORASSIGN:
case REMASSIGN:
case LSHIFTASSIGN:
case RSIGNEDSHIFTASSIGN:
case RUNSIGNEDSHIFTASSIGN:{
op = AssignmentOperator();
value = Expression();
expr = new AssignExpr(range(expr, token()), expr, value, op);
break;
}
default:
jj_la1[142] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
default:
jj_la1[143] = jj_gen;
;
}
break;
}
default:
jj_la1[144] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
jj_consume_token(SEMICOLON);
{if ("" != null) return new ExpressionStmt(range(expr, token()), expr);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note that the {@code SwitchExpression} and {@code SwitchStatemnt} are similar but different. // TODO: Why/How?
* // TODO: Examine more closely.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.11
* {@code
* SwitchStatement:
* switch ( Expression ) SwitchBlock
* }
* For Convenience:
* {@code
* SwitchBlock:
* { SwitchRule {SwitchRule} }
* { {SwitchBlockStatementGroup} {SwitchLabel :} }
* SwitchRule:
* SwitchLabel -> Expression ;
* SwitchLabel -> Block
* SwitchLabel -> ThrowStatement
* SwitchBlockStatementGroup:
* SwitchLabel : {SwitchLabel :} BlockStatements
* SwitchLabel:
* case CaseConstant {, CaseConstant}
* default
* CaseConstant:
* ConditionalExpression
* }
*/
final public SwitchStmt SwitchStatement() throws ParseException {Expression selector;
SwitchEntry entry;
NodeList entries = emptyNodeList() ;
JavaToken begin;
jj_consume_token(SWITCH);
begin=token();
jj_consume_token(LPAREN);
selector = Expression();
jj_consume_token(RPAREN);
jj_consume_token(LBRACE);
label_49:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case CASE:
case _DEFAULT:{
break;
}
default:
jj_la1[145] = jj_gen;
break label_49;
}
entry = SwitchEntry();
entries = add(entries, entry);
}
jj_consume_token(RBRACE);
{if ("" != null) return new SwitchStmt(range(begin, token()), selector, entries);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note that the {@code SwitchExpression} and {@code SwitchStatemnt} are similar but different. // TODO: Why/How?
* // TODO: Examine more closely.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.28
* {@code
* SwitchExpression:
* switch ( Expression ) SwitchBlock
* }
* For Convenience:
* {@code
* SwitchBlock:
* { SwitchRule {SwitchRule} }
* { {SwitchBlockStatementGroup} {SwitchLabel :} }
* SwitchRule:
* SwitchLabel -> Expression ;
* SwitchLabel -> Block
* SwitchLabel -> ThrowStatement
* SwitchBlockStatementGroup:
* SwitchLabel : {SwitchLabel :} BlockStatements
* SwitchLabel:
* case CaseConstant {, CaseConstant}
* default
* CaseConstant:
* ConditionalExpression
* }
*/
final public SwitchExpr SwitchExpression() throws ParseException {Expression selector;
SwitchEntry entry;
NodeList entries = emptyNodeList();
JavaToken begin;
jj_consume_token(SWITCH);
begin=token();
jj_consume_token(LPAREN);
selector = Expression();
jj_consume_token(RPAREN);
jj_consume_token(LBRACE);
label_50:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case CASE:
case _DEFAULT:{
break;
}
default:
jj_la1[146] = jj_gen;
break label_50;
}
entry = SwitchEntry();
entries = add(entries, entry);
}
jj_consume_token(RBRACE);
{if ("" != null) return new SwitchExpr(range(begin, token()), selector, entries);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* Note that the {@code SwitchBlock} (JLS) and {@code SwitchEntry} (JavaParser) are equivlent.
* // TODO: Examine more closely.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.11.1
* {@code
* SwitchBlock:
* { SwitchRule {SwitchRule} }
* { {SwitchBlockStatementGroup} {SwitchLabel :} }
* SwitchRule:
* SwitchLabel -> Expression ;
* SwitchLabel -> Block
* SwitchLabel -> ThrowStatement
* SwitchBlockStatementGroup:
* SwitchLabel : {SwitchLabel :} BlockStatements
* SwitchLabel:
* case CaseConstant {, CaseConstant}
* case null [, default]
* case CasePattern [Guard]
* default
* CaseConstant:
* ConditionalExpression
* CasePattern:
* Pattern
* Guard:
* when Expression
* }
*/
final public SwitchEntry SwitchEntry() throws ParseException {Expression label = null;
NodeList labels = emptyNodeList();
NodeList stmts = emptyNodeList();
JavaToken begin;
SwitchEntry ret;
Statement stmt = null;
Expression expr = null;
boolean isDefault = false;
Expression guard = null;
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case CASE:{
jj_consume_token(CASE);
begin=token();
if (jj_2_59(3)) {
label = NullLiteral();
labels = add(labels, label);
jj_consume_token(COMMA);
jj_consume_token(_DEFAULT);
isDefault = true;
} else if (jj_2_60(2147483647)) {
label = PatternExpression();
labels = add(labels, label);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case WHEN:{
jj_consume_token(WHEN);
guard = ConditionalExpression();
break;
}
default:
jj_la1[147] = jj_gen;
;
}
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
label = ConditionalExpression();
labels = add(labels, label);
label_51:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[148] = jj_gen;
break label_51;
}
jj_consume_token(COMMA);
label = ConditionalExpression();
labels = add(labels, label);
}
break;
}
default:
jj_la1[149] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
break;
}
case _DEFAULT:{
jj_consume_token(_DEFAULT);
begin=token(); isDefault = true;
break;
}
default:
jj_la1[150] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COLON:{
jj_consume_token(COLON);
stmts = Statements();
ret = new SwitchEntry(range(begin, token()), labels, STATEMENT_GROUP, stmts, isDefault, guard);
break;
}
case ARROW:{
jj_consume_token(ARROW);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
expr = Expression();
TokenRange r=range(begin, token());
// expr.getTokenRange() will not be present if storeTokens is false
stmts.add(new ExpressionStmt(expr.getTokenRange().orElse(null), expr));
ret = new SwitchEntry(r, labels, EXPRESSION, stmts, isDefault, guard);
jj_consume_token(SEMICOLON);
break;
}
case LBRACE:{
stmt = Block();
TokenRange r=range(begin, token());
stmts.add(stmt);
ret = new SwitchEntry(r, labels, BLOCK, stmts, isDefault, guard);
break;
}
case THROW:{
stmt = ThrowStatement();
TokenRange r=range(begin, token());
stmts.add(stmt);
ret = new SwitchEntry(r, labels, THROWS_STATEMENT, stmts, isDefault, guard);
break;
}
default:
jj_la1[151] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
}
default:
jj_la1[152] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.9
* {@code
* IfThenStatement:
* if ( Expression ) Statement
* IfThenElseStatement:
* if ( Expression ) StatementNoShortIf else Statement
* IfThenElseStatementNoShortIf:
* if ( Expression ) StatementNoShortIf else StatementNoShortIf
* }
*/
final public IfStmt IfStatement() throws ParseException {Expression condition;
Statement thenStmt;
Statement elseStmt = null;
JavaToken begin;
jj_consume_token(IF);
begin=token();
jj_consume_token(LPAREN);
condition = Expression();
jj_consume_token(RPAREN);
thenStmt = Statement();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ELSE:{
jj_consume_token(ELSE);
elseStmt = Statement();
break;
}
default:
jj_la1[153] = jj_gen;
;
}
{if ("" != null) return new IfStmt(range(begin, token()), condition, thenStmt, elseStmt);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.12
* {@code
* WhileStatement:
* while ( Expression ) Statement
* WhileStatementNoShortIf:
* while ( Expression ) StatementNoShortIf
* }
*/
final public WhileStmt WhileStatement() throws ParseException {Expression condition;
Statement body;
JavaToken begin;
jj_consume_token(WHILE);
begin=token();
jj_consume_token(LPAREN);
condition = Expression();
jj_consume_token(RPAREN);
body = Statement();
{if ("" != null) return new WhileStmt(range(begin, token()),condition, body);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.12
* {@code
* DoStatement:
* do Statement while ( Expression ) ;
* }
*/
final public DoStmt DoStatement() throws ParseException {Expression condition;
Statement body;
JavaToken begin;
jj_consume_token(DO);
begin=token();
body = Statement();
jj_consume_token(WHILE);
jj_consume_token(LPAREN);
condition = Expression();
jj_consume_token(RPAREN);
jj_consume_token(SEMICOLON);
{if ("" != null) return new DoStmt(range(begin, token()),body, condition);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.14
* {@code
* ForStatement:
* BasicForStatement
* EnhancedForStatement
* ForStatementNoShortIf:
* BasicForStatementNoShortIf
* EnhancedForStatementNoShortIf
* }
*/
final public Statement ForStatement() throws ParseException {VariableDeclarationExpr varExpr = null;
Expression expr = null;
NodeList init = emptyNodeList();
NodeList update = emptyNodeList();
Statement body;
JavaToken begin;
jj_consume_token(FOR);
begin=token();
jj_consume_token(LPAREN);
if (jj_2_61(2147483647)) {
varExpr = VariableDeclarationExpression();
jj_consume_token(COLON);
expr = Expression();
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FALSE:
case FINAL:
case FLOAT:
case INT:
case LONG:
case NATIVE:
case NEW:
case NON_SEALED:
case NULL:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SUPER:
case SWITCH:
case SYNCHRONIZED:
case THIS:
case TRANSIENT:
case TRUE:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case SEMICOLON:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ABSTRACT:
case BOOLEAN:
case BYTE:
case CHAR:
case _DEFAULT:
case DOUBLE:
case ENUM:
case FALSE:
case FINAL:
case FLOAT:
case INT:
case LONG:
case NATIVE:
case NEW:
case NON_SEALED:
case NULL:
case PERMITS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case RECORD:
case SEALED:
case SHORT:
case STATIC:
case STRICTFP:
case SUPER:
case SWITCH:
case SYNCHRONIZED:
case THIS:
case TRANSIENT:
case TRUE:
case VOID:
case VOLATILE:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
init = ForInit();
break;
}
default:
jj_la1[154] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
expr = Expression();
break;
}
default:
jj_la1[155] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
update = ForUpdate();
break;
}
default:
jj_la1[156] = jj_gen;
;
}
break;
}
default:
jj_la1[157] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
jj_consume_token(RPAREN);
body = Statement();
if (varExpr != null) {
{if ("" != null) return new ForEachStmt(range(begin, token()),varExpr, expr, body);}
}
{if ("" != null) return new ForStmt(range(begin, token()),init, expr, update, body);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.14
* {@code
* BasicForStatement:
* for ( [ForInit] ; [Expression] ; [ForUpdate] ) Statement
* BasicForStatementNoShortIf:
* for ( [ForInit] ; [Expression] ; [ForUpdate] ) StatementNoShortIf
* ForInit:
* StatementExpressionList
* LocalVariableDeclaration
* ForUpdate:
* StatementExpressionList
* StatementExpressionList:
* StatementExpression {, StatementExpression}
* }
*/
final public NodeList ForInit() throws ParseException {NodeList ret;
Expression expr;
if (jj_2_62(2147483647)) {
expr = VariableDeclarationExpression();
ret = new NodeList(); ret.add(expr);
} else {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
ret = ExpressionList();
break;
}
default:
jj_la1[158] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.14
* {@code
* BasicForStatement:
* for ( [ForInit] ; [Expression] ; [ForUpdate] ) Statement
* BasicForStatementNoShortIf:
* for ( [ForInit] ; [Expression] ; [ForUpdate] ) StatementNoShortIf
* ForInit:
* StatementExpressionList
* LocalVariableDeclaration
* ForUpdate:
* StatementExpressionList
* StatementExpressionList:
* StatementExpression {, StatementExpression}
* }
*/
final public NodeList ExpressionList() throws ParseException {NodeList ret = new NodeList();
Expression expr;
expr = Expression();
ret.add(expr);
label_52:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case COMMA:{
break;
}
default:
jj_la1[159] = jj_gen;
break label_52;
}
jj_consume_token(COMMA);
expr = Expression();
ret.add(expr);
}
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.14
* {@code
* BasicForStatement:
* for ( [ForInit] ; [Expression] ; [ForUpdate] ) Statement
* BasicForStatementNoShortIf:
* for ( [ForInit] ; [Expression] ; [ForUpdate] ) StatementNoShortIf
* ForInit:
* StatementExpressionList
* LocalVariableDeclaration
* ForUpdate:
* StatementExpressionList
* StatementExpressionList:
* StatementExpression {, StatementExpression}
* }
*/
final public NodeList ForUpdate() throws ParseException {NodeList ret;
ret = ExpressionList();
{if ("" != null) return ret;}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.15
* {@code
* BreakStatement:
* break [Identifier] ;
* }
*/
final public BreakStmt BreakStatement() throws ParseException {SimpleName label = null;
JavaToken begin;
jj_consume_token(BREAK);
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
label = SimpleName();
break;
}
default:
jj_la1[160] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
{if ("" != null) return new BreakStmt(range(begin, token()), label);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.21
* {@code
* YieldStatement:
* yield Expression ;
* }
*/
final public YieldStmt YieldStatement() throws ParseException {Expression value;
JavaToken begin;
jj_consume_token(YIELD);
begin=token();
value = Expression();
jj_consume_token(SEMICOLON);
{if ("" != null) return new YieldStmt(range(begin, token()), value);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.16
* {@code
* ContinueStatement:
* continue [Identifier] ;
* }
*/
final public ContinueStmt ContinueStatement() throws ParseException {SimpleName label = null;
JavaToken begin;
jj_consume_token(CONTINUE);
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case ENUM:
case PERMITS:
case RECORD:
case SEALED:
case STRICTFP:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case IDENTIFIER:{
label = SimpleName();
break;
}
default:
jj_la1[161] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
{if ("" != null) return new ContinueStmt(range(begin, token()), label);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.17
* {@code
* ReturnStatement:
* return [Expression] ;
* }
*/
final public ReturnStmt ReturnStatement() throws ParseException {Expression expr = null;
JavaToken begin;
jj_consume_token(RETURN);
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case ENUM:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case PERMITS:
case RECORD:
case SEALED:
case SHORT:
case STRICTFP:
case SUPER:
case SWITCH:
case THIS:
case TRUE:
case VOID:
case YIELD:
case REQUIRES:
case TO:
case WITH:
case OPEN:
case OPENS:
case USES:
case MODULE:
case EXPORTS:
case PROVIDES:
case TRANSITIVE:
case WHEN:
case LONG_LITERAL:
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TEXT_BLOCK_LITERAL:
case IDENTIFIER:
case LPAREN:
case AT:
case BANG:
case TILDE:
case INCR:
case DECR:
case PLUS:
case MINUS:{
expr = Expression();
break;
}
default:
jj_la1[162] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
{if ("" != null) return new ReturnStmt(range(begin, token()),expr);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.18
* {@code
* ThrowStatement:
* throw Expression ;
* }
*/
final public ThrowStmt ThrowStatement() throws ParseException {Expression expr;
JavaToken begin;
jj_consume_token(THROW);
begin=token();
expr = Expression();
jj_consume_token(SEMICOLON);
{if ("" != null) return new ThrowStmt(range(begin, token()),expr);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.19
* {@code
* SynchronizedStatement:
* synchronized ( Expression ) Block
* }
*/
final public SynchronizedStmt SynchronizedStatement() throws ParseException {Expression expr;
BlockStmt body;
JavaToken begin;
jj_consume_token(SYNCHRONIZED);
begin=token();
jj_consume_token(LPAREN);
expr = Expression();
jj_consume_token(RPAREN);
body = Block();
{if ("" != null) return new SynchronizedStmt(range(begin, token()),expr, body);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* // TODO: Examine more closely.
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.20
* {@code
* TryStatement:
* try Block Catches
* try Block [Catches] Finally
* TryWithResourcesStatement
* Catches:
* CatchClause {CatchClause}
* CatchClause:
* catch ( CatchFormalParameter ) Block
* CatchFormalParameter:
* {VariableModifier} CatchType VariableDeclaratorId
* CatchType:
* UnannClassType {| ClassType}
* Finally:
* finally Block
* }
* For Convenience:
* {@code
* VariableModifier:
* Annotation
* final
* VariableDeclaratorId:
* Identifier [Dims]
* Dims:
* {Annotation} [ ] {{Annotation} [ ]}
* }
*/
final public TryStmt TryStatement() throws ParseException {NodeList resources = emptyNodeList();
BlockStmt tryBlock;
BlockStmt finallyBlock = null;
NodeList catchs = emptyNodeList();
BlockStmt catchBlock;
ModifierHolder exceptModifier;
ReferenceType exceptionType;
NodeList exceptionTypes = emptyNodeList();
Pair> exceptId;
JavaToken begin;
JavaToken catchBegin;
JavaToken typesBegin;
JavaToken paramEnd;
Type type;
jj_consume_token(TRY);
begin=token();
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case LPAREN:{
resources = ResourceSpecification();
break;
}
default:
jj_la1[163] = jj_gen;
;
}
tryBlock = Block();
label_53:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case CATCH:{
break;
}
default:
jj_la1[164] = jj_gen;
break label_53;
}
jj_consume_token(CATCH);
catchBegin=token();
jj_consume_token(LPAREN);
exceptModifier = Modifiers();
typesBegin = exceptModifier.begin;
exceptionType = ReferenceType(emptyNodeList());
exceptionTypes.add(exceptionType); typesBegin = orIfInvalid(typesBegin, token());
label_54:
while (true) {
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case BIT_OR:{
break;
}
default:
jj_la1[165] = jj_gen;
break label_54;
}
jj_consume_token(BIT_OR);
exceptionType = AnnotatedReferenceType();
exceptionTypes.add(exceptionType);
}
exceptId = VariableDeclaratorId();
paramEnd = token();
jj_consume_token(RPAREN);
catchBlock = Block();
if (exceptionTypes.size() > 1) {
type = new UnionType(range(exceptionTypes.get(0), exceptionTypes.get(exceptionTypes.size() - 1)), exceptionTypes);
} else {
type = (Type)exceptionTypes.get(0);
}
Parameter catchType = new Parameter(range(typesBegin, paramEnd), exceptModifier.modifiers, exceptModifier.annotations, type, false, emptyNodeList(), exceptId.a);
catchs = add(catchs, new CatchClause(range(catchBegin, token()), catchType, catchBlock));
exceptionTypes = emptyNodeList();
}
switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
case FINALLY:{
jj_consume_token(FINALLY);
finallyBlock = Block();
break;
}
default:
jj_la1[166] = jj_gen;
;
}
{if ("" != null) return new TryStmt(range(begin, token()), resources, tryBlock, catchs, finallyBlock);}
throw new IllegalStateException ("Missing return statement in function");
}
/**
* https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-14.20.3
* {@code
* TryWithResourcesStatement:
* try ResourceSpecification Block [Catches] [Finally]
* ResourceSpecification:
* ( ResourceList [;] )
* ResourceList:
* Resource {; Resource}
* Resource:
* {VariableModifier} LocalVariableType Identifier = Expression
* VariableAccess
* VariableAccess:
* ExpressionName
* FieldAccess
* }
* For Convenience:
* {@code
* VariableModifier:
* Annotation
* final
* LocalVariableType:
* UnannType
* var
* }
*/
final public NodeList