Ecmascript3Handler.java
01 /**
02  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03  */
04 package net.sourceforge.pmd.lang.ecmascript;
05 
06 import java.io.Writer;
07 
08 import net.sf.saxon.sxpath.IndependentContext;
09 import net.sourceforge.pmd.lang.DataFlowHandler;
10 import net.sourceforge.pmd.lang.LanguageVersionHandler;
11 import net.sourceforge.pmd.lang.Parser;
12 import net.sourceforge.pmd.lang.VisitorStarter;
13 import net.sourceforge.pmd.lang.XPathHandler;
14 import net.sourceforge.pmd.lang.ast.Node;
15 import net.sourceforge.pmd.lang.ast.xpath.AbstractASTXPathHandler;
16 import net.sourceforge.pmd.lang.ecmascript.ast.DumpFacade;
17 import net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptNode;
18 import net.sourceforge.pmd.lang.ecmascript.rule.EcmascriptRuleViolationFactory;
19 import net.sourceforge.pmd.lang.rule.RuleViolationFactory;
20 
21 /**
22  * Implementation of LanguageVersionHandler for the ECMAScript Version 3.
23  */
24 public class Ecmascript3Handler implements LanguageVersionHandler {
25 
26     public DataFlowHandler getDataFlowHandler() {
27   return DataFlowHandler.DUMMY;
28     }
29 
30     public XPathHandler getXPathHandler() {
31   return new AbstractASTXPathHandler() {
32       public void initialize() {
33       }
34 
35       public void initialize(IndependentContext context) {
36       }
37   };
38     }
39 
40     public RuleViolationFactory getRuleViolationFactory() {
41   return EcmascriptRuleViolationFactory.INSTANCE;
42     }
43 
44     public Parser getParser() {
45   return new Ecmascript3Parser();
46     }
47 
48     public VisitorStarter getDataFlowFacade() {
49   return VisitorStarter.DUMMY;
50     }
51 
52     public VisitorStarter getSymbolFacade() {
53   return VisitorStarter.DUMMY;
54     }
55 
56     public VisitorStarter getTypeResolutionFacade(ClassLoader classLoader) {
57   return VisitorStarter.DUMMY;
58     }
59 
60     public VisitorStarter getDumpFacade(final Writer writer, final String prefix, final boolean recurse) {
61   return new VisitorStarter() {
62       public void start(Node rootNode) {
63     new DumpFacade().initializeWith(writer, prefix, recurse, (EcmascriptNoderootNode);
64       }
65   };
66     }
67 }