@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
39 lines (38 loc) • 1.63 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";
export declare function isBoolean(value: string): 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";
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 function number2ts(value: string): RNumberValue;
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';
}
/**
* Convert a valid R string into a {@link RStringValue}.
*
* @throws {@link ValueConversionError} if the string has an unknown starting quote
*/
export declare function string2ts(value: string): RStringValue;
export declare const RNa = "NA";
export declare const RNull = "NULL";
export declare function isNA(value: string): value is (typeof RNa);