View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.cpp;
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.AbstractTokenManager;
13  import net.sourceforge.pmd.lang.ast.Node;
14  import net.sourceforge.pmd.lang.ast.ParseException;
15  
16  /**
17   * Adapter for the C++ Parser.
18   */
19  public class CppParser extends AbstractParser {
20  
21      public CppParser(ParserOptions parserOptions) {
22  	super(parserOptions);
23      }
24  
25      @Override
26      public TokenManager createTokenManager(Reader source) {
27  	return new CppTokenManager(source);
28      }
29  
30      public boolean canParse() {
31  	return false;
32      }
33  
34      public Node parse(String fileName, Reader source) throws ParseException {
35  	AbstractTokenManager.setFileName(fileName);
36  	throw new UnsupportedOperationException("parse(Reader) is not supported for C++");
37      }
38  
39      public Map<Integer, String> getSuppressMap() {
40  	throw new UnsupportedOperationException("getSuppressMap() is not supported for C++");
41      }
42  }