Class ScalaParser

  • All Implemented Interfaces:
    net.sourceforge.pmd.lang.Parser

    public class ScalaParser
    extends net.sourceforge.pmd.lang.AbstractParser
    Scala's Parser implementation. Defers parsing to the scala compiler via Scalameta. This parser then wraps all of ScalaMeta's Nodes in Java versions for compatibility.
    • Constructor Detail

      • ScalaParser

        public ScalaParser​(scala.meta.Dialect scalaDialect,
                           net.sourceforge.pmd.lang.ParserOptions parserOptions)
        Create a parser using the given Scala Dialect and set of parser options.
        Parameters:
        scalaDialect - the Scala Dialect for this parser
        parserOptions - any additional options for this parser
    • Method Detail

      • canParse

        public boolean canParse()
      • parse

        public ASTSource parse​(String fileName,
                               Reader source)
                        throws net.sourceforge.pmd.lang.ast.ParseException
        Throws:
        net.sourceforge.pmd.lang.ast.ParseException
      • createTokenManager

        protected net.sourceforge.pmd.lang.TokenManager createTokenManager​(Reader source)
        Specified by:
        createTokenManager in class net.sourceforge.pmd.lang.AbstractParser