import type { Argument, Expression } from '../ast/index.js'; import type { Span } from '../span/index.js'; import type { Token, TokenKind } from '../tokens/index.js'; import type { Cursor } from './cursor.js'; /** * Whether an expression can begin here, which is what tells one argument from * the next and what keeps a list from reading a closing bracket as an item. * * A reserved word a reader meant as a name begins one too, because `parsePrimary` * reads it as the name it was meant to be rather than leaving it where it sits. */ export declare function startsExpression(kind: TokenKind): boolean; interface List { readonly items: readonly Item[]; /** Where the list ended, so the node around it can reach its closing bracket. */ readonly end: Span; } export declare function parseExpression(cursor: Cursor): Expression; /** * An expression in a position where a value is being tested rather than stored. * * `if x = 5` is the one typo the language is shaped to catch: assignment is a * statement and never an expression (10.1), so there is no reading of the line * that compiles, and OS1006 can name the fix instead of a type error arriving * three stages later. The `==` is built as though the fix had been applied, so * the rest of the file still checks. */ export declare function parseCondition(cursor: Cursor): Expression; /** * A comma separated list inside brackets: an argument list or an array literal. * * The two shapes are one function because their recovery is the same and has to * stay the same: a missing comma is OS1014 and the list carries on, and a list * that runs to the end of the line without a closer is the bracket's own error * rather than one per item. */ export declare function parseBracketedList(cursor: Cursor, open: Token, parseItem: (cursor: Cursor) => Item): List; /** * The closing bracket, or the two ways it can be missing. * * OS1012 is reported at the opening bracket rather than at the end of the file, * because an open bracket continues the statement onto every following line * (3.11) and the mistake is where the bracket was opened. */ export declare function closeBracket(cursor: Cursor, open: Token): Span; /** * The hole a rule leaves where an expression was required. * * The span is empty and sits where the expression should have been, so it never * takes a caret meant for its neighbour, and everything downstream still has a * tree to walk over a file that is being typed. */ export declare function missingExpression(cursor: Cursor): Expression; /** An argument list, for the three statements that are a call in all but name. */ export declare function parseArgumentList(cursor: Cursor, open: Token): List; export {}; //# sourceMappingURL=expressions.d.ts.map