@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
42 lines (41 loc) • 1.92 kB
TypeScript
import type { JsonEntry, NamedJsonEntry } from '../json/format';
import type { SourceRange } from '../../../../../util/range';
import type { RawRType } from '../../model/type';
import type { RNode } from '../../model/model';
import type { RExpressionList } from '../../model/nodes/r-expression-list';
/**
* Given a JSON element, extract the source location of the corresponding element in the R-ast
*/
export declare function extractLocation(ast: JsonEntry): SourceRange;
/**
* The JSON object that represents the input contains various meta-information.
* This function extracts the meta-information and returns it.
*
* @param entry - The JSON object to extract the meta-information from
* @returns An object containing the passed entry, the location of the corresponding R-ast element, and the content of the passed entry
*/
export declare function retrieveMetaStructure(entry: JsonEntry): {
location: SourceRange;
content: string;
};
export declare function assureTokenType(token: string, expectedName: RawRType): void;
/**
* Extract the token-type of the given object. This is based on the knowledge, that all JSON objects created
* from the R XML have a name attached.
*
* @param content - the JSON object to extract the token-type from
*/
export declare function getTokenType(content: JsonEntry): RawRType;
export declare function getWithTokenType(obj: JsonEntry[]): {
name: RawRType;
content: JsonEntry;
}[];
export declare function retrieveOpName(operator: NamedJsonEntry): string;
/**
* Ensure that the first child is completely before the second child.
*
* @param first - the first child which should be the lhs
* @param second - the second child which should be the rhs
*/
export declare function ensureChildrenAreLhsAndRhsOrdered(first: JsonEntry, second: JsonEntry): void;
export declare function ensureExpressionList<Info>(node: RNode<Info>): RExpressionList<Info>;