Package org.mozilla.javascript
Class CompilerEnvirons
java.lang.Object
org.mozilla.javascript.CompilerEnvirons
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal ErrorReporterfinal intfinal intbooleanstatic CompilerEnvironsReturns aCompilerEnvironssuitable for using Rhino in an IDE environment.voidfinal booleanExtension to ECMA: if 'function <name>' is not followed by '(', assume <name> starts amemberExprfinal booleanbooleanfinal booleanbooleanbooleanbooleanfinal booleanfinal booleanfinal booleanbooleanfinal booleanvoidsetActivationNames(Set<String> activationNames) voidsetAllowMemberExprAsFunctionName(boolean flag) voidsetAllowSharpComments(boolean allow) Mozilla sources use the C preprocessor.voidsetErrorReporter(ErrorReporter errorReporter) voidsetGenerateDebugInfo(boolean flag) voidsetGenerateObserverCount(boolean generateObserverCount) Turn on or off generation of code with callbacks to track the count of executed instructions.voidsetGeneratingSource(boolean generatingSource) Specify whether or not source information should be generated.voidsetIdeMode(boolean ide) Puts the parser in "IDE" mode.voidsetLanguageVersion(int languageVersion) voidsetOptimizationLevel(int level) voidsetRecordingComments(boolean record) voidsetRecordingLocalJsDocComments(boolean record) voidsetRecoverFromErrors(boolean recover) Turn on or off full error recovery.voidsetReservedKeywordAsIdentifier(boolean flag) voidsetStrictMode(boolean strict) voidsetWarnTrailingComma(boolean warn) voidsetXmlAvailable(boolean flag)
-
Constructor Details
-
CompilerEnvirons
public CompilerEnvirons()
-
-
Method Details
-
initFromContext
-
getErrorReporter
-
setErrorReporter
-
getLanguageVersion
public final int getLanguageVersion() -
setLanguageVersion
public void setLanguageVersion(int languageVersion) -
isGenerateDebugInfo
public final boolean isGenerateDebugInfo() -
setGenerateDebugInfo
public void setGenerateDebugInfo(boolean flag) -
isReservedKeywordAsIdentifier
public final boolean isReservedKeywordAsIdentifier() -
setReservedKeywordAsIdentifier
public void setReservedKeywordAsIdentifier(boolean flag) -
isAllowMemberExprAsFunctionName
public final boolean isAllowMemberExprAsFunctionName()Extension to ECMA: if 'function <name>' is not followed by '(', assume <name> starts amemberExpr -
setAllowMemberExprAsFunctionName
public void setAllowMemberExprAsFunctionName(boolean flag) -
isXmlAvailable
public final boolean isXmlAvailable() -
setXmlAvailable
public void setXmlAvailable(boolean flag) -
getOptimizationLevel
public final int getOptimizationLevel() -
setOptimizationLevel
public void setOptimizationLevel(int level) -
isGeneratingSource
public final boolean isGeneratingSource() -
getWarnTrailingComma
public boolean getWarnTrailingComma() -
setWarnTrailingComma
public void setWarnTrailingComma(boolean warn) -
isStrictMode
public final boolean isStrictMode() -
setStrictMode
public void setStrictMode(boolean strict) -
reportWarningAsError
public final boolean reportWarningAsError() -
setGeneratingSource
public void setGeneratingSource(boolean generatingSource) Specify whether or not source information should be generated.Without source information, evaluating the "toString" method on JavaScript functions produces only "[native code]" for the body of the function. Note that code generated without source is not fully ECMA conformant.
-
isGenerateObserverCount
public boolean isGenerateObserverCount()- Returns:
- true iff code will be generated with callbacks to enable instruction thresholds
-
setGenerateObserverCount
public void setGenerateObserverCount(boolean generateObserverCount) Turn on or off generation of code with callbacks to track the count of executed instructions. Currently only affects JVM byte code generation: this slows down the generated code, but code generated without the callbacks will not be counted toward instruction thresholds. Rhino's interpretive mode does instruction counting without inserting callbacks, so there is no requirement to compile code differently.- Parameters:
generateObserverCount- if true, generated code will contain calls to accumulate an estimate of the instructions executed.
-
isRecordingComments
public boolean isRecordingComments() -
setRecordingComments
public void setRecordingComments(boolean record) -
isRecordingLocalJsDocComments
public boolean isRecordingLocalJsDocComments() -
setRecordingLocalJsDocComments
public void setRecordingLocalJsDocComments(boolean record) -
setRecoverFromErrors
public void setRecoverFromErrors(boolean recover) Turn on or off full error recovery. In this mode, parse errors do not throw an exception, and the parser attempts to build a full syntax tree from the input. Useful for IDEs and other frontends. -
recoverFromErrors
public boolean recoverFromErrors() -
setIdeMode
public void setIdeMode(boolean ide) Puts the parser in "IDE" mode. This enables some slightly more expensive computations, such as figuring out helpful error bounds. -
isIdeMode
public boolean isIdeMode() -
getActivationNames
-
setActivationNames
-
setAllowSharpComments
public void setAllowSharpComments(boolean allow) Mozilla sources use the C preprocessor. -
getAllowSharpComments
public boolean getAllowSharpComments() -
ideEnvirons
Returns aCompilerEnvironssuitable for using Rhino in an IDE environment. Most features are enabled by default. TheErrorReporteris set to anErrorCollector.
-