Permalink
Browse files

initial commit

  • Loading branch information...
1 parent 512435c commit bc8bb2f249c7f3d775321a9735f3252721bb1155 @pferruggiaro committed Dec 17, 2012
Showing with 434 additions and 2 deletions.
  1. +6 −2 README.md
  2. +152 −0 tea.JSON-tmlanguage
  3. +276 −0 tea.tmlanguage
View
8 README.md
@@ -1,2 +1,6 @@
-sublime-tea
-===========
+Sublime Tea
+===========
+
+A Sublime Text 2 language definition file for the Tea templating language.
+
+Drop into tea.tmlanguage into Library/Application Support/Sublime Text 2/Packages/User and restart.
View
152 tea.JSON-tmlanguage
@@ -0,0 +1,152 @@
+{
+ "fileTypes": [
+ "tea"
+ ],
+ "foldingStartMarker": "(\\{\\s*(//.*)?$|^\\s*// \\{\\{\\{)",
+ "foldingStopMarker": "^\\s*(\\}|// \\}\\}\\}$)",
+ "name": "Tea",
+ "patterns": [
+ {
+ "begin": "<%",
+ "end": "%>",
+ "patterns": [
+ { "include": "#language" }
+ ]
+ },
+ { "include": "text.html.basic" },
+ { "include": "source.js" },
+ { "include": "text.xml" }
+ ],
+ "repository": {
+ "functions": {
+ "patterns": [
+ {
+ "match": "\\b(setLocale|getLocale|getAvailableLocales|nullFormat|getNullFormat|getDateFormat|getAvailableTimeZones|getDataFormatTimeZone|numberFormat|getNumberFormat|getNumberFormatInfinity|getNumberFormatNaN|currentDate|startsWith|endsWith|find|findFirst|substring|toLowerCase|toUpperCase|trim|trimLeading|trimTrailing|replace|replaceFirst|replaceLast|shortOrdinal|ordinal|cardinal)\\b(?=\\()",
+ "name": "support.function.tea"
+ }
+ ]
+ },
+ "strings": {
+ "patterns": [
+ {
+ "begin": "\"",
+ "end": "\"",
+ "name": "string.quoted.double.tea",
+ "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.tea"
+ }
+ ]
+ },
+ {
+ "begin": "'",
+ "end": "'",
+ "name": "string.quoted.single.tea",
+ "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.tea"
+ }
+ ]
+ }
+ ]
+ },
+ "language": {
+ "patterns": [
+ { "include": "#strings" },
+ { "include": "#functions" },
+ {
+ "name": "meta.template.tea",
+ "begin": "\\b(template)\\s+([a-zA-Z_$]\\w*)?\\s*(\\()",
+ "end": "(\\))",
+ "beginCaptures": {
+ "1": { "name": "storage.type.template.tea" },
+ "2": { "name": "entity.name.class.tea" }
+ },
+ "patterns": [
+ {
+ "match": "\\s*([a-zA-Z_$]\\w*)\\s+(.*?),\\s*",
+ "captures": {
+ "1": { "name": "storage.type.tea" },
+ "2": { "name": "variable.parameter.template.tea" }
+ }
+ }
+ ]
+ },
+ {
+ "name": "meta.template-call.tea",
+ "begin": "\\b(call)\\s+(.*?)\\(.*?",
+ "end": "\\)",
+ "beginCaptures": {
+ "1": { "name": "keyword.other.tea" },
+ "2": { "name": "entity.name.function.tea" }
+ },
+ "patterns": [
+ { "include": "#functions" },
+ { "include": "#strings" }
+ ]
+ },
+ {
+ "match": "\\?:|\\?\\.|\\b(break|else|foreach|if|in|reverse)\\b",
+ "name": "keyword.control.tea"
+ },
+ {
+ "match": "#|##|\\.\\.|\\.\\.\\.|&|\\*\\.",
+ "name": "keyword.operator.tea"
+ },
+ {
+ "match": "(\\-|\\+|\\*|%)",
+ "name": "keyword.operator.arithmetic.tea"
+ },
+ {
+ "match": "(=)",
+ "name": "keyword.operator.assignment.tea"
+ },
+ {
+ "match": "(==|!=|<|>|<=|>=|<=>|\\b(and|not|or|isa)\\b)",
+ "name": "keyword.operator.comparison.tea"
+ },
+ {
+ "match": "(!)",
+ "name": "keyword.operator.logical.tea"
+ },
+ {
+ "match": "\\b(call|as|define)\\b",
+ "name": "keyword.other.tea"
+ },
+ {
+ "match": "\\b(true)\\b",
+ "name": "constant.language.boolean.true.tea"
+ },
+ {
+ "match": "\\b(false)\\b",
+ "name": "constant.language.boolean.false.tea"
+ },
+ {
+ "match": "\\b(null)\\b",
+ "name": "constant.language.null.tea"
+ },
+ {
+ "match": "\\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\b",
+ "name": "constant.numeric.tea"
+ },
+ {
+ "match": "(//).*$\\n?",
+ "name": "comment.line.double-slash.tea"
+ },
+ {
+ "begin": "/\\*",
+ "end": "\\*/",
+ "name": "comment.block.tea"
+ },
+ {
+ "match": "\\;",
+ "name": "punctuation.terminator.statement.tea"
+ }
+ ]
+ }
+ },
+ "scopeName": "source.tea",
+ "uuid": "89c32adb-9c57-4d3a-982a-3b2d3b6625fb"
+}
View
276 tea.tmlanguage
@@ -0,0 +1,276 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>fileTypes</key>
+ <array>
+ <string>tea</string>
+ </array>
+ <key>foldingStartMarker</key>
+ <string>(\{\s*(//.*)?$|^\s*// \{\{\{)</string>
+ <key>foldingStopMarker</key>
+ <string>^\s*(\}|// \}\}\}$)</string>
+ <key>name</key>
+ <string>Tea</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>begin</key>
+ <string>&lt;%</string>
+ <key>end</key>
+ <string>%&gt;</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
+ <string>#language</string>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>text.html.basic</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>source.js</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>text.xml</string>
+ </dict>
+ </array>
+ <key>repository</key>
+ <dict>
+ <key>functions</key>
+ <dict>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>match</key>
+ <string>\b(setLocale|getLocale|getAvailableLocales|nullFormat|getNullFormat|getDateFormat|getAvailableTimeZones|getDataFormatTimeZone|numberFormat|getNumberFormat|getNumberFormatInfinity|getNumberFormatNaN|currentDate|startsWith|endsWith|find|findFirst|substring|toLowerCase|toUpperCase|trim|trimLeading|trimTrailing|replace|replaceFirst|replaceLast|shortOrdinal|ordinal|cardinal)\b(?=\()</string>
+ <key>name</key>
+ <string>support.function.tea</string>
+ </dict>
+ </array>
+ </dict>
+ <key>language</key>
+ <dict>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
+ <string>#strings</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#functions</string>
+ </dict>
+ <dict>
+ <key>begin</key>
+ <string>\b(template)\s+([a-zA-Z_$]\w*)?\s*(\()</string>
+ <key>beginCaptures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>storage.type.template.tea</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.class.tea</string>
+ </dict>
+ </dict>
+ <key>end</key>
+ <string>(\))</string>
+ <key>name</key>
+ <string>meta.template.tea</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>storage.type.tea</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>variable.parameter.template.tea</string>
+ </dict>
+ </dict>
+ <key>match</key>
+ <string>\s*([a-zA-Z_$]\w*)\s+(.*?),\s*</string>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>begin</key>
+ <string>\b(call)\s+(.*?)\(.*?</string>
+ <key>beginCaptures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.other.tea</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.function.tea</string>
+ </dict>
+ </dict>
+ <key>end</key>
+ <string>\)</string>
+ <key>name</key>
+ <string>meta.template-call.tea</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
+ <string>#functions</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#strings</string>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>\?:|\?\.|\b(break|else|foreach|if|in|reverse)\b</string>
+ <key>name</key>
+ <string>keyword.control.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>#|##|\.\.|\.\.\.|&amp;|\*\.</string>
+ <key>name</key>
+ <string>keyword.operator.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>(\-|\+|\*|%)</string>
+ <key>name</key>
+ <string>keyword.operator.arithmetic.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>(=)</string>
+ <key>name</key>
+ <string>keyword.operator.assignment.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>(==|!=|&lt;|&gt;|&lt;=|&gt;=|&lt;=&gt;|\b(and|not|or|isa)\b)</string>
+ <key>name</key>
+ <string>keyword.operator.comparison.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>(!)</string>
+ <key>name</key>
+ <string>keyword.operator.logical.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>\b(call|as|define)\b</string>
+ <key>name</key>
+ <string>keyword.other.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>\b(true)\b</string>
+ <key>name</key>
+ <string>constant.language.boolean.true.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>\b(false)\b</string>
+ <key>name</key>
+ <string>constant.language.boolean.false.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>\b(null)\b</string>
+ <key>name</key>
+ <string>constant.language.null.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b</string>
+ <key>name</key>
+ <string>constant.numeric.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>(//).*$\n?</string>
+ <key>name</key>
+ <string>comment.line.double-slash.tea</string>
+ </dict>
+ <dict>
+ <key>begin</key>
+ <string>/\*</string>
+ <key>end</key>
+ <string>\*/</string>
+ <key>name</key>
+ <string>comment.block.tea</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>\;</string>
+ <key>name</key>
+ <string>punctuation.terminator.statement.tea</string>
+ </dict>
+ </array>
+ </dict>
+ <key>strings</key>
+ <dict>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>begin</key>
+ <string>"</string>
+ <key>end</key>
+ <string>"</string>
+ <key>name</key>
+ <string>string.quoted.double.tea</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>match</key>
+ <string>\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)</string>
+ <key>name</key>
+ <string>constant.character.escape.tea</string>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>begin</key>
+ <string>'</string>
+ <key>end</key>
+ <string>'</string>
+ <key>name</key>
+ <string>string.quoted.single.tea</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>match</key>
+ <string>\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)</string>
+ <key>name</key>
+ <string>constant.character.escape.tea</string>
+ </dict>
+ </array>
+ </dict>
+ </array>
+ </dict>
+ </dict>
+ <key>scopeName</key>
+ <string>source.tea</string>
+ <key>uuid</key>
+ <string>89c32adb-9c57-4d3a-982a-3b2d3b6625fb</string>
+</dict>
+</plist>

0 comments on commit bc8bb2f

Please sign in to comment.