@Override
 protected void emit_ParenthesizedElement_LeftParenthesisKeyword_0_a(
     EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
   if (semanticObject instanceof CompoundElement) {
     CompoundElement ele = (CompoundElement) semanticObject;
     if (!Strings.isNullOrEmpty(ele.getCardinality()) && ele.getElements().size() > 1) {
       Keyword kw = grammarAccess.getParenthesizedElementAccess().getLeftParenthesisKeyword_0();
       acceptUnassignedKeyword(
           kw, kw.getValue(), nodes == null || nodes.isEmpty() ? null : (ILeafNode) nodes.get(0));
     }
   }
   super.emit_ParenthesizedCondition_LeftParenthesisKeyword_0_a(semanticObject, transition, nodes);
 }
Ejemplo n.º 2
0
 @Override
 public Boolean caseCompoundElement(CompoundElement object) {
   Multimap<String, AbstractElement> prevAssignedFeatures = newMultimap(assignedFeatures);
   for (AbstractElement element : object.getElements()) {
     doSwitch(element);
   }
   if (GrammarUtil.isMultipleCardinality(object)) {
     for (AbstractElement element : object.getElements()) {
       doSwitch(element);
     }
   }
   if (GrammarUtil.isOptionalCardinality(object)) assignedFeatures.putAll(prevAssignedFeatures);
   return Boolean.FALSE;
 }
Ejemplo n.º 3
0
 protected List<AbstractElement> _contentsAsList(final CompoundElement it) {
   EList<AbstractElement> _elements = it.getElements();
   final Function1<AbstractElement, List<AbstractElement>> _function =
       new Function1<AbstractElement, List<AbstractElement>>() {
         @Override
         public List<AbstractElement> apply(final AbstractElement it) {
           return GrammarAccessExtensions.this.contentsAsList(it);
         }
       };
   List<List<AbstractElement>> _map =
       ListExtensions.<AbstractElement, List<AbstractElement>>map(_elements, _function);
   Iterable<AbstractElement> _flatten = Iterables.<AbstractElement>concat(_map);
   return IterableExtensions.<AbstractElement>toList(_flatten);
 }