Java 类org.eclipse.xtext.UnorderedGroup 实例源码

项目:xtext-core    文件:EofListener.java   
@Override
public void announceEof(int lookAhead) {
    if (!wasRecovering) {
        parser.announceEof(lookAhead);
        if (lookAhead > 1)
            announcedEofWithLA = true;
    }
    if (parser.isDFAPrediction()) {
        int lastGrammarElement = parser.getGrammarElements().size() - 1;
        if (elementToParse instanceof UnorderedGroup && parser.getGrammarElements().get(lastGrammarElement) == elementToParse) {
            IUnorderedGroupHelper helper = parser.getUnorderedGroupHelper();
            if (!helper.canLeave((UnorderedGroup) elementToParse)) {
                wasEof = true;      
            }
        }
    } else {
        wasEof = true;
    }
}
项目:xtext-core    文件:XtextValidator.java   
@Check
public void checkRuleCallInUnorderedGroup(final RuleCall call) {
    if (call.getRule() == null || call.getRule().eIsProxy() || !(call.getRule() instanceof ParserRule))
        return;
    if (GrammarUtil.isDatatypeRule((ParserRule) call.getRule()))
        return;
    if (GrammarUtil.isAssigned(call))
        return;
    if (EcoreUtil2.getContainerOfType(call, UnorderedGroup.class) != null)
        error(
                "Unassigned rule calls may not be used in unordered groups.", 
                call, 
                null,
                ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
                null);
}
项目:xtext-core    文件:PredicateUsesUnorderedGroupInspector.java   
public void createErrorMessages(UnorderedGroup object) {
    acceptError(
            "Cannot use unordered groups in syntactic predicates.", 
            object, 
            null,
            ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
            null);
    for(AbstractElement element: elementStack) {
        acceptError(
                "A predicate may not use an unordered group.", 
                element, 
                XtextPackage.Literals.ABSTRACT_ELEMENT__PREDICATED,
                ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
                null);
    }
    for(RuleCall ruleCall: callHierarchy) {
        if (!ruleCall.isPredicated())
            acceptError(
                    "The rule call is part of a call hierarchy that leads to a predicated unordered group.", 
                    ruleCall, 
                    XtextPackage.Literals.RULE_CALL__RULE,
                    ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
                    null);
    }
}
项目:xtext-core    文件:AbstractInternalAntlrParser.java   
@Override
public List<AbstractElement> getMissingMandatoryElements() {
    List<AbstractElement> result = missingMandatoryElements;
    if (result == null) {
        String predicate = getRecognitionException().toString();
        int idx = predicate.indexOf("grammarAccess");
        int lastIdx = predicate.lastIndexOf('(');
        predicate = predicate.substring(idx + "grammarAccess.".length(), lastIdx);
        String ruleMethodGetter = predicate.substring(0, predicate.indexOf('('));
        String elementGetter = predicate.substring(predicate.indexOf('.') + 1);
        IGrammarAccess grammarAccess = getGrammarAccess();
        Object ruleAccess = invokeNoArgMethod(ruleMethodGetter, grammarAccess);
        UnorderedGroup group = (UnorderedGroup) invokeNoArgMethod(elementGetter, ruleAccess);
        List<AbstractElement> missingElements = Lists.newArrayList();
        for(int i = 0; i < group.getElements().size(); i++) {
            AbstractElement element = group.getElements().get(i);
            if (!GrammarUtil.isOptionalCardinality(element) && unorderedGroupHelper.canSelect(group, i)) {
                missingElements.add(element);
            }
        }
        result = ImmutableList.copyOf(missingElements);
        missingMandatoryElements = result;
    }
    return result;
}
项目:xtext-core    文件:UnorderedGroupHelper.java   
@Inject
public Collector(IGrammarAccess grammarAccess) {
    Grammar grammar = grammarAccess.getGrammar();
    List<ParserRule> parserRules = GrammarUtil.allParserRules(grammar);
    List<UnorderedGroup> groups = Lists.newArrayList();
    for(ParserRule rule: parserRules) {
        Iterator<EObject> iter = rule.eAllContents();
        while(iter.hasNext()) {
            EObject next = iter.next();
            if (next instanceof UnorderedGroup) {
                groups.add((UnorderedGroup) next);
            }
        }
    }
    this.groups = ImmutableList.copyOf(groups);
}
项目:xtext-core    文件:AntlrContentAssistGrammarGenerator.java   
protected CharSequence compileRule(final Object it, final Grammar grammar, final AntlrOptions options) {
  if (it instanceof Alternatives) {
    return _compileRule((Alternatives)it, grammar, options);
  } else if (it instanceof Group) {
    return _compileRule((Group)it, grammar, options);
  } else if (it instanceof UnorderedGroup) {
    return _compileRule((UnorderedGroup)it, grammar, options);
  } else if (it instanceof Assignment) {
    return _compileRule((Assignment)it, grammar, options);
  } else if (it instanceof EnumRule) {
    return _compileRule((EnumRule)it, grammar, options);
  } else if (it instanceof ParserRule) {
    return _compileRule((ParserRule)it, grammar, options);
  } else if (it instanceof TerminalRule) {
    return _compileRule((TerminalRule)it, grammar, options);
  } else if (it instanceof String) {
    return _compileRule((String)it, grammar, options);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, grammar, options).toString());
  }
}
项目:xtext-core    文件:AntlrContentAssistGrammarGenerator.java   
protected String ebnf2(final AbstractElement it, final AntlrOptions options, final boolean supportActions) {
  if (it instanceof Alternatives) {
    return _ebnf2((Alternatives)it, options, supportActions);
  } else if (it instanceof Group) {
    return _ebnf2((Group)it, options, supportActions);
  } else if (it instanceof UnorderedGroup) {
    return _ebnf2((UnorderedGroup)it, options, supportActions);
  } else if (it instanceof Action) {
    return _ebnf2((Action)it, options, supportActions);
  } else if (it instanceof Assignment) {
    return _ebnf2((Assignment)it, options, supportActions);
  } else if (it instanceof EnumLiteralDeclaration) {
    return _ebnf2((EnumLiteralDeclaration)it, options, supportActions);
  } else if (it instanceof Keyword) {
    return _ebnf2((Keyword)it, options, supportActions);
  } else if (it instanceof RuleCall) {
    return _ebnf2((RuleCall)it, options, supportActions);
  } else if (it != null) {
    return _ebnf2(it, options, supportActions);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, options, supportActions).toString());
  }
}
项目:xtext-core    文件:AbstractAntlrGrammarGenerator.java   
protected String _ebnf2(final UnorderedGroup it, final AntlrOptions options, final boolean supportActions) {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("(");
  {
    EList<AbstractElement> _elements = it.getElements();
    boolean _hasElements = false;
    for(final AbstractElement element : _elements) {
      if (!_hasElements) {
        _hasElements = true;
      } else {
        _builder.appendImmediate("\n    |", "");
      }
      String _ebnf = this.ebnf(element, options, supportActions);
      _builder.append(_ebnf);
    }
  }
  _builder.append(")*");
  _builder.newLineIfNotEmpty();
  return _builder.toString();
}
项目:xtext-core    文件:AbstractAntlrGrammarGenerator.java   
protected String dataTypeEbnf2(final AbstractElement it, final boolean supportActions) {
  if (it instanceof Alternatives) {
    return _dataTypeEbnf2((Alternatives)it, supportActions);
  } else if (it instanceof Group) {
    return _dataTypeEbnf2((Group)it, supportActions);
  } else if (it instanceof UnorderedGroup) {
    return _dataTypeEbnf2((UnorderedGroup)it, supportActions);
  } else if (it instanceof Keyword) {
    return _dataTypeEbnf2((Keyword)it, supportActions);
  } else if (it instanceof RuleCall) {
    return _dataTypeEbnf2((RuleCall)it, supportActions);
  } else if (it != null) {
    return _dataTypeEbnf2(it, supportActions);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, supportActions).toString());
  }
}
项目:xtext-core    文件:AbstractAntlrGrammarGenerator.java   
protected String ebnf2(final AbstractElement it, final AntlrOptions options, final boolean supportActions) {
  if (it instanceof Alternatives) {
    return _ebnf2((Alternatives)it, options, supportActions);
  } else if (it instanceof Group) {
    return _ebnf2((Group)it, options, supportActions);
  } else if (it instanceof UnorderedGroup) {
    return _ebnf2((UnorderedGroup)it, options, supportActions);
  } else if (it instanceof Action) {
    return _ebnf2((Action)it, options, supportActions);
  } else if (it instanceof Assignment) {
    return _ebnf2((Assignment)it, options, supportActions);
  } else if (it instanceof EnumLiteralDeclaration) {
    return _ebnf2((EnumLiteralDeclaration)it, options, supportActions);
  } else if (it instanceof Keyword) {
    return _ebnf2((Keyword)it, options, supportActions);
  } else if (it instanceof RuleCall) {
    return _ebnf2((RuleCall)it, options, supportActions);
  } else if (it != null) {
    return _ebnf2(it, options, supportActions);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, options, supportActions).toString());
  }
}
项目:xtext-core    文件:BaseInternalContentAssistParser.java   
public void after(EObject grammarElement) {
    EObject foundGrammarElement = removeLast(grammarElements);
    if (grammarElement != foundGrammarElement)
        throw new IllegalStateException(
                "expected element: '" + grammarElement + "', but was: '" + foundGrammarElement + "'");
    if (grammarElement instanceof UnorderedGroup && indexToHandledElements != null) {
        indexToHandledElements.removeAll(grammarElements.size());
    } else if (!grammarElements.isEmpty()) {
        int index = grammarElements.size() - 1;
        if (grammarElements.get(index) instanceof UnorderedGroup) {
            if (indexToHandledElements == null) {
                indexToHandledElements = LinkedHashMultimap.create();
            }
            indexToHandledElements.put(index, (AbstractElement) grammarElement);
        }
    }
}
项目:xtext-extras    文件:ParseTreeConstructorUtil.java   
private static boolean isOptionalUnorderedGroup(UnorderedGroup group) {
    if (GrammarUtil.containedAssignments(group).size() != 1)
        return false;
    if (GrammarUtil.isOptionalCardinality(group))
        return true;
    if (group.eContainer() instanceof Group)
        return isOptionalGroup((Group) group.eContainer());
    if (group.eContainer() instanceof UnorderedGroup)
        return isOptionalUnorderedGroup((UnorderedGroup) group.eContainer());
    return false;
}
项目:xtext-core    文件:NonTerminalConsumer.java   
private int doConsumeUnorderedGroup(ElementConsumer<UnorderedGroup> groupConsumer, IElementConsumer[] groupElements, 
            IFurtherParsable.Source<UnorderedGroupToken> source, boolean optional) throws Exception {
        final UnorderedGroupResult result = createUnorderedGroupResult(groupConsumer, source, optional);
        result.reset();
        for(IElementConsumer consumer: groupElements) {
            if (result.didGroupFail(consumer.consume())) {
                if (result.result == ConsumeResult.EMPTY_MATCH) {
                    result.error(groupConsumer.getErrorMessage());
                    result.getResult();
                    return getOffset();
                }
                return result.getResult();
            }
        }
        return result.getResult();
//      result.reset();
//      result.setAlternative(entry - 1);
//      for (int i = entry; i < alternativesElements.length; i++) {
//          result.nextAlternative();
//          if (result.isAlternativeDone(alternativesElements[i].consume()))
//              return result.getResult();
//      }
//      if (result.bestResult == ConsumeResult.EMPTY_MATCH) {
//          result.fakeNextAlternative();
//          result.error(alternativesConsumer.getErrorMessage());
//          result.isAlternativeDone(ConsumeResult.SUCCESS);
//          result.getResult();
//          return getOffset();
//      }
//      return result.getResult();
    }
项目:xtext-core    文件:BaseContentAssistParser.java   
public Collection<FE> getFollowElements(FE element) {
    if (element.getLookAhead() <= 1)
        throw new IllegalArgumentException("lookahead may not be less than or equal to 1");
    Collection<FE> result = new ArrayList<FE>();
    for (AbstractElement elementToParse : getElementsToParse(element)) {
        elementToParse = unwrapSingleElementGroups(elementToParse);
        String ruleName = getRuleName(elementToParse);
        String[][] allRuleNames = getRequiredRuleNames(ruleName, element.getParamStack(), elementToParse);
        for (String[] ruleNames : allRuleNames) {
            for (int i = 0; i < ruleNames.length; i++) {
                InternalParser parser = createParser();
                parser.setUnorderedGroupHelper(createUnorderedGroupHelper());
                parser.getUnorderedGroupHelper().initializeWith(parser);
                ObservableXtextTokenStream tokens = setTokensFromFollowElement(parser, element);
                tokens.setListener(parser);
                parser.getGrammarElements().addAll(element.getTrace());
                parser.getGrammarElements().add(elementToParse);
                parser.getLocalTrace().addAll(element.getLocalTrace());
                parser.getLocalTrace().add(elementToParse);
                parser.getParamStack().addAll(element.getParamStack());
                if (elementToParse instanceof UnorderedGroup && element.getGrammarElement() == elementToParse) {
                    UnorderedGroup group = (UnorderedGroup) elementToParse;
                    IUnorderedGroupHelper helper = getInitializedUnorderedGroupHelper(element, parser, group);
                    parser.setUnorderedGroupHelper(ignoreFirstEntrance(helper));
                }
                Collection<FE> elements = getFollowElements(parser, elementToParse, ruleNames, i);
                result.addAll(elements);
            }
        }
    }
    return result;
}
项目:xtext-core    文件:GrammarWithoutLeftRecursionInspector.java   
@Override
public Boolean caseUnorderedGroup(UnorderedGroup object) {
    Boolean result = Boolean.TRUE;
    for(AbstractElement element: object.getElements()) {
        if (!doSwitch(element))
            result = Boolean.FALSE;
    }
    return result || GrammarUtil.isOptionalCardinality(object);
}
项目:xtext-core    文件:GrammarParserTest.java   
@Test public void testPrecedencies_02() throws Exception {
    UnorderedGroup group = (UnorderedGroup) getModel("('keyword' | 'keyword') & ('keyword' | 'keyword')");
    assertNotNull(group);
    assertEquals(2, group.getElements().size());
    assertTrue(group.getElements().get(0) instanceof Alternatives);
    assertTrue(group.getElements().get(1) instanceof Alternatives);
}
项目:xtext-core    文件:PredicateUsesUnorderedGroupInspector.java   
@Override
public Boolean caseUnorderedGroup(UnorderedGroup object) {
    if (!elementStack.isEmpty()) {
        createErrorMessages(object);
    }
    return super.caseUnorderedGroup(object);
}
项目:xtext-core    文件:GrammarParserTest.java   
@Test public void testPrecedencies_05() throws Exception {
    UnorderedGroup group = (UnorderedGroup) getModel("name=ID & 'keyword'");
    assertNotNull(group);
    assertEquals(2, group.getElements().size());
    assertTrue(group.getElements().get(0) instanceof Assignment);
    assertTrue(group.getElements().get(1) instanceof Keyword);
}
项目:xtext-core    文件:UnorderedGroupHelper.java   
@Inject
public UnorderedGroupHelper(Collector collector) {
    groupToState = Maps.newHashMap();
    backtrackingSnapShot = Maps.newTreeMap();
    for(UnorderedGroup group: collector.getGroups())
        configure(group);
    allGroups = collector.getGroups().toArray(new UnorderedGroup[collector.getGroups().size()]);
}
项目:xtext-core    文件:UnorderedGroupHelper.java   
protected State get(UnorderedGroup group) {
    snapShotForBacktracking();
    State result = groupToState.get(group);
    if (result == null)
        throw new IllegalArgumentException("Unexpected group: " + group);
    return result;
}
项目:xtext-core    文件:UnorderedGroupHelper.java   
protected UnorderedGroupStateImpl(UnorderedGroup[] groups) {
    groupToState = Maps.newHashMap();
    for(UnorderedGroup group: groups) {
        State state = UnorderedGroupHelper.this.groupToState.get(group);
        groupToState.put(group, state.copy());
    }
}
项目:xtext-core    文件:GrammarElementTitleSwitch.java   
@Override
public String toString() {
    if (text != null)
        return text;
    if (children.size() == 1)
        return children.get(0).toString();
    if (compound instanceof Group)
        return "(" + Joiner.on(" ").join(children) + ")";
    if (compound instanceof UnorderedGroup)
        return "(" + Joiner.on("&").join(children) + ")";
    if (compound instanceof Alternatives)
        return "(" + Joiner.on("|").join(children) + ")";
    return "";
}
项目:xtext-core    文件:CfgAdapter.java   
@Override
public Iterable<AbstractElement> getUnorderedChildren(AbstractElement ele) {
    switch (ele.eClass().getClassifierID()) {
        case XtextPackage.UNORDERED_GROUP:
            return ((UnorderedGroup) ele).getElements();
        default:
            return null;
    }
}
项目:xtext-core    文件:CallHierarchyHelper.java   
@Override
public Boolean caseUnorderedGroup(UnorderedGroup object) {
    if (!checkFurther(object))
        return result;
    // elements may occur in any order - treat them as looped alternatives
    if (caseAlternatives(object.getElements()))
        return true;
    if (!checkFurther(object))
        return result;
    return caseAlternatives(object.getElements());
}
项目:xtext-core    文件:AbstractAntlrGrammarWithActionsGenerator.java   
protected CharSequence _compileInitUnorderedGroups(final ParserRule it, final AntlrOptions options) {
  StringConcatenation _builder = new StringConcatenation();
  {
    boolean _definesUnorderedGroups = this._grammarAccessExtensions.definesUnorderedGroups(it, options);
    if (_definesUnorderedGroups) {
      _builder.newLineIfNotEmpty();
      _builder.append("UnorderedGroupState myUnorderedGroupState = getUnorderedGroupHelper().snapShot(");
      _builder.newLine();
      {
        Iterable<UnorderedGroup> _filter = Iterables.<UnorderedGroup>filter(EcoreUtil2.eAllContentsAsList(it), UnorderedGroup.class);
        boolean _hasElements = false;
        for(final UnorderedGroup group : _filter) {
          if (!_hasElements) {
            _hasElements = true;
          } else {
            _builder.appendImmediate(", ", "");
          }
          _builder.append("grammarAccess.");
          UnorderedGroup _originalElement = AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(group);
          String _gaRuleElementAccessor = this._grammarAccessExtensions.gaRuleElementAccessor(((AbstractElement) _originalElement));
          _builder.append(_gaRuleElementAccessor);
          _builder.newLineIfNotEmpty();
        }
      }
      _builder.append(");");
    }
  }
  return _builder;
}
项目:xtext-core    文件:GrammarParserTest.java   
@Test public void testPrecedencies_04() throws Exception {
    Group group = (Group) getModel("'keyword' ('keyword' & 'keyword') 'keyword'");
    assertNotNull(group);
    assertEquals(3, group.getElements().size());
    assertTrue(group.getElements().get(0) instanceof Keyword);
    assertTrue(group.getElements().get(1) instanceof UnorderedGroup);
    assertTrue(group.getElements().get(2) instanceof Keyword);
}
项目:xtext-core    文件:AntlrContentAssistGrammarGenerator.java   
@Override
protected String _ebnf2(final UnorderedGroup it, final AntlrOptions options, final boolean supportActions) {
  StringConcatenation _builder = new StringConcatenation();
  String _contentAssistRuleName = AntlrGrammarGenUtil.getContentAssistRuleName(GrammarUtil.containingRule(it));
  _builder.append(_contentAssistRuleName);
  _builder.append("__");
  String _gaElementIdentifier = this._grammarAccessExtensions.gaElementIdentifier(AntlrGrammarGenUtil.<UnorderedGroup>getOriginalElement(it));
  _builder.append(_gaElementIdentifier);
  return _builder.toString();
}
项目:xtext-core    文件:AbstractAntlrGeneratorFragment2.java   
protected boolean containsUnorderedGroup(final Grammar grammar) {
  List<ParserRule> _allParserRules = GrammarUtil.allParserRules(grammar);
  for (final ParserRule rule : _allParserRules) {
    boolean _hasNext = Iterators.<UnorderedGroup>filter(rule.eAllContents(), UnorderedGroup.class).hasNext();
    if (_hasNext) {
      return true;
    }
  }
  return false;
}
项目:xtext-core    文件:XtextValidationTest.java   
@Test public void testCheckRuleCallInUnorderedGroup_02() throws Exception {
    XtextValidator validator = get(XtextValidator.class);
    UnorderedGroup unorderedGroup = XtextFactory.eINSTANCE.createUnorderedGroup();
    RuleCall ruleCall = XtextFactory.eINSTANCE.createRuleCall();
    TypeRef typeRef = XtextFactory.eINSTANCE.createTypeRef();
    typeRef.setClassifier(EcorePackage.Literals.EBIG_DECIMAL);
    ParserRule parserRule = XtextFactory.eINSTANCE.createParserRule();
    parserRule.setType(typeRef);
    ruleCall.setRule(parserRule);
    unorderedGroup.getElements().add(ruleCall);
    ValidatingMessageAcceptor messageAcceptor = new ValidatingMessageAcceptor(null, false, false);
    validator.setMessageAcceptor(messageAcceptor);
    validator.checkRuleCallInUnorderedGroup(ruleCall);
    messageAcceptor.validate();
}
项目:xtext-core    文件:PsiAntlrGrammarGenerator.java   
@Override
protected String compileParserImports(final Grammar it, final AntlrOptions options) {
  StringConcatenation _builder = new StringConcatenation();
  _builder.newLine();
  _builder.append("import ");
  String _name = this.getGrammarNaming().getInternalParserSuperClass(it).getName();
  _builder.append(_name);
  _builder.append(";");
  _builder.newLineIfNotEmpty();
  _builder.append("import ");
  TypeReference _elementTypeProvider = this._ideaPluginClassNames.getElementTypeProvider(GrammarUtil.getGrammar(it));
  _builder.append(_elementTypeProvider);
  _builder.append(";");
  _builder.newLineIfNotEmpty();
  _builder.append("import org.eclipse.xtext.idea.parser.TokenTypeProvider;");
  _builder.newLine();
  _builder.append("import org.eclipse.xtext.parser.antlr.XtextTokenStream;");
  _builder.newLine();
  _builder.append("import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;");
  _builder.newLine();
  {
    if (((!IterableExtensions.isEmpty(Iterables.<UnorderedGroup>filter(Iterables.<EObject>concat(ListExtensions.<ParserRule, List<EObject>>map(GrammarUtil.allParserRules(it), ((Function1<ParserRule, List<EObject>>) (ParserRule it_1) -> {
      return EcoreUtil2.eAllContentsAsList(it_1);
    }))), UnorderedGroup.class))) && options.isBacktrack())) {
      _builder.append("import org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState;");
      _builder.newLine();
    }
  }
  _builder.append("import ");
  String _name_1 = this._grammarAccessExtensions.getGrammarAccess(it).getName();
  _builder.append(_name_1);
  _builder.append(";");
  _builder.newLineIfNotEmpty();
  _builder.newLine();
  _builder.append("import com.intellij.lang.PsiBuilder;");
  _builder.newLine();
  return _builder.toString();
}
项目:xtext-core    文件:GrammarParserTest.java   
@Test public void testPrecedencies_03() throws Exception {
    UnorderedGroup group = (UnorderedGroup) getModel("'keyword' 'keyword' & 'keyword' 'keyword'");
    assertNotNull(group);
    assertEquals(2, group.getElements().size());
    assertTrue(group.getElements().get(0) instanceof Group);
    assertTrue(group.getElements().get(1) instanceof Group);
}
项目:xtext-core    文件:XtextValidationTest.java   
@Test public void testCheckRuleCallInUnorderedGroup_01() throws Exception {
    XtextValidator validator = get(XtextValidator.class);
    UnorderedGroup unorderedGroup = XtextFactory.eINSTANCE.createUnorderedGroup();
    RuleCall ruleCall = XtextFactory.eINSTANCE.createRuleCall();
    TypeRef typeRef = XtextFactory.eINSTANCE.createTypeRef();
    typeRef.setClassifier(EcorePackage.Literals.EOBJECT);
    ParserRule parserRule = XtextFactory.eINSTANCE.createParserRule();
    parserRule.setType(typeRef);
    ruleCall.setRule(parserRule);
    unorderedGroup.getElements().add(ruleCall);
    ValidatingMessageAcceptor messageAcceptor = new ValidatingMessageAcceptor(ruleCall, true, false);
    validator.setMessageAcceptor(messageAcceptor);
    validator.checkRuleCallInUnorderedGroup(ruleCall);
    messageAcceptor.validate();
}
项目:xtext-core    文件:XtextValidationTest.java   
@Test public void testCheckRuleCallInUnorderedGroup_04() throws Exception {
    XtextValidator validator = get(XtextValidator.class);
    UnorderedGroup unorderedGroup = XtextFactory.eINSTANCE.createUnorderedGroup();
    RuleCall ruleCall = XtextFactory.eINSTANCE.createRuleCall();
    TerminalRule terminalRule = XtextFactory.eINSTANCE.createTerminalRule();
    ruleCall.setRule(terminalRule);
    unorderedGroup.getElements().add(ruleCall);
    ValidatingMessageAcceptor messageAcceptor = new ValidatingMessageAcceptor(null, false, false);
    validator.setMessageAcceptor(messageAcceptor);
    validator.checkRuleCallInUnorderedGroup(ruleCall);
    messageAcceptor.validate();
}
项目:xtext-core    文件:IgnoreFirstEntranceUnorderedGroupHelper.java   
@Override
public boolean canLeave(UnorderedGroup group) {
    return helper.canLeave(group);
}
项目:xtext-extras    文件:XtextAntlrUiGeneratorFragment.java   
public static Collection<UnorderedGroup> getAllUnorderedGroups(Grammar g) {
    return getAllElementsByType(g, UnorderedGroup.class);
}
项目:xtext-core    文件:IgnoreFirstEntranceUnorderedGroupHelper.java   
@Override
public void enter(UnorderedGroup group) {
    if (!first)
        helper.enter(group);
    first = false;
}
项目:xtext-core    文件:NonTerminalConsumer.java   
public UnorderedGroupConsumer(UnorderedGroup element) {
    super(element);
}
项目:xtext-core    文件:NonTerminalConsumer.java   
public OptionalUnorderedGroupConsumer(UnorderedGroup element) {
    super(element);
}
项目:xtext-core    文件:NonTerminalConsumer.java   
public LoopUnorderedGroupConsumer(UnorderedGroup element) {
    super(element);
}
项目:xtext-core    文件:NonTerminalConsumer.java   
public MandatoryLoopUnorderedGroupConsumer(UnorderedGroup element) {
    super(element);
}