void checkFile(IResource resource) { if (resource instanceof IFile) { IFile file = (IFile) resource; if (file.getName().endsWith("xfm.xmi")) { String thisUri = resource.getFullPath().toString(); featureModelUri = getFeatureModelUri(file.getProject()); if (thisUri.equals(featureModelUri)) refreshFeatureModel(file.getProject()); } if (file.getName().endsWith(".v")) { builder.deleteMarkers(file); checkFilenameDepenency(file); checkFileContents(file); } if (file.getName().endsWith(".java")) { try { builder.deleteMarkers(file); List<CommentStructure> comments = buildCommentsStructure(loadFile(file)); if (comments.size() > 0) { for (CommentStructure c : comments) { IParseResult result = injector .getInstance(FeaturesParser.class) .parse("FeatureClause", new ByteArrayInputStream(c.clause.getBytes())); if (result.getParseErrors().size() > 0) { String message = ""; for (SyntaxError err : result.getParseErrors()) message += err.getMessage() + "\n"; Exception e = new RuntimeException("parse error: " + message); log.error("error while parsing feature clause", e); } EObject clause = result.getRootASTElement(); if (clause instanceof Feature) { String feature = clause.eGet(clause.eClass().getEStructuralFeature("feature")).toString(); if (!isFeatureDefined(file, feature)) addMarkerIfNotDefined(feature, file, c.line); } else for (EObject e : EcoreUtil2.eAllContentsAsList(clause)) { if (e instanceof Feature || e instanceof Atom) { String feature = e.eGet(e.eClass().getEStructuralFeature("feature")).toString(); if (!isFeatureDefined(file, feature)) addMarkerIfNotDefined(feature, file, c.line); } } } } } catch (ResourceException e) { log.error("error loading file", e); } catch (Throwable e) { log.error("error loading file", e); } } } }
public String localVar(final Assignment it, final AbstractElement terminal) { String _feature = it.getFeature(); String _plus = ("lv_" + _feature); String _plus_1 = (_plus + "_"); ParserRule _containingParserRule = GrammarUtil.containingParserRule(it); List<AbstractElement> _contentsAsList = this.contentsAsList(_containingParserRule); int _indexOf = _contentsAsList.indexOf(it); String _plus_2 = (_plus_1 + Integer.valueOf(_indexOf)); String _plus_3 = (_plus_2 + "_"); List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(it); int _indexOf_1 = _eAllContentsAsList.indexOf(terminal); return (_plus_3 + Integer.valueOf(_indexOf_1)); }
public boolean definesUnorderedGroups(final ParserRule it, final AntlrOptions options) { boolean _and = false; boolean _isBacktrack = options.isBacktrack(); if (!_isBacktrack) { _and = false; } else { List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(it); List<UnorderedGroup> _typeSelect = EcoreUtil2.<UnorderedGroup>typeSelect(_eAllContentsAsList, UnorderedGroup.class); boolean _isEmpty = _typeSelect.isEmpty(); boolean _not = (!_isEmpty); _and = _not; } return _and; }
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(); { List<EObject> _eAllContentsAsList = EcoreUtil2.eAllContentsAsList(it); Iterable<UnorderedGroup> _filter = Iterables.<UnorderedGroup>filter(_eAllContentsAsList, 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._grammarAccess.gaRuleElementAccessor(_originalElement); _builder.append(_gaRuleElementAccessor, ""); _builder.newLineIfNotEmpty(); } } _builder.append(");"); } } return _builder; }