@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
34 lines • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowrAnalyzerNamespaceFilesPlugin = void 0;
const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin");
const semver_1 = require("semver");
const flowr_file_1 = require("../../context/flowr-file");
const flowr_namespace_file_1 = require("./files/flowr-namespace-file");
const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source");
const NamespaceFilePattern = /^NAMESPACE(\.txt)?$/i;
/**
* This plugin provides support for R `NAMESPACE` files.
*/
class FlowrAnalyzerNamespaceFilesPlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
name = 'flowr-analyzer-namespace-file-plugin';
description = 'This plugin provides support for NAMESPACE files and extracts their content into the NAMESPACEFormat.';
version = new semver_1.SemVer('0.1.0');
pattern;
/**
* Creates a new instance of the NAMESPACE file plugin.
* @param filePattern - The pattern to identify NAMESPACE files, see {@link NamespaceFilePattern} for the default pattern.
*/
constructor(filePattern = NamespaceFilePattern) {
super();
this.pattern = filePattern;
}
applies(file) {
return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
}
process(ctx, file) {
return flowr_namespace_file_1.FlowrNamespaceFile.from(file, ctx, flowr_file_1.FileRole.Namespace);
}
}
exports.FlowrAnalyzerNamespaceFilesPlugin = FlowrAnalyzerNamespaceFilesPlugin;
//# sourceMappingURL=flowr-analyzer-namespace-files-plugin.js.map