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;
5   
6   import java.io.Reader;
7   import java.util.Map;
8   
9   import net.sourceforge.pmd.lang.AbstractParser;
10  import net.sourceforge.pmd.lang.ParserOptions;
11  import net.sourceforge.pmd.lang.TokenManager;
12  import net.sourceforge.pmd.lang.ast.Node;
13  import net.sourceforge.pmd.lang.ast.ParseException;
14  
15  /**
16   * Adapter for the EcmascriptParser.
17   */
18  public class Ecmascript3Parser extends AbstractParser {
19      private net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParser ecmascriptParser;
20  
21      public Ecmascript3Parser(ParserOptions parserOptions) {
22  	super(parserOptions);
23  	ecmascriptParser = new net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParser((EcmascriptParserOptions)parserOptions);
24      }
25  
26      @Override
27      public TokenManager createTokenManager(Reader source) {
28  	return null;
29      }
30  
31      public boolean canParse() {
32  	return true;
33      }
34  
35      public Node parse(String fileName, Reader source) throws ParseException {
36      return ecmascriptParser.parse(source);
37      }
38  
39      public Map<Integer, String> getSuppressMap() {
40          return ecmascriptParser.getSuppressMap();
41      }
42  }