@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
26 lines (25 loc) • 1.85 kB
TypeScript
import type { DataflowProcessorInformation } from '../../../../../processor';
import type { DataflowInformation } from '../../../../../info';
import { type ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
export interface StringTemplateConfiguration {
/** what opens an interpolation, `{` unless given */
readonly open?: string;
/** what closes it, `}` unless given */
readonly close?: string;
/** whether `{.cls ...}` styles its content instead of evaluating it, as cli does */
readonly markup?: boolean;
}
/**
* The R expressions a template interpolates. A doubled delimiter escapes it, delimiters nest, and one inside a
* string is literal, so this walks the template. With `markup`, `{.cls ...}` contributes its content instead.
*/
export declare function interpolationsOf(template: string, open: string, close: string, markup?: boolean): readonly string[];
/**
* Processes a call whose string arguments are templates carrying R code, as `glue` and `cli` use them.
* The code runs where the call is, reading and writing like anything written there, so that is how it is
* analyzed. A template pointed at another scope is marked unknown instead.
*/
export declare function processStringTemplate<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: StringTemplateConfiguration): DataflowInformation;