Files
reverse-engineering-anything/scripts/verify/source-tokens.d.mts
T
morluto fbea9e8778 fix(verify): read a TypeScript non-null assertion as completing its operand (#11596)
* fix(verify): read a TypeScript non-null assertion as completing its operand

A postfix ! after a completed operand leaves it complete, so a following / divides instead of opening a regular expression that hid the rest of the expression from the guards.

* fix(verify): read export default as the start of an expression
2026-11-16 08:52:06 +08:00

28 lines
868 B
TypeScript

export interface SourceToken {
readonly kind: string;
readonly text: string;
readonly start: number;
/** An expression keyword such as `return`, not a property name. */
keyword?: true;
/** The `}` that closes a statement block rather than an object literal. */
closesBlock?: true;
/** The `)` that closes a control head such as `if (…)`. */
controlHead?: true;
/** A postfix `!` (TypeScript non-null assertion) after a completed operand. */
nonNullAssertion?: true;
/** Template text that opens a `${` substitution. */
readonly opensSubstitution?: true;
}
export interface SourceComment {
readonly text: string;
readonly end: number;
}
export function blankComments(
source: string,
comments?: readonly SourceComment[],
): string;
export function tokenize(source: string): {
tokens: SourceToken[];
comments: SourceComment[];
};