Merge pull request #1809 from ajaxorg/c9
Add smarty mode and fix several small bugs
This commit is contained in:
commit
ffc9cec9ef
21 changed files with 290 additions and 69 deletions
|
|
@ -280,7 +280,7 @@ function addSuffix(options) {
|
|||
}
|
||||
}
|
||||
|
||||
function getWriteFilters(options, projectType) {
|
||||
function getWriteFilters(options, projectType, main) {
|
||||
var filters = [
|
||||
copy.filter.moduleDefines,
|
||||
removeUseStrict,
|
||||
|
|
@ -310,11 +310,9 @@ function getWriteFilters(options, projectType) {
|
|||
return text;
|
||||
});
|
||||
|
||||
if (options.exportModule && projectType == "main") {
|
||||
if (options.noconflict)
|
||||
filters.push(exportAce(options.ns, options.exportModule, options.ns));
|
||||
else
|
||||
filters.push(exportAce(options.ns, options.exportModule));
|
||||
if (options.exportModule && projectType == "main" || projectType == "ext") {
|
||||
filters.push(exportAce(options.ns, options.exportModule,
|
||||
options.noconflict ? options.ns : "", projectType == "ext" && main));
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
|
|
@ -390,7 +388,7 @@ var buildAce = function(options) {
|
|||
project: cloneProject(project),
|
||||
require: [ 'ace/ext/' + ext ]
|
||||
}],
|
||||
filter: getWriteFilters(options, "ext"),
|
||||
filter: getWriteFilters(options, "ext", 'ace/ext/' + ext),
|
||||
dest: targetDir + "/ext-" + ext + ".js"
|
||||
});
|
||||
});
|
||||
|
|
@ -650,7 +648,7 @@ function namespace(ns) {
|
|||
};
|
||||
}
|
||||
|
||||
function exportAce(ns, module, requireBase) {
|
||||
function exportAce(ns, module, requireBase, extModule) {
|
||||
requireBase = requireBase || "window";
|
||||
module = module || "ace/ace";
|
||||
return function(text) {
|
||||
|
|
@ -666,7 +664,16 @@ function exportAce(ns, module, requireBase) {
|
|||
});
|
||||
})();
|
||||
};
|
||||
|
||||
|
||||
if (extModule) {
|
||||
module = extModule;
|
||||
template = function() {
|
||||
(function() {
|
||||
REQUIRE_NS.require(["MODULE"], function() {});
|
||||
})();
|
||||
};
|
||||
}
|
||||
|
||||
return (text + ";" + template
|
||||
.toString()
|
||||
.replace(/MODULE/g, module)
|
||||
|
|
|
|||
7
demo/kitchen-sink/docs/smarty.smarty
Normal file
7
demo/kitchen-sink/docs/smarty.smarty
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{foreach $foo as $bar}
|
||||
<a href="{$bar.zig}">{$bar.zag}</a>
|
||||
<a href="{$bar.zig2}">{$bar.zag2}</a>
|
||||
<a href="{$bar.zig3}">{$bar.zag3}</a>
|
||||
{foreachelse}
|
||||
There were no rows found.
|
||||
{/foreach}
|
||||
|
|
@ -191,7 +191,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
|
||||
this.row = pos.row;
|
||||
this.column = pos.column;
|
||||
this._emit("change", {
|
||||
this._signal("change", {
|
||||
old: old,
|
||||
value: pos
|
||||
});
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
first: firstRow,
|
||||
last: lastRow
|
||||
};
|
||||
this._emit("update", {data: data});
|
||||
this._signal("update", {data: data});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ var Document = function(text) {
|
|||
range: range,
|
||||
lines: lines
|
||||
};
|
||||
this._emit("change", { data: delta });
|
||||
this._signal("change", { data: delta });
|
||||
return end || range.end;
|
||||
};
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ var Document = function(text) {
|
|||
range: Range.fromPoints(position, end),
|
||||
text: this.getNewLineCharacter()
|
||||
};
|
||||
this._emit("change", { data: delta });
|
||||
this._signal("change", { data: delta });
|
||||
|
||||
return end;
|
||||
};
|
||||
|
|
@ -390,7 +390,7 @@ var Document = function(text) {
|
|||
range: Range.fromPoints(position, end),
|
||||
text: text
|
||||
};
|
||||
this._emit("change", { data: delta });
|
||||
this._signal("change", { data: delta });
|
||||
|
||||
return end;
|
||||
};
|
||||
|
|
@ -458,7 +458,7 @@ var Document = function(text) {
|
|||
range: range,
|
||||
text: removed
|
||||
};
|
||||
this._emit("change", { data: delta });
|
||||
this._signal("change", { data: delta });
|
||||
return range.start;
|
||||
};
|
||||
|
||||
|
|
@ -485,7 +485,7 @@ var Document = function(text) {
|
|||
nl: this.getNewLineCharacter(),
|
||||
lines: removed
|
||||
};
|
||||
this._emit("change", { data: delta });
|
||||
this._signal("change", { data: delta });
|
||||
return removed;
|
||||
};
|
||||
|
||||
|
|
@ -508,7 +508,7 @@ var Document = function(text) {
|
|||
range: range,
|
||||
text: this.getNewLineCharacter()
|
||||
};
|
||||
this._emit("change", { data: delta });
|
||||
this._signal("change", { data: delta });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ var EditSession = function(text, mode) {
|
|||
|
||||
config.resetOptions(this);
|
||||
this.setMode(mode);
|
||||
config._emit("session", this);
|
||||
config._signal("session", this);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
|
||||
this.bgTokenizer.$updateOnChange(delta);
|
||||
this._emit("change", e);
|
||||
this._signal("change", e);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -528,7 +528,7 @@ var EditSession = function(text, mode) {
|
|||
if (!this.$decorations[row])
|
||||
this.$decorations[row] = "";
|
||||
this.$decorations[row] += " " + className;
|
||||
this._emit("changeBreakpoint", {});
|
||||
this._signal("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -540,7 +540,7 @@ var EditSession = function(text, mode) {
|
|||
**/
|
||||
this.removeGutterDecoration = function(row, className) {
|
||||
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
|
||||
this._emit("changeBreakpoint", {});
|
||||
this._signal("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -563,7 +563,7 @@ var EditSession = function(text, mode) {
|
|||
for (var i=0; i<rows.length; i++) {
|
||||
this.$breakpoints[rows[i]] = "ace_breakpoint";
|
||||
}
|
||||
this._emit("changeBreakpoint", {});
|
||||
this._signal("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -571,7 +571,7 @@ var EditSession = function(text, mode) {
|
|||
**/
|
||||
this.clearBreakpoints = function() {
|
||||
this.$breakpoints = [];
|
||||
this._emit("changeBreakpoint", {});
|
||||
this._signal("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -588,7 +588,7 @@ var EditSession = function(text, mode) {
|
|||
this.$breakpoints[row] = className;
|
||||
else
|
||||
delete this.$breakpoints[row];
|
||||
this._emit("changeBreakpoint", {});
|
||||
this._signal("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -599,7 +599,7 @@ var EditSession = function(text, mode) {
|
|||
**/
|
||||
this.clearBreakpoint = function(row) {
|
||||
delete this.$breakpoints[row];
|
||||
this._emit("changeBreakpoint", {});
|
||||
this._signal("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -626,10 +626,10 @@ var EditSession = function(text, mode) {
|
|||
|
||||
if (inFront) {
|
||||
this.$frontMarkers[id] = marker;
|
||||
this._emit("changeFrontMarker")
|
||||
this._signal("changeFrontMarker")
|
||||
} else {
|
||||
this.$backMarkers[id] = marker;
|
||||
this._emit("changeBackMarker")
|
||||
this._signal("changeBackMarker")
|
||||
}
|
||||
|
||||
return id;
|
||||
|
|
@ -652,10 +652,10 @@ var EditSession = function(text, mode) {
|
|||
|
||||
if (inFront) {
|
||||
this.$frontMarkers[id] = marker;
|
||||
this._emit("changeFrontMarker")
|
||||
this._signal("changeFrontMarker")
|
||||
} else {
|
||||
this.$backMarkers[id] = marker;
|
||||
this._emit("changeBackMarker")
|
||||
this._signal("changeBackMarker")
|
||||
}
|
||||
|
||||
return marker;
|
||||
|
|
@ -676,7 +676,7 @@ var EditSession = function(text, mode) {
|
|||
var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
|
||||
if (marker) {
|
||||
delete (markers[markerId]);
|
||||
this._emit(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
|
||||
this._signal(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -728,7 +728,7 @@ var EditSession = function(text, mode) {
|
|||
**/
|
||||
this.setAnnotations = function(annotations) {
|
||||
this.$annotations = annotations;
|
||||
this._emit("changeAnnotation", {});
|
||||
this._signal("changeAnnotation", {});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -858,7 +858,7 @@ var EditSession = function(text, mode) {
|
|||
this.onReloadTokenizer = function(e) {
|
||||
var rows = e.data;
|
||||
this.bgTokenizer.start(rows.first);
|
||||
this._emit("tokenizerUpdate", e);
|
||||
this._signal("tokenizerUpdate", e);
|
||||
};
|
||||
|
||||
this.$modes = {};
|
||||
|
|
@ -937,7 +937,7 @@ var EditSession = function(text, mode) {
|
|||
this.bgTokenizer = new BackgroundTokenizer(tokenizer);
|
||||
var _self = this;
|
||||
this.bgTokenizer.addEventListener("update", function(e) {
|
||||
_self._emit("tokenizerUpdate", e);
|
||||
_self._signal("tokenizerUpdate", e);
|
||||
});
|
||||
} else {
|
||||
this.bgTokenizer.setTokenizer(tokenizer);
|
||||
|
|
@ -1563,7 +1563,7 @@ var EditSession = function(text, mode) {
|
|||
this.$updateWrapData(0, len - 1);
|
||||
}
|
||||
|
||||
this._emit("changeWrapMode");
|
||||
this._signal("changeWrapMode");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1594,7 +1594,7 @@ var EditSession = function(text, mode) {
|
|||
};
|
||||
this.$modified = true;
|
||||
// This will force a recalculation of the wrap limit
|
||||
this._emit("changeWrapMode");
|
||||
this._signal("changeWrapMode");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1616,7 +1616,7 @@ var EditSession = function(text, mode) {
|
|||
if (this.$useWrapMode) {
|
||||
this.$updateWrapData(0, this.getLength() - 1);
|
||||
this.$resetRowCache(0);
|
||||
this._emit("changeWrapLimit");
|
||||
this._signal("changeWrapLimit");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2507,7 +2507,7 @@ config.defineOptions(EditSession.prototype, "session", {
|
|||
initialValue: "auto"
|
||||
},
|
||||
firstLineNumber: {
|
||||
set: function() {this._emit("changeBreakpoint");},
|
||||
set: function() {this._signal("changeBreakpoint");},
|
||||
initialValue: 1
|
||||
},
|
||||
useWorker: {
|
||||
|
|
@ -2528,13 +2528,13 @@ config.defineOptions(EditSession.prototype, "session", {
|
|||
this.$modified = true;
|
||||
this.$rowLengthCache = [];
|
||||
this.$tabSize = tabSize;
|
||||
this._emit("changeTabSize");
|
||||
this._signal("changeTabSize");
|
||||
},
|
||||
initialValue: 4,
|
||||
handlesSet: true
|
||||
},
|
||||
overwrite: {
|
||||
set: function(val) {this._emit("changeOverwrite");},
|
||||
set: function(val) {this._signal("changeOverwrite");},
|
||||
initialValue: false
|
||||
},
|
||||
newLineMode: {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ var Editor = function(renderer, session) {
|
|||
|
||||
this.setSession(session || new EditSession(""));
|
||||
config.resetOptions(this);
|
||||
config._emit("editor", this);
|
||||
config._signal("editor", this);
|
||||
};
|
||||
|
||||
(function(){
|
||||
|
|
@ -384,7 +384,7 @@ var Editor = function(renderer, session) {
|
|||
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
||||
this.renderer.updateFull();
|
||||
|
||||
this._emit("changeSession", {
|
||||
this._signal("changeSession", {
|
||||
session: session,
|
||||
oldSession: oldSession
|
||||
});
|
||||
|
|
@ -617,7 +617,7 @@ var Editor = function(renderer, session) {
|
|||
lastRow = Infinity;
|
||||
this.renderer.updateLines(range.start.row, lastRow);
|
||||
|
||||
this._emit("change", e);
|
||||
this._signal("change", e);
|
||||
|
||||
// update cursor because tab characters can influence the cursor position
|
||||
this.$cursorChange();
|
||||
|
|
@ -650,7 +650,7 @@ var Editor = function(renderer, session) {
|
|||
|
||||
this.$highlightBrackets();
|
||||
this.$updateHighlightActiveLine();
|
||||
this._emit("changeSelection");
|
||||
this._signal("changeSelection");
|
||||
};
|
||||
|
||||
this.$updateHighlightActiveLine = function() {
|
||||
|
|
@ -675,7 +675,7 @@ var Editor = function(renderer, session) {
|
|||
session.$highlightLineMarker.start.row = highlight.row;
|
||||
session.$highlightLineMarker.end.row = highlight.row;
|
||||
session.$highlightLineMarker.start.column = highlight.column;
|
||||
session._emit("changeBackMarker");
|
||||
session._signal("changeBackMarker");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -698,7 +698,7 @@ var Editor = function(renderer, session) {
|
|||
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
|
||||
this.session.highlight(re);
|
||||
|
||||
this._emit("changeSelection");
|
||||
this._signal("changeSelection");
|
||||
};
|
||||
|
||||
this.$getSelectionHighLightRegexp = function() {
|
||||
|
|
@ -2302,7 +2302,7 @@ var Editor = function(renderer, session) {
|
|||
**/
|
||||
this.destroy = function() {
|
||||
this.renderer.destroy();
|
||||
this._emit("destroy", this);
|
||||
this._signal("destroy", this);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -2379,7 +2379,7 @@ config.defineOptions(Editor.prototype, "editor", {
|
|||
selectionStyle: {
|
||||
set: function(style) {
|
||||
this.onSelectionChange();
|
||||
this._emit("changeSelectionStyle", {data: style});
|
||||
this._signal("changeSelectionStyle", {data: style});
|
||||
},
|
||||
initialValue: "line"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -108,8 +108,9 @@ exports.showErrorMarker = function(editor, dir) {
|
|||
var gutterAnno;
|
||||
if (annotations) {
|
||||
var annotation = annotations[0];
|
||||
if (annotation.pos && annotation.column == null)
|
||||
pos.column = annotation.pos.sc;
|
||||
pos.column = (annotation.pos && typeof annotation.column != "number"
|
||||
? annotation.pos.sc
|
||||
: annotation.column) || 0;
|
||||
pos.row = annotation.row;
|
||||
gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row];
|
||||
} else if (oldWidget) {
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ var supportedModes = {
|
|||
SASS: ["sass"],
|
||||
SCAD: ["scad"],
|
||||
Scala: ["scala"],
|
||||
Smarty: ["smarty|tpl"],
|
||||
Scheme: ["scm|rkt"],
|
||||
SCSS: ["scss"],
|
||||
SH: ["sh|bash|^.bashrc"],
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ define(function(require, exports, module) {
|
|||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var MushCodeRules = require("./mushcode_high_rules").MushCodeRules;
|
||||
var MushCodeRules = require("./mushcode_highlight_rules").MushCodeRules;
|
||||
var PythonFoldMode = require("./folding/pythonic").FoldMode;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
|
|
|
|||
|
|
@ -969,13 +969,11 @@ var PhpLangHighlightRules = function() {
|
|||
else if (value == "debugger")
|
||||
return "invalid.deprecated";
|
||||
else
|
||||
if(value.match(/^(\$[a-zA-Z][a-zA-Z0-9_]*|self|parent)$/))
|
||||
if(value.match(/^(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|self|parent)$/))
|
||||
return "variable";
|
||||
return "identifier";
|
||||
},
|
||||
// TODO: Unicode escape sequences
|
||||
// TODO: Unicode identifiers
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
regex : "[a-zA-Z_$\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\b"
|
||||
}, {
|
||||
onMatch : function(value, currentSate, state) {
|
||||
value = value.substr(3);
|
||||
|
|
|
|||
58
lib/ace/mode/smarty.js
Normal file
58
lib/ace/mode/smarty.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var SmartyHighlightRules = require("./smarty_highlight_rules").SmartyHighlightRules;
|
||||
var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
|
||||
var HtmlFoldMode = require("./folding/html").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
HtmlMode.call(this);
|
||||
this.HighlightRules = SmartyHighlightRules;
|
||||
this.$behaviour = new HtmlBehaviour();
|
||||
|
||||
|
||||
this.foldingRules = new HtmlFoldMode();
|
||||
};
|
||||
|
||||
oop.inherits(Mode, HtmlMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.$id = "ace/mode/smarty";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
139
lib/ace/mode/smarty_highlight_rules.js
Normal file
139
lib/ace/mode/smarty_highlight_rules.js
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* This file was autogenerated from https://raw.github.com/amitsnyderman/sublime-smarty/master/Syntaxes/Smarty.tmLanguage (uuid: ) */
|
||||
/****************************************************************************************
|
||||
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
|
||||
* fileTypes *
|
||||
****************************************************************************************/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
||||
|
||||
var SmartyHighlightRules = function() {
|
||||
HtmlHighlightRules.call(this);
|
||||
var smartyRules = { start:
|
||||
[ { include: '#comments' },
|
||||
{ include: '#blocks' } ],
|
||||
'#blocks':
|
||||
[ { token: 'punctuation.section.embedded.begin.smarty',
|
||||
regex: '\\{%?',
|
||||
push:
|
||||
[ { token: 'punctuation.section.embedded.end.smarty',
|
||||
regex: '%?\\}',
|
||||
next: 'pop' },
|
||||
{ include: '#strings' },
|
||||
{ include: '#variables' },
|
||||
{ include: '#lang' },
|
||||
{ defaultToken: 'source.smarty' } ] } ],
|
||||
'#comments':
|
||||
[ { token:
|
||||
[ 'punctuation.definition.comment.smarty',
|
||||
'comment.block.smarty' ],
|
||||
regex: '(\\{%?)(\\*)',
|
||||
push:
|
||||
[ { token: 'comment.block.smarty', regex: '\\*%?\\}', next: 'pop' },
|
||||
{ defaultToken: 'comment.block.smarty' } ] } ],
|
||||
'#lang':
|
||||
[ { token: 'keyword.operator.smarty',
|
||||
regex: '(?:!=|!|<=|>=|<|>|===|==|%|&&|\\|\\|)|\\b(?:and|or|eq|neq|ne|gte|gt|ge|lte|lt|le|not|mod)\\b' },
|
||||
{ token: 'constant.language.smarty',
|
||||
regex: '\\b(?:TRUE|FALSE|true|false)\\b' },
|
||||
{ token: 'keyword.control.smarty',
|
||||
regex: '\\b(?:if|else|elseif|foreach|foreachelse|section|switch|case|break|default)\\b' },
|
||||
{ token: 'variable.parameter.smarty', regex: '\\b[a-zA-Z]+=' },
|
||||
{ token: 'support.function.built-in.smarty',
|
||||
regex: '\\b(?:capture|config_load|counter|cycle|debug|eval|fetch|include_php|include|insert|literal|math|strip|rdelim|ldelim|assign|constant|block|html_[a-z_]*)\\b' },
|
||||
{ token: 'support.function.variable-modifier.smarty',
|
||||
regex: '\\|(?:capitalize|cat|count_characters|count_paragraphs|count_sentences|count_words|date_format|default|escape|indent|lower|nl2br|regex_replace|replace|spacify|string_format|strip_tags|strip|truncate|upper|wordwrap)' } ],
|
||||
'#strings':
|
||||
[ { token: 'punctuation.definition.string.begin.smarty',
|
||||
regex: '\'',
|
||||
push:
|
||||
[ { token: 'punctuation.definition.string.end.smarty',
|
||||
regex: '\'',
|
||||
next: 'pop' },
|
||||
{ token: 'constant.character.escape.smarty', regex: '\\\\.' },
|
||||
{ defaultToken: 'string.quoted.single.smarty' } ] },
|
||||
{ token: 'punctuation.definition.string.begin.smarty',
|
||||
regex: '"',
|
||||
push:
|
||||
[ { token: 'punctuation.definition.string.end.smarty',
|
||||
regex: '"',
|
||||
next: 'pop' },
|
||||
{ token: 'constant.character.escape.smarty', regex: '\\\\.' },
|
||||
{ defaultToken: 'string.quoted.double.smarty' } ] } ],
|
||||
'#variables':
|
||||
[ { token:
|
||||
[ 'punctuation.definition.variable.smarty',
|
||||
'variable.other.global.smarty' ],
|
||||
regex: '\\b(\\$)(Smarty\\.)' },
|
||||
{ token:
|
||||
[ 'punctuation.definition.variable.smarty',
|
||||
'variable.other.smarty' ],
|
||||
regex: '(\\$)([a-zA-Z_][a-zA-Z0-9_]*)\\b' },
|
||||
{ token: [ 'keyword.operator.smarty', 'variable.other.property.smarty' ],
|
||||
regex: '(->)([a-zA-Z_][a-zA-Z0-9_]*)\\b' },
|
||||
{ token:
|
||||
[ 'keyword.operator.smarty',
|
||||
'meta.function-call.object.smarty',
|
||||
'punctuation.definition.variable.smarty',
|
||||
'variable.other.smarty',
|
||||
'punctuation.definition.variable.smarty' ],
|
||||
regex: '(->)([a-zA-Z_][a-zA-Z0-9_]*)(\\()(.*?)(\\))' } ] }
|
||||
|
||||
var smartyStart = smartyRules.start;
|
||||
|
||||
["start", "qqstring_inner", "qstring_inner", "attributes", "cdata"].forEach(function(x) {
|
||||
this.$rules[x].unshift.apply(this.$rules[x], smartyStart);
|
||||
}, this);
|
||||
|
||||
Object.keys(smartyRules).forEach(function(x) {
|
||||
if (!this.$rules[x])
|
||||
this.$rules[x] = smartyRules[x];
|
||||
}, this);
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
SmartyHighlightRules.metaData = { fileTypes: [ 'tpl' ],
|
||||
foldingStartMarker: '\\{%?',
|
||||
foldingStopMarker: '%?\\}',
|
||||
name: 'Smarty',
|
||||
scopeName: 'text.html.smarty' }
|
||||
|
||||
|
||||
oop.inherits(SmartyHighlightRules, HtmlHighlightRules);
|
||||
|
||||
exports.SmartyHighlightRules = SmartyHighlightRules;
|
||||
});
|
||||
|
|
@ -59,6 +59,10 @@ var SqlHighlightRules = function() {
|
|||
"start" : [ {
|
||||
token : "comment",
|
||||
regex : "--.*$"
|
||||
}, {
|
||||
token : "comment",
|
||||
start : "/\\*",
|
||||
end : "\\*/"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : '".*?"'
|
||||
|
|
@ -85,6 +89,7 @@ var SqlHighlightRules = function() {
|
|||
regex : "\\s+"
|
||||
} ]
|
||||
};
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(SqlHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -80,7 +80,9 @@ var TextHighlightRules = function() {
|
|||
};
|
||||
|
||||
this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) {
|
||||
var embedRules = new HighlightRules().getRules();
|
||||
var embedRules = typeof HighlightRules == "function"
|
||||
? new HighlightRules().getRules()
|
||||
: HighlightRules;
|
||||
if (states) {
|
||||
for (var i = 0; i < states.length; i++)
|
||||
states[i] = prefix + states[i];
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ var EditSession = require("./edit_session").EditSession;
|
|||
this.$onRemoveRange(removed);
|
||||
|
||||
if (this.rangeCount > 1 && !this.inMultiSelectMode) {
|
||||
this._emit("multiSelect");
|
||||
this._signal("multiSelect");
|
||||
this.inMultiSelectMode = true;
|
||||
this.session.$undoSelect = false;
|
||||
this.rangeList.attach(this.session);
|
||||
|
|
@ -150,7 +150,7 @@ var EditSession = require("./edit_session").EditSession;
|
|||
this.$onAddRange = function(range) {
|
||||
this.rangeCount = this.rangeList.ranges.length;
|
||||
this.ranges.unshift(range);
|
||||
this._emit("addRange", {range: range});
|
||||
this._signal("addRange", {range: range});
|
||||
};
|
||||
|
||||
this.$onRemoveRange = function(removed) {
|
||||
|
|
@ -166,11 +166,11 @@ var EditSession = require("./edit_session").EditSession;
|
|||
this.ranges.splice(index, 1);
|
||||
}
|
||||
|
||||
this._emit("removeRange", {ranges: removed});
|
||||
this._signal("removeRange", {ranges: removed});
|
||||
|
||||
if (this.rangeCount == 0 && this.inMultiSelectMode) {
|
||||
this.inMultiSelectMode = false;
|
||||
this._emit("singleSelect");
|
||||
this._signal("singleSelect");
|
||||
this.session.$undoSelect = true;
|
||||
this.rangeList.detach(this.session);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ var SnippetManager = function() {
|
|||
// defult but can't fill :(
|
||||
case "FILENAME":
|
||||
case "FILEPATH":
|
||||
return "ace.ajax.org";
|
||||
return "";
|
||||
case "FULLNAME":
|
||||
return "Ace";
|
||||
}
|
||||
|
|
@ -329,8 +329,11 @@ var SnippetManager = function() {
|
|||
continue;
|
||||
var id = p.tabstopId;
|
||||
var i1 = tokens.indexOf(p, i + 1);
|
||||
if (expanding[id] == p) {
|
||||
expanding[id] = null;
|
||||
if (expanding[id]) {
|
||||
// if reached closing bracket clear expanding state
|
||||
if (expanding[id] === p)
|
||||
expanding[id] = null;
|
||||
// otherwise just ignore recursive tabstop
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ snippet from
|
|||
# Module Docstring
|
||||
snippet docs
|
||||
'''
|
||||
File: ${1:`Filename('$1.py', 'foo.py')`}
|
||||
Author: ${2:`g:snips_author`}
|
||||
File: ${1:FILENAME:file_name}
|
||||
Author: ${2:author}
|
||||
Description: ${3}
|
||||
'''
|
||||
snippet wh
|
||||
|
|
@ -129,7 +129,7 @@ snippet "
|
|||
"""
|
||||
# test function/method
|
||||
snippet test
|
||||
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
|
||||
def test_${1:description}(${2:self}):
|
||||
${3:# TODO: write code...}
|
||||
# test case
|
||||
snippet testcase
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ window.onmessage = function(e) {
|
|||
main = new clazz(sender);
|
||||
}
|
||||
else if (msg.event && sender) {
|
||||
sender._emit(msg.event, msg.data);
|
||||
sender._signal(msg.event, msg.data);
|
||||
}
|
||||
};
|
||||
})(this);
|
||||
|
|
@ -96,7 +96,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
|||
break;
|
||||
|
||||
case "event":
|
||||
this._emit(msg.name, {data: msg.data});
|
||||
this._signal(msg.name, {data: msg.data});
|
||||
break;
|
||||
|
||||
case "call":
|
||||
|
|
@ -121,7 +121,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
|||
};
|
||||
|
||||
this.terminate = function() {
|
||||
this._emit("terminate", {});
|
||||
this._signal("terminate", {});
|
||||
this.deltaQueue = null;
|
||||
this.$worker.terminate();
|
||||
this.$worker = null;
|
||||
|
|
@ -217,7 +217,7 @@ var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
|
|||
if (msg.command)
|
||||
main[msg.command].apply(main, msg.args);
|
||||
else if (msg.event)
|
||||
sender._emit(msg.event, msg.data);
|
||||
sender._signal(msg.event, msg.data);
|
||||
};
|
||||
|
||||
sender.postMessage = function(msg) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue