meteor-api/grammars/meteor-api-grammer-coffeescript.cson
2015-01-06 15:58:56 -05:00

608 lines
17 KiB
Text

'scopeName': 'source.coffee'
'name': 'CoffeeScript (Meteor)'
'fileTypes': [
'coffee'
'Cakefile'
'coffee.erb'
'cson'
'_coffee'
]
'firstLineMatch': '^#!.*\\bcoffee'
'foldingStartMarker': '^\\s*class\\s+\\S.*$|.*(->|=>)\\s*$|.*[\\[{]\\s*$'
'foldingStopMarker': '^\\s*$|^\\s*[}\\]]\\s*$'
'patterns': [
{
'match': '(Meteor.isClient|Meteor.isServer|Meteor.isCordova|Meteor.startup|Meteor.absolute)'
'name': 'api.meteor.core'
}
{
'match': '(Meteor.publish|Meteor.subscribe)'
'name': 'api.meteor.ddp'
}
{
'match': '(HTTP.get|HTTP.post|HTTP.call|HTTP.put|HTTP.del)'
'name': 'api.meteor.http'
}
{
'match': '(Session.setDefault|Session.set|Session.get|Session.equals|Session.toggle|Session.clear)'
'name': 'api.meteor.session'
}
{
'match': '(([a-zA-Z_?.$][\\w?.$]*)\\.findOne|([a-zA-Z_?.$][\\w?.$]*)\\.find|([a-zA-Z_?.$][\\w?.$]*)\\.update|([a-zA-Z_?.$][\\w?.$]*)\\.upsert|([a-zA-Z_?.$][\\w?.$]*)\\.remove|([a-zA-Z_?.$][\\w?.$]*)\\.insert)'
'name': 'api.mongo.collection'
}
{
'match': 'Template.(.*).events|Template.(.*).helpers|Template.(.*).rendered|Template.(.*).created|Template.(.*).destroyed|Template.registerHelper'
'name': 'api.meteor.template'
}
{
'match': '(Blaze.render|Blaze.renderWithData|Blaze.remove|Blaze.getData|Blaze.toHTML|Blaze.toHTMLWithData|Blaze.isTemplate)'
'name': 'api.meteor.blaze'
}
{
'match': '(Router.map|Router.go|Router.configure|this.route)'
'name': 'api.meteor.router'
}
{
'captures':
'1':
'name': 'variable.parameter.function.coffee'
'2':
'name': 'storage.type.function.coffee'
'comment': 'match stuff like: a -> … '
'match': '(\\([^()]*?\\))\\s*([=-]>)'
'name': 'meta.inline.function.coffee'
}
{
'captures':
'1':
'name': 'keyword.operator.new.coffee'
'4':
'name': 'storage.type.class.coffee'
'6':
'name': 'entity.name.type.instance.coffee'
'7':
'name': 'entity.name.type.instance.coffee'
'match': '(new)\\s+(((class)(\\s+(\\w+(?:\\.\\w*)*))?)|(\\w+(?:\\.\\w*)*))'
'name': 'meta.class.instance.constructor'
}
{
'begin': '\'\'\''
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.coffee'
'end': '\'\'\''
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.coffee'
'name': 'string.quoted.heredoc.coffee'
}
{
'begin': '"""'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.coffee'
'end': '"""'
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.coffee'
'name': 'string.quoted.double.heredoc.coffee'
'patterns': [
{
'match': '\\\\.'
'name': 'constant.character.escape.coffee'
}
{
'include': '#interpolated_coffee'
}
]
}
{
'begin': '`'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.coffee'
'end': '`'
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.coffee'
'name': 'string.quoted.script.coffee'
'patterns': [
{
'include': 'source.js'
}
]
}
{
'begin': '(?<!#)###(?!#)'
'captures':
'0':
'name': 'punctuation.definition.comment.coffee'
'end': '###(?:[ \\t]*\\n)'
'name': 'comment.block.coffee'
'patterns': [
{
'match': '(?<=^|\\s)@\\w*(?=\\s)'
'name': 'storage.type.annotation.coffee'
}
]
}
{
'begin': '(#)(?!\\{)'
'beginCaptures':
'1':
'name': 'punctuation.definition.comment.coffee'
'end': '\\n'
'name': 'comment.line.number-sign.coffee'
}
{
'begin': '/{3}'
'end': '(/{3})[imgy]{0,4}'
'name': 'string.regexp.coffee'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.js'
'endCaptures':
'1':
'name': 'punctuation.definition.string.begin.js'
'patterns': [
{
'include': '#heregexp'
}
]
}
{
'begin': '/(?=(?![ /*+?])([^\\\\]|\\\\.)*?/[igmy]{0,4}(?![a-zA-Z0-9]))'
'end': '(/)[imgy]{0,4}'
'name': 'string.regexp.coffee'
'patterns': [
{
'include': 'source.js.regexp'
}
]
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.js'
'endCaptures':
'1':
'name': 'punctuation.definition.string.begin.js'
}
{
'match': '(?x)\\b(?<![\\.\\$])(\n\t\t\t\t\tbreak|by|catch|continue|else|finally|for|in|of|if|return|switch|\n\t\t\t\t\tthen|throw|try|unless|when|while|until|loop|do|(?<=for)\\s+own\n\t\t\t\t)(?!\\s*:)\\b'
'name': 'keyword.control.coffee'
}
{
'match': '(?x)and=|or=|!|%|&|\\^|\\*|\\/|(\\-)?\\-(?!>)|\\+\\+|\\+|~|==|=(?!>)|!=|<=|>=|<<=|>>=|\n\t\t\t\t>>>=|<>|<|>|!|&&|\\.\\.(\\.)?|\\?|\\||\\|\\||\\:|\\*=|(?<!\\()/=|%=|\\+=|\\-=|&=|\n\t\t\t\t\\^=|\\b(?<![\\.\\$])(instanceof|new|delete|typeof|and|or|is|isnt|not|super)(?!\\s*:)\\b'
'name': 'keyword.operator.coffee'
}
{
'match': '\\b(?<![\\.\\$])(case|default|function|var|void|with|const|let|enum|export|import|native|__hasProp|__extends|__slice|__bind|__indexOf|implements|interface|package|private|protected|public|static|yield)(?!\\s*:)\\b'
'name': 'keyword.reserved.coffee'
}
{
'captures':
'1':
'name': 'variable.assignment.coffee'
'4':
'name': 'punctuation.separator.key-value'
'5':
'name': 'keyword.operator.coffee'
'match': '([a-zA-Z\\$_](\\w|\\$|\\.)*\\s*(?!\\::)((:)|((?:or|and|[-+/&%*?])?=)(?![>=]))(?!(\\s*\\(.*\\))?\\s*([=-]>)))'
'name': 'variable.assignment.coffee'
}
{
'begin': '(?<=\\s|^)(\\{)(?=.+?\\}\\s+[:=])'
'beginCaptures':
'0':
'name': 'keyword.operator.coffee'
'end': '(\\}\\s*[:=])'
'endCaptures':
'0':
'name': 'keyword.operator.coffee'
'name': 'meta.variable.assignment.destructured.object.coffee'
'patterns': [
{
'include': '#variable_name'
}
{
'include': '#instance_variable'
}
{
'include': '#single_quoted_string'
}
{
'include': '#double_quoted_string'
}
{
'include': '#numeric'
}
]
}
{
'begin': '(?<=\\s|^)(\\[)(?=.+?\\]\\s+[:=])'
'beginCaptures':
'0':
'name': 'keyword.operator.coffee'
'end': '(\\]\\s*[:=])'
'endCaptures':
'0':
'name': 'keyword.operator.coffee'
'name': 'meta.variable.assignment.destructured.array.coffee'
'patterns': [
{
'include': '#variable_name'
}
{
'include': '#instance_variable'
}
{
'include': '#single_quoted_string'
}
{
'include': '#double_quoted_string'
}
{
'include': '#numeric'
}
]
}
{
'captures':
'1':
'name': 'entity.name.function.coffee'
'3':
'name': 'variable.parameter.function.coffee'
'4':
'name': 'storage.type.function.coffee'
'match': '(?x)\n\t\t\t\t(?<=^|\\s)\n\t\t\t\t(?=@?[a-zA-Z\\$_])\n\t\t\t\t(\n\t\t\t\t\t@?[a-zA-Z\\$_](\\w|\\$|:|\\.)*\\s*\n\t\t\t\t\t(?=[:=](\\s*\\(.*\\))?\\s*([=-]>))\n\t\t\t\t)\n\t\t\t'
'name': 'meta.function.coffee'
}
{
'match': '[=-]>'
'name': 'storage.type.function.coffee'
}
{
'match': '\\b(?<!\\.|::)(true|on|yes)(?!\\s*[:=][^=])\\b'
'name': 'constant.language.boolean.true.coffee'
}
{
'match': '\\b(?<!\\.|::)(false|off|no)(?!\\s*[:=][^=])\\b'
'name': 'constant.language.boolean.false.coffee'
}
{
'match': '\\b(?<!\\.|::)null(?!\\s*[:=][^=])\\b'
'name': 'constant.language.null.coffee'
}
{
'match': '\\b(?<!\\.|::)extends(?!\\s*[:=])\\b'
'name': 'variable.language.coffee'
}
{
'match': '\\b(?<!\\.)this(?!\\s*[:=][^=])\\b'
'name': 'variable.language.this.coffee'
}
{
'captures':
'1':
'name': 'storage.type.class.coffee'
'2':
'name': 'keyword.control.inheritance.coffee'
'3':
'name': 'entity.other.inherited-class.coffee'
'match': '(?<=\\s|^|\\[|\\()(class)\\s+(extends)\\s+(@?[a-zA-Z\\$\\._][\\w\\.]*)'
'name': 'meta.class.coffee'
}
{
'captures':
'1':
'name': 'storage.type.class.coffee'
'2':
'name': 'entity.name.type.class.coffee'
'3':
'name': 'keyword.control.inheritance.coffee'
'4':
'name': 'entity.other.inherited-class.coffee'
'match': '(?<=\\s|^|\\[|\\()(class\\b)\\s+(@?[a-zA-Z\\$_][\\w\\.]*)?(?:\\s+(extends)\\s+(@?[a-zA-Z\\$\\._][\\w\\.]*))?'
'name': 'meta.class.coffee'
}
{
'match': '\\b(debugger|\\\\)\\b'
'name': 'keyword.other.coffee'
}
{
'match': '(?x)\\b(\n\t\t\t\tArray|ArrayBuffer|Blob|Boolean|Date|document|Function|\n\t\t\t\tInt(8|16|32|64)Array|Math|Map|Number|\n\t\t\t\tObject|Proxy|RegExp|Set|String|WeakMap|\n\t\t\t\twindow|Uint(8|16|32|64)Array|XMLHttpRequest\n\t\t\t)\\b'
'name': 'support.class.coffee'
}
{
'match': '\\b(console)\\b'
'name': 'entity.name.type.object.coffee'
}
{
'match': '((?<=console\\.)(debug|warn|info|log|error|time|timeEnd|assert))\\b'
'name': 'support.function.console.coffee'
}
{
'match': '(?x)\\b(\n\t\t\t\tdecodeURI(Component)?|encodeURI(Component)?|eval|parse(Float|Int)|require\n\t\t\t)\\b'
'name': 'support.function.coffee'
}
{
'match': '(?x)((?<=\\.)(\n\t\t\t\tapply|call|concat|every|filter|forEach|from|hasOwnProperty|indexOf|\n\t\t\t\tisPrototypeOf|join|lastIndexOf|map|of|pop|propertyIsEnumerable|push|\n\t\t\t\treduce(Right)?|reverse|shift|slice|some|sort|splice|to(Locale)?String|\n\t\t\t\tunshift|valueOf\n\t\t\t))\\b'
'name': 'support.function.method.array.coffee'
}
{
'match': '(?x)((?<=Array\\.)(\n\t\t\t\tisArray\n\t\t\t))\\b'
'name': 'support.function.static.array.coffee'
}
{
'match': '(?x)((?<=Object\\.)(\n\t\t\t\tcreate|definePropert(ies|y)|freeze|getOwnProperty(Descriptors?|Names)|\n\t\t\t\tgetProperty(Descriptor|Names)|getPrototypeOf|is(Extensible|Frozen|Sealed)?|\n\t\t\t\tisnt|keys|preventExtensions|seal\n\t\t\t))\\b'
'name': 'support.function.static.object.coffee'
}
{
'match': '(?x)((?<=Math\\.)(\n\t\t\t\tabs|acos|acosh|asin|asinh|atan|atan2|atanh|ceil|cos|cosh|exp|expm1|floor|\n\t\t\t\thypot|log|log10|log1p|log2|max|min|pow|random|round|sign|sin|sinh|sqrt|\n\t\t\t\ttan|tanh|trunc\n\t\t\t))\\b'
'name': 'support.function.static.math.coffee'
}
{
'match': '(?x)((?<=Number\\.)(\n\t\t\t\tis(Finite|Integer|NaN)|toInteger\n\t\t\t))\\b'
'name': 'support.function.static.number.coffee'
}
{
'match': '(?<!\\.)\\b(module|exports|__filename|__dirname|global|process)(?!\\s*:)\\b'
'name': 'support.variable.coffee'
}
{
'match': '\\b(Infinity|NaN|undefined)\\b'
'name': 'constant.language.coffee'
}
{
'match': '\\;'
'name': 'punctuation.terminator.statement.coffee'
}
{
'match': ',[ |\\t]*'
'name': 'meta.delimiter.object.comma.coffee'
}
{
'match': '\\.'
'name': 'meta.delimiter.method.period.coffee'
}
{
'match': '\\{|\\}'
'name': 'meta.brace.curly.coffee'
}
{
'match': '\\(|\\)'
'name': 'meta.brace.round.coffee'
}
{
'match': '\\[|\\]\\s*'
'name': 'meta.brace.square.coffee'
}
{
'include': '#instance_variable'
}
{
'include': '#single_quoted_string'
}
{
'include': '#double_quoted_string'
}
{
'include': '#numeric'
}
]
'repository':
'double_quoted_string':
'patterns': [
{
'begin': '"'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.coffee'
'end': '"'
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.coffee'
'name': 'string.quoted.double.coffee'
'patterns': [
{
'match': '\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
'name': 'constant.character.escape.coffee'
}
{
'include': '#interpolated_coffee'
}
]
}
]
'embedded_comment':
'patterns': [
{
'captures':
'1':
'name': 'punctuation.definition.comment.coffee'
'match': '(?<!\\\\)(#).*$\\n?'
'name': 'comment.line.number-sign.coffee'
}
]
'instance_variable':
'patterns': [
{
'match': '(@)([a-zA-Z_\\$]\\w*)?'
'name': 'variable.other.readwrite.instance.coffee'
}
]
'interpolated_coffee':
'patterns': [
{
'begin': '\\#\\{'
'captures':
'0':
'name': 'punctuation.section.embedded.coffee'
'end': '\\}'
'name': 'source.coffee.embedded.source'
'patterns': [
{
'include': '$self'
}
]
}
]
'numeric':
'patterns': [
{
'match': '(?<!\\$)\\b((0([box])[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?(e[+\\-]?[0-9]+)?))\\b'
'name': 'constant.numeric.coffee'
}
]
'single_quoted_string':
'patterns': [
{
'begin': '\''
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.coffee'
'end': '\''
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.coffee'
'name': 'string.quoted.single.coffee'
'patterns': [
{
'match': '\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
'name': 'constant.character.escape.coffee'
}
]
}
]
'variable_name':
'patterns': [
{
'captures':
'1':
'name': 'variable.assignment.coffee'
'match': '([a-zA-Z\\$_]\\w*(\\.\\w+)*)'
'name': 'variable.assignment.coffee'
}
]
'regex-character-class':
'patterns': [
{
'match': '\\\\[wWsSdD]|\\.'
'name': 'constant.character.character-class.regexp'
}
{
'match': '\\\\([0-7]{3}|x\\h\\h|u\\h\\h\\h\\h)'
'name': 'constant.character.numeric.regexp'
}
{
'match': '\\\\c[A-Z]'
'name': 'constant.character.control.regexp'
}
{
'match': '\\\\.'
'name': 'constant.character.escape.backslash.regexp'
}
]
'heregexp':
'patterns': [
{
'match': '\\\\[bB]|\\^|\\$'
'name': 'keyword.control.anchor.regexp'
}
{
'match': '\\\\[1-9]\\d*'
'name': 'keyword.other.back-reference.regexp'
}
{
'match': '[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??'
'name': 'keyword.operator.quantifier.regexp'
}
{
'match': '\\|'
'name': 'keyword.operator.or.regexp'
}
{
'begin': '(\\()((\\?=)|(\\?!))'
'beginCaptures':
'1':
'name': 'punctuation.definition.group.regexp'
'3':
'name': 'meta.assertion.look-ahead.regexp'
'4':
'name': 'meta.assertion.negative-look-ahead.regexp'
'end': '(\\))'
'endCaptures':
'1':
'name': 'punctuation.definition.group.regexp'
'name': 'meta.group.assertion.regexp'
'patterns': [
{
'include': '#heregexp'
}
]
}
{
'begin': '\\((\\?:)?'
'beginCaptures':
'0':
'name': 'punctuation.definition.group.regexp'
'end': '\\)'
'endCaptures':
'0':
'name': 'punctuation.definition.group.regexp'
'name': 'meta.group.regexp'
'patterns': [
{
'include': '#heregexp'
}
]
}
{
'begin': '(\\[)(\\^)?'
'beginCaptures':
'1':
'name': 'punctuation.definition.character-class.regexp'
'2':
'name': 'keyword.operator.negation.regexp'
'end': '(\\])'
'endCaptures':
'1':
'name': 'punctuation.definition.character-class.regexp'
'name': 'constant.other.character-class.set.regexp'
'patterns': [
{
'captures':
'1':
'name': 'constant.character.numeric.regexp'
'2':
'name': 'constant.character.control.regexp'
'3':
'name': 'constant.character.escape.backslash.regexp'
'4':
'name': 'constant.character.numeric.regexp'
'5':
'name': 'constant.character.control.regexp'
'6':
'name': 'constant.character.escape.backslash.regexp'
'match': '(?:.|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))'
'name': 'constant.other.character-class.range.regexp'
}
{
'include': '#regex-character-class'
}
]
}
{
'include': '#regex-character-class'
}
{
'include': '#interpolated_coffee'
}
{
'include': '#embedded_comment'
}
]