Stash
This commit is contained in:
parent
8e199d4b24
commit
5a081f748e
3 changed files with 579 additions and 122 deletions
|
|
@ -33,24 +33,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
THIS FILE WAS AUTOGENERATED BY theme_mode.tmpl.js
|
||||
|
||||
IT MIGHT NOT BE PERFECT, PARTICULARLY:
|
||||
|
||||
IN DECIDING STATES TO TRANSITION TO,
|
||||
|
||||
IGNORING WHITESPACE,
|
||||
|
||||
EXTENDING EXISTING MODES,
|
||||
|
||||
GATHERING KEYWORDS, OR
|
||||
|
||||
RULE PREFERENCE ORDER.
|
||||
|
||||
...But it's a good start from an existing *.tmlanguage file.
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
|
|
@ -66,111 +48,63 @@ var JadeHighlightRules = function() {
|
|||
{
|
||||
"start": [
|
||||
{
|
||||
"token": {
|
||||
"1": {
|
||||
"name": "keyword.control.import.include.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^\\s*\\b(include)\\b"
|
||||
"token": "keyword.control.import.include.jade",
|
||||
"regex": "^\\s*\\binclude\\b"
|
||||
},
|
||||
{
|
||||
"token": "keyword.other.doctype.jade",
|
||||
"regex": "^(!!!)(\\s*[a-zA-Z0-9-_]+)?"
|
||||
"regex": "^!!!\\s*[a-zA-Z0-9-_]+?"
|
||||
},
|
||||
{
|
||||
"token": {
|
||||
"1": {
|
||||
"name": "punctuation.section.comment.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^ *(//)\\s*\\S.*$\\n?"
|
||||
"token": "punctuation.section.comment.jade",
|
||||
"regex": "^ *//\\s*\\S.*$\\n?"
|
||||
},
|
||||
{
|
||||
"token": {
|
||||
"2": {
|
||||
"name": "punctuation.section.comment.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^(\\s*)(//)\\s*$",
|
||||
"next": "state_4"
|
||||
"token": "punctuation.section.comment.jade",
|
||||
"regex": "^\\s*//\\s*$",
|
||||
"next": "block_comment"
|
||||
},
|
||||
/*{
|
||||
"token": "entity.name.function.jade",
|
||||
"regex": "^\\s*\\:markdown",
|
||||
"next": "markdown_filter"
|
||||
},
|
||||
{
|
||||
"token": {
|
||||
"2": {
|
||||
"name": "entity.name.function.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^(\\s*)(\\:markdown)",
|
||||
"next": "state_5"
|
||||
"token": "entity.name.function.jade",
|
||||
"regex": "^\\s*\\:sass",
|
||||
"next": "sass_filter"
|
||||
},
|
||||
{
|
||||
"token": {
|
||||
"2": {
|
||||
"name": "entity.name.function.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^(\\s*)(\\:sass)",
|
||||
"next": "state_6"
|
||||
"token": "entity.name.function.jade",
|
||||
"regex": "^\\s*\\:less",
|
||||
"next": "less_filter"
|
||||
},
|
||||
{
|
||||
"token": {
|
||||
"2": {
|
||||
"name": "entity.name.function.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^(\\s*)(\\:less)",
|
||||
"next": "state_7"
|
||||
"token": "entity.name.function.jade",
|
||||
"regex": "^\\s*\\:coffeescript",
|
||||
"next": "coffeescript_filter"
|
||||
},
|
||||
{
|
||||
"token": {
|
||||
"2": {
|
||||
"name": "entity.name.function.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^(\\s*)(\\:coffeescript)",
|
||||
"next": "state_8"
|
||||
},
|
||||
{
|
||||
"token": {
|
||||
"2": {
|
||||
"name": "entity.name.function.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^(\\s*)(\\:cdata)",
|
||||
"next": "state_9"
|
||||
},
|
||||
"token": "entity.name.function.jade",
|
||||
"regex": "^\\s*\\:cdata",
|
||||
"next": "cdata_9"
|
||||
},*/
|
||||
// match stuff like: mixin dialog-title-desc(title, desc)
|
||||
{
|
||||
"token": {
|
||||
"1": {
|
||||
"name": "storage.type.function.jade"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.function.jade"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.parameters.begin.jade"
|
||||
},
|
||||
"4": {
|
||||
"name": "variable.parameter.function.jade"
|
||||
},
|
||||
"5": {
|
||||
"name": "punctuation.definition.parameters.end.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^\\s*(mixin) ([\\w\\-]+)\\s*(\\()(.*?)(\\))"
|
||||
"token": [ "storage.type.function.jade",
|
||||
"entity.name.function.jade",
|
||||
"punctuation.definition.parameters.begin.jade",
|
||||
"variable.parameter.function.jade",
|
||||
"punctuation.definition.parameters.end.jade"
|
||||
],
|
||||
"regex": "^(\\s*mixin) ([\\w\\-]+)(\\s*\\()(.*?)(\\))"
|
||||
},
|
||||
// match stuff like: mixin dialog-title-desc
|
||||
{
|
||||
"token": {
|
||||
"1": {
|
||||
"name": "storage.type.function.jade"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.function.jade"
|
||||
}
|
||||
},
|
||||
"regex": "^\\s*(mixin) ([\\w\\-]+)"
|
||||
"token": ["storage.type.function.jade",
|
||||
"entity.name.function.jade"
|
||||
],
|
||||
"regex": "^(\\s*mixin)( [\\w\\-]+)"
|
||||
},
|
||||
{
|
||||
"regex": "^\\s*(-|=|!=)",
|
||||
|
|
@ -203,23 +137,23 @@ var JadeHighlightRules = function() {
|
|||
"next": "state_15"
|
||||
},
|
||||
{
|
||||
"regex": "(?<=\\w)\\s*\\(",
|
||||
"regex": "(?<=\\w)\\s*\\(", // ERROR: This contains a lookbehind, which JS does not support :(",
|
||||
"next": "state_16"
|
||||
}
|
||||
],
|
||||
"state_4": [
|
||||
"block_comment": [
|
||||
{
|
||||
"token": "TODO",
|
||||
"regex": "^(?!\\1\\s+)",
|
||||
"token": "text",
|
||||
"regex": "^(?!\\1\\s+|$)",
|
||||
"next": "start"
|
||||
},
|
||||
{
|
||||
"token": "TODO",
|
||||
"token": "text",
|
||||
"regex": ".+",
|
||||
"next": "state_4"
|
||||
"next": "block_comment"
|
||||
}
|
||||
],
|
||||
"state_5": [
|
||||
/*"markdown_filter": [
|
||||
{
|
||||
"include": "text.html.markdown"
|
||||
},
|
||||
|
|
@ -229,7 +163,7 @@ var JadeHighlightRules = function() {
|
|||
"next": "start"
|
||||
}
|
||||
],
|
||||
"state_6": [
|
||||
"sass_filter": [
|
||||
{
|
||||
"include": "source.sass"
|
||||
},
|
||||
|
|
@ -239,7 +173,7 @@ var JadeHighlightRules = function() {
|
|||
"next": "start"
|
||||
}
|
||||
],
|
||||
"state_7": [
|
||||
"less_filter": [
|
||||
{
|
||||
"include": "source.css.less"
|
||||
},
|
||||
|
|
@ -249,7 +183,7 @@ var JadeHighlightRules = function() {
|
|||
"next": "start"
|
||||
}
|
||||
],
|
||||
"state_8": [
|
||||
"coffee_filter": [
|
||||
{
|
||||
"include": "source.coffee"
|
||||
},
|
||||
|
|
@ -259,7 +193,7 @@ var JadeHighlightRules = function() {
|
|||
"next": "start"
|
||||
}
|
||||
],
|
||||
"state_9": [
|
||||
"cdata_filter": [
|
||||
{
|
||||
"token": "TODO",
|
||||
"regex": "^(?!\\1\\s+)",
|
||||
|
|
@ -270,7 +204,7 @@ var JadeHighlightRules = function() {
|
|||
"regex": ".+",
|
||||
"next": "state_9"
|
||||
}
|
||||
],
|
||||
],*/
|
||||
"state_12": [
|
||||
{
|
||||
"include": "source.js"
|
||||
|
|
|
|||
513
tool/Jade.tmLanguage
Executable file
513
tool/Jade.tmLanguage
Executable file
|
|
@ -0,0 +1,513 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>fileTypes</key>
|
||||
<array>
|
||||
<string>jade</string>
|
||||
</array>
|
||||
<key>keyEquivalent</key>
|
||||
<string>^~J</string>
|
||||
<key>name</key>
|
||||
<string>Jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.control.import.include.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>match</key>
|
||||
<string>^\s*\b(include)\b</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>^(!!!)(\s*[a-zA-Z0-9-_]+)?</string>
|
||||
<key>name</key>
|
||||
<string>keyword.other.doctype.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.section.comment.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>match</key>
|
||||
<string>^\s*(//-?)(?:\s*[^-\s]|\s+\S).*$\n?</string>
|
||||
<key>name</key>
|
||||
<string>comment.line.double-slash.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)(//-?)\s*$</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.section.comment.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>^(?!\1\s+|$)</string>
|
||||
<key>name</key>
|
||||
<string>comment.block.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)(\:markdown)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.function.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>^(?!\1\s+)</string>
|
||||
<key>name</key>
|
||||
<string>meta.filter.markdown.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>text.html.markdown</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)(\:sass)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.function.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>^(?!\1\s+)</string>
|
||||
<key>name</key>
|
||||
<string>meta.filter.sass.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>source.sass</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)(\:less)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.function.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>^(?!\1\s+)</string>
|
||||
<key>name</key>
|
||||
<string>meta.filter.less.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>source.css.less</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)(\:coffeescript)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.function.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>^(?!\1\s+)(?=\s*.)</string>
|
||||
<key>name</key>
|
||||
<string>meta.filter.coffee.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>source.coffee</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)(\:cdata)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.function.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>^(?!\1\s+)</string>
|
||||
<key>name</key>
|
||||
<string>meta.filter.cdata.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.type.function.jade</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.function.jade</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.parameters.begin.jade</string>
|
||||
</dict>
|
||||
<key>4</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.parameter.function.jade</string>
|
||||
</dict>
|
||||
<key>5</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.parameters.end.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>match stuff like: mixin dialog-title-desc(title, desc)</string>
|
||||
<key>match</key>
|
||||
<string>^\s*(mixin) ([\w\-]+)\s*(\()(.*?)(\))</string>
|
||||
<key>name</key>
|
||||
<string>meta.mixin.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.type.function.jade</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.function.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>match stuff like: mixin dialog-title-desc</string>
|
||||
<key>match</key>
|
||||
<string>^\s*(mixin) ([\w\-]+)</string>
|
||||
<key>name</key>
|
||||
<string>meta.mixin.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^\s*(-|=|!=)</string>
|
||||
<key>end</key>
|
||||
<string>$</string>
|
||||
<key>name</key>
|
||||
<string>source.js.embedded.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>source.js</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b(each)\b</string>
|
||||
<key>name</key>
|
||||
<string>keyword.control.js</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)(script)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.tag.script.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>^((?=(\1)([\w#\.]|$\n?))|^$\n?)</string>
|
||||
<key>name</key>
|
||||
<string>source.js.embedded.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?<=script)\s*\(</string>
|
||||
<key>end</key>
|
||||
<string>\)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#tag-stuff</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>source.js</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>[#!]\{[^\}]+\}</string>
|
||||
<key>name</key>
|
||||
<string>string.interpolated.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^\s*(?!\w+\:)(?:(([\w]+))|(?=\.|#))</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.tag.any.jade</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.name.tag.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>Match any tag, id or class. skip AST filters</string>
|
||||
<key>end</key>
|
||||
<string>$|(?!\.|#|=|-)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\.[\w-]+</string>
|
||||
<key>name</key>
|
||||
<string>meta.tag.attribute.class.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>#[\w-]+</string>
|
||||
<key>name</key>
|
||||
<string>meta.tag.attribute.id.jade</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?<=\w)\s*\(</string>
|
||||
<key>end</key>
|
||||
<string>\)</string>
|
||||
<key>name</key>
|
||||
<string>meta.tag.attribute.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#tag-stuff</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>repository</key>
|
||||
<dict>
|
||||
<key>entities</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.entity.jade</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.entity.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>match</key>
|
||||
<string>(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)</string>
|
||||
<key>name</key>
|
||||
<string>constant.character.entity.jade</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>&</string>
|
||||
<key>name</key>
|
||||
<string>invalid.illegal.bad-ampersand.jade</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>filter-langs</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#markdown</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#sass</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>markdown</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>markdown\s*$\n?</string>
|
||||
<key>end</key>
|
||||
<string>(?!^\1\s+)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>text.html.markdown</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>sass</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\s*)\:sass</string>
|
||||
<key>end</key>
|
||||
<string>(?!^\1\s+)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>source.sass</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>string-double-quoted</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>"</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.string.begin.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>"</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.string.end.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>name</key>
|
||||
<string>string.quoted.double.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#entities</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>string-single-quoted</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>'</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.string.begin.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>'</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.string.end.jade</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>name</key>
|
||||
<string>string.quoted.single.jade</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#entities</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>tag-generic-attribute</key>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b([a-zA-Z\-:]+)</string>
|
||||
<key>name</key>
|
||||
<string>entity.other.attribute-name.jade</string>
|
||||
</dict>
|
||||
<key>tag-stuff</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#string-double-quoted</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#string-single-quoted</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#tag-generic-attribute</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>scopeName</key>
|
||||
<string>source.jade</string>
|
||||
<key>uuid</key>
|
||||
<string>C5B73B98-5F2A-42E3-9F0E-028A74A9FE4B</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -69,7 +69,12 @@ function cleanMultiCapture(match) {
|
|||
|
||||
// stupid yet necessary function, to transform JSON id comments into real comments
|
||||
function restoreComments(objStr) {
|
||||
return objStr.replace(/"\s+(\/\/.+)",/g, "\$1")
|
||||
return objStr.replace(/"\s+(\/\/.+)",/g, "\$1").replace(/ \/\/ ERROR/g, '", // ERROR');
|
||||
}
|
||||
|
||||
function checkForLookBehind(str) {
|
||||
var lookbehindRegExp = new RegExp("\\?<[=|!]");
|
||||
return lookbehindRegExp.test(str) ? str + " // ERROR: This contains a lookbehind, which JS does not support :(" : str;
|
||||
}
|
||||
|
||||
function assembleStateObjs(strState, pattern) {
|
||||
|
|
@ -86,19 +91,19 @@ function assembleStateObjs(strState, pattern) {
|
|||
}
|
||||
else {
|
||||
stateObj.token = patterns[p].name;
|
||||
stateObj.regex = patterns[p].match;
|
||||
stateObj.regex = checkForLookBehind(patterns[p].match);
|
||||
}
|
||||
statesObj[strState].push(stateObj);
|
||||
}
|
||||
|
||||
stateObj = {};
|
||||
stateObj.token = "TODO";
|
||||
stateObj.regex = pattern.end;
|
||||
stateObj.regex = checkForLookBehind(pattern.end);
|
||||
stateObj.next = "start";
|
||||
}
|
||||
else {
|
||||
stateObj.token = "TODO";
|
||||
stateObj.regex = pattern.end;
|
||||
stateObj.regex = checkForLookBehind(pattern.end);
|
||||
stateObj.next = "start";
|
||||
|
||||
statesObj[strState].push(stateObj);
|
||||
|
|
@ -141,7 +146,7 @@ function extractPatterns(patterns) {
|
|||
statesObj[strState] = [ ];
|
||||
statesObj[strState].push(assembleStateObjs(strState, pattern));
|
||||
|
||||
tokenObj.regex = pattern.begin;
|
||||
tokenObj.regex = checkForLookBehind(pattern.begin);
|
||||
tokenObj.next = strState;
|
||||
startState.start.push(tokenObj);
|
||||
}
|
||||
|
|
@ -151,14 +156,14 @@ function extractPatterns(patterns) {
|
|||
|
||||
else if (pattern.captures) {
|
||||
tokenObj.token = pattern.captures;
|
||||
tokenObj.regex = pattern.match;
|
||||
tokenObj.regex = checkForLookBehind(pattern.match);
|
||||
|
||||
startState.start.push(tokenObj);
|
||||
}
|
||||
|
||||
else if (pattern.match) {
|
||||
tokenObj.token = pattern.name;
|
||||
tokenObj.regex = pattern.match;
|
||||
tokenObj.regex = checkForLookBehind(pattern.match);
|
||||
|
||||
startState.start.push(tokenObj);
|
||||
}
|
||||
|
|
@ -203,4 +208,9 @@ function convertLanguage(name) {
|
|||
}
|
||||
|
||||
var tmLanguageFile = process.argv.splice(2)[0];
|
||||
|
||||
if (tmLanguageFile === undefined) {
|
||||
console.error("Please pass in a language file via the command line.");
|
||||
process.exit(1);
|
||||
}
|
||||
convertLanguage(tmLanguageFile);
|
||||
Loading…
Add table
Add a link
Reference in a new issue