Package net.sourceforge.pmd.lang
Interface Parser
-
- All Known Implementing Classes:
AbstractParser
public interface Parser
Common interface for calling tree-building parsers or source files.- Author:
- Pieter_Van_Raemdonck - Application Engineers NV/SA - www.ae.be
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canParse()
Indicates if this parser can actual parse, or if it can only tokenize.ParserOptions
getParserOptions()
Get the ParserOptions used by this Parser.java.util.Map<java.lang.Integer,java.lang.String>
getSuppressMap()
TokenManager
getTokenManager(java.lang.String fileName, java.io.Reader source)
Get a TokenManager for the given source.Node
parse(java.lang.String fileName, java.io.Reader source)
Parse source code and return the root node of the AST.
-
-
-
Method Detail
-
getParserOptions
ParserOptions getParserOptions()
Get the ParserOptions used by this Parser.
-
getTokenManager
TokenManager getTokenManager(java.lang.String fileName, java.io.Reader source)
Get a TokenManager for the given source.- Parameters:
fileName
- The file name being parsed (may benull
).source
- Reader that provides the source code to tokenize.- Returns:
- A TokenManager for reading token.
-
canParse
boolean canParse()
Indicates if this parser can actual parse, or if it can only tokenize.
-
parse
Node parse(java.lang.String fileName, java.io.Reader source) throws ParseException
Parse source code and return the root node of the AST.- Parameters:
fileName
- The file name being parsed (may benull
).source
- Reader that provides the source code of a compilation unit- Returns:
- the root node of the AST that is built from the source code
- Throws:
ParseException
- In case the source code could not be parsed, probably due to syntactical errors.
-
getSuppressMap
java.util.Map<java.lang.Integer,java.lang.String> getSuppressMap()
-
-