@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
48 lines (47 loc) • 4.06 kB
TypeScript
import type { Leaf, Location, NoInfo } from '../model';
import { RNode } from '../model';
import { RType } from '../type';
import { RNa, RNull } from '../../../convert-values';
import type { Identifier } from '../../../../../dataflow/environments/identifier';
/**
* Represents identifiers (variables) such as `x` in `x <- 42` or `a::foo` in `a::foo()`.
* See {@link Identifier} for more information about how identifiers are represented.
* @typeParam Info - can be used to store additional information about the node
* @typeParam T - the type used to represent the identifier, by default {@link Identifier}
*/
export interface RSymbol<Info = NoInfo, T extends Identifier = Identifier> extends Leaf<Info>, Location {
readonly type: RType.Symbol;
content: T;
}
/**
* Helper for working with {@link RSymbol} AST nodes.
*/
export declare const RSymbol: {
readonly name: "RSymbol";
/**
* Type guard for {@link RSymbol} nodes.
* @see {@link RSymbol.isSpecial} - to check whether a symbol is a special symbol like `NA` or `NULL`
*/
readonly is: <OtherInfo = object>(this: void, node: RNode<OtherInfo> | undefined) => node is RSymbol<OtherInfo>;
/**
* Type guard for special symbols, i.e. `NA` and `NULL`.
* @see {@link RNa} - for the value of `NA`
* @see {@link RNull} - for the value of `NULL`
* @see {@link RSymbol.is} - to check whether a node is a symbol at all
*/
readonly isSpecial: <OtherInfo = object>(this: void, node: RNode<OtherInfo> | undefined) => node is RSymbol<OtherInfo, typeof RNull | typeof RNa>;
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("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").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 import("./r-function-call").EmptyArgument)[];
readonly directParent: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<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: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => Generator<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>;
readonly depth: (this: void, node: RNode<import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<import("../processing/decorate").ParentInformation>) => number;
readonly collectAllIdsWithStop: <OtherInfo>(this: void, nodes: import("../model").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;
};