UNPKG

graphql

Version:

A Query Language and Runtime which can target any service.

58 lines (57 loc) 1.61 kB
import { Token } from "./ast.mjs"; import type { LexerInterface } from "./lexer.mjs"; import type { Source } from "./source.mjs"; /** * Given a Source schema coordinate, creates a Lexer for that source. * A SchemaCoordinateLexer is a stateful stream generator in that every time * it is advanced, it returns the next token in the Source. Assuming the * source lexes, the final Token emitted by the lexer will be of kind * EOF, after which the lexer will repeatedly return the same EOF token * whenever called. * * @internal */ export declare class SchemaCoordinateLexer implements LexerInterface { source: Source; /** * The previously focused non-ignored token. * * @internal */ lastToken: Token; /** * The currently focused non-ignored token. * * @internal */ token: Token; /** * The (1-indexed) line containing the current token. * Since a schema coordinate may not contain newline, this value is always 1. * * @internal */ line: 1; /** * The character offset at which the current line begins. * Since a schema coordinate may not contain newline, this value is always 0. * * @internal */ lineStart: 0; constructor(source: Source); get [Symbol.toStringTag](): string; /** * Advances the token stream to the next non-ignored token. * * @internal */ advance(): Token; /** * Looks ahead and returns the next non-ignored token, but does not change * the current Lexer token. * * @internal */ lookahead(): Token; }