@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
81 lines (80 loc) • 6.21 kB
TypeScript
import type { DataflowProcessorInformation } from '../processor';
import type { ExitPointType, DataflowInformation } from '../info';
import { processAccess } from '../internal/process/functions/call/built-in/built-in-access';
import { processIfThenElse } from '../internal/process/functions/call/built-in/built-in-if-then-else';
import { processAssignment } from '../internal/process/functions/call/built-in/built-in-assignment';
import { processSpecialBinOp } from '../internal/process/functions/call/built-in/built-in-special-bin-op';
import { processPipe } from '../internal/process/functions/call/built-in/built-in-pipe';
import { processForLoop } from '../internal/process/functions/call/built-in/built-in-for-loop';
import { processRepeatLoop } from '../internal/process/functions/call/built-in/built-in-repeat-loop';
import { processWhileLoop } from '../internal/process/functions/call/built-in/built-in-while-loop';
import type { Identifier, IdentifierDefinition, IdentifierReference } from './identifier';
import { ReferenceType } from './identifier';
import { processReplacementFunction } from '../internal/process/functions/call/built-in/built-in-replacement';
import { processQuote } from '../internal/process/functions/call/built-in/built-in-quote';
import { processFunctionDefinition } from '../internal/process/functions/call/built-in/built-in-function-definition';
import { processExpressionList } from '../internal/process/functions/call/built-in/built-in-expression-list';
import { processGet } from '../internal/process/functions/call/built-in/built-in-get';
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { RFunctionArgument } 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';
import { processLibrary } from '../internal/process/functions/call/built-in/built-in-library';
import { processSourceCall } from '../internal/process/functions/call/built-in/built-in-source';
import type { ForceArguments } from '../internal/process/functions/call/common';
import { processApply } from '../internal/process/functions/call/built-in/built-in-apply';
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
import { processList } from '../internal/process/functions/call/built-in/built-in-list';
import { processVector } from '../internal/process/functions/call/built-in/built-in-vector';
import { processRm } from '../internal/process/functions/call/built-in/built-in-rm';
import { processEvalCall } from '../internal/process/functions/call/built-in/built-in-eval';
export declare const BuiltIn = "built-in";
export type BuiltInIdentifierProcessor = <OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>) => DataflowInformation;
export type BuiltInIdentifierProcessorWithConfig<Config> = <OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: Config) => DataflowInformation;
export interface BuiltInIdentifierDefinition extends IdentifierReference {
type: ReferenceType.BuiltInFunction;
definedAt: typeof BuiltIn;
processor: BuiltInIdentifierProcessor;
config?: object;
}
export interface BuiltInIdentifierConstant<T = unknown> extends IdentifierReference {
type: ReferenceType.BuiltInConstant;
definedAt: typeof BuiltIn;
value: T;
}
export interface DefaultBuiltInProcessorConfiguration extends ForceArguments {
readonly returnsNthArgument?: number | 'last';
readonly cfg?: ExitPointType;
readonly readAllArguments?: boolean;
readonly hasUnknownSideEffects?: boolean | LinkTo<RegExp | string>;
}
declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: DefaultBuiltInProcessorConfiguration): DataflowInformation;
export declare function registerBuiltInFunctions<Config extends object, Proc extends BuiltInIdentifierProcessorWithConfig<Config>>(both: boolean, names: readonly Identifier[], processor: Proc, config: Config): void;
export declare const BuiltInProcessorMapper: {
readonly 'builtin:default': typeof defaultBuiltInProcessor;
readonly 'builtin:eval': typeof processEvalCall;
readonly 'builtin:apply': typeof processApply;
readonly 'builtin:expression-list': typeof processExpressionList;
readonly 'builtin:source': typeof processSourceCall;
readonly 'builtin:access': typeof processAccess;
readonly 'builtin:if-then-else': typeof processIfThenElse;
readonly 'builtin:get': typeof processGet;
readonly 'builtin:rm': typeof processRm;
readonly 'builtin:library': typeof processLibrary;
readonly 'builtin:assignment': typeof processAssignment;
readonly 'builtin:special-bin-op': typeof processSpecialBinOp;
readonly 'builtin:pipe': typeof processPipe;
readonly 'builtin:function-definition': typeof processFunctionDefinition;
readonly 'builtin:quote': typeof processQuote;
readonly 'builtin:for-loop': typeof processForLoop;
readonly 'builtin:repeat-loop': typeof processRepeatLoop;
readonly 'builtin:while-loop': typeof processWhileLoop;
readonly 'builtin:replacement': typeof processReplacementFunction;
readonly 'builtin:list': typeof processList;
readonly 'builtin:vector': typeof processVector;
};
export type BuiltInMappingName = keyof typeof BuiltInProcessorMapper;
export type ConfigOfBuiltInMappingName<N extends BuiltInMappingName> = Parameters<typeof BuiltInProcessorMapper[N]>[4];
export declare const BuiltInMemory: Map<Identifier, IdentifierDefinition[]>;
export declare const EmptyBuiltInMemory: Map<Identifier, IdentifierDefinition[]>;
export {};