Files
linguist/samples/CSON/ff-sfd.cson
2016-08-29 01:57:32 +10:00

109 lines
3.0 KiB
Plaintext

name: "Spline Font Database"
scopeName: "text.sfd"
fileTypes: ["sfd"]
firstLineMatch: "^SplineFontDB: [\\d.]+"
patterns: [include: "#main"]
repository:
main:
patterns: [
{include: "#punctuation"}
{include: "#private"}
{include: "#image"}
{include: "#pickleData"}
{include: "#sections"}
{include: "#copyright"}
{include: "#property"}
{include: "#control"}
{include: "#address"}
{include: "#encoding"}
{include: "source.fontforge#shared"}
{include: "#colour"}
]
punctuation:
patterns: [
{match: "<|>", name: "punctuation.definition.brackets.angle.sfd"}
{match: "[{}]", name: "punctuation.definition.brackets.curly.sfd"}
]
private:
name: "meta.section.private.sfd"
begin: "^BeginPrivate(?=:)"
end: "^EndPrivate\\b"
beginCaptures: 0: name: "keyword.control.begin.private.sfd"
endCaptures: 0: name: "keyword.control.end.private.sfd"
patterns: [
{match: "^\\S+", name: "entity.name.private.property.sfd"}
{include: "$self"}
]
image:
name: "meta.image.sfd"
begin: "^(Image)(?=:)(.+)$"
end: "^(EndImage)\\b"
contentName: "string.unquoted.raw.data.sfd"
beginCaptures:
1: name: "keyword.control.begin.image.sfd"
2: patterns: [include: "$self"]
endCaptures:
1: name: "keyword.control.end.image.sfd"
pickleData:
name: "meta.pickle-data.sfd"
begin: "^(PickledData)(:)\\s*(\")"
end: '"'
beginCaptures:
1: name: "entity.name.property.sfd"
2: name: "punctuation.separator.dictionary.key-value.sfd"
3: name: "punctuation.definition.string.begin.sfd"
endCaptures:
0: name: "punctuation.definition.string.end.sfd"
patterns: [match: "\\\\.", name: "constant.character.escape.sfd"]
sections:
name: "meta.section.${2:/downcase}.sfd"
begin: "^(Start|Begin)([A-Z]\\w+)(?=:)"
end: "^(End\\2)\\b"
beginCaptures: 0: name: "keyword.control.begin.${2:/downcase}.sfd"
endCaptures: 0: name: "keyword.control.end.${2:/downcase}.sfd"
patterns: [include: "$self"]
control:
name: "keyword.control.${1:/downcase}.sfd"
match: "\\b(Fore|Back|SplineSet|^End\\w+)\\b"
colour:
name: "constant.other.hex.colour.sfd"
match: "(#)[A-Fa-f0-9]{3,}|(?<=\\s)[A-Fa-f0-9]{6,8}"
captures:
1: name: "punctuation.definition.colour.sfd"
encoding:
name: "constant.language.encoding.sfd"
match: "(?i)\\b(ISO[-\\w]+)(?<=\\d)(?=\\s|$)"
# Don't highlight numbers in freeform strings (years/version strings)
copyright:
name: "meta.${1:/downcase}-string.sfd"
begin: "^(Copyright|U?Comments?|\\w+Name)(:)"
end: "$"
beginCaptures:
1: name: "entity.name.property.sfd"
2: name: "punctuation.separator.dictionary.key-value.sfd"
patterns: [include: "source.fontforge#stringEscapes"]
# No idea what this is, but it looks distracting without a fix
# Assuming it's referring to a memory register or something.
address:
match: "\\d+[xX][A-Fa-f0-9]+"
name: "constant.numeric.hexadecimal.sfd"
property:
match: "^([^:]+)(:)"
name: "meta.dictionary.key-value.sfd"
captures:
1: name: "entity.name.property.sfd"
2: name: "punctuation.separator.dictionary.key-value.sfd"