net.sourceforge.pmd.lang

## Interface Parser

- All Known Implementing Classes:
    AbstractJavaParser, AbstractParser, CppParser, Ecmascript3Parser, Java13Parser, Java14Parser, Java15Parser, Java16Parser, Java17Parser, JspParser, XmlParser

      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

    Methods
    Modifier and Type | Method and 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.
    `Map<Integer,String>` | `getSuppressMap()`
    `TokenManager` | `getTokenManager(String fileName, Reader source)` Get a TokenManager for the given source.
    `Node` | `parse(String fileName, 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(String fileName,
                                     Reader source)

      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

          boolean canParse()

      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

          Map<Integer,String> getSuppressMap()

Copyright © 2002-2013 InfoEther. All Rights Reserved.