Skip to content

Commit

Permalink
Fix to load needed grammars, add missing deep grammars
Browse files Browse the repository at this point in the history
Grammars refer to other grammars.
Sometimes they need them, other times it is optional.
For example, `source.gfm` includes optional support for highlighting
frontmatter if `source.yaml` is registered.
Another example is `text.xml.svg`, which needs `text.xml` to work.

All grammars are now tagged for whether they **need** other grammars or
not.
See `graph.yml` for the tags, see the new `dependencies` field on
grammars for the needed dependencies, or refer to the § Languages
section in the readme.

Our lists of grammars, `common` and `all`, now include all needed
grammars.
You can use the new `.missingScopes()` function to find what’s missing.

Some grammars supported by GitHub use other grammars that can’t be used on
their own.
For example, `source.c` and `source.objc` refer to a
`source.c.platform` grammar, which includes reusable patterns.

All grammars that are referenced in others are now included in `lang/`.
  • Loading branch information
wooorm committed Mar 26, 2023
1 parent f4ec5bd commit b2482b9
Show file tree
Hide file tree
Showing 200 changed files with 20,495 additions and 311 deletions.
1,222 changes: 1,222 additions & 0 deletions lang/annotation.liquidhaskell.haskell.js

Large diffs are not rendered by default.

627 changes: 627 additions & 0 deletions lang/etc.js

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions lang/hidden.manref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/** @type {import('../lib/index.js').Grammar} */
const grammar = {
extensions: [],
names: [],
patterns: [
{
captures: {
1: {name: 'manref.subject'},
2: {name: 'manref.section'},
3: {name: 'punctuation.definition.begin.manref'},
4: {name: 'manref.section-number'},
5: {name: 'manref.section-group'},
6: {name: 'punctuation.definition.end.manref'}
},
match:
'(?xi)\n# Subject\n((?:\n\t[^:\\s()<>/"\'`{}!&*\\#?\\\\]\n\t|\n\t# Avoid matching scheme component of “man:man(1)” URLs\n\t(?-i: (?<!man)\n\t| (?<=[-\\w]man)\n\t) :\n)+)\n\n# Section\n((?i)\n\t(\\()\n\t( [0-9](?![0-9]) # Section number\n\t| (?:[lnop]|tcl)(?=[/)]) # Non-numeric section\n\t)\n\t\n\t# Section group\n\t([a-z_0-9:/]*?(?:/(?!/)[-a-z_0-9:./]+)?)\n\t(\\))\n)',
name: 'manref'
}
],
scopeName: 'hidden.manref'
}

export default grammar
349 changes: 349 additions & 0 deletions lang/injections.etc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/Alhadis/language-etc>
// and licensed `isc`.
// See <https://github.com/wooorm/starry-night> for more info.
/** @type {import('../lib/index.js').Grammar} */
const grammar = {
extensions: [],
names: [],
patterns: [
{match: '(?<!\\w)@?(PINHACK)\\b', name: 'storage.type.class.${1:/downcase}'}
],
repository: {
scopeHack: {
begin: '\\A(?:\\xC2\\xAD|\\xAD){50}',
end: '(?=A)B',
patterns: [
{
captures: {1: {name: 'constant.other.reference.link'}},
match: '^ {5}(PRIMER PREVIEW - How grammar scopes look on GitHub):',
name: 'markup.bold'
},
{
match: '^\\s*Last updated:\\s*(\\d{4}-\\d{2}-\\d{2})$',
name: 'comment.line'
},
{
captures: {1: {name: 'markup.heading'}},
match: '^│ +(TEXTMATE.*) +│$',
name: 'constant.other.reference.link'
},
{
captures: {0: {name: 'constant.other.reference.link'}},
match: '^│ +│$'
},
{
captures: {1: {name: 'brackethighlighter.angle'}},
match: '^│\\s+(brackethighlighter.angle\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'brackethighlighter.curly'}},
match: '^│\\s+(brackethighlighter.curly\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'brackethighlighter.quote'}},
match: '^│\\s+(brackethighlighter.quote\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'brackethighlighter.round'}},
match: '^│\\s+(brackethighlighter.round\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'brackethighlighter.square'}},
match: '^│\\s+(brackethighlighter.square\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'brackethighlighter.tag'}},
match: '^│\\s+(brackethighlighter.tag\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'brackethighlighter.unmatched'}},
match: '^│\\s+(brackethighlighter.unmatched\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'carriage-return'}},
match: '^│\\s+(carriage-return\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'comment'}},
match: '^│\\s+(comment\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'constant'}},
match: '^│\\s+(constant\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'constant.character.escape'}},
match: '^│\\s+(constant.character.escape\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'constant.other.reference.link'}},
match: '^│\\s+(constant.other.reference.link\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'entity'}},
match: '^│\\s+(entity\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'entity.name'}},
match: '^│\\s+(entity.name\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'entity.name.constant'}},
match: '^│\\s+(entity.name.constant\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'entity.name.tag'}},
match: '^│\\s+(entity.name.tag\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'invalid.broken'}},
match: '^│\\s+(invalid.broken\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'invalid.deprecated'}},
match: '^│\\s+(invalid.deprecated\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'invalid.illegal'}},
match: '^│\\s+(invalid.illegal\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'invalid.unimplemented'}},
match: '^│\\s+(invalid.unimplemented\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'keyword'}},
match: '^│\\s+(keyword\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'keyword.operator.symbole'}},
match: '^│\\s+(keyword.operator.symbole\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'keyword.other.mark'}},
match: '^│\\s+(keyword.other.mark\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.bold'}},
match: '^│\\s+(markup.bold\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.changed'}},
match: '^│\\s+(markup.changed\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.deleted'}},
match: '^│\\s+(markup.deleted\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.heading'}},
match: '^│\\s+(markup.heading\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.ignored'}},
match: '^│\\s+(markup.ignored\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.inserted'}},
match: '^│\\s+(markup.inserted\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.italic'}},
match: '^│\\s+(markup.italic\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.list'}},
match: '^│\\s+(markup.list\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.quote'}},
match: '^│\\s+(markup.quote\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.raw'}},
match: '^│\\s+(markup.raw\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'markup.untracked'}},
match: '^│\\s+(markup.untracked\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'message.error'}},
match: '^│\\s+(message.error\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'meta.diff.header'}},
match: '^│\\s+(meta.diff.header\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'meta.diff.header.from-file'}},
match: '^│\\s+(meta.diff.header.from-file\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'meta.diff.header.to-file'}},
match: '^│\\s+(meta.diff.header.to-file\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'meta.diff.range'}},
match: '^│\\s+(meta.diff.range\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'meta.module-reference'}},
match: '^│\\s+(meta.module-reference\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'meta.output'}},
match: '^│\\s+(meta.output\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'meta.property-name'}},
match: '^│\\s+(meta.property-name\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'meta.separator'}},
match: '^│\\s+(meta.separator\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'punctuation.definition.changed'}},
match: '^│\\s+(punctuation.definition.changed\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'punctuation.definition.comment'}},
match: '^│\\s+(punctuation.definition.comment\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'punctuation.definition.deleted'}},
match: '^│\\s+(punctuation.definition.deleted\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'punctuation.definition.inserted'}},
match:
'^│\\s+(punctuation.definition.inserted\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'punctuation.definition.string'}},
match: '^│\\s+(punctuation.definition.string\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'punctuation.section.embedded'}},
match: '^│\\s+(punctuation.section.embedded\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'source'}},
match: '^│\\s+(source\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'source.regexp'}},
match: '^│\\s+(source.regexp\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'source.ruby.embedded'}},
match: '^│\\s+(source.ruby.embedded\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'storage'}},
match: '^│\\s+(storage\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'storage.modifier.import'}},
match: '^│\\s+(storage.modifier.import\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'storage.modifier.package'}},
match: '^│\\s+(storage.modifier.package\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'storage.type'}},
match: '^│\\s+(storage.type\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'storage.type.java'}},
match: '^│\\s+(storage.type.java\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'string'}},
match: '^│\\s+(string\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'string.comment'}},
match: '^│\\s+(string.comment\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'string.other.link'}},
match: '^│\\s+(string.other.link\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'string.regexp'}},
match: '^│\\s+(string.regexp\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'string.regexp.arbitrary-repitition'}},
match:
'^│\\s+(string.regexp.arbitrary-repitition\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'string.regexp.character-class'}},
match: '^│\\s+(string.regexp.character-class\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'string.unquoted.import.ada'}},
match: '^│\\s+(string.unquoted.import.ada\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'sublimelinter.gutter-mark'}},
match: '^│\\s+(sublimelinter.gutter-mark\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'sublimelinter.mark.error'}},
match: '^│\\s+(sublimelinter.mark.error\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'sublimelinter.mark.warning'}},
match: '^│\\s+(sublimelinter.mark.warning\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'support'}},
match: '^│\\s+(support\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'support.constant'}},
match: '^│\\s+(support.constant\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'support.variable'}},
match: '^│\\s+(support.variable\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'variable'}},
match: '^│\\s+(variable\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'variable.language'}},
match: '^│\\s+(variable.language\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'variable.other'}},
match: '^│\\s+(variable.other\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'variable.other.constant'}},
match: '^│\\s+(variable.other.constant\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: 'variable.parameter.function'}},
match: '^│\\s+(variable.parameter.function\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{
captures: {1: {name: '$2'}},
match: '^│\\s+(([a-z][-a-z.]+)\\s+\\S+\\s+░▒▓█+)\\s+│$'
},
{match: '^#.*$', name: 'comment.line'}
]
}
},
scopeName: 'injections.etc'
}

export default grammar
1 change: 1 addition & 0 deletions lang/objdump.x86asm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See <https://github.com/wooorm/starry-night> for more info.
/** @type {import('../lib/index.js').Grammar} */
const grammar = {
dependencies: ['source.c', 'source.c++'],
extensions: [
'.c++-objdump',
'.c++objdump',
Expand Down
1 change: 1 addition & 0 deletions lang/source.actionscript.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// See <https://github.com/wooorm/starry-night> for more info.
/** @type {import('../lib/index.js').Grammar} */
const grammar = {
dependencies: ['text.html.asdoc', 'text.xml'],
extensions: ['.as'],
names: ['actionscript', 'actionscript-3', 'actionscript3', 'as3'],
patterns: [
Expand Down
Loading

0 comments on commit b2482b9

Please sign in to comment.