View Javadoc

    1   /**
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package net.sourceforge.pmd.lang.jsp;
    5
    6   import java.io.Reader;
    7   import java.util.HashMap;
    8   import java.util.Map;
    9
    10  import net.sourceforge.pmd.lang.AbstractParser;
    11  import net.sourceforge.pmd.lang.ParserOptions;
    12  import net.sourceforge.pmd.lang.TokenManager;
    13  import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
    14  import net.sourceforge.pmd.lang.ast.Node;
    15  import net.sourceforge.pmd.lang.ast.ParseException;
    16  import net.sourceforge.pmd.lang.ast.SimpleCharStream;
    17
    18  /**
    19   * Adapter for the JspParser.
    20   */
    21  public class JspParser extends AbstractParser {
    22
    23      public JspParser(ParserOptions parserOptions) {
    24  	super(parserOptions);
    25      }
    26
    27      @Override
    28      public TokenManager createTokenManager(Reader source) {
    29  	return new JspTokenManager(source);
    30      }
    31
    32      public boolean canParse() {
    33  	return true;
    34      }
    35
    36      public Node parse(String fileName, Reader source) throws ParseException {
    37  	AbstractTokenManager.setFileName(fileName);
    38  	return new net.sourceforge.pmd.lang.jsp.ast.JspParser(new SimpleCharStream(source)).CompilationUnit();
    39      }
    40
    41      public Map<Integer, String> getSuppressMap() {
    42  	return new HashMap<Integer, String>(); // FIXME
    43      }
    44  }