@lpc-lang/core
Version:
LPC Language Compiler Library
58 lines • 3.63 kB
TypeScript
import { Node, SourceFile, SyntaxKind, CallExpression, LiteralLikeNode, Expression, BinaryOperatorToken, JSDoc, CompilerOptions, JSDocTag, TypeNode, ScriptTarget, CommaListExpression, StringLiteral, QualifiedName, LanguageVariant, IncludeDirective, ThisObjectPragmas } from "./_namespaces/lpc.js";
declare function Node(this: Mutable<Node>, kind: SyntaxKind, pos: number, end: number): void;
export declare function isLiteralLike(node: Node): node is LiteralLikeNode;
export declare function isFalsyLiteral(node: Node): boolean;
export declare function isTruthyLiteral(node: Node): boolean;
export declare function isBinaryLogicalOperator(token: SyntaxKind): boolean;
export declare function skipParentParenthesis(node: Node): Node;
/**
* This function checks multiple locations for JSDoc comments that apply to a host node.
* At each location, the whole comment may apply to the node, or only a specific tag in
* the comment. In the first case, location adds the entire {@link JSDoc} object. In the
* second case, it adds the applicable {@link JSDocTag}.
*
* For example, a JSDoc comment before a parameter adds the entire {@link JSDoc}. But a
* `@param` tag on the parent function only adds the {@link JSDocTag} for the `@param`.
*
* ```ts
* /** JSDoc will be returned for `a` *\/
* const a = 0
* /**
* * Entire JSDoc will be returned for `b`
* * @param c JSDocTag will be returned for `c`
* *\/
* function b(/** JSDoc will be returned for `c` *\/ c) {}
* ```
*/
export declare function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[];
export declare function isBinaryOperatorToken(node: Node): node is BinaryOperatorToken;
export declare function isInMacroContext(node: Node): boolean;
export declare function isInExternalFileContext(node: Node): boolean;
export declare function getEmitScriptTarget(options: CompilerOptions): ScriptTarget;
export declare function isObjectOrMixedType(type: TypeNode | undefined): boolean;
export declare function isCommaListExpression(node: Node): node is CommaListExpression;
export declare function isPartOfTypeNode(node: Node): boolean;
/**
* remove quotes from the start & end of the string
* @param str
*/
export declare function trimQuotes(str: string): string;
export declare function trimStart(original: string, toRemove: string): string;
export declare function getNormalizedModuleName(moduleName: string): string;
export declare function getIncludeDirectiveFilename(node: IncludeDirective): string;
/**
* Create a VM that can be used to evaluate the FluffOS master apply `get_include_path`
* @param masterFile SourceFile that stores the master file object
* @returns
*/
export declare function createMasterApplyGetIncludePathVm(masterFile: SourceFile): (fileName: string) => string[] | undefined;
export declare function driverTypeToLanguageVariant(driverType: string): LanguageVariant;
/** try to resolve a full filename to a lib-rooted filename */
export declare function getLibRootedFileName(fileName: string, options: CompilerOptions): string;
export declare function thisObjectPragmaToStringLiteral(file: SourceFile, thisObjectPragmas: ThisObjectPragmas | ThisObjectPragmas[]): StringLiteral;
export declare function changesAffectLibCompilation(oldOptions: CompilerOptions, newOptions: CompilerOptions): boolean;
export declare function tryGetLocalizedLibPath(options: CompilerOptions): string;
export declare function isThisObjectExpression(node: Expression | QualifiedName): node is CallExpression;
export declare function getStringLiteralsTextRecursively(node: Node): string[];
export {};
//# sourceMappingURL=utilities.d.ts.map