01: package net.sourceforge.pmd.parsers;
02:
03: import net.sourceforge.pmd.ast.JavaCharStream;
04: import net.sourceforge.pmd.ast.JavaParser;
05: import net.sourceforge.pmd.ast.ParseException;
06:
07: import java.io.Reader;
08: import java.util.Map;
09:
10: /**
11: * Adapter for the JavaParser, using Java 1.3 grammar.
12: *
13: * @author Pieter_Van_Raemdonck - Application Engineers NV/SA - www.ae.be
14: */
15: public class Java13Parser implements Parser {
16:
17: private JavaParser parser;
18: private String marker;
19:
20: public Object parse(Reader source) throws ParseException {
21: parser = new JavaParser(new JavaCharStream(source));
22: parser.setJDK13();
23: parser.setExcludeMarker(marker);
24: return parser.CompilationUnit();
25: }
26:
27: public Map<Integer, String> getExcludeMap() {
28: return parser.getExcludeMap();
29: }
30:
31: public void setExcludeMarker(String marker) {
32: this.marker = marker;
33: }
34: }
|