Package com.github.javaparser
Class ParserConfiguration
java.lang.Object
com.github.javaparser.ParserConfiguration
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 Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the SymbolResolver to be used while parsing, if any.int
boolean
boolean
boolean
boolean
boolean
boolean
boolean
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.setCharacterEncoding(Charset characterEncoding)
The character encoding used for reading input from files and streams.setDetectOriginalLineSeparator(boolean detectOriginalLineSeparator)
setDoNotAssignCommentsPrecedingEmptyLines(boolean doNotAssignCommentsPrecedingEmptyLines)
setIgnoreAnnotationsWhenAttributingComments(boolean ignoreAnnotationsWhenAttributingComments)
setLanguageLevel(ParserConfiguration.LanguageLevel languageLevel)
setLexicalPreservationEnabled(boolean lexicalPreservationEnabled)
Disabled by default.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.setStoreTokens(boolean storeTokens)
setSymbolResolver(SymbolResolver symbolResolver)
Set the SymbolResolver to be injected while parsing.setTabSize(int tabSize)
When a TAB character is encountered during parsing, the column position will be increased by this value.
-
Constructor Details
-
ParserConfiguration
public ParserConfiguration()
-
-
Method Details
-
isAttributeComments
public boolean isAttributeComments() -
setAttributeComments
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. -
isDoNotAssignCommentsPrecedingEmptyLines
public boolean isDoNotAssignCommentsPrecedingEmptyLines() -
setDoNotAssignCommentsPrecedingEmptyLines
public ParserConfiguration setDoNotAssignCommentsPrecedingEmptyLines(boolean doNotAssignCommentsPrecedingEmptyLines) -
isIgnoreAnnotationsWhenAttributingComments
public boolean isIgnoreAnnotationsWhenAttributingComments() -
setIgnoreAnnotationsWhenAttributingComments
public ParserConfiguration setIgnoreAnnotationsWhenAttributingComments(boolean ignoreAnnotationsWhenAttributingComments) -
setStoreTokens
-
isStoreTokens
public boolean isStoreTokens() -
getTabSize
public int getTabSize() -
setTabSize
When a TAB character is encountered during parsing, the column position will be increased by this value. By default it is 1. -
setLexicalPreservationEnabled
Disabled by default. When this is enabled, LexicalPreservingPrinter.print can be used to reproduce the original formatting of the file. -
isLexicalPreservationEnabled
public boolean isLexicalPreservationEnabled() -
getSymbolResolver
Retrieve the SymbolResolver to be used while parsing, if any. -
setSymbolResolver
Set the SymbolResolver to be injected while parsing. -
getPreProcessors
-
getPostProcessors
-
setLanguageLevel
-
getLanguageLevel
-
setPreprocessUnicodeEscapes
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. -
isPreprocessUnicodeEscapes
public boolean isPreprocessUnicodeEscapes() -
setDetectOriginalLineSeparator
-
isDetectOriginalLineSeparator
public boolean isDetectOriginalLineSeparator() -
getCharacterEncoding
-
setCharacterEncoding
The character encoding used for reading input from files and streams. By default UTF8 is used.
-