View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.ecmascript.rule;
5   
6   import net.sourceforge.pmd.lang.Language;
7   import net.sourceforge.pmd.lang.ParserOptions;
8   import net.sourceforge.pmd.lang.ecmascript.EcmascriptParserOptions;
9   import net.sourceforge.pmd.lang.rule.XPathRule;
10  import net.sourceforge.pmd.lang.rule.properties.BooleanProperty;
11  import net.sourceforge.pmd.lang.rule.properties.EnumeratedProperty;
12  
13  public class EcmascriptXPathRule extends XPathRule {
14  
15      private static final BooleanProperty RECORDING_COMMENTS_DESCRIPTOR = EcmascriptParserOptions.RECORDING_COMMENTS_DESCRIPTOR;
16      private static final BooleanProperty RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR = EcmascriptParserOptions.RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR;
17      private static final EnumeratedProperty<EcmascriptParserOptions.Version> RHINO_LANGUAGE_VERSION = EcmascriptParserOptions.RHINO_LANGUAGE_VERSION;
18  
19      public EcmascriptXPathRule() {
20  	super.setLanguage(Language.ECMASCRIPT);
21  	definePropertyDescriptor(RECORDING_COMMENTS_DESCRIPTOR);
22  	definePropertyDescriptor(RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR);
23  	definePropertyDescriptor(RHINO_LANGUAGE_VERSION);
24      }
25  
26      @Override
27      public ParserOptions getParserOptions() {
28  	return new EcmascriptParserOptions(this);
29      }
30  }