Expand description
Lexer for Bynk v0.
Token kinds correspond to the terminals defined in the grammar (spec §3
and §4). Whitespace is skipped; line comments are emitted as Comment
tokens so the formatter can preserve them through round-trips (v1.1 LSP
spec §3.5). Doc blocks (---) are emitted as DocBlock tokens, lexed
outside of logos (see tokenize).
Structs§
- Token
- A token plus its source span.
Enums§
- Token
Kind - Token kinds. Discriminants without payload data; the lexeme is recovered
from the source string via the token’s
Span.
Functions§
- comment_
body - Extract the body of a
Commenttrivia token: everything after the leading--marker, preserving its inline whitespace verbatim. Used by the parser when attaching comments to declarations. - doc_
block_ body_ range - The doc-block body as a byte range into
source— leading/trailing---marker lines stripped, no further processing (unlikedoc_block_content, which additionally strips a common per-line indent — not offset-preserving). Callers that need to map a position in the body back tosource(e.g. document-link spans) use this instead of re-deriving it from the stringdoc_block_contentreturns. - doc_
block_ content - Extract the body content of a doc-block token from its source span.
Strips the leading and trailing
---marker lines and returns the body verbatim. If every non-empty content line begins with the same horizontal whitespace prefix (e.g., because the doc block sits inside a brace-form commons body), that common prefix is removed so the body reads naturally when emitted as JSDoc. - has_
blank_ line_ between - Returns true if there is a blank line (a line containing only whitespace)
in
sourcestrictly between byte offsetsfrom(inclusive) andto(exclusive). Used by the parser to detect orphan doc blocks. - tokenize
- Tokenise a source string with no real file identity — every span’s
FileIddefaults toFileId::UNKNOWN. Seetokenize_infor the real-identity entry point production callers use. - tokenize_
expanding_ holes - Like
tokenize, but with every interpolated-string token replaced by the tokens of its holes — each hole’s bytes re-lexed and its token spans rebased to absolute source positions (the same rebasecrate::parserapplies when parsing a hole), recursing through nested interpolation. Chunk (literal) text between holes yields no tokens. - tokenize_
expanding_ holes_ in - Like
tokenize_expanding_holes, but stamping every token’s span (including rebased hole tokens) withfile. - tokenize_
in - Tokenise a source string, stamping every token’s span with
file. Returns the full token vector or the first lexical error.