@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
33 lines • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowrAnalyzerSweaveFilePlugin = void 0;
const semver_1 = require("semver");
const flowr_analyzer_file_plugin_1 = require("../flowr-analyzer-file-plugin");
const built_in_source_1 = require("../../../../dataflow/internal/process/functions/call/built-in/built-in-source");
const flowr_sweave_file_1 = require("../files/flowr-sweave-file");
const SweavePattern = /\.Rnw$/i;
/**
* The plugin provides support for Sweave (`.Rnw`) files
*/
class FlowrAnalyzerSweaveFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
name = 'sweave-file-plugin';
description = 'Parses R Sweave files';
version = new semver_1.SemVer('0.1.0');
pattern;
/**
* Creates a new instance of the Sweave file plugin.
* @param filePattern - The pattern to identify Sweave files, see {@link SweavePattern} for the default pattern.
*/
constructor(filePattern = SweavePattern) {
super();
this.pattern = filePattern;
}
applies(file) {
return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
}
process(_ctx, arg) {
return flowr_sweave_file_1.FlowrSweaveFile.from(arg);
}
}
exports.FlowrAnalyzerSweaveFilePlugin = FlowrAnalyzerSweaveFilePlugin;
//# sourceMappingURL=flowr-analyzer-sweave-file-plugin.js.map