Documentation
¶
Overview ¶
Package javascript parses .js / .jsx / .mjs / .cjs source files.
Implementation note: TypeScript is a syntactic superset of JavaScript, and tree-sitter-typescript ships both the TS and TSX grammars. We therefore delegate parsing to internal/parse/typescript so plain JS goes through the TS grammar (which happily accepts type-free input) and JSX goes through the TSX grammar — same span set, no extra dependency, no grammar drift between the two adapters.
The package exists as its own seam so discover/builder can tag JS files with Language="javascript" and a future native tree-sitter JavaScript grammar swap touches one file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser implements parse.Parser for JavaScript family extensions.
func (*Parser) Language ¶
Language returns the tag stored on each Chunk produced from a JS file. The discover layer assigns the same tag based on extension; this method is what parse.Parser callers ask when they need the language name as a string.