@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
64 lines (63 loc) • 2.37 kB
TypeScript
/**
* transforms a value to something R can understand (e.g., booleans to TRUE/FALSE)
*/
export declare function ts2r<T>(value: T): string;
/** The R literal for the logical true */
export declare const RTrue = "TRUE";
/** The R literal for the logical false */
export declare const RFalse = "FALSE";
/**
* Checks whether the given string is an R boolean (logical) literal.
*/
export declare function isBoolean(value: string): boolean;
/**
* Converts an R boolean (logical) literal to a TypeScript boolean.
*/
export declare function boolean2ts(value: string): boolean;
export declare const RNumHexFloatRegex: RegExp;
export declare const RImaginaryMarker = "i";
export declare const RIntegerMarker = "L";
export declare const RInf = "Inf";
/**
* Represents a numeric value in R.
* If you need to create one from a ts numeric,
* please use {@link getScalarFromInteger}.
*/
export interface RNumberValue {
num: number;
/** see {@link RIntegerMarker}, still, R treats 1.1L as numeric and not especially integer */
markedAsInt: boolean;
/** see {@link RImaginaryMarker}, compound imaginary numbers are expressions in R */
complexNumber: boolean;
}
export declare const RNumberValue: {
readonly name: "RNumberValue";
readonly fromRLexeme: (this: void, value: string) => RNumberValue;
};
/**
* Represents a string value in R, including the type of quotes used and whether it is a raw string.
*/
export interface RStringValue {
str: string;
/** from the R-language definition a string is either delimited by a pair of single or double quotes, 'none' strings are syntactically unquoted but treated as strings */
quotes: '"' | '\'' | 'none';
/** a string is raw if prefixed with r */
flag?: 'raw';
}
/**
* Checks whether the given string is an R string literal (including raw strings).
*/
export declare const RStringValue: {
readonly name: "RStringValue";
/**
* Convert a valid R string into a {@link RStringValue}.
* @throws {@link ValueConversionError} if the string has an unknown starting quote
*/
readonly fromRLexeme: (this: void, value: string) => RStringValue;
};
export declare const RNa = "NA";
export declare const RNull = "NULL";
/**
* Checks whether the given string is the R NA literal (untyped).
*/
export declare function isNA(value: string): value is (typeof RNa);