Code cleanup.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
index 8b89035..8d09e77 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/parser/PreferenceDrivenProtobufParser.java
@@ -15,7 +15,6 @@
import com.google.inject.Inject;
import org.antlr.runtime.CharStream;
-import org.eclipse.xtext.nodemodel.*;
import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
import org.eclipse.xtext.parser.*;
import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
@@ -24,13 +23,8 @@
* @author alruiz@google.com (Alex Ruiz)
*/
public class PreferenceDrivenProtobufParser extends ProtobufParser {
- private static final String[] ERRORS_TO_LOOK_FOR = { "missing EOF at 'c'", "missing EOF at 'java'",
- "missing EOF at 'parsed'", "missing EOF at 'python'", "missing EOF at 'sawzall'",
- "no viable alternative at input '<'" };
-
@Inject private IPreferenceStoreAccess storeAccess;
- // @Inject private ParserChecksSettingsProvider settingsProvider;
@Override protected IParseResult doParse(String ruleName, CharStream in, NodeModelBuilder builder,
int initialLookAhead) {
IParseResult result = super.doParse(ruleName, in, builder, initialLookAhead);
@@ -42,28 +36,7 @@
}
private boolean isNotProto2(IParseResult result) {
- for (INode node : result.getSyntaxErrors()) {
- if (isNonProto2(node.getSyntaxErrorMessage())) {
- return true;
- }
- }
Protobuf root = (Protobuf) result.getRootASTElement();
- if (root != null && root.getSyntax() == null) {
- return true;
- }
- return false;
- }
-
- private boolean isNonProto2(SyntaxErrorMessage syntaxErrorMessage) {
- if (syntaxErrorMessage == null) {
- return false;
- }
- String message = syntaxErrorMessage.getMessage();
- for (String nonProto2Keyword : ERRORS_TO_LOOK_FOR) {
- if (message.contains(nonProto2Keyword)) {
- return true;
- }
- }
- return false;
+ return root == null || root.getSyntax() == null;
}
}