1
2
3
4 package net.sourceforge.pmd.lang.ecmascript.rule;
5
6 import net.sourceforge.pmd.lang.LanguageRegistry;
7 import net.sourceforge.pmd.lang.ParserOptions;
8 import net.sourceforge.pmd.lang.ecmascript.EcmascriptLanguageModule;
9 import net.sourceforge.pmd.lang.ecmascript.EcmascriptParserOptions;
10 import net.sourceforge.pmd.lang.rule.XPathRule;
11 import net.sourceforge.pmd.lang.rule.properties.BooleanProperty;
12 import net.sourceforge.pmd.lang.rule.properties.EnumeratedProperty;
13
14 public class EcmascriptXPathRule extends XPathRule {
15
16 private static final BooleanProperty RECORDING_COMMENTS_DESCRIPTOR = EcmascriptParserOptions.RECORDING_COMMENTS_DESCRIPTOR;
17 private static final BooleanProperty RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR = EcmascriptParserOptions.RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR;
18 private static final EnumeratedProperty<EcmascriptParserOptions.Version> RHINO_LANGUAGE_VERSION = EcmascriptParserOptions.RHINO_LANGUAGE_VERSION;
19
20 public EcmascriptXPathRule() {
21 super.setLanguage(LanguageRegistry.getLanguage(EcmascriptLanguageModule.NAME));
22 definePropertyDescriptor(RECORDING_COMMENTS_DESCRIPTOR);
23 definePropertyDescriptor(RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR);
24 definePropertyDescriptor(RHINO_LANGUAGE_VERSION);
25 }
26
27 @Override
28 public ParserOptions getParserOptions() {
29 return new EcmascriptParserOptions(this);
30 }
31 }