tools/java/src/stx/libjava/tools/parser/Parser.java
branchdevelopment
changeset 2728 658220e93dc9
parent 2723 02802ba0024f
child 2729 ac412f6ea6d4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/java/src/stx/libjava/tools/parser/Parser.java	Thu Sep 12 00:24:05 2013 +0100
@@ -0,0 +1,39 @@
+package stx.libjava.tools.parser;
+
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
+
+
+public class Parser extends org.eclipse.jdt.internal.compiler.parser.Parser {
+    
+    public Parser() {
+        this(
+                new ProblemReporter(
+                        DefaultErrorHandlingPolicies.proceedWithAllProblems(), 
+                        new CompilerOptions(), 
+                        new DefaultProblemFactory()),
+                true);                
+    }
+    
+
+    public Parser(ProblemReporter problemReporter,
+            boolean optimizeStringLiterals) {
+        super(problemReporter, optimizeStringLiterals);
+        options.docCommentSupport = true;
+        javadocParser.checkDocComment = true;
+    }
+
+    public CompilationUnitDeclaration parse(ICompilationUnit cu, boolean diet) {
+        if (diet) {
+            return dietParse(cu, new CompilationResult(cu, 1, 1, 1000));
+        } else {
+            return parse(cu, new CompilationResult(cu, 1, 1, 1000 ));            
+        }
+    }
+
+}