KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > pmd > parsers > Java14Parser


1 package net.sourceforge.pmd.parsers;
2
3 import net.sourceforge.pmd.ast.JavaCharStream;
4 import net.sourceforge.pmd.ast.JavaParser;
5 import net.sourceforge.pmd.ast.ParseException;
6
7 import java.io.Reader JavaDoc;
8 import java.util.Map JavaDoc;
9
10 /**
11  * Adapter for the JavaParser, using Java 1.4 grammar.
12  *
13  * @author Pieter_Van_Raemdonck - Application Engineers NV/SA - www.ae.be
14  */

15 public class Java14Parser implements Parser {
16
17     private JavaParser parser;
18     private String JavaDoc marker;
19
20     public Object JavaDoc parse(Reader JavaDoc source) throws ParseException {
21         parser = new JavaParser(new JavaCharStream(source));
22         parser.setExcludeMarker(marker);
23         return parser.CompilationUnit();
24     }
25
26     public Map JavaDoc getExcludeMap() {
27         return parser.getExcludeMap();
28     }
29
30     public void setExcludeMarker(String JavaDoc marker) {
31         this.marker = marker;
32     }
33
34 }
35
Popular Tags