Package | Description |
---|---|
org.codehaus.commons.compiler |
This package declares interfaces for the implementation of an
IExpressionEvaluator , an IScriptEvaluator , an
IClassBodyEvaluator and an ISimpleCompiler . |
org.codehaus.commons.compiler.jdk |
Main package of the plugin.
|
org.codehaus.janino |
The classes in this package pose the core of the Janino JavaTM compiler.
|
org.codehaus.janino.samples |
Sample applications for the Janino JavaTM compiler.
|
Modifier and Type | Field and Description |
---|---|
CompileException |
UncheckedCompileException.compileException
The nested
CompileException . |
Modifier and Type | Method and Description |
---|---|
void |
Cookable.cook(InputStream is) |
void |
ICookable.cook(InputStream is)
Reads, scans, parses and compiles Java tokens from the given
InputStream , encoded
in the "platform default encoding". |
void |
Cookable.cook(InputStream is,
String optionalEncoding) |
void |
ICookable.cook(InputStream is,
String optionalEncoding)
Reads, scans, parses and compiles Java tokens from the given
InputStream with the
given encoding . |
void |
Cookable.cook(Reader r) |
void |
ICookable.cook(Reader r)
Reads, scans, parses and compiles Java tokens from the given
Reader . |
void |
IScriptEvaluator.cook(Reader[] readers)
Same as
ICookable.cook(Reader) , but for multiple scripts. |
void |
Cookable.cook(String s) |
void |
ICookable.cook(String s)
Reads, scans, parses and compiles Java tokens from the given
String . |
void |
IScriptEvaluator.cook(String[] strings)
Same as
ICookable.cook(String) , but for multiple scripts. |
void |
IScriptEvaluator.cook(String[] optionalFileNames,
Reader[] readers)
Same as
ICookable.cook(String, Reader) , but cooks a set of scripts into one class. |
void |
IScriptEvaluator.cook(String[] optionalFileNames,
String[] strings)
Same as
ICookable.cook(String, String) , but for multiple scripts. |
void |
Cookable.cook(String optionalFileName,
InputStream is) |
void |
ICookable.cook(String optionalFileName,
InputStream is)
Reads, scans, parses and compiles Java tokens from the given
InputStream , encoded
in the "platform default encoding". |
void |
Cookable.cook(String optionalFileName,
InputStream is,
String optionalEncoding) |
void |
ICookable.cook(String optionalFileName,
InputStream is,
String optionalEncoding)
Reads, scans, parses and compiles Java tokens from the given
InputStream with the
given encoding . |
abstract void |
Cookable.cook(String optionalFileName,
Reader r) |
void |
ICookable.cook(String optionalFileName,
Reader r)
Reads, scans, parses and compiles Java tokens from the given
Reader . |
void |
Cookable.cook(String optionalFileName,
String s) |
void |
ICookable.cook(String optionalFileName,
String s)
Reads, scans, parses and compiles Java tokens from the given
String . |
void |
Cookable.cookFile(File file) |
void |
ICookable.cookFile(File file)
Reads, scans, parses and compiles Java tokens from the given
File , encoded
in the "platform default encoding". |
void |
Cookable.cookFile(File file,
String optionalEncoding) |
void |
ICookable.cookFile(File file,
String optionalEncoding)
Reads, scans, parses and compiles Java tokens from the given
File with the
given encoding . |
void |
Cookable.cookFile(String fileName) |
void |
ICookable.cookFile(String fileName)
Reads, scans, parses and compiles Java tokens from the named file, encoded in the "platform
default encoding".
|
void |
Cookable.cookFile(String fileName,
String optionalEncoding) |
void |
ICookable.cookFile(String fileName,
String optionalEncoding)
Reads, scans, parses and compiles Java tokens from the named file with the given
optionalEncoding . |
<T> Object |
IExpressionEvaluator.createFastEvaluator(Reader reader,
Class<T> interfaceToImplement,
String[] parameterNames) |
<T> Object |
IScriptEvaluator.createFastEvaluator(Reader reader,
Class<T> interfaceToImplement,
String[] parameterNames)
If the parameter and return types of the expression are known at compile time, then a "fast"
script evaluator can be instantiated through this method.
|
<T> Object |
IExpressionEvaluator.createFastEvaluator(String expression,
Class<T> interfaceToImplement,
String[] parameterNames)
If the parameter and return types of the expression are known at compile time, then a "fast" expression evaluator
can be instantiated through
IExpressionEvaluator.createFastEvaluator(String, Class, String[]) . |
<T> Object |
IScriptEvaluator.createFastEvaluator(String script,
Class<T> interfaceToImplement,
String[] parameterNames) |
Object |
IClassBodyEvaluator.createInstance(Reader reader)
Scans, parses and compiles a class body from the tokens delivered by the the given
Reader , then creates
and returns an instance of that class. |
void |
ErrorHandler.handleError(String message,
Location optionalLocation)
May or may not choose to throw a
CompileException . |
void |
WarningHandler.handleWarning(String handle,
String message,
Location optionalLocation)
May or may not choose to throw a
CompileException . |
Constructor and Description |
---|
UncheckedCompileException(CompileException compileException) |
Modifier and Type | Method and Description |
---|---|
void |
ScriptEvaluator.cook(Reader[] readers) |
void |
ScriptEvaluator.cook(String[] strings) |
void |
ExpressionEvaluator.cook(String[] optionalFileNames,
Reader[] readers) |
void |
ScriptEvaluator.cook(String[] optionalFileNames,
Reader[] readers) |
protected void |
ScriptEvaluator.cook(String[] optionalFileNames,
Reader[] readers,
String[] imports) |
void |
ScriptEvaluator.cook(String[] optionalFileNames,
String[] strings) |
void |
SimpleCompiler.cook(String optionalFileName,
Reader r) |
void |
ClassBodyEvaluator.cook(String optionalFileName,
Reader r) |
void |
ScriptEvaluator.cook(String optionalFileName,
Reader r) |
protected void |
ClassBodyEvaluator.cook(String optionalFileName,
String[] imports,
Reader r) |
Object |
ScriptEvaluator.createFastEvaluator(Reader r,
Class interfaceToImplement,
String[] parameterNames) |
Object |
ScriptEvaluator.createFastEvaluator(String script,
Class interfaceToImplement,
String[] parameterNames) |
Object |
ClassBodyEvaluator.createInstance(Reader reader) |
Constructor and Description |
---|
ExpressionEvaluator(String expression,
Class<?> expressionType,
String[] parameterNames,
Class<?>[] parameterTypes)
Equivalent to
|
ExpressionEvaluator(String expression,
Class<?> expressionType,
String[] parameterNames,
Class<?>[] parameterTypes,
Class<?>[] thrownExceptions,
Class<?> optionalExtendedType,
Class<?>[] implementedTypes,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ExpressionEvaluator(String expression,
Class<?> expressionType,
String[] parameterNames,
Class<?>[] parameterTypes,
Class<?>[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ScriptEvaluator(String script)
Equivalent to
|
ScriptEvaluator(String script,
Class<?> returnType)
Equivalent to
|
ScriptEvaluator(String script,
Class<?> returnType,
String[] parameterNames,
Class<?>[] parameterTypes)
Equivalent to
|
ScriptEvaluator(String script,
Class<?> returnType,
String[] parameterNames,
Class<?>[] parameterTypes,
Class<?>[] thrownExceptions)
Equivalent to
|
ScriptEvaluator(String optionalFileName,
InputStream is,
Class<?> returnType,
String[] parameterNames,
Class<?>[] parameterTypes,
Class<?>[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ScriptEvaluator(String optionalFileName,
Reader reader,
Class<?> returnType,
String[] parameterNames,
Class<?>[] parameterTypes,
Class<?>[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
Modifier and Type | Method and Description |
---|---|
protected CompileException |
Parser.compileException(String message)
Convenience method for throwing a
CompileException . |
Modifier and Type | Method and Description |
---|---|
protected Java.PackageMemberClassDeclaration |
ClassBodyEvaluator.addPackageMemberClassDeclaration(Location location,
Java.CompilationUnit compilationUnit)
To the given
Java.CompilationUnit , add
A class declaration with the configured name, superclass and interfaces
A method declaration with the given return type, name, parameter names and values and thrown exceptions
|
protected void |
UnitCompiler.buildLocalVariableMap(Java.CatchClause catchClause,
Map<String,Java.LocalVariable> localVars)
Adds the given
localVars to the 'local variable map' of the given catchClause . |
boolean |
Compiler.compile(File[] sourceFiles)
Reads a set of Java™ compilation units (a.k.a.
|
boolean |
Compiler.compile(Resource[] sourceResources)
|
protected Class |
ClassBodyEvaluator.compileToClass(Java.CompilationUnit compilationUnit)
Compile the given compilation unit, load all generated classes, and return the class with the given name.
|
protected ClassLoader |
SimpleCompiler.compileToClassLoader(Java.CompilationUnit compilationUnit)
Compile the given compilation unit.
|
ClassFile[] |
UnitCompiler.compileUnit(boolean debugSource,
boolean debugLines,
boolean debugVars)
Generates an array of
ClassFile objects which represent the classes and interfaces declared in the
compilation unit. |
void |
SimpleCompiler.cook(Java.CompilationUnit compilationUnit)
Cooks this compilation unit directly.
|
void |
ScriptEvaluator.cook(Parser[] parsers) |
void |
ScriptEvaluator.cook(Reader[] readers) |
void |
SimpleCompiler.cook(Scanner scanner)
Scans, parses and ompiles a given compilation unit from the given scanner.
|
void |
ClassBodyEvaluator.cook(Scanner scanner) |
void |
ScriptEvaluator.cook(Scanner scanner) |
void |
ScriptEvaluator.cook(Scanner[] scanners)
Like
ScriptEvaluator.cook(Scanner) , but cooks a set of scripts into one class. |
void |
ScriptEvaluator.cook(String[] strings) |
void |
ScriptEvaluator.cook(String[] optionalFileNames,
Reader[] readers)
On a 2 GHz Intel Pentium Core Duo under Windows XP with an IBM 1.4.2 JDK, compiling
10000 expressions "a + b" (integer) takes about 4 seconds and 56 MB of main memory.
|
void |
ScriptEvaluator.cook(String[] optionalFileNames,
String[] strings) |
void |
SimpleCompiler.cook(String optionalFileName,
Reader r)
Scans, parses and compiles a given compilation unit from the given
Reader . |
static Object |
ClassBodyEvaluator.createFastClassBodyEvaluator(Scanner scanner,
Class optionalBaseType,
ClassLoader optionalParentClassLoader)
Use
ClassBodyEvaluator.createInstance(Reader) instead: |
static Object |
ClassBodyEvaluator.createFastClassBodyEvaluator(Scanner scanner,
String className,
Class optionalExtendedClass,
Class[] implementedInterfaces,
ClassLoader optionalParentClassLoader)
Deprecated.
Use
ClassBodyEvaluator.createInstance(Reader) instead. |
Object |
ScriptEvaluator.createFastEvaluator(Reader reader,
Class interfaceToImplement,
String[] parameterNames) |
Object |
ScriptEvaluator.createFastEvaluator(Scanner scanner,
Class interfaceToImplement,
String[] parameterNames)
Notice: This method is not declared in
IScriptEvaluator , and is hence only available in this
implementation of org.codehaus.commons.compiler . |
Object |
ScriptEvaluator.createFastEvaluator(String script,
Class interfaceToImplement,
String[] parameterNames) |
static Object |
ExpressionEvaluator.createFastExpressionEvaluator(Scanner scanner,
String[] optionalDefaultImports,
String className,
Class optionalExtendedType,
Class interfaceToImplement,
String[] parameterNames,
ClassLoader optionalParentClassLoader)
Deprecated.
|
static Object |
ExpressionEvaluator.createFastExpressionEvaluator(Scanner scanner,
String className,
Class optionalExtendedType,
Class interfaceToImplement,
String[] parameterNames,
ClassLoader optionalParentClassLoader)
Deprecated.
|
static Object |
ExpressionEvaluator.createFastExpressionEvaluator(String expression,
Class interfaceToImplement,
String[] parameterNames,
ClassLoader optionalParentClassLoader)
Deprecated.
|
static Object |
ScriptEvaluator.createFastScriptEvaluator(Scanner scanner,
Class interfaceToImplement,
String[] parameterNames,
ClassLoader optionalParentClassLoader)
|
static Object |
ScriptEvaluator.createFastScriptEvaluator(Scanner scanner,
String[] optionalDefaultImports,
String className,
Class optionalExtendedClass,
Class interfaceToImplement,
String[] parameterNames,
ClassLoader optionalParentClassLoader)
Deprecated.
|
static Object |
ScriptEvaluator.createFastScriptEvaluator(Scanner scanner,
String className,
Class optionalExtendedType,
Class interfaceToImplement,
String[] parameterNames,
ClassLoader optionalParentClassLoader)
|
static Object |
ScriptEvaluator.createFastScriptEvaluator(String script,
Class interfaceToImplement,
String[] parameterNames)
|
Object |
ClassBodyEvaluator.createInstance(Reader reader) |
void |
Java.ClassDeclaration.defineSyntheticField(IClass.IField iField) |
protected Java.CompilationUnit |
JavaSourceIClassLoader.findCompilationUnit(String className)
Finds the Java™ source file for the named class through the configured 'source resource finder' and
parses it.
|
IClass.IConstructor |
IClass.findIConstructor(IClass[] parameterTypes) |
IClass.IMethod |
UnitCompiler.findIMethod(Java.MethodInvocation mi)
Find named methods of "targetType", examine the argument types and choose the most specific method.
|
IClass.IMethod |
UnitCompiler.findIMethod(Java.SuperclassMethodInvocation superclassMethodInvocation) |
IClass.IMethod |
IClass.findIMethod(String methodName,
IClass[] parameterTypes) |
IClass.IInvocable |
UnitCompiler.findMostSpecificIInvocable(Java.Locatable locatable,
IClass.IInvocable[] iInvocables,
IClass[] argumentTypes,
boolean boxingPermitted,
Java.Scope contextScope)
Determine the applicable invocables and choose the most specific invocable.
|
abstract Object |
IClass.IField.getConstantValue()
Returns the value of the field if it is a compile-time constant value, i.e.
|
Object |
UnitCompiler.getConstantValue(Java.Rvalue rv)
Attempts to evaluate as a constant expression.
|
IClass[] |
IClass.getDeclaredIClasses()
Returns the classes and interfaces declared as members of the class
(but not inherited classes and interfaces).
Returns an empty array for an array, primitive type or "void". |
protected abstract IClass[] |
IClass.getDeclaredIClasses2() |
protected IClass[] |
ClassFileIClass.getDeclaredIClasses2() |
IClass |
IClass.getDeclaringIClass() |
protected abstract IClass |
IClass.getDeclaringIClass2() |
protected IClass |
ClassFileIClass.getDeclaringIClass2() |
String |
IClass.IInvocable.getDescriptor()
Returns the method descriptor of this constructor or method.
|
String |
IClass.IField.getDescriptor() |
abstract String |
IClass.IInvocable.getDescriptor2()
Uncached implementation of
IClass.IInvocable.getDescriptor() . |
String |
IClass.IConstructor.getDescriptor2()
Opposed to
IClass.IInvocable.getParameterTypes() , the method descriptor returned by this method does include the
optionally leading synthetic parameters. |
String |
IClass.IMethod.getDescriptor2() |
IClass.IMethod[] |
IClass.getIMethods()
Returns all methods declared in the class or interface, its superclasses and its
superinterfaces.
|
void |
UnitCompiler.getIMethods(IClass type,
String methodName,
List<IClass.IMethod> v)
Add all methods with the given
methodName that are declared by the type , its superclasses and
all their superinterfaces to the result list v . |
IClass[] |
IClass.getInterfaces()
Returns the interfaces implemented by the class.
Returns the superinterfaces of the interface. Returns "Cloneable" and "Serializable" for arrays. Returns an empty array for primitive types and "void". |
protected abstract IClass[] |
IClass.getInterfaces2() |
protected IClass[] |
ClassFileIClass.getInterfaces2() |
Java.LocalVariable |
UnitCompiler.getLocalVariable(Java.FunctionDeclarator.FormalParameter parameter) |
Java.LocalVariable |
UnitCompiler.getLocalVariable(Java.FunctionDeclarator.FormalParameter parameter,
boolean isVariableArityParameter) |
Java.LocalVariable |
UnitCompiler.getLocalVariable(Java.LocalVariableDeclarationStatement lvds,
Java.VariableDeclarator vd) |
IClass |
IClass.getOuterIClass()
The following types have an "outer class":
Anonymous classes declared in a non-static method of a class
Local classes declared in a non-static method of a class
Non-static member classes
|
protected abstract IClass |
IClass.getOuterIClass2() |
protected IClass |
ClassFileIClass.getOuterIClass2() |
IClass[] |
IClass.IInvocable.getParameterTypes()
Returns the types of the parameters of this constructor or method.
|
abstract IClass[] |
IClass.IInvocable.getParameterTypes2() |
abstract IClass[] |
IClass.IConstructor.getParameterTypes2()
Opposed to
Constructor.getParameterTypes() , the
return value of this method does not include the optionally leading "synthetic
parameters". |
abstract IClass |
IClass.IMethod.getReturnType() |
String[] |
UnitCompiler.getSingleTypeImport(String name,
Location location)
Check if the given simple name was imported through a single type import.
|
IClass |
IClass.getSuperclass()
Returns the superclass of the class.
Returns "null" for class "Object", interfaces, arrays, primitive types and "void". |
protected abstract IClass |
IClass.getSuperclass2() |
protected IClass |
ClassFileIClass.getSuperclass2() |
IClass[] |
IClass.IInvocable.getThrownExceptions()
Returns the types thrown by this constructor or method.
|
abstract IClass[] |
IClass.IInvocable.getThrownExceptions2() |
abstract IClass |
IClass.IField.getType() |
static String[] |
ExpressionEvaluator.guessParameterNames(Scanner scanner)
Guess the names of the parameters used in the given expression.
|
static String[] |
ScriptEvaluator.guessParameterNames(Scanner scanner)
Guess the names of the parameters used in the given expression.
|
void |
FilterWarningHandler.handleWarning(String handle,
String message,
Location optionalLocation) |
boolean |
IClass.hasIMethod(String methodName,
IClass[] parameterTypes) |
boolean |
IClass.implementsInterface(IClass that)
If
this represents a class: Return true if this class
directly or indirectly implements that interface. |
IClass |
UnitCompiler.importTypeOnDemand(String simpleTypeName,
Location location)
6.5.2.BL1.B1.B5, 6.5.2.BL1.B1.B6 Type-import-on-demand.
6.5.5.1.6 Type-import-on-demand declaration. |
boolean |
IClass.isAssignableFrom(IClass that)
Determine if "this" is assignable from "that".
|
boolean |
IClass.IInvocable.isLessSpecificThan(IClass.IInvocable that) |
boolean |
IClass.IInvocable.isMoreSpecificThan(IClass.IInvocable that) |
boolean |
IClass.isSubclassOf(IClass that)
Returns
true if this class is an immediate or non-immediate
subclass of that class. |
protected Java.CompilationUnit |
ClassBodyEvaluator.makeCompilationUnit(Parser optionalParser)
Create a
Java.CompilationUnit , set the default imports, and parse the import declarations. |
protected List<Java.BlockStatement> |
ExpressionEvaluator.makeStatements(int idx,
Parser parser) |
protected List<Java.BlockStatement> |
ScriptEvaluator.makeStatements(int idx,
Parser parser)
Fills the given
block by parsing statements until EOF and adding them to the block. |
Java.Atom |
Parser.parseAdditiveExpression()
AdditiveExpression :=
MultiplicativeExpression { ( '+' | '-' ) MultiplicativeExpression }
|
Java.Atom |
Parser.parseAndExpression()
AndExpression :=
EqualityExpression { '&' EqualityExpression }
|
Java.Rvalue[] |
Parser.parseArgumentList()
ArgumentList := Expression { ',' Expression }
|
Java.Rvalue[] |
Parser.parseArguments()
Arguments := '(' [ ArgumentList ] ')'
|
Java.ArrayInitializer |
Parser.parseArrayInitializer()
ArrayInitializer :=
'{' [ VariableInitializer { ',' VariableInitializer } [ ',' ] '}'
|
Java.Statement |
Parser.parseAssertStatement()
AssertStatement := 'assert' Expression [ ':' Expression ] ';'
|
Java.Atom |
Parser.parseAssignmentExpression()
AssignmentExpression :=
ConditionalExpression [ AssignmentOperator AssignmentExpression ]
AssignmentOperator :=
'=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' |
'>>=' | '>>>=' | '&=' | '^=' | '|='
|
Java.Block |
Parser.parseBlock()
'{' BlockStatements '}'
|
Java.BlockStatement |
Parser.parseBlockStatement()
BlockStatement := { Identifier ':' } (
( Modifiers Type | ModifiersOpt BasicType ) VariableDeclarators ';' |
'class' ...
|
List<Java.BlockStatement> |
Parser.parseBlockStatements()
BlockStatements := { BlockStatement }
|
Java.Statement |
Parser.parseBreakStatement()
BreakStatement := 'break' [ Identifier ] ';'
|
void |
Parser.parseClassBody(Java.ClassDeclaration classDeclaration)
ClassBody := '{' { ClassBodyDeclaration } '}'
|
void |
Parser.parseClassBodyDeclaration(Java.ClassDeclaration classDeclaration)
ClassBodyDeclaration :=
';' |
ModifiersOpt (
Block | // Instance (JLS7 8.6) or static initializer (JLS7 8.7)
'void' Identifier MethodDeclarationRest |
'class' ClassDeclarationRest |
'interface' InterfaceDeclarationRest |
ConstructorDeclarator |
Type Identifier (
MethodDeclarationRest |
FieldDeclarationRest ';'
)
)
|
Java.NamedClassDeclaration |
Parser.parseClassDeclarationRest(String optionalDocComment,
Java.Modifiers modifiers,
Parser.ClassDeclarationContext context)
ClassDeclarationRest :=
Identifier [ typeParameters ]
[ 'extends' ReferenceType ]
[ 'implements' ReferenceTypeList ]
ClassBody
|
Java.CompilationUnit |
Parser.parseCompilationUnit()
CompilationUnit := [ PackageDeclaration ]
{ ImportDeclaration }
{ TypeDeclaration }
|
Java.Atom |
Parser.parseConditionalAndExpression()
ConditionalAndExpression :=
InclusiveOrExpression { '&&' InclusiveOrExpression }
|
Java.Atom |
Parser.parseConditionalExpression()
ConditionalExpression :=
ConditionalOrExpression [ '?' Expression ':' ConditionalExpression ]
|
Java.Atom |
Parser.parseConditionalOrExpression()
ConditionalOrExpression :=
ConditionalAndExpression { '||' ConditionalAndExpression ]
|
Java.ConstructorDeclarator |
Parser.parseConstructorDeclarator(String optionalDocComment,
Java.Modifiers modifiers)
ConstructorDeclarator :=
Identifier
FormalParameters
[ 'throws' ReferenceTypeList ]
'{'
[ 'this' Arguments ';' | 'super' Arguments ';' | Primary '.' 'super' Arguments ';' ]
BlockStatements
'}'
|
Java.Statement |
Parser.parseContinueStatement()
ContinueStatement := 'continue' [ Identifier ] ';'
|
Java.Rvalue |
Parser.parseDimExpr()
DimExpr := '[' Expression ']'
|
Java.Rvalue[] |
Parser.parseDimExprs()
DimExprs := DimExpr { DimExpr }
|
Java.Statement |
Parser.parseDoStatement()
DoStatement := 'do' Statement 'while' '(' Expression ')' ';'
|
Java.Statement |
Parser.parseEmptyStatement()
EmptyStatement := ';'
|
Java.Atom |
Parser.parseEqualityExpression()
EqualityExpression :=
RelationalExpression { ( '==' | '!=' ) RelationalExpression }
|
Java.Atom |
Parser.parseExclusiveOrExpression()
ExclusiveOrExpression :=
AndExpression { '^' AndExpression }
|
Java.Atom |
Parser.parseExpression()
Expression := AssignmentExpression
|
Java.Rvalue[] |
Parser.parseExpressionList()
ExpressionList := Expression { ',' Expression }
|
Java.Statement |
Parser.parseExpressionStatement()
ExpressionStatement := Expression ';'
|
Java.VariableDeclarator[] |
Parser.parseFieldDeclarationRest(String name)
FieldDeclarationRest :=
VariableDeclaratorRest
{ ',' VariableDeclarator }
|
Java.FunctionDeclarator.FormalParameter |
Parser.parseFormalParameter(boolean[] hasEllipsis)
FormalParameter := [ 'final' ] Type [ '.' '.' '.' ] Identifier BracketsOpt
|
Java.FunctionDeclarator.FormalParameters |
Parser.parseFormalParameters()
FormalParameters := '(' [ FormalParameter { ',' FormalParameter } ] ')'
|
Java.Statement |
Parser.parseForStatement()
ForStatement :=
'for' '(' [ ForInit ] ';' [ Expression ] ';' [ ExpressionList ] ')' Statement
| 'for' '(' FormalParameter ':' Expression ')' Statement
ForInit :=
Modifiers Type VariableDeclarators
| ModifiersOpt BasicType VariableDeclarators
| Expression VariableDeclarators (1)
| Expression { ',' Expression }
|
Java.Statement |
Parser.parseIfStatement()
IfStatement := 'if' '(' Expression ')' Statement [ 'else' Statement ]
|
Java.CompilationUnit.ImportDeclaration |
Parser.parseImportDeclaration()
ImportDeclaration := 'import' ImportDeclarationBody ';'
|
Java.CompilationUnit.ImportDeclaration |
Parser.parseImportDeclarationBody()
ImportDeclarationBody := [ 'static' ] Identifier { '.' Identifier } [ '.' '*' ]
|
Java.Atom |
Parser.parseInclusiveOrExpression()
InclusiveOrExpression :=
ExclusiveOrExpression { '|' ExclusiveOrExpression }
|
void |
Parser.parseInterfaceBody(Java.InterfaceDeclaration interfaceDeclaration)
InterfaceBody := '{' {
';' |
ModifiersOpt (
'void' Identifier MethodDeclarationRest |
'class' ClassDeclarationRest |
'interface' InterfaceDeclarationRest |
Type Identifier (
MethodDeclarationRest |
FieldDeclarationRest
)
)
} '}'
|
Java.InterfaceDeclaration |
Parser.parseInterfaceDeclarationRest(String optionalDocComment,
Java.Modifiers modifiers,
Parser.InterfaceDeclarationContext context)
InterfaceDeclarationRest :=
Identifier [ typeParameters ]
[ 'extends' ReferenceTypeList ]
InterfaceBody
|
Java.Statement |
Parser.parseLabeledStatement()
LabeledStatement := Identifier ':' Statement
|
Java.Rvalue |
Parser.parseLiteral()
Literal :=
IntegerLiteral
| FloatingPointLiteral
| BooleanLiteral
| CharacterLiteral
| StringLiteral
| NullLiteral
|
Java.Block |
Parser.parseMethodBody()
MethodBody := Block
|
Java.MethodDeclarator |
Parser.parseMethodDeclarationRest(String optionalDocComment,
Java.Modifiers modifiers,
Java.Type type,
String name)
MethodDeclarationRest :=
FormalParameters
{ '[' ']' }
[ 'throws' ReferenceTypeList ]
( ';' | MethodBody )
|
Java.Modifiers |
Parser.parseModifiers()
ModifiersAndAnnotations := { 'public' | 'protected' | 'private' | 'static' | 'abstract' | 'final' | 'native'
| 'synchronized' | 'transient' | 'volatile' | 'strictfp' | Annotation }
|
Java.Atom |
Parser.parseMultiplicativeExpression()
MultiplicativeExpression :=
UnaryExpression { ( '*' | '/' | '%' ) UnaryExpression }
|
Java.PackageDeclaration |
Parser.parsePackageDeclaration()
PackageDeclaration := 'package' QualifiedIdentifier ';'
|
Java.PackageMemberTypeDeclaration |
Parser.parsePackageMemberTypeDeclaration()
PackageMemberTypeDeclaration :=
ModifiersOpt 'class' ClassDeclarationRest |
ModifiersOpt 'interface' InterfaceDeclarationRest
|
Java.Atom |
Parser.parsePrimary()
Primary :=
CastExpression | // CastExpression 15.16
'(' Expression ')' | // ParenthesizedExpression 15.8.5
Literal | // Literal 15.8.1
Name | // AmbiguousName
Name Arguments | // MethodInvocation
Name '[]' { '[]' } | // ArrayType 10.1
Name '[]' { '[]' } '.' 'class' | // ClassLiteral 15.8.2
'this' | // This 15.8.3
'this' Arguments | // Alternate constructor invocation 8.8.5.1
'super' Arguments | // Unqualified superclass constructor invocation 8.8.5.1
'super' '.' Identifier | // SuperclassFieldAccess 15.11.2
'super' '.' Identifier Arguments | // SuperclassMethodInvocation 15.12.4.9
NewClassInstance |
NewAnonymousClassInstance | // ClassInstanceCreationExpression 15.9
NewArray | // ArrayCreationExpression 15.10
NewInitializedArray | // ArrayInitializer 10.6
BasicType { '[]' } | // Type
BasicType { '[]' } '.' 'class' | // ClassLiteral 15.8.2
'void' '.' 'class' // ClassLiteral 15.8.2
CastExpression :=
'(' PrimitiveType { '[]' } ')' UnaryExpression |
'(' Expression ')' UnaryExpression
NewClassInstance := 'new' ReferenceType Arguments
NewAnonymousClassInstance := 'new' ReferenceType Arguments [ ClassBody ]
NewArray := 'new' Type DimExprs { '[]' }
NewInitializedArray := 'new' ArrayType ArrayInitializer
|
String[] |
Parser.parseQualifiedIdentifier()
QualifiedIdentifier := Identifier { '.' Identifier }
|
Java.ReferenceType |
Parser.parseReferenceType()
ReferenceType := QualifiedIdentifier [ TypeArguments ]
|
Java.ReferenceType[] |
Parser.parseReferenceTypeList()
ReferenceTypeList := ReferenceType { ',' ReferenceType }
|
Java.Atom |
Parser.parseRelationalExpression()
RelationalExpression :=
ShiftExpression {
'instanceof' ReferenceType
| '<' ShiftExpression [ { ',' TypeArgument } '>' ]
| '<' TypeArgument [ { ',' TypeArgument } '>' ]
| ( '>' | '<=' | '>=' ) ShiftExpression
}
|
Java.Statement |
Parser.parseReturnStatement()
ReturnStatement := 'return' [ Expression ] ';'
|
Java.Atom |
Parser.parseSelector(Java.Atom atom)
Selector :=
'.' Identifier | // FieldAccess 15.11.1
'.' Identifier Arguments | // MethodInvocation
'.' 'this' // QualifiedThis 15.8.4
'.' 'super' Arguments // Qualified superclass constructor invocation (JLS7 8.8.7.1)
'.' 'super' '.' Identifier | // SuperclassFieldReference (JLS7 15.11.2)
'.' 'super' '.' Identifier Arguments | // SuperclassMethodInvocation (JLS7 15.12.3)
'.' 'new' Identifier Arguments [ ClassBody ] | // QualifiedClassInstanceCreationExpression 15.9
'.' 'class'
'[' Expression ']' // ArrayAccessExpression 15.13
|
Java.Atom |
Parser.parseShiftExpression()
ShiftExpression :=
AdditiveExpression { ( '<<' | '>>' | '>>>' ) AdditiveExpression }
|
Java.Statement |
Parser.parseStatement()
Statement :=
LabeledStatement |
Block |
IfStatement |
ForStatement |
WhileStatement |
DoStatement |
TryStatement |
'switch' ...
|
Java.Statement |
Parser.parseSwitchStatement()
SwitchStatement :=
'switch' '(' Expression ')' '{' { SwitchLabels BlockStatements } '}'
SwitchLabels := SwitchLabels { SwitchLabels }
SwitchLabel := 'case' Expression ':' | 'default' ':'
|
Java.Statement |
Parser.parseSynchronizedStatement()
SynchronizedStatement :=
'synchronized' '(' expression ')' Block
|
Java.Statement |
Parser.parseThrowStatement()
ThrowStatement := 'throw' Expression ';'
|
Java.Statement |
Parser.parseTryStatement()
TryStatement :=
'try' Block Catches [ Finally ] |
'try' Block Finally
Catches := CatchClause { CatchClause }
CatchClause := 'catch' '(' FormalParameter ')' Block
Finally := 'finally' Block
|
Java.Type |
Parser.parseType()
Type := (
'byte' | 'short' | 'char' | 'int' | 'long' |
'float' | 'double' | 'boolean' |
ReferenceType
) { '[' ']' }
|
Java.Atom |
Parser.parseUnaryExpression()
UnaryExpression :=
{ PrefixOperator } Primary { Selector } { PostfixOperator }
PrefixOperator := '++' | '--' | '+' | '-' | '~' | '!'
PostfixOperator := '++' | '--'
|
Java.VariableDeclarator |
Parser.parseVariableDeclarator()
VariableDeclarator := Identifier VariableDeclaratorRest
|
Java.VariableDeclarator |
Parser.parseVariableDeclaratorRest(String name)
VariableDeclaratorRest := { '[' ']' } [ '=' VariableInitializer ]
|
Java.VariableDeclarator[] |
Parser.parseVariableDeclarators()
VariableDeclarators := VariableDeclarator { ',' VariableDeclarator }
|
Java.ArrayInitializerOrRvalue |
Parser.parseVariableInitializer()
VariableInitializer :=
ArrayInitializer |
Expression
|
Java.Statement |
Parser.parseWhileStatement()
WhileStatement := 'while' '(' Expression ')' Statement
|
Scanner.Token |
Parser.peek() |
int |
Parser.peek(int[] suspected)
Checks whether the type of the next token is any of the
suspected ; does not consume the next token. |
boolean |
Parser.peek(String suspected) |
int |
Parser.peek(String[] suspected)
Checks whether the value of the next token equals any of the
suspected ; does not consume the next
token. |
boolean |
Parser.peekEof() |
String |
Parser.peekIdentifier() |
boolean |
Parser.peekLiteral() |
Scanner.Token |
Parser.peekNextButOne() |
boolean |
Parser.peekNextButOne(String suspected) |
boolean |
Parser.peekRead(String suspected) |
int |
Parser.peekRead(String[] values) |
Scanner.Token |
Scanner.produce()
Preduces and returns the next token.
|
Scanner.Token |
Parser.read() |
void |
Parser.read(String expected)
Verifies that the value of the next token equals
expected , and consumes the token. |
int |
Parser.read(String[] expected)
Verifies that the value of the next token equals one of the
expected , and consumes the token. |
String |
Parser.readIdentifier() |
String |
Parser.readOperator() |
void |
Java.Locatable.throwCompileException(String message)
Throw a
CompileException with the given message and this
object's location. |
void |
Java.Located.throwCompileException(String message) |
void |
Java.AbstractTypeDeclaration.throwCompileException(String message) |
Java.Lvalue |
Java.Atom.toLvalueOrCompileException() |
Java.Rvalue |
Java.Atom.toRvalueOrCompileException() |
Java.Type |
Java.Atom.toTypeOrCompileException() |
Constructor and Description |
---|
ClassBodyEvaluator(Scanner scanner,
Class optionalExtendedType,
Class[] implementedTypes,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ClassBodyEvaluator(Scanner scanner,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ClassBodyEvaluator(Scanner scanner,
String className,
Class optionalExtendedType,
Class[] implementedTypes,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ClassBodyEvaluator(String classBody)
Equivalent to
|
ClassBodyEvaluator(String optionalFileName,
InputStream is)
Equivalent to
|
ClassBodyEvaluator(String optionalFileName,
Reader reader)
Equivalent to
|
ExpressionEvaluator(Scanner scanner,
String className,
Class optionalExtendedType,
Class[] implementedTypes,
boolean staticMethod,
Class expressionType,
String methodName,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ExpressionEvaluator(String expression,
Class expressionType,
String[] parameterNames,
Class[] parameterTypes)
Equivalent to
|
ExpressionEvaluator(String expression,
Class expressionType,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions,
Class optionalExtendedType,
Class[] implementedTypes,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ExpressionEvaluator(String expression,
Class expressionType,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ExpressionStatement(Java.Rvalue rvalue) |
PackageMemberClassDeclaration(Location location,
String optionalDocComment,
Java.Modifiers modifiers,
String name,
Java.TypeParameter[] optionalTypeParameters,
Java.Type optionalExtendedType,
Java.Type[] implementedTypes) |
PackageMemberInterfaceDeclaration(Location location,
String optionalDocComment,
Java.Modifiers modifiers,
String name,
Java.TypeParameter[] optionalTypeParameters,
Java.Type[] extendedTypes) |
Scanner(File file)
Deprecated.
// SUPPRESS CHECKSTYLE MissingDeprecated
|
Scanner(File file,
String optionalEncoding)
Deprecated.
// SUPPRESS CHECKSTYLE MissingDeprecated
|
Scanner(String fileName)
Deprecated.
// SUPPRESS CHECKSTYLE MissingDeprecated
|
Scanner(String optionalFileName,
InputStream is)
Set up a scanner that reads tokens from the given
InputStream in the platform default encoding. |
Scanner(String optionalFileName,
InputStream is,
String optionalEncoding)
Set up a scanner that reads tokens from the given
InputStream with the given optionalEncoding
(null means platform default encoding). |
Scanner(String optionalFileName,
Reader in)
Set up a scanner that reads tokens from the given
Reader . |
Scanner(String optionalFileName,
Reader in,
short initialLineNumber,
short initialColumnNumber)
Creates a
Scanner that counts lines and columns from non-default initial values. |
Scanner(String fileName,
String encoding)
Deprecated.
// SUPPRESS CHECKSTYLE MissingDeprecated
|
ScriptEvaluator(Scanner scanner,
Class optionalExtendedType,
Class[] implementedTypes,
Class returnType,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ScriptEvaluator(Scanner scanner,
Class returnType,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ScriptEvaluator(Scanner scanner,
String className,
Class optionalExtendedType,
Class[] implementedTypes,
boolean staticMethod,
Class returnType,
String methodName,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ScriptEvaluator(String script)
Equivalent to
|
ScriptEvaluator(String script,
Class returnType)
Equivalent to
|
ScriptEvaluator(String script,
Class returnType,
String[] parameterNames,
Class[] parameterTypes)
Equivalent to
|
ScriptEvaluator(String script,
Class returnType,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions)
Equivalent to
|
ScriptEvaluator(String optionalFileName,
InputStream is,
Class returnType,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
ScriptEvaluator(String optionalFileName,
Reader reader,
Class returnType,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions,
ClassLoader optionalParentClassLoader)
Equivalent to
|
SimpleCompiler(Scanner scanner,
ClassLoader optionalParentClassLoader)
Equivalent to
|
SimpleCompiler(String fileName)
Equivalent to
|
SimpleCompiler(String optionalFileName,
InputStream is)
Equivalent to
|
SimpleCompiler(String optionalFileName,
Reader in)
Equivalent to
|
Modifier and Type | Method and Description |
---|---|
static void |
DeclarationCounter.main(String[] args) |
Copyright © 2001–2016. All rights reserved.