1
2
3
4 package net.sourceforge.pmd.lang.vm;
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.lang.vm.util.VelocityCharStream;
17
18
19
20
21 public class VmParser extends AbstractParser {
22
23 public VmParser(final ParserOptions parserOptions) {
24 super(parserOptions);
25 }
26
27 @Override
28 public TokenManager createTokenManager(final Reader source) {
29 return new VmTokenManager(source);
30 }
31
32 public boolean canParse() {
33 return true;
34 }
35
36 public Node parse(final String fileName, final Reader source) throws ParseException {
37 AbstractTokenManager.setFileName(fileName);
38 return new net.sourceforge.pmd.lang.vm.ast.VmParser(new VelocityCharStream(source, 1, 1)).process();
39 }
40
41 public Map<Integer, String> getSuppressMap() {
42 return new HashMap<Integer, String>();
43 }
44 }