Expand description
Tokenizer shared by the portable-core translation frontends.
Every token keeps its UTF-16 offsets so diagnostics and source mappings agree with the
JavaScript runtime; comments are retained separately because JSDoc types
are part of the JavaScript frontend’s input.
Mirrors js/src/translation/lexer.js.
Structs§
- Comment
- Source
- Source text addressed by UTF-16 code units, as JavaScript strings are.
- Template
Expression - A
${…}substitution in a JavaScript template literal. - Template
Part - Token
- Token
Cursor - Cursor over a token list with the helpers every frontend needs.
- Tokens
Enums§
Functions§
- describe
JSON.stringify(token.raw), orend of input.- is_
js_ space - JavaScript’s
/\s/uon one code unit. - json_
string JSON.stringifyof a string.- matching_
brace - The index of the
}closing the{atopen. - tokenize
- Splits
textinto tokens and comments. - tokenize_
source tokenizeover an already encoded source.