Merge pull request #404 from eclipse/sz_gh341

Problem with content assist and grammar fragments
This commit is contained in:
Sebastian Zarnekow 2017-09-06 14:29:14 +02:00 committed by GitHub
commit 278a115708
2 changed files with 17 additions and 2 deletions

View file

@ -593,6 +593,22 @@ public abstract class AbstractInternalContentAssistParser extends Parser impleme
delegate.announceEof(lookAhead);
}
@Override
public void reportError(RecognitionException e) {
if (strict) {
if ( state.errorRecovery ) {
return;
}
if (e.index != input.size()) {
// don't count errors at EOF in strict mode
state.syntaxErrors++;
}
state.errorRecovery = true;
} else {
super.reportError(e);
}
}
@Override
public void announceConsume() {
if (marked <= 0)

View file

@ -299,8 +299,7 @@ public class GrammarUtil {
public static boolean isDatatypeRuleCall(EObject grammarElement) {
if (grammarElement instanceof RuleCall) {
AbstractRule calledRule = ((RuleCall) grammarElement).getRule();
return calledRule != null && calledRule instanceof ParserRule
&& calledRule.getType() != null && calledRule.getType().getClassifier() instanceof EDataType;
return calledRule != null && isDatatypeRule(calledRule);
}
return false;
}