mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
Merge pull request #404 from eclipse/sz_gh341
Problem with content assist and grammar fragments
This commit is contained in:
commit
278a115708
2 changed files with 17 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue