From 229762d3a8cd2330481df474836f99ff9c9504fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 15 Apr 2019 14:40:18 +0200 Subject: [PATCH] Fix #357 --- .../eclipse/editor/builder/CucumberGherkinBuilder.java | 2 +- .../cucumber/eclipse/editor/editors/GherkinModel.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/builder/CucumberGherkinBuilder.java b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/builder/CucumberGherkinBuilder.java index 36277eb8..c7603cc2 100644 --- a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/builder/CucumberGherkinBuilder.java +++ b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/builder/CucumberGherkinBuilder.java @@ -333,7 +333,7 @@ public MarkerFormatter(IDocument document, IResource gherkinFile, MarkerFactory @Override public void syntaxError(String state, String event, List legalEvents, String uri, Integer line) { - this.markerFactory.syntaxErrorOnGherkin(this.gherkinFile, new ParseException(event, line)); + this.markerFactory.syntaxErrorOnGherkin(this.gherkinFile, "Found "+event+" when expecting one of: "+legalEvents+". (Current state: "+state+").", line); } @Override diff --git a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/GherkinModel.java b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/GherkinModel.java index 04970e8e..f963a33e 100644 --- a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/GherkinModel.java +++ b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/GherkinModel.java @@ -61,7 +61,7 @@ public PositionedElement getStepElement(int offset) throws BadLocationException public void updateFromDocument(final IDocument document) { elements.clear(); - Parser p = new Parser(new Formatter() { + Formatter formatter = new Formatter() { private Stack stack = new Stack(); @@ -70,8 +70,7 @@ public void uri(String arg0) { } @Override - public void syntaxError(String arg0, String arg1, - List arg2, String arg3, Integer arg4) { + public void syntaxError(String state, String event, List legalEvents, String uri, Integer line) { } @Override @@ -157,7 +156,8 @@ public void startOfScenarioLifeCycle(Scenario arg0) { // TODO Auto-generated method stub } - }); + }; + Parser p = new Parser(formatter, false); try { p.parse(document.get(), "", 0);