UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

62 lines (61 loc) 4.46 kB
import type { RAstNodeBase, Location, NoInfo } from '../model'; import { RNode } from '../model'; import { RType } from '../type'; import type { RArgument, RUnnamedArgument } from './r-argument'; import type { EmptyArgument } from './r-function-call'; /** * Represents an R Indexing operation with `$`, `@`, `[[`, or `[`. */ interface RAccessBase<Info = NoInfo> extends RAstNodeBase<Info>, Location { readonly type: RType.Access; /** the accessed container/variable/expression */ accessed: RNode<Info>; operator: '[' | '[[' | '$' | '@'; } /** * Represents an R named access operation with `$` or `@`, the field is a string. */ export interface RNamedAccess<Info = NoInfo> extends RAccessBase<Info> { operator: '$' | '@'; access: [RUnnamedArgument<Info>]; } /** access can be a number, a variable or an expression that resolves to one, a filter etc. */ export interface RIndexAccess<Info = NoInfo> extends RAccessBase<Info> { operator: '[' | '[['; /** is null if the access is empty, e.g. `a[,3]` */ access: readonly (RArgument<Info> | typeof EmptyArgument)[]; } export type RAccess<Info = NoInfo> = RNamedAccess<Info> | RIndexAccess<Info>; /** * Helper for working with {@link RAccess} AST nodes. */ export declare const RAccess: { readonly name: "RAccess"; /** * Type guard for {@link RAccess} nodes. */ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RAccess<Info>; /** * Type guard for {@link RNamedAccess} nodes. */ readonly isNamed: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RNamedAccess<Info>; /** * Type guard for {@link RIndexAccess} nodes. */ readonly isIndex: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RIndexAccess<Info>; readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined; readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId; readonly getType: (this: void, node: RNode) => RType; readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void; readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>; readonly directChildren: <OtherInfo>(this: void, node: RNode<OtherInfo>) => readonly (RNode<OtherInfo> | typeof EmptyArgument)[]; readonly directParent: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined; readonly iterateParents: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Generator<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>; readonly depth: (this: void, node: RNode<import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<import("../processing/decorate").ParentInformation>>) => number; readonly collectAllIdsWithStop: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>, stop: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => Set<import("../processing/node-id").NodeId>; readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends { lexeme: string; } ? string : string | undefined; readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf; }; export {};