mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 19:53:50 +00:00
* 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
28 lines
868 B
TypeScript
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[];
|
|
};
|