{ "name": "LilyPond", "scopeName": "source.lilypond", "patterns": [ { "include": "#comments" }, { "include": "#g_header" }, { "include": "#groupings" }, { "include": "#strings" }, { "include": "#scheme" }, { "include": "#functions" } ], "repository": { "comments": { "patterns": [ { "name": "comment.block.lilypond", "begin": "%{", "end": "%}", "captures": { "0": { "name": "punctuation.definition.comment.lilypond" } } }, { "begin": "(^[ \\t]+)?(?=%)", "end": "(?!\\G)", "patterns": [ { "name": "comment.line.percentage.lilypond", "begin": "%", "end": "\\n", "beginCaptures": { "0": { "name": "punctuation.definition.comment.lilypond" } } } ], "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.lilypond" } } } ] }, "f_clef": { "name": "meta.element.clef.lilypond", "match": "(?x)\n\t\t\t\t((\\\\) clef) \\s+ # backslash + \"clef\" + spaces (groups 1-2)\n\t\t\t\t(?:\n\t\t\t\t (\"?)\t# beginning quotes (group 3)\n\t\t\t\t (?:\n\t\t\t\t\t ( (?: # group 4\n\t\t\t\t\t\t treble | violin | G | french | # G clefs\n\t\t\t\t\t alto | C | tenor | (?:mezzo)?soprano | baritone | # C clefs\n\t\t\t\t\t (?:sub)?bass | F | varbaritone | # F clefs\n\t\t\t\t\t percussion | tab | # percussion / tablature clefs\n \n\t\t\t\t (?:neo)?mensural-c[1-4] | mensural-[fg] | \t\t# Ancient clefs\n\t\t\t\t\t petrucci-(?: [fg] | c[1-5] ) |\n\t\t\t\t\t (?: vaticana | medicaea | hufnagel ) - (?: do[1-3] | fa[12] ) |\n\t\t\t\t\t hufnagel-do-fa\n\t\t\t\t\t )\n\t\t\t\t\t ([_^](?:8|15)?)? # optionally shift 1-2 octaves ↑/↓ (group 5)\n\t\t\t\t\t ) |\n\t\t\t\t\t ( (?:\\w+) ([_^](?:8|15))? ) # unknown clef name (groups 6-7)\n\t\t\t\t )\n\t\t\t\t (\\3) # closing quotes (group 8)\n\t\t\t\t)?\n\t\t\t", "captures": { "1": { "name": "support.function.element.lilypond" }, "2": { "name": "punctuation.definition.function.lilypond" }, "3": { "name": "punctuation.definition.string.lilypond" }, "4": { "name": "constant.language.clef-name.lilypond" }, "5": { "name": "constant.other.modifier.clef.lilypond" }, "6": { "name": "meta.fixme.unknown-clef-name.lilypond" }, "7": { "name": "constant.other.modifier.clef.lilypond" }, "8": { "name": "punctuation.definition.string.lilypond" } } }, "f_generic": { "name": "support.function.general.lilypond", "match": "(\\\\)[a-zA-Z-]+\\b", "captures": { "1": { "name": "punctuation.definition.function.lilypond" } } }, "f_key-signature": { "name": "meta.element.key-signature.lilypond" }, "f_keywords": { "name": "keyword.control.lilypond", "match": "(?x)\n\t\t\t\t(?: (\\\\)\n\t\t\t\t (?: set | new | override | revert)\\b\n\t\t\t\t)\n\t\t\t", "captures": { "1": { "name": "punctuation.definition.function.lilypond" } } }, "f_time-signature": { "name": "meta.element.time-signature.lilypond", "match": "(?x)\n\t\t\t\t((\\\\) time) \\s+ # backslash + \"time\" + spaces (groups 1-2)\n\t\t\t\t([1-9][0-9]*/[1-9][0-9]*)?\n\t\t\t", "captures": { "1": { "name": "support.function.element.lilypond" }, "2": { "name": "punctuation.definition.function.lilypond" }, "3": { "name": "constant.numeric.time-signature.lilypond" } } }, "functions": { "patterns": [ { "include": "#f_clef" }, { "include": "#f_time-signature" }, { "include": "#f_key-signature" }, { "include": "#f_keywords" }, { "include": "#f_generic" } ] }, "g_header": { "name": "meta.header.lilypond", "begin": "((\\\\)header)\\s*({)", "end": "}", "patterns": [ { "include": "#comments" }, { "include": "#strings" }, { "include": "#scheme" }, { "include": "#g_markup" }, { "name": "punctuation.separator.key-value.lilypond", "match": "=" }, { "name": "support.constant.header.lilypond", "match": "(?x)\n\t\t\t\t\t\tdedication | title | subtitle | subsubtitle | poet |\n\t\t\t\t\t\tcomposer | meter | opus | arranger | instrument |\n\t\t\t\t\t\tpiece | breakbefore | copyright | tagline | enteredby\n\t\t\t\t\t" }, { "name": "support.constant.header.mutopia.lilypond", "match": "(?x)\n\t\t\t\t\t\tmutopiatitle | mutopiacomposer | mutopiapoet |\n\t\t\t\t\t\tmutopiaopus | mutopiainstrument | date | source |\n\t\t\t\t\t\tstyle | maintainer | maintainerEmail |\n\t\t\t\t\t\tmaintainerWeb | lastupdated\n\t\t\t\t\t" } ], "beginCaptures": { "1": { "name": "support.function.section.header.lilypond" }, "2": { "name": "punctuation.definition.function.lilypond" }, "3": { "name": "punctuation.section.group.begin.lilypond" } }, "endCaptures": { "0": { "name": "punctuation.section.group.end.lilypond" } } }, "g_m_group": { "name": "meta.group.lilypond", "begin": "{", "end": "}", "patterns": [ { "include": "#f_generic" }, { "include": "#strings" }, { "include": "#comments" }, { "include": "#scheme" }, { "include": "#g_m_group" } ], "beginCaptures": { "0": { "name": "punctuation.section.group.begin.lilypond" } }, "endCaptures": { "0": { "name": "punctuation.section.group.end.lilypond" } } }, "g_markup": { "name": "meta.element.markup.lilypond", "begin": "(?x)\n\t\t\t\t((\\\\) markup) \\s+ # backslash + \"markup\" + spaces\n\t\t\t\t(?={)\n\t\t\t", "end": "(?\u003c=})", "patterns": [ { "include": "#g_m_group" } ], "beginCaptures": { "1": { "name": "support.function.element.markup.lilypond" }, "2": { "name": "punctuation.definition.function.markup" } } }, "g_relative": { "begin": "((\\\\)relative)\\s*(?:([a-h][',]*)\\s*)?(?={)", "end": "(?\u003c=})", "patterns": [ { "include": "#group" } ], "beginCaptures": { "1": { "name": "support.function.section.lilypond" }, "2": { "name": "punctuation.definition.function.lilypond" }, "3": { "name": "storage.type.pitch.lilypond" } } }, "g_system": { "name": "meta.system.lilypond", "begin": "\u003c\u003c", "end": "\u003e\u003e", "patterns": [ { "include": "$self" } ], "beginCaptures": { "0": { "name": "punctuation.section.system.begin.lilypond" } }, "endCaptures": { "0": { "name": "punctuation.section.system.end.lilypond" } } }, "g_times": { "begin": "((\\\\)times)\\s*(?:([1-9][0-9]*/[1-9][0-9])\\s*)(?={)", "end": "(?\u003c=})", "patterns": [ { "include": "#group" } ], "beginCaptures": { "1": { "name": "support.function.section.lilypond" }, "2": { "name": "punctuation.definition.function.lilypond" }, "3": { "name": "constant.numeric.fraction.lilypond" } } }, "group": { "name": "meta.music-expression.lilypond", "begin": "{", "end": "}", "patterns": [ { "include": "#music-expr" } ], "beginCaptures": { "0": { "name": "punctuation.section.group.begin.lilypond" } }, "endCaptures": { "0": { "name": "punctuation.section.group.end.lilypond" } } }, "groupings": { "patterns": [ { "include": "#g_system" }, { "include": "#g_relative" }, { "include": "#g_times" }, { "include": "#group" } ] }, "music-expr": { "patterns": [ { "include": "#comments" }, { "include": "#groupings" }, { "include": "#strings" }, { "include": "#functions" }, { "include": "#scheme" }, { "include": "#notes" } ] }, "n_articulations": { "patterns": [ { "name": "storage.modifier.articulation.accent.lilypond", "match": "(?x)\n\t\t\t\t\t\t([_^-])\n\t\t\t\t\t\t(?:[.\u003e^+|_-])\n\t\t\t\t\t" }, { "name": "storage.modifier.articulation.named.lilypond", "match": "(?x)\n\t\t\t\t\t\t(\\\\)\n\t\t\t\t\t\t(?: accent | markato | staccatissimo |\t\t # basic accents\n\t\t\t\t\t\t\tespressivo | staccato | tenuto | portato | \n\t\t\t\t\t\t\t(?:up|down)bow | flageolet | thumb |\n\t\t\t\t\t\t\t[lr](?:heel|toe) | open | stopped |\n\t\t\t\t\t\t\t(?:reverse)?turn | trill |\n\t\t\t\t\t\t\tprall(?: prall | mordent | down | up)? | # pralls\n\t\t\t\t\t\t\t(?: up | down | line ) prall | # and\n\t\t\t\t\t\t\t(?: up | down )? mordent | # mordents\n\t\t\t\t\t\t\tsignumcongruentiae |\n\t\t\t\t\t\t\t(?: (?:very)? long | short)?fermata(Markup)? | # fermatas\n\t\t\t\t\t\t\tsegno | (?:var)?coda \n\t\t\t\t\t\t)\n\t\t\t\t\t", "captures": { "1": { "name": "punctuation.definition.function.lilypond" } } }, { "name": "storage.modifier.articulation.dynamics.lilypond", "match": "(?x)\n\t\t\t\t\t\t(\\\\) # backslash\n\t\t\t\t\t\t(?:\n\t\t\t\t\t\t p{1,5} | m[pf] | f{1,4} | fp | # forte, piano, etc.\n \t\t\t\t\t\t[sr]fz | sff? | spp? | \n \t\t\t\t\t\t\u003c | \u003e | ! | espressivo # (de)crescendo\n\t\t\t\t\t\t)\n\t\t\t\t\t" }, { "name": "storage.modifier.beam.lilypond", "match": "\\[|\\]" }, { "name": "storage.modifier.slur.lilypond", "match": "\\(|\\)" }, { "name": "storage.modifier.slur.phrasing.lilypond", "match": "\\\\\\(|\\\\\\)" } ] }, "notes": { "patterns": [ { "name": "meta.element.note.lilypond", "begin": "(?x)\\b\n\t\t\t\t\t (\t\t\t\t\t\t # (group 1)\n\t\t\t\t\t\t ( [a-h] # Pitch (group 2)\n\t\t\t\t\t\t ( (?:i[sh]){1,2} | # - sharp (group 3)\n\t\t\t\t\t\t (?:e[sh]|s){1,2} # - flat\n\t\t\t\t\t\t )?\n\t\t\t\t\t (?:(\\!)|(\\?))? # Cautionary accidental (groups 4-5)\n\t\t\t\t\t ('+|,+)? # Octave (group 6)\n\t\t\t\t\t\t )\n\t\t\t\t\t\t ( ( ((\\\\)breve)| # Duration (groups 7-10)\n\t\t\t\t\t\t 64|32|16|8|4|2|1\n\t\t\t\t\t\t )\n\t\t\t\t\t\t (\\.+)? # Augmentation dot (group 11)\n\t\t\t\t\t\t\t((?:(\\*)(\\d+(?:/\\d+)?))*) # Scaling duration (groups 12-14)\n\t\t\t\t\t\t )?\n\t\t\t\t\t\t)(?![a-z])\t# do not follow a note with a letter\n\t\t\t\t\t", "end": "(?x)\n\t\t\t\t\t\t(?= [\\s}~a-z] |$) # End when we encounter a space or } or end of line\n\t\t\t\t\t", "patterns": [ { "include": "#n_articulations" } ], "beginCaptures": { "10": { "name": "punctuation.definition.function.lilypond" }, "13": { "name": "keyword.operator.duration-scale.lilypond" }, "14": { "name": "constant.numeric.fraction.lilypond" }, "2": { "name": "storage.type.pitch.lilypond" }, "4": { "name": "meta.note-modifier.accidental.reminder.lilypond" }, "5": { "name": "meta.note-modifier.accidental.cautionary.lilypond" }, "6": { "name": "meta.note-modifier.octave.lilypond" }, "7": { "name": "storage.type.duration.lilypond" } } }, { "name": "meta.element.pause.rest.lilypond", "begin": "(?x)\\b\n\t\t\t\t\t\t(?:(r)|(R)) # (groups 1-2)\n\t\t\t\t\t\t( ( (\\\\)breve| # Duration (groups 3-5)\n\t\t\t\t\t\t 64|32|16|8|4|2|1\n\t\t\t\t\t\t )\n\t\t\t\t\t\t (\\.+)? # Augmentation dot (group 6)\n\t\t\t\t\t\t ((?:(\\*)(\\d+(?:/\\d+)?))*) # Scaling duration (groups 7-9)\n\t\t\t\t\t\t\n\t\t\t\t\t\t)?\n\t\t\t\t\t\t(?![a-z])\t# do not follow a note with a letter\n\t\t\t\t\t", "end": "(?=[\\s}~a-z])", "patterns": [ { "include": "#n_articulations" } ], "beginCaptures": { "1": { "name": "storage.type.pause.rest.lilypond" }, "2": { "name": "storage.type.pause.rest.multi-measure.lilypond" }, "3": { "name": "storage.type.duration.lilypond" }, "5": { "name": "punctuation.definition.function.lilypond" }, "7": { "name": "keyword.operator.duration-scale.lilypond" }, "9": { "name": "constant.numeric.fraction.lilypond" } } }, { "name": "meta.element.pause.skip.lilypond", "begin": "(?x)\\b\n\t\t\t\t\t\t(s) # (group 1)\n\t\t\t\t\t\t( ( (\\\\)breve| # Duration (groups 2-4)\n\t\t\t\t\t\t 64|32|16|8|4|2|1\n\t\t\t\t\t\t )\n\t\t\t\t\t\t (\\.+)? # Augmentation dot (group 5)\n\t\t\t\t\t\t ((?:(\\*)(\\d+(?:/\\d+)?))*) # Scaling duration (groups 6-8)\n\t\t\t\t\t\t\n\t\t\t\t\t\t)?\n\t\t\t\t\t\t(?![a-z])\t# do not follow a note with a letter\n\t\t\t\t\t", "end": "(?=[\\s}~a-z]|$)", "patterns": [ { "include": "#n_articulations" } ], "beginCaptures": { "1": { "name": "storage.type.pause.skip.lilypond" }, "2": { "name": "storage.type.duration.lilypond" }, "4": { "name": "punctuation.definition.function.lilypond" }, "6": { "name": "keyword.operator.duration-scale.lilypond" }, "8": { "name": "constant.numeric.fraction.lilypond" } } }, { "name": "meta.element.pause.skip.lilypond", "match": "((\\\\)skip)\\s+(64|32|16|8|4|2|1)", "captures": { "1": { "name": "storage.type.pause.skip.lilypond" }, "2": { "name": "punctuation.definition.function.lilypond" }, "3": { "name": "storage.type.duration.lilypond" } } }, { "name": "meta.element.chord.lilypond", "begin": "\u003c", "end": "\u003e", "patterns": [ { "match": "(?x)\\b\n\t\t\t\t\t\t\t\t ( [a-h] # Pitch (group 1)\n\t\t\t\t\t\t\t\t ( (?:i[sh]){1,2} | # - sharp (group 2)\n\t\t\t\t\t\t\t\t (?:e[sh]|s){1,2} # - flat\n\t\t\t\t\t\t\t\t )?\n\t\t\t\t\t\t\t (?:(\\!)|(\\?))? # Reminder/cautionary accidental (groups 3-4)\n\t\t\t\t\t\t\t ('+|,+)? # Octave (group 5)\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t", "captures": { "1": { "name": "storage.type.pitch.lilypond" }, "3": { "name": "meta.note-modifier.accidental.reminder.lilypond" }, "4": { "name": "meta.note-modifier.accidental.cautionary.lilypond" }, "5": { "name": "meta.note-modifier.octave.lilypond" } } } ], "beginCaptures": { "0": { "name": "punctuation.definition.chord.lilypond" } }, "endCaptures": { "0": { "name": "punctuation.definition.chord.lilypond" } } }, { "name": "meta.element.chord.lilypond", "begin": "(?x)\n\t\t\t\t\t (?\u003c!-)\n\t\t\t\t\t (?\u003c=\u003e)\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t( ( ((\\\\)breve)| # Duration (groups 1-4)\n\t\t\t\t\t\t\t 64|32|16|8|4|2|1\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t (\\.+)? # Augmentation dot (group 5)\n\t\t\t\t\t\t\t) |\n\t\t\t\t\t\t\t(?![\\s}~a-z]|$)\n\t\t\t\t\t\t)\n\t\t\t\t\t", "end": "(?=[\\s}~a-z]|$)(?\u003c![^-]\u003e)", "patterns": [ { "include": "#n_articulations" } ], "beginCaptures": { "1": { "name": "storage.type.duration.lilypond" }, "4": { "name": "punctuation.definition.function.lilypond" } } }, { "name": "storage.type.tie.lilypond", "match": "~" }, { "name": "storage.type.breath-mark.lilypond", "match": "(\\\\)breathe", "captures": { "1": { "name": "punctuation.definition.function.lilypond" } } } ] }, "scheme": { "begin": "(^[ \\t])?(?=#)", "end": "(?!\\G)", "patterns": [ { "name": "meta.embedded.line.scheme", "contentName": "source.scheme", "begin": "#", "end": "(?=[\\s%])|(?\u003c=\\n)", "patterns": [ { "include": "source.scheme" } ] } ], "beginCaptures": { "0": { "name": "punctuation.whitespace.embedded.leading.scheme" } } }, "strings": { "name": "string.quoted.double.lilypond", "begin": "\"", "end": "\"", "patterns": [ { "name": "constant.character.escape.lilypond", "match": "\\\\." } ], "captures": { "0": { "name": "punctuation.definition.string.lilypond" } } } } }