escaya-codegen
Version:
lightweight and blazing fast JavaScript code generator from an EScaya-compliant AST
34 lines • 1.44 kB
TypeScript
import { Node } from 'escaya/dist/ast/node';
export declare const enum Context {
None = 0,
InForStatement = 1,
AllowCall = 2,
OptionsSemicolons = 4,
DisallowSemicolon = 8,
DisallowParens = 16,
AllowArrowParens = 32,
OptionsDoubleQuote = 64,
OptionsMinify = 128,
OptionsNoEscape = 256,
OptionsJson = 512,
ReturnStatement = 1024,
RegularExpressionLiteral = 2048,
IdentifierReference = 4096,
NumericLiteral = 8192,
FloatingPointLiteral = 16384
}
export interface CodeGenState {
lineEnd: string;
space: string;
currentIndent: number;
indent: string;
}
export declare function create(space: string, lineEnd: string, indent: string, currentIndent: number): CodeGenState;
export declare function toggleASI(context: Context): string;
export declare function printLeafs(node: any, state: CodeGenState, context: Context): string;
export declare function printBlockLeafs(node: any, state: CodeGenState, context: Context): string;
export declare function delimitedList(node: any, state: CodeGenState, context: Context): string;
export declare function stringRepeat(str: string, times: number): string;
export declare function print(node: Node, state: CodeGenState, context: Context): string;
export declare function stringify(str: string, context: Context, _forceSingleDoubleQuote: boolean): string;
//# sourceMappingURL=common.d.ts.map