Top Description Inners Fields Constructors Methods
com.github.javaparser

public Class ParserConfiguration

extends Object
Class Inheritance
Static Imports
com.github.javaparser.ParserConfiguration.LanguageLevel.*, com.github.javaparser.utils.Utils.*

The configuration that is used by the parser. Note that this can be changed even when reusing the same JavaParser instance. It will pick up the changes.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private boolean
private Charset
private boolean
private boolean
private ParserConfiguration.LanguageLevel
private boolean
private final List<ParseResult.PostProcessor>
private final List<Providers.PreProcessor>
private boolean
private boolean
private SymbolResolver
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Charset
public ParserConfiguration.LanguageLevel
public List<ParseResult.PostProcessor>
public List<Providers.PreProcessor>
public Optional<SymbolResolver>
getSymbolResolver()

Retrieve the SymbolResolver to be used while parsing, if any.

public int
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public ParserConfiguration
setAttributeComments(boolean attributeComments)

Whether to run CommentsInserter, which will put the comments that were found in the source code into the comment and javadoc fields of the nodes it thinks they refer to.

public ParserConfiguration
setCharacterEncoding(Charset characterEncoding)

The character encoding used for reading input from files and streams.

public ParserConfiguration
setDoNotAssignCommentsPrecedingEmptyLines(boolean doNotAssignCommentsPrecedingEmptyLines)

public ParserConfiguration
setIgnoreAnnotationsWhenAttributingComments(boolean ignoreAnnotationsWhenAttributingComments)

public ParserConfiguration
public ParserConfiguration
setLexicalPreservationEnabled(boolean lexicalPreservationEnabled)

Disabled by default.

public ParserConfiguration
setPreprocessUnicodeEscapes(boolean preprocessUnicodeEscapes)

When set to true, unicode escape handling is done by preprocessing the whole input, meaning that all unicode escapes are turned into unicode characters before parsing.

public ParserConfiguration
setStoreTokens(boolean storeTokens)

public ParserConfiguration
setSymbolResolver(SymbolResolver symbolResolver)

Set the SymbolResolver to be injected while parsing.

public ParserConfiguration
setTabSize(int tabSize)

When a TAB character is encountered during parsing, the column position will be increased by this value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeCommentsback to summary
private boolean attributeComments
characterEncodingback to summary
private Charset characterEncoding
doNotAssignCommentsPrecedingEmptyLinesback to summary
private boolean doNotAssignCommentsPrecedingEmptyLines
ignoreAnnotationsWhenAttributingCommentsback to summary
private boolean ignoreAnnotationsWhenAttributingComments
languageLevelback to summary
private ParserConfiguration.LanguageLevel languageLevel
lexicalPreservationEnabledback to summary
private boolean lexicalPreservationEnabled
postProcessorsback to summary
private final List<ParseResult.PostProcessor> postProcessors
preProcessorsback to summary
private final List<Providers.PreProcessor> preProcessors
preprocessUnicodeEscapesback to summary
private boolean preprocessUnicodeEscapes
storeTokensback to summary
private boolean storeTokens
symbolResolverback to summary
private SymbolResolver symbolResolver
tabSizeback to summary
private int tabSize

Constructor Detail

ParserConfigurationback to summary
public ParserConfiguration()

Method Detail

getCharacterEncodingback to summary
public Charset getCharacterEncoding()
getLanguageLevelback to summary
public ParserConfiguration.LanguageLevel getLanguageLevel()
getPostProcessorsback to summary
public List<ParseResult.PostProcessor> getPostProcessors()
getPreProcessorsback to summary
public List<Providers.PreProcessor> getPreProcessors()
getSymbolResolverback to summary
public Optional<SymbolResolver> getSymbolResolver()

Retrieve the SymbolResolver to be used while parsing, if any.

getTabSizeback to summary
public int getTabSize()
isAttributeCommentsback to summary
public boolean isAttributeComments()
isDoNotAssignCommentsPrecedingEmptyLinesback to summary
public boolean isDoNotAssignCommentsPrecedingEmptyLines()
isIgnoreAnnotationsWhenAttributingCommentsback to summary
public boolean isIgnoreAnnotationsWhenAttributingComments()
isLexicalPreservationEnabledback to summary
public boolean isLexicalPreservationEnabled()
isPreprocessUnicodeEscapesback to summary
public boolean isPreprocessUnicodeEscapes()
isStoreTokensback to summary
public boolean isStoreTokens()
setAttributeCommentsback to summary
public ParserConfiguration setAttributeComments(boolean attributeComments)

Whether to run CommentsInserter, which will put the comments that were found in the source code into the comment and javadoc fields of the nodes it thinks they refer to.

setCharacterEncodingback to summary
public ParserConfiguration setCharacterEncoding(Charset characterEncoding)

The character encoding used for reading input from files and streams. By default UTF8 is used.

setDoNotAssignCommentsPrecedingEmptyLinesback to summary
public ParserConfiguration setDoNotAssignCommentsPrecedingEmptyLines(boolean doNotAssignCommentsPrecedingEmptyLines)
setIgnoreAnnotationsWhenAttributingCommentsback to summary
public ParserConfiguration setIgnoreAnnotationsWhenAttributingComments(boolean ignoreAnnotationsWhenAttributingComments)
setLanguageLevelback to summary
public ParserConfiguration setLanguageLevel(ParserConfiguration.LanguageLevel languageLevel)
setLexicalPreservationEnabledback to summary
public ParserConfiguration setLexicalPreservationEnabled(boolean lexicalPreservationEnabled)

Disabled by default. When this is enabled, LexicalPreservingPrinter.print can be used to reproduce the original formatting of the file.

setPreprocessUnicodeEscapesback to summary
public ParserConfiguration setPreprocessUnicodeEscapes(boolean preprocessUnicodeEscapes)

When set to true, unicode escape handling is done by preprocessing the whole input, meaning that all unicode escapes are turned into unicode characters before parsing. That means the AST will never contain literal unicode escapes. However, positions in the AST will point to the original input, which is exactly the same as without this option. Without this option enabled, the unicode escapes will not be processed and are transfered intact to the AST.

setStoreTokensback to summary
public ParserConfiguration setStoreTokens(boolean storeTokens)
setSymbolResolverback to summary
public ParserConfiguration setSymbolResolver(SymbolResolver symbolResolver)

Set the SymbolResolver to be injected while parsing.

setTabSizeback to summary
public ParserConfiguration setTabSize(int tabSize)

When a TAB character is encountered during parsing, the column position will be increased by this value. By default it is 1.

com.github.javaparser back to summary

public final Enum ParserConfiguration.LanguageLevel

extends Enum<ParserConfiguration.LanguageLevel>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static ParserConfiguration.LanguageLevel
BLEEDING_EDGE

The newest Java features supported.

public static ParserConfiguration.LanguageLevel
CURRENT

The latest Java version that is available.

public static final ParserConfiguration.LanguageLevel
JAVA_10

Java 10

public static final ParserConfiguration.LanguageLevel
JAVA_11

Java 11

public static final ParserConfiguration.LanguageLevel
JAVA_12

Java 12

public static final ParserConfiguration.LanguageLevel
JAVA_13

Java 13

public static final ParserConfiguration.LanguageLevel
JAVA_14

Java 14

public static final ParserConfiguration.LanguageLevel
JAVA_1_0

Java 1.0

public static final ParserConfiguration.LanguageLevel
JAVA_1_1

Java 1.1

public static final ParserConfiguration.LanguageLevel
JAVA_1_2

Java 1.2

public static final ParserConfiguration.LanguageLevel
JAVA_1_3

Java 1.3

public static final ParserConfiguration.LanguageLevel
JAVA_1_4

Java 1.4

public static final ParserConfiguration.LanguageLevel
JAVA_5

Java 5

public static final ParserConfiguration.LanguageLevel
JAVA_6

Java 6

public static final ParserConfiguration.LanguageLevel
JAVA_7

Java 7

public static final ParserConfiguration.LanguageLevel
JAVA_8

Java 8

public static final ParserConfiguration.LanguageLevel
JAVA_9

Java 9

public static ParserConfiguration.LanguageLevel
POPULAR

The most used Java version.

pack-priv final ParseResult.PostProcessor
public static ParserConfiguration.LanguageLevel
RAW

Does no post processing or validation.

pack-priv final Validator

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ParserConfiguration.LanguageLevel
public static ParserConfiguration.LanguageLevel[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BLEEDING_EDGEback to summary
public static ParserConfiguration.LanguageLevel BLEEDING_EDGE

The newest Java features supported.

CURRENTback to summary
public static ParserConfiguration.LanguageLevel CURRENT

The latest Java version that is available.

JAVA_10back to summary
public static final ParserConfiguration.LanguageLevel JAVA_10

Java 10

JAVA_11back to summary
public static final ParserConfiguration.LanguageLevel JAVA_11

Java 11

JAVA_12back to summary
public static final ParserConfiguration.LanguageLevel JAVA_12

Java 12

JAVA_13back to summary
public static final ParserConfiguration.LanguageLevel JAVA_13

Java 13

JAVA_14back to summary
public static final ParserConfiguration.LanguageLevel JAVA_14

Java 14

JAVA_1_0back to summary
public static final ParserConfiguration.LanguageLevel JAVA_1_0

Java 1.0

JAVA_1_1back to summary
public static final ParserConfiguration.LanguageLevel JAVA_1_1

Java 1.1

JAVA_1_2back to summary
public static final ParserConfiguration.LanguageLevel JAVA_1_2

Java 1.2

JAVA_1_3back to summary
public static final ParserConfiguration.LanguageLevel JAVA_1_3

Java 1.3

JAVA_1_4back to summary
public static final ParserConfiguration.LanguageLevel JAVA_1_4

Java 1.4

JAVA_5back to summary
public static final ParserConfiguration.LanguageLevel JAVA_5

Java 5

JAVA_6back to summary
public static final ParserConfiguration.LanguageLevel JAVA_6

Java 6

JAVA_7back to summary
public static final ParserConfiguration.LanguageLevel JAVA_7

Java 7

JAVA_8back to summary
public static final ParserConfiguration.LanguageLevel JAVA_8

Java 8

JAVA_9back to summary
public static final ParserConfiguration.LanguageLevel JAVA_9

Java 9

POPULARback to summary
public static ParserConfiguration.LanguageLevel POPULAR

The most used Java version.

postProcessorback to summary
pack-priv final ParseResult.PostProcessor postProcessor
RAWback to summary
public static ParserConfiguration.LanguageLevel RAW

Does no post processing or validation. Only for people wanting the fastest parsing.

validatorback to summary
pack-priv final Validator validator

Constructor Detail

LanguageLevelback to summary
private LanguageLevel(Validator validator, ParseResult.PostProcessor postProcessor)

Method Detail

valueOfback to summary
public static ParserConfiguration.LanguageLevel valueOf(String name)
valuesback to summary
public static ParserConfiguration.LanguageLevel[] values()