protected List<Task> findTasks(final ILeafNode node, final TaskTags taskTags) { boolean _canContainTaskTags = this.canContainTaskTags(node); if (_canContainTaskTags) { final List<Task> tasks = this.parser.parseTasks(this.stripText(node, node.getText()), taskTags); final Consumer<Task> _function = (Task it) -> { int _offset = it.getOffset(); int _offset_1 = node.getOffset(); int _plus = (_offset + _offset_1); it.setOffset(_plus); int _lineNumber = it.getLineNumber(); int _startLine = node.getStartLine(); int _plus_1 = (_lineNumber + _startLine); int _minus = (_plus_1 - 1); it.setLineNumber(_minus); }; tasks.forEach(_function); return tasks; } return Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList()); }
protected Pattern toPattern(final TaskTags taskTags) { Pattern _xblockexpression = null; { int flags = Pattern.MULTILINE; boolean _isCaseSensitive = taskTags.isCaseSensitive(); boolean _not = (!_isCaseSensitive); if (_not) { flags = ((flags | Pattern.CASE_INSENSITIVE) | Pattern.UNICODE_CASE); } StringConcatenation _builder = new StringConcatenation(); _builder.append("^.*(("); final Function1<TaskTag, String> _function = (TaskTag it) -> { return Pattern.quote(it.getName()); }; String _join = IterableExtensions.join(IterableExtensions.<TaskTag, String>map(taskTags, _function), "|"); _builder.append(_join); _builder.append(")(.*)?)$"); _xblockexpression = Pattern.compile(_builder.toString(), flags); } return _xblockexpression; }
@Override public TaskTags getTaskTags(final Resource resource) { TaskTags _xblockexpression = null; { final IPreferenceValues prefs = this.preferenceValuesProvider.getPreferenceValues(resource); final String names = prefs.getPreference(PreferenceTaskTagProvider.TAGS_KEY); final String priorities = prefs.getPreference(PreferenceTaskTagProvider.PRIORITIES_KEY); TaskTags _taskTags = new TaskTags(); final Procedure1<TaskTags> _function = (TaskTags it) -> { it.setCaseSensitive((Boolean.valueOf(prefs.getPreference(PreferenceTaskTagProvider.CASE_SENSITIVE_KEY))).booleanValue()); List<TaskTag> _taskTags_1 = it.getTaskTags(); List<TaskTag> _parseTags = PreferenceTaskTagProvider.parseTags(names, priorities); Iterables.<TaskTag>addAll(_taskTags_1, _parseTags); }; _xblockexpression = ObjectExtensions.<TaskTags>operator_doubleArrow(_taskTags, _function); } return _xblockexpression; }
public List<Task> findTasks(StextResource resource) { TaskTags taskTags = taskTagProvider.getTaskTags(resource); List<Task> result = Lists.newArrayList(); TreeIterator<EObject> allContents = resource.getAllContents(); while (allContents.hasNext()) { EObject eObject = (EObject) allContents.next(); if (eObject instanceof SpecificationElement) { List<Task> parseTasks = parseTasks(eObject, SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION, taskTags); result.addAll(parseTasks); } if (eObject instanceof DocumentedElement) { result.addAll(parseTasks(eObject, BasePackage.Literals.DOCUMENTED_ELEMENT__DOCUMENTATION, taskTags)); } } return result; }
@Override public List<Task> findTasks(final Resource resource) { List<Task> _xblockexpression = null; { final TaskTags taskTags = this.taskTagProvider.getTaskTags(resource); boolean _isEmpty = IterableExtensions.isEmpty(taskTags); if (_isEmpty) { return Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList()); } List<Task> _xifexpression = null; if ((resource instanceof XtextResource)) { List<Task> _elvis = null; IParseResult _parseResult = ((XtextResource)resource).getParseResult(); ICompositeNode _rootNode = null; if (_parseResult!=null) { _rootNode=_parseResult.getRootNode(); } List<Task> _findTasks = null; if (_rootNode!=null) { _findTasks=this.findTasks(_rootNode, taskTags); } if (_findTasks != null) { _elvis = _findTasks; } else { _elvis = Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList()); } _xifexpression = _elvis; } else { _xifexpression = Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList()); } _xblockexpression = _xifexpression; } return _xblockexpression; }
@Override public List<Task> parseTasks(final String source, final TaskTags taskTags) { ArrayList<Task> _xblockexpression = null; { boolean _isEmpty = IterableExtensions.isEmpty(taskTags); if (_isEmpty) { return Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList()); } final Function<TaskTag, String> _function = (TaskTag it) -> { return it.getName().toLowerCase(); }; final ImmutableMap<String, TaskTag> taskTagsByName = Maps.<String, TaskTag>uniqueIndex(taskTags, _function); final Matcher matcher = this.toPattern(taskTags).matcher(source); final ArrayList<Task> tasks = CollectionLiterals.<Task>newArrayList(); int prevLine = 1; int prevOffset = 0; while (matcher.find()) { { final Task task = new Task(); task.setTag(taskTagsByName.get(matcher.group(2).toLowerCase())); task.setDescription(matcher.group(3)); task.setOffset(matcher.start(2)); int _countLineBreaks = Strings.countLineBreaks(source, prevOffset, task.getOffset()); int _plus = (_countLineBreaks + prevLine); task.setLineNumber(_plus); prevLine = task.getLineNumber(); prevOffset = task.getOffset(); tasks.add(task); } } _xblockexpression = tasks; } return _xblockexpression; }
protected List<Task> parseTasks(EObject element, EStructuralFeature feature, TaskTags tags) { String expression = (String) element.eGet(feature); if (expression == null) return Collections.emptyList(); List<Task> tasks = parser.parseTasks(expression, tags); List<Task> result = Lists.newArrayList(); for (Task task : tasks) { SCTTask sctTask = new SCTTask(task); sctTask.setSemanticURI(EcoreUtil.getURI(element).fragment()); result.add(sctTask); } return result; }
protected List<Task> findTasks(final ICompositeNode it, final TaskTags taskTags) { final Function1<ILeafNode, List<Task>> _function = (ILeafNode it_1) -> { return this.findTasks(it_1, taskTags); }; return IterableExtensions.<Task>toList(Iterables.<Task>concat(IterableExtensions.<ILeafNode, List<Task>>map(it.getLeafNodes(), _function))); }