View Javadoc

    1   package net.sourceforge.pmd.sourcetypehandlers;
    2
    3   import net.sourceforge.pmd.ast.ParseException;
    4   import net.sourceforge.pmd.jsp.ast.JspCharStream;
    5   import net.sourceforge.pmd.parsers.Parser;
    6   import net.sourceforge.pmd.symboltable.JspSymbolFacade;
    7
    8   import java.io.Reader;
    9
    10  /***
    11   * Implementation of SourceTypeHandler for the JSP parser.
    12   *
    13   * @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
    14   */
    15  public class JspTypeHandler implements SourceTypeHandler {
    16      DummyVisitorStarter dummyVisitor = new DummyVisitorStarter();
    17
    18      public Parser getParser() {
    19          return new Parser() {
    20              public Object parse(Reader source) throws ParseException {
    21                  return new net.sourceforge.pmd.jsp.ast.JspParser(new JspCharStream(source))
    22                          .CompilationUnit();
    23              }
    24          };
    25      }
    26
    27      public VisitorStarter getDataFlowFacade() {
    28          return dummyVisitor;
    29      }
    30
    31      public VisitorStarter getSymbolFacade() {
    32          return new JspSymbolFacade();
    33      }
    34
    35  }