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.ast;
5   
6   import org.mozilla.javascript.Token;
7   import org.mozilla.javascript.ast.KeywordLiteral;
8   
9   public class ASTKeywordLiteral extends AbstractEcmascriptNode<KeywordLiteral> {
10      public ASTKeywordLiteral(KeywordLiteral keywordLiteral) {
11  	super(keywordLiteral);
12  	super.setImage(Token.typeToName(keywordLiteral.getType()).toLowerCase());
13      }
14  
15      /**
16       * Accept the visitor.
17       */
18      @Override
19      public Object jjtAccept(EcmascriptParserVisitor visitor, Object data) {
20  	return visitor.visit(this, data);
21      }
22  
23      public boolean isBoolean() {
24  	return node.isBooleanLiteral();
25      }
26      
27      public boolean isThis() {
28  	return node.getType() == Token.THIS;
29      }
30      
31      public boolean isNull() {
32  	return node.getType() == Token.NULL;
33      }
34      
35      public boolean isDebugger() {
36  	return node.getType() == Token.DEBUGGER;
37      }
38  }