View Javadoc

    1   package net.sourceforge.pmd.lang.cpp;
    2
    3   import java.io.Reader;
    4   import java.util.Map;
    5
    6   import net.sourceforge.pmd.lang.AbstractParser;
    7   import net.sourceforge.pmd.lang.ParserOptions;
    8   import net.sourceforge.pmd.lang.TokenManager;
    9   import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
    10  import net.sourceforge.pmd.lang.ast.Node;
    11  import net.sourceforge.pmd.lang.ast.ParseException;
    12
    13  /**
    14   * Adapter for the C++ Parser.
    15   */
    16  public class CppParser extends AbstractParser {
    17
    18      public CppParser(ParserOptions parserOptions) {
    19  	super(parserOptions);
    20      }
    21
    22      @Override
    23      public TokenManager createTokenManager(Reader source) {
    24  	return new CppTokenManager(source);
    25      }
    26
    27      public boolean canParse() {
    28  	return false;
    29      }
    30
    31      public Node parse(String fileName, Reader source) throws ParseException {
    32  	AbstractTokenManager.setFileName(fileName);
    33  	throw new UnsupportedOperationException("parse(Reader) is not supported for C++");
    34      }
    35
    36      public Map<Integer, String> getSuppressMap() {
    37  	throw new UnsupportedOperationException("getSuppressMap() is not supported for C++");
    38      }
    39  }