1
2
3
4 package net.sourceforge.pmd.lang.plsql;
5
6 import java.io.Reader;
7 import java.util.HashMap;
8 import java.util.Map;
9
10 import net.sourceforge.pmd.lang.AbstractParser;
11 import net.sourceforge.pmd.lang.ParserOptions;
12 import net.sourceforge.pmd.lang.TokenManager;
13 import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
14 import net.sourceforge.pmd.lang.ast.Node;
15 import net.sourceforge.pmd.lang.ast.ParseException;
16 import net.sourceforge.pmd.util.IOUtil;
17
18
19
20
21 public class PLSQLParser extends AbstractParser {
22
23
24
25
26 private net.sourceforge.pmd.lang.plsql.ast.PLSQLParser parser;
27
28 public PLSQLParser(ParserOptions parserOptions) {
29 super(parserOptions);
30 }
31
32 @Override
33 public TokenManager createTokenManager(Reader source) {
34 return new PLSQLTokenManager(IOUtil.skipBOM(source));
35 }
36
37
38
39
40 protected net.sourceforge.pmd.lang.plsql.ast.PLSQLParser createPLSQLParser(Reader source) throws ParseException {
41 Reader in = IOUtil.skipBOM(source);
42 parser = new net.sourceforge.pmd.lang.plsql.ast.PLSQLParser(in);
43 return parser;
44 }
45
46 public boolean canParse() {
47 return true;
48 }
49
50 public Node parse(String fileName, Reader source) throws ParseException {
51 AbstractTokenManager.setFileName(fileName);
52 return createPLSQLParser(source).Input();
53 }
54
55 public Map<Integer, String> getSuppressMap() {
56 return new HashMap<Integer, String>();
57 }
58 }