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 Detail

      • getTokenManager

        @Deprecated
        TokenManager getTokenManager​(String fileName,
                                     Reader source)
        Deprecated.
        For removal in 7.0.0
        Get a TokenManager for the given source.
        Parameters:
        fileName - The file name being parsed (may be null).
        source - Reader that provides the source code to tokenize.
        Returns:
        A TokenManager for reading token.
      • canParse

        @Deprecated
        boolean canParse()
        Deprecated.
        With 7.0.0, all parsers will be able to parse and this method will be removed. Note that in the meantime, you probably still need to check this method.
        Indicates if this parser can actual parse, or if it can only tokenize.
      • parse

        Node parse​(String fileName,
                   Reader source)
            throws ParseException
        Parse source code and return the root node of the AST.
        Parameters:
        fileName - The file name being parsed (may be null).
        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

        @Deprecated
        Map<Integer,​String> getSuppressMap()
        Deprecated.
        With 7.0.0, this method will be removed. To support suppressing with suppress markers, this method is still needed in PMD 6.
        Returns the map of line numbers to suppression / review comments. Only single line comments are considered, that start with the configured "suppressMarker", which by default is "PMD". The text after the suppressMarker is used as a "review comment" and included in this map.

        This map is later used to determine, if a violation is being suppressed. It is suppressed, if the line of the violation is contained in this suppress map.

        Returns:
        map of the suppress lines with the corresponding review comments.