private static boolean containsChildrenInRange(EObject element, EObject bottomElement) { return bottomElement != null ? element == bottomElement || EcoreUtil2.eAllContentsAsList(element).contains(bottomElement) : false; }
public static List<AbstractElement> elementsBeforeThisInContainingGroup(AbstractElement _this) { Group g = containingGroup(_this); List<AbstractElement> result = new ArrayList<AbstractElement>(); for (AbstractElement ae : g.getElements()) { if (ae == _this || eAllContentsAsList(ae).contains(_this)) { return result; } result.add(ae); } return result; }
public String localVar(final Assignment it, final AbstractElement terminal) { String _feature = it.getFeature(); String _plus = ("lv_" + _feature); String _plus_1 = (_plus + "_"); int _indexOf = this.contentsAsList(GrammarUtil.containingParserRule(it)).indexOf(it); String _plus_2 = (_plus_1 + Integer.valueOf(_indexOf)); String _plus_3 = (_plus_2 + "_"); int _indexOf_1 = EcoreUtil2.eAllContentsAsList(it).indexOf(terminal); return (_plus_3 + Integer.valueOf(_indexOf_1)); }
public boolean definesUnorderedGroups(final ParserRule it, final AntlrOptions options) { return (options.isBacktrack() && (!EcoreUtil2.<UnorderedGroup>typeSelect(EcoreUtil2.eAllContentsAsList(it), UnorderedGroup.class).isEmpty())); }
public static Set<String> getAllKeywords(Grammar g) { Set<String> kws = new HashSet<String>(); List<ParserRule> rules = allParserRules(g); for (ParserRule parserRule : rules) { List<Keyword> list = typeSelect(eAllContentsAsList(parserRule), Keyword.class); for (Keyword keyword : list) { kws.add(keyword.getValue()); } } List<EnumRule> enumRules = allEnumRules(g); for (EnumRule enumRule : enumRules) { List<Keyword> list = typeSelect(eAllContentsAsList(enumRule), Keyword.class); for (Keyword keyword : list) { kws.add(keyword.getValue()); } } return kws; }
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; }
return EcoreUtil2.eAllContentsAsList(it_1); }))), UnorderedGroup.class))) && options.isBacktrack())) { _builder.append("import org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState;");
return EcoreUtil2.eAllContentsAsList(it_1); }))), UnorderedGroup.class))) && options.isBacktrack())) { _builder.append("import org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState;");