A Grammar object defines how to parse and highlight JSDoc files. It consists of extensions, names, patterns, and an optional repository for reusable sub-patterns.
Key components of a Grammar object:
patterns: An array of pattern objects used for matching text. Patterns can use match (for simple regex), begin/end (for block-level parsing), or captures to assign syntax highlighting names to specific groups.repository: A collection of named patterns that can be reused within the main patterns array using the include key.scopeName: The textmate scope name for the language (e.g., source.jsdoc).
/** @type {Grammar} */
const grammar = {
extensions: [],
names: [],
patterns: [
// ... pattern objects with match, begin, end, captures, etc.
],
repository: {
// ... reusable patterns
},
scopeName: 'source.jsdoc'
}
export default grammar;