Merge remote-tracking branch 'remotes/origin/master' into mode_live_edit

Conflicts:
	demo/kitchen-sink/demo.js
	lib/ace/mode/coffee_highlight_rules_test.js
This commit is contained in:
nightwing 2012-10-03 22:43:37 +04:00
commit 3d6ce5fdf5
89 changed files with 3929 additions and 12705 deletions

View file

@ -105,6 +105,7 @@ var docs = {
"docs/svg.svg": "SVG",
"docs/tcl.tcl": "Tcl",
"docs/textile.textile": {name: "Textile", wrapped: true},
"docs/typescript.ts": "Typescript",
"docs/xml.xml": "XML",
"docs/xquery.xq": "XQuery",
"docs/yaml.yaml": "YAML",

View file

@ -16,7 +16,7 @@ index 23fc3fc..ed3b273 100644
+ this.highlight = function(re) {
+ if (!this.$searchHighlight) {
+ var highlight = new SearchHighlight(null, "ace_selected_word", "text");
+ var highlight = new SearchHighlight(null, "ace_selected-word", "text");
+ this.$searchHighlight = this.addDynamicMarker(highlight);
+ }
+ this.$searchHighlight.setRegexp(re);

View file

@ -47,7 +47,7 @@
setTimeout("ShowAndGrowElement()", timer_increment)
}
window.ShowAndGrowElement = ShowAndGrowElement
]]</script>
]]></script>
<rect
fill="#2e3436"

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

View file

@ -0,0 +1,72 @@
class Greeter {
greeting: string;
constructor (message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
var greeter = new Greeter("world");
var button = document.createElement('button')
button.innerText = "Say Hello"
button.onclick = function() {
alert(greeter.greet())
}
document.body.appendChild(button)
class Snake extends Animal {
move() {
alert("Slithering...");
super(5);
}
}
class Horse extends Animal {
move() {
alert("Galloping...");
super.move(45);
}
}
module Sayings {
export class Greeter {
greeting: string;
constructor (message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
}
module Mankala {
export class Features {
public turnContinues = false;
public seedStoredCount = 0;
public capturedCount = 0;
public spaceCaptured = NoSpace;
public clear() {
this.turnContinues = false;
this.seedStoredCount = 0;
this.capturedCount = 0;
this.spaceCaptured = NoSpace;
}
public toString() {
var stringBuilder = "";
if (this.turnContinues) {
stringBuilder += " turn continues,";
}
stringBuilder += " stores " + this.seedStoredCount;
if (this.capturedCount > 0) {
stringBuilder += " captures " + this.capturedCount + " from space " + this.spaceCaptured;
}
return stringBuilder;
}
}
}

View file

@ -68,6 +68,7 @@ var modesByName = {
tcl: ["Tcl" , "tcl"],
text: ["Text" , "txt"],
textile: ["Textile" , "textile"],
typescript: ["Typescript" , "typescript|ts|str"],
xml: ["XML" , "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
xquery: ["XQuery" , "xq"],
yaml: ["YAML" , "yaml"]

View file

@ -1,7 +1,3 @@
/*PACKAGE
@import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono);
PACKAGE*/
html {
height: 100%;
width: 100%;

BIN
doc/site/images/plunker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 8 KiB

Before After
Before After

View file

@ -17,6 +17,10 @@
<link href="./doc/resources/ace/skeleton/images/favicon.ico" rel="icon" type="image/x-icon">
</head>
<body>
<a href="http://github.com/ajaxorg/ace">
<img style="z-index: 50000; position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/camo.github.com/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67"
alt="Fork me on GitHub">
</a>
<div id="wrapper">
<div class="content">
<div class="column2">
@ -157,7 +161,7 @@ console.log(addResult);</div>
return x;
}&lt;/div>
&lt;script src="//d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8">&lt;/script>
&lt;script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8">&lt;/script>
&lt;script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
@ -483,10 +487,15 @@ tests for the highlighting.</p>
</li>
<li>
<img src="doc/site/images/zorba-logo.png"
style="position: relative; left: -7px; top: 16px;
padding: 6px 4px 6px 6px;" />
style="position: relative; left: -5px; top: 16px;
padding: 6px 4px 6px 6px; width: 100px" />
<a href="http://www.zorba-xquery.com/html/demo">Zorba XQuery</a>
</li>
<li>
<img src="doc/site/images/plunker.png"
style="position: relative; left: 13px; top: -4px; width: 75px" />
<a href="http://plnkr.co/edit/">Plunker</a>
</li>
<li>
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
</li>

View file

@ -13,10 +13,12 @@
<!--DEVEL-->
<link rel="stylesheet" href="demo/kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
<script src="http://use.edgefonts.net/source-code-pro.js"></script>
<!--DEVEL-->
<!--PACKAGE
<link rel="stylesheet" href="kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
<script src="http://use.edgefonts.net/source-code-pro.js"></script>
PACKAGE-->
</head>
<body>

View file

@ -1,7 +1,7 @@
.ace_editor {
position: absolute;
overflow: hidden;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Droid Sans Mono', 'Consolas', monospace;
font-family: 'Menlo', 'Monaco', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
font-size: 12px;
}
@ -12,9 +12,9 @@
.ace_content {
position: absolute;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: text;
}
@ -27,13 +27,13 @@
z-index: 4;
}
.ace_gutter_active_line {
.ace_gutter-active-line {
position: absolute;
left: 0;
right: 0;
}
.ace_scroller.horscroll {
.ace_scroller.ace_scroll-left {
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
}
@ -62,50 +62,40 @@
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=");
}
.ace_editor .ace_sb {
.ace_scrollbar {
position: absolute;
overflow-x: hidden;
overflow-y: scroll;
right: 0;
}
.ace_editor .ace_sb div {
.ace_scrollbar-inner {
position: absolute;
width: 1px;
left: 0;
}
.ace_editor .ace_print_margin_layer {
z-index: 0;
position: absolute;
overflow: hidden;
margin: 0;
left: 0;
height: 100%;
width: 100%;
}
.ace_editor .ace_print_margin {
.ace_print-margin {
position: absolute;
height: 100%;
}
.ace_editor > textarea {
.ace_text-input {
position: absolute;
z-index: 0;
width: 0.5em;
height: 1em;
opacity: 0;
background: transparent;
appearance: none;
-moz-appearance: none;
appearance: none;
border: none;
resize: none;
outline: none;
overflow: hidden;
}
.ace_editor > textarea.ace_composition {
.ace_text-input.ace_composition {
background: #fff;
color: #000;
z-index: 1000;
@ -121,15 +111,15 @@
white-space: nowrap;
height: 100%;
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
/* setting pointer-events: auto; on node under the mouse, which changes
during scroll, will break mouse wheel scrolling in Safari */
pointer-events: none;
}
.ace_gutter .ace_layer {
.ace_gutter-layer {
position: relative;
width: auto;
text-align: right;
@ -153,13 +143,16 @@
.ace_cursor {
z-index: 4;
position: absolute;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.ace_cursor.ace_hidden {
opacity: 0.2;
}
.ace_editor.multiselect .ace_cursor {
.ace_editor.ace_multiselect .ace_cursor {
border-left-width: 1px;
}
@ -182,23 +175,23 @@
z-index: 6;
}
.ace_marker-layer .ace_active_line {
.ace_marker-layer .ace_active-line {
position: absolute;
z-index: 2;
}
.ace_marker-layer .ace_selected_word {
.ace_marker-layer .ace_selected-word {
position: absolute;
z-index: 4;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.ace_line .ace_fold {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
display: inline-block;
height: 11px;
@ -232,11 +225,11 @@
background-position: center center, top left;
}
.ace_dragging .ace_content {
.ace_editor.ace_dragging .ace_content {
cursor: move;
}
.ace_gutter_tooltip {
.ace_gutter-tooltip {
background-color: #FFFFD5;
border: 1px solid gray;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
@ -245,9 +238,9 @@
padding: 4px;
position: absolute;
z-index: 300;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
}
@ -256,9 +249,9 @@
}
.ace_fold-widget {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0 -12px 0 1px;
display: inline-block;
@ -274,11 +267,11 @@
border: 1px solid transparent;
}
.ace_fold-widget.end {
.ace_fold-widget.ace_end {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82");
}
.ace_fold-widget.closed {
.ace_fold-widget.ace_closed {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82");
}
@ -303,10 +296,10 @@
.ace_dark .ace_fold-widget {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
}
.ace_dark .ace_fold-widget.end {
.ace_dark .ace_fold-widget.ace_end {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget.closed {
.ace_dark .ace_fold-widget.ace_closed {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget:hover {
@ -321,7 +314,7 @@
.ace_fold-widget.invalid {
.ace_fold-widget.ace_invalid {
background-color: #FFB4B4;
border-color: #DE5555;
}
@ -352,6 +345,10 @@
font-weight: bold;
}
.ace_nobold .ace_bold {
font-weight: normal;
}
.ace_italic {
font-style: italic;
}

View file

@ -378,7 +378,7 @@ var EditSession = function(text, mode) {
this.highlight = function(re) {
if (!this.$searchHighlight) {
var highlight = new SearchHighlight(null, "ace_selected_word", "text");
var highlight = new SearchHighlight(null, "ace_selected-word", "text");
this.$searchHighlight = this.addDynamicMarker(highlight);
}
this.$searchHighlight.setRegexp(re);
@ -752,15 +752,7 @@ var EditSession = function(text, mode) {
* Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event.
**/
this.setAnnotations = function(annotations) {
this.$annotations = {};
for (var i=0; i<annotations.length; i++) {
var annotation = annotations[i];
var row = annotation.row;
if (this.$annotations[row])
this.$annotations[row].push(annotation);
else
this.$annotations[row] = [annotation];
}
this.$annotations = annotations;
this._emit("changeAnnotation", {});
};

View file

@ -497,7 +497,7 @@ var Editor = function(renderer, session) {
} else {
range = new Range(cursor.row, 0, cursor.row+1, 0);
}
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
session.$highlightLineMarker = session.addMarker(range, "ace_active-line", "background");
}
}
};

View file

@ -57,6 +57,7 @@ exports.handler.attach = function(editor) {
.emacs-mode .ace_cursor{\
border: 2px rgba(50,250,50,0.8) solid!important;\
-moz-box-sizing: border-box!important;\
-webkit-box-sizing: border-box!important;\
box-sizing: border-box!important;\
background-color: rgba(0,250,0,0.9);\
opacity: 0.5;\

View file

@ -37,6 +37,7 @@ var dom = require("../lib/dom");
var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea");
text.className = "ace_text-input";
/*/ debug
text.style.opacity = 1
text.style.background = "rgba(0, 250, 0, 0.3)"
@ -46,7 +47,8 @@ var TextInput = function(parentNode, host) {
if (useragent.isTouchPad)
text.setAttribute("x-palm-disable-auto-cap", true);
text.setAttribute("wrap", "off");
text.wrap = "off";
text.spellcheck = false;
text.style.top = "-2em";
parentNode.insertBefore(text, parentNode.firstChild);

View file

@ -28,9 +28,9 @@
*
* ***** END LICENSE BLOCK ***** */
"use strict"
define(function(require, exports, module) {
"use strict";
var util = require("./util");
@ -42,42 +42,27 @@ var keepScrollPosition = function(editor, fn) {
editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
};
function Motion(getRange, type){
if (type == 'extend')
var extend = true;
else
var reverse = type;
this.nav = function(editor) {
var r = getRange(editor);
if (!r)
function Motion(m) {
if (typeof m == "function") {
var getPos = m;
m = this;
} else {
var getPos = m.getPos;
}
m.nav = function(editor, range, count, param) {
var a = getPos(editor, range, count, param, false);
if (!a)
return;
if (!r.end)
var a = r;
else if (reverse)
var a = r.start;
else
var a = r.end;
editor.clearSelection();
editor.moveCursorTo(a.row, a.column);
}
this.sel = function(editor){
var r = getRange(editor);
if (!r)
};
m.sel = function(editor, range, count, param) {
var a = getPos(editor, range, count, param, true);
if (!a)
return;
if (extend)
return editor.selection.setSelectionRange(r);
if (!r.end)
var a = r;
else if (reverse)
var a = r.start;
else
var a = r.end;
editor.selection.selectTo(a.row, a.column);
}
};
return m;
}
var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
@ -90,20 +75,20 @@ var StringStream = function(editor, cursor) {
this.row = cursor.row;
this.col = cursor.column;
var line = editor.session.getLine(this.row);
var maxRow = editor.session.getLength()
this.ch = line[this.col] || '\n'
var maxRow = editor.session.getLength();
this.ch = line[this.col] || '\n';
this.skippedLines = 0;
this.next = function() {
this.ch = line[++this.col] || this.handleNewLine(1);
//this.debug()
return this.ch;
}
};
this.prev = function() {
this.ch = line[--this.col] || this.handleNewLine(-1);
//this.debug()
return this.ch;
}
};
this.peek = function(dir) {
var ch = line[this.col + dir];
if (ch)
@ -113,7 +98,7 @@ var StringStream = function(editor, cursor) {
if (this.col == line.length - 1)
return '\n';
return editor.session.getLine(this.row + 1)[0] || '\n';
}
};
this.handleNewLine = function(dir) {
if (dir == 1){
@ -128,7 +113,7 @@ var StringStream = function(editor, cursor) {
return line[0] || '\n';
}
if (dir == -1) {
if (this.row == 0)
if (this.row === 0)
return '';
this.row --;
line = editor.session.getLine(this.row);
@ -136,11 +121,11 @@ var StringStream = function(editor, cursor) {
this.skippedLines--;
return '\n';
}
}
};
this.debug = function() {
console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
}
}
};
};
var Search = require("ace/search").Search;
var search = new Search();
@ -179,7 +164,7 @@ module.exports = {
else
str.next();
return {column: str.col, row: str.row}
return {column: str.col, row: str.row};
}),
"b": new Motion(function(editor) {
var str = new StringStream(editor);
@ -199,7 +184,7 @@ module.exports = {
return {column: str.col, row: str.row};
}),
"B": new Motion(function(editor) {
var str = new StringStream(editor)
var str = new StringStream(editor);
str.prev();
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
str.prev();
@ -208,7 +193,7 @@ module.exports = {
str.next();
return {column: str.col, row: str.row};
}, true),
}),
"e": new Motion(function(editor) {
var str = new StringStream(editor);
@ -389,98 +374,58 @@ module.exports = {
}
},
"f": {
"f": new Motion({
param: true,
handlesCount: true,
nav: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
getPos: function(editor, range, count, param, isSel) {
var cursor = editor.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.selection.clearSelection(); // Why does it select in the first place?
ed.moveCursorTo(cursor.row, column + cursor.column + 1);
cursor.column += column + (isSel ? 2 : 1);
return cursor;
}
},
sel: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
}
}),
"F": new Motion({
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel) {
var cursor = editor.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
cursor.column -= column + 1;
return cursor;
}
}
}),
"t": new Motion({
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel) {
var cursor = editor.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.moveCursorTo(cursor.row, column + cursor.column + 1);
cursor.column += column + (isSel ? 1 : 0);
return cursor;
}
}
},
"F": {
}),
"T": new Motion({
param: true,
handlesCount: true,
nav: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
getPos: function(editor, range, count, param, isSel) {
var cursor = editor.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.selection.clearSelection(); // Why does it select in the first place?
ed.moveCursorTo(cursor.row, cursor.column - column - 1);
}
},
sel: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.moveCursorTo(cursor.row, cursor.column - column - 1);
cursor.column -= column;
return cursor;
}
}
},
"t": {
param: true,
handlesCount: true,
nav: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.selection.clearSelection(); // Why does it select in the first place?
ed.moveCursorTo(cursor.row, column + cursor.column);
}
},
sel: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.moveCursorTo(cursor.row, column + cursor.column);
}
}
},
"T": {
param: true,
handlesCount: true,
nav: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.selection.clearSelection(); // Why does it select in the first place?
ed.moveCursorTo(cursor.row, -column + cursor.column);
}
},
sel: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.moveCursorTo(cursor.row, -column + cursor.column);
}
}
},
}),
"^": {
nav: function(editor) {

View file

@ -2,7 +2,7 @@ define(function(require, exports, module) {
var registers = require("../registers");
var dom = require("../../../lib/dom");
dom.importCssString('.insert-mode. ace_cursor{\
dom.importCssString('.insert-mode .ace_cursor{\
border-left: 2px solid #333333;\
}\
.ace_dark.insert-mode .ace_cursor{\

View file

@ -177,7 +177,7 @@ var Cursor = function(parentEl) {
var overwrite = this.session.getOverwrite();
if (overwrite != this.overwrite)
this.$setOverite(overwrite);
this.$setOverwrite(overwrite);
// cache for textarea and gutter highlight
this.$pixelPos = pixelPos;
@ -185,7 +185,7 @@ var Cursor = function(parentEl) {
this.restartTimer();
};
this.$setOverite = function(overwrite) {
this.$setOverwrite = function(overwrite) {
this.overwrite = overwrite;
for (var i = this.cursors.length; i--; ) {
if (overwrite)

View file

@ -44,14 +44,18 @@ var Gutter = function(parentEl) {
this.gutterWidth = 0;
this.$annotations = [];
this.$updateAnnotations = this.$updateAnnotations.bind(this);
};
(function() {
oop.implement(this, EventEmitter);
this.setSession = function(session) {
if (this.session)
this.session.removeEventListener("change", this.$updateAnnotations);
this.session = session;
session.on("change", this.$updateAnnotations);
};
this.addGutterDecoration = function(row, className){
@ -68,28 +72,43 @@ var Gutter = function(parentEl) {
this.setAnnotations = function(annotations) {
// iterate over sparse array
this.$annotations = [];
for (var row in annotations) if (annotations.hasOwnProperty(row)) {
var rowAnnotations = annotations[row];
if (!rowAnnotations)
continue;
var rowInfo = this.$annotations[row] = {
text: []
};
for (var i=0; i<rowAnnotations.length; i++) {
var annotation = rowAnnotations[i];
var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</, "&lt;");
if (rowInfo.text.indexOf(annoText) === -1)
rowInfo.text.push(annoText);
var type = annotation.type;
if (type == "error")
rowInfo.className = " ace_error";
else if (type == "warning" && rowInfo.className != " ace_error")
rowInfo.className = " ace_warning";
else if (type == "info" && (!rowInfo.className))
rowInfo.className = " ace_info";
this.$annotations = []
var rowInfo, row;
for (var i = 0; i < annotations.length; i++) {
var annotation = annotations[i];
var row = annotation.row;
var rowInfo = this.$annotations[row];
if (!rowInfo) {
rowInfo = this.$annotations[row] = {text: []};
}
var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</g, "&lt;");
if (rowInfo.text.indexOf(annoText) === -1)
rowInfo.text.push(annoText);
var type = annotation.type;
if (type == "error")
rowInfo.className = " ace_error";
else if (type == "warning" && rowInfo.className != " ace_error")
rowInfo.className = " ace_warning";
else if (type == "info" && (!rowInfo.className))
rowInfo.className = " ace_info";
}
};
this.$updateAnnotations = function (e) {
if (!this.$annotations.length)
return;
var delta = e.data;
var range = delta.range;
var firstRow = range.start.row;
var len = range.end.row - firstRow;
if (len === 0) {
// do nothing
} else if (delta.action == "removeText" || delta.action == "removeLines") {
this.$annotations.splice(firstRow, len + 1, null);
} else {
var args = Array(len + 1);
args.unshift(firstRow, 1);
this.$annotations.splice.apply(this.$annotations, args);
}
};
@ -129,8 +148,8 @@ var Gutter = function(parentEl) {
c = foldWidgets[i] = this.session.getFoldWidget(i);
if (c)
html.push(
"<span class='ace_fold-widget ", c,
c == "start" && i == foldStart && i < fold.end.row ? " closed" : " open",
"<span class='ace_fold-widget ace_", c,
c == "start" && i == foldStart && i < fold.end.row ? " ace_closed" : " ace_open",
"' style='height:", config.lineHeight, "px",
"'></span>"
);

View file

@ -95,7 +95,7 @@ var Marker = function(parentEl) {
}
else {
this.drawSingleLineMarker(
html, range, marker.clazz + " start", config,
html, range, marker.clazz + " ace_start", config,
null, marker.type
);
}
@ -116,7 +116,7 @@ var Marker = function(parentEl) {
row, range.start.column,
row, this.session.getScreenLastRowColumn(row)
);
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " start", layerConfig, 1, "text");
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, "text");
// selection end
row = range.end.row;
@ -140,7 +140,7 @@ var Marker = function(parentEl) {
var left = Math.round(padding + range.start.column * config.characterWidth);
stringBuilder.push(
"<div class='", clazz, " start' style='",
"<div class='", clazz, " ace_start' style='",
"height:", height, "px;",
"right:0;",
"top:", top, "px;",

View file

@ -42,7 +42,8 @@ var Text = function(parentEl) {
this.element.className = "ace_layer ace_text-layer";
parentEl.appendChild(this.element);
this.$characterSize = this.$measureSizes() || {width: 0, height: 0};
this.$characterSize = {width: 0, height: 0};
this.checkForSizeChanges();
this.$pollSizeChanges();
};
@ -72,7 +73,11 @@ var Text = function(parentEl) {
this.checkForSizeChanges = function() {
var size = this.$measureSizes();
if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
this.$measureNode.style.fontWeight = "bold";
var boldSize = this.$measureSizes();
this.$measureNode.style.fontWeight = "";
this.$characterSize = size;
this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
this._emit("changeCharacterSize", {data: size});
}
};

View file

@ -193,7 +193,7 @@
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " var highlight = new SearchHighlight(null, \"ace_selected_word\", \"text\");" ]
[ "text", " var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");" ]
]
},
{

View file

@ -2,7 +2,7 @@
{
"state": "start",
"data": [
[ "xml_pe", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ]
[ "xml-pe", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ]
]
},
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 Jeremy Ashkenas
/**
* Copyright (c) 2009-2012 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@ -24,9 +24,9 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.2.1-pre
// Generated by CoffeeScript 1.3.3
var extend, flatten;
var extend, flatten, _ref;
exports.starts = function(string, literal, start) {
return literal === string.substr(start, literal.length);
@ -43,7 +43,9 @@ define(function(require, exports, module) {
_results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
item = array[_i];
if (item) _results.push(item);
if (item) {
_results.push(item);
}
}
return _results;
};
@ -51,7 +53,9 @@ define(function(require, exports, module) {
exports.count = function(string, substr) {
var num, pos;
num = pos = 0;
if (!substr.length) return 1 / 0;
if (!substr.length) {
return 1 / 0;
}
while (pos = 1 + string.indexOf(substr, pos)) {
num++;
}
@ -96,5 +100,16 @@ define(function(require, exports, module) {
return array[array.length - (back || 0) - 1];
};
exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) {
var e, _i, _len;
for (_i = 0, _len = this.length; _i < _len; _i++) {
e = this[_i];
if (fn(e)) {
return true;
}
}
return false;
};
});
});

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 Jeremy Ashkenas
/**
* Copyright (c) 2009-2012 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@ -24,7 +24,7 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.2.1-pre
// Generated by CoffeeScript 1.3.3
var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
@ -35,14 +35,16 @@ define(function(require, exports, module) {
exports.Lexer = Lexer = (function() {
Lexer.name = 'Lexer';
function Lexer() {}
Lexer.prototype.tokenize = function(code, opts) {
var i, tag;
if (opts == null) opts = {};
if (WHITESPACE.test(code)) code = "\n" + code;
if (opts == null) {
opts = {};
}
if (WHITESPACE.test(code)) {
code = "\n" + code;
}
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
this.code = code;
this.line = opts.line || 0;
@ -57,14 +59,20 @@ define(function(require, exports, module) {
i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
}
this.closeIndentation();
if (tag = this.ends.pop()) this.error("missing " + tag);
if (opts.rewrite === false) return this.tokens;
if (tag = this.ends.pop()) {
this.error("missing " + tag);
}
if (opts.rewrite === false) {
return this.tokens;
}
return (new Rewriter).rewrite(this.tokens);
};
Lexer.prototype.identifierToken = function() {
var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3;
if (!(match = IDENTIFIER.exec(this.chunk))) return 0;
if (!(match = IDENTIFIER.exec(this.chunk))) {
return 0;
}
input = match[0], id = match[1], colon = match[2];
if (id === 'own' && this.tag() === 'FOR') {
this.token('OWN', id);
@ -105,7 +113,9 @@ define(function(require, exports, module) {
}
}
if (!forcedIdentifier) {
if (__indexOf.call(COFFEE_ALIASES, id) >= 0) id = COFFEE_ALIAS_MAP[id];
if (__indexOf.call(COFFEE_ALIASES, id) >= 0) {
id = COFFEE_ALIAS_MAP[id];
}
tag = (function() {
switch (id) {
case '!':
@ -118,8 +128,6 @@ define(function(require, exports, module) {
return 'LOGIC';
case 'true':
case 'false':
case 'null':
case 'undefined':
return 'BOOL';
case 'break':
case 'continue':
@ -130,29 +138,33 @@ define(function(require, exports, module) {
})();
}
this.token(tag, id);
if (colon) this.token(':', ':');
if (colon) {
this.token(':', ':');
}
return input.length;
};
Lexer.prototype.numberToken = function() {
var binaryLiteral, lexedLength, match, number, octalLiteral;
if (!(match = NUMBER.exec(this.chunk))) return 0;
if (!(match = NUMBER.exec(this.chunk))) {
return 0;
}
number = match[0];
if (/E/.test(number)) {
this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'");
} else if (/[BOX]/.test(number)) {
if (/^0[BOX]/.test(number)) {
this.error("radix prefix '" + number + "' must be lowercase");
} else if (/^0[89]/.test(number)) {
} else if (/E/.test(number) && !/^0x/.test(number)) {
this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'");
} else if (/^0\d*[89]/.test(number)) {
this.error("decimal literal '" + number + "' must not be prefixed with '0'");
} else if (/^0[0-7]/.test(number)) {
} else if (/^0\d+/.test(number)) {
this.error("octal literal '" + number + "' must be prefixed with '0o'");
}
lexedLength = number.length;
if (octalLiteral = /0o([0-7]+)/.exec(number)) {
number = (parseInt(octalLiteral[1], 8)).toString();
if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16);
}
if (binaryLiteral = /0b([01]+)/.exec(number)) {
number = (parseInt(binaryLiteral[1], 2)).toString();
if (binaryLiteral = /^0b([01]+)/.exec(number)) {
number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16);
}
this.token('NUMBER', number);
return lexedLength;
@ -162,11 +174,15 @@ define(function(require, exports, module) {
var match, octalEsc, string;
switch (this.chunk.charAt(0)) {
case "'":
if (!(match = SIMPLESTR.exec(this.chunk))) return 0;
if (!(match = SIMPLESTR.exec(this.chunk))) {
return 0;
}
this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n'));
break;
case '"':
if (!(string = this.balancedString(this.chunk, '"'))) return 0;
if (!(string = this.balancedString(this.chunk, '"'))) {
return 0;
}
if (0 < string.indexOf('#{', 1)) {
this.interpolateString(string.slice(1, -1));
} else {
@ -176,7 +192,7 @@ define(function(require, exports, module) {
default:
return 0;
}
if (octalEsc = /^(?:\\.|[^\\])*\\[0-7]/.test(string)) {
if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) {
this.error("octal escape sequences " + string + " are not allowed");
}
this.line += count(string, '\n');
@ -185,7 +201,9 @@ define(function(require, exports, module) {
Lexer.prototype.heredocToken = function() {
var doc, heredoc, match, quote;
if (!(match = HEREDOC.exec(this.chunk))) return 0;
if (!(match = HEREDOC.exec(this.chunk))) {
return 0;
}
heredoc = match[0];
quote = heredoc.charAt(0);
doc = this.sanitizeHeredoc(match[2], {
@ -205,7 +223,9 @@ define(function(require, exports, module) {
Lexer.prototype.commentToken = function() {
var comment, here, match;
if (!(match = this.chunk.match(COMMENT))) return 0;
if (!(match = this.chunk.match(COMMENT))) {
return 0;
}
comment = match[0], here = match[1];
if (here) {
this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
@ -223,12 +243,15 @@ define(function(require, exports, module) {
return 0;
}
this.token('JS', (script = match[0]).slice(1, -1));
this.line += count(script, '\n');
return script.length;
};
Lexer.prototype.regexToken = function() {
var flags, length, match, prev, regex, _ref2, _ref3;
if (this.chunk.charAt(0) !== '/') return 0;
if (this.chunk.charAt(0) !== '/') {
return 0;
}
if (match = HEREGEX.exec(this.chunk)) {
length = this.heregexToken(match);
this.line += count(match[0], '\n');
@ -238,12 +261,16 @@ define(function(require, exports, module) {
if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) {
return 0;
}
if (!(match = REGEX.exec(this.chunk))) return 0;
if (!(match = REGEX.exec(this.chunk))) {
return 0;
}
_ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2];
if (regex.slice(0, 2) === '/*') {
this.error('regular expressions cannot begin with `*`');
}
if (regex === '//') regex = '/(?:)/';
if (regex === '//') {
regex = '/(?:)/';
}
this.token('REGEX', "" + regex + flags);
return match.length;
};
@ -270,7 +297,9 @@ define(function(require, exports, module) {
if (tag === 'TOKENS') {
tokens.push.apply(tokens, value);
} else {
if (!(value = value.replace(HEREGEX_OMIT, ''))) continue;
if (!(value = value.replace(HEREGEX_OMIT, ''))) {
continue;
}
value = value.replace(/\\/g, '\\\\');
tokens.push(['STRING', this.makeString(value, '"', true)]);
}
@ -281,18 +310,21 @@ define(function(require, exports, module) {
this.tokens.push(['STRING', '""'], ['+', '+']);
}
(_ref5 = this.tokens).push.apply(_ref5, tokens);
if (flags) this.tokens.push([',', ','], ['STRING', '"' + flags + '"']);
if (flags) {
this.tokens.push([',', ','], ['STRING', '"' + flags + '"']);
}
this.token(')', ')');
return heregex.length;
};
Lexer.prototype.lineToken = function() {
var diff, indent, match, noNewlines, prev, size;
if (!(match = MULTI_DENT.exec(this.chunk))) return 0;
var diff, indent, match, noNewlines, size;
if (!(match = MULTI_DENT.exec(this.chunk))) {
return 0;
}
indent = match[0];
this.line += count(indent, '\n');
this.seenFor = false;
prev = last(this.tokens, 1);
size = indent.length - 1 - indent.lastIndexOf('\n');
noNewlines = this.unfinished();
if (size - this.indebt === this.indent) {
@ -342,7 +374,9 @@ define(function(require, exports, module) {
this.token('OUTDENT', dent);
}
}
if (dent) this.outdebt -= moveOut;
if (dent) {
this.outdebt -= moveOut;
}
while (this.value() === ';') {
this.tokens.pop();
}
@ -358,7 +392,9 @@ define(function(require, exports, module) {
return 0;
}
prev = last(this.tokens);
if (prev) prev[match ? 'spaced' : 'newLine'] = true;
if (prev) {
prev[match ? 'spaced' : 'newLine'] = true;
}
if (match) {
return match[0].length;
} else {
@ -370,12 +406,16 @@ define(function(require, exports, module) {
while (this.value() === ';') {
this.tokens.pop();
}
if (this.tag() !== 'TERMINATOR') this.token('TERMINATOR', '\n');
if (this.tag() !== 'TERMINATOR') {
this.token('TERMINATOR', '\n');
}
return this;
};
Lexer.prototype.suppressNewlines = function() {
if (this.value() === '\\') this.tokens.pop();
if (this.value() === '\\') {
this.tokens.pop();
}
return this;
};
@ -383,7 +423,9 @@ define(function(require, exports, module) {
var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
if (match = OPERATOR.exec(this.chunk)) {
value = match[0];
if (CODE.test(value)) this.tagParameters();
if (CODE.test(value)) {
this.tagParameters();
}
} else {
value = this.chunk.charAt(0);
}
@ -416,7 +458,9 @@ define(function(require, exports, module) {
tag = 'LOGIC';
} else if (prev && !prev.spaced) {
if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) {
if (prev[0] === '?') prev[0] = 'FUNC_EXIST';
if (prev[0] === '?') {
prev[0] = 'FUNC_EXIST';
}
tag = 'CALL_START';
} else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) {
tag = 'INDEX_START';
@ -448,7 +492,9 @@ define(function(require, exports, module) {
if (HEREDOC_ILLEGAL.test(doc)) {
this.error("block comment cannot contain \"*/\", starting");
}
if (doc.indexOf('\n') <= 0) return doc;
if (doc.indexOf('\n') <= 0) {
return doc;
}
} else {
while (match = HEREDOC_INDENT.exec(doc)) {
attempt = match[1];
@ -457,14 +503,20 @@ define(function(require, exports, module) {
}
}
}
if (indent) doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
if (!herecomment) doc = doc.replace(/^\n/, '');
if (indent) {
doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
}
if (!herecomment) {
doc = doc.replace(/^\n/, '');
}
return doc;
};
Lexer.prototype.tagParameters = function() {
var i, stack, tok, tokens;
if (this.tag() !== ')') return this;
if (this.tag() !== ')') {
return this;
}
stack = [];
tokens = this.tokens;
i = tokens.length;
@ -508,7 +560,9 @@ define(function(require, exports, module) {
continue;
case end:
stack.pop();
if (!stack.length) return str.slice(0, i + 1 || 9e9);
if (!stack.length) {
return str.slice(0, +i + 1 || 9e9);
}
end = stack[stack.length - 1];
continue;
}
@ -528,7 +582,9 @@ define(function(require, exports, module) {
Lexer.prototype.interpolateString = function(str, options) {
var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4;
if (options == null) options = {};
if (options == null) {
options = {};
}
heredoc = options.heredoc, regex = options.regex;
tokens = [];
pi = 0;
@ -541,7 +597,9 @@ define(function(require, exports, module) {
if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) {
continue;
}
if (pi < i) tokens.push(['NEOSTRING', str.slice(pi, i)]);
if (pi < i) {
tokens.push(['NEOSTRING', str.slice(pi, i)]);
}
inner = expr.slice(1, -1);
if (inner.length) {
nested = new Lexer().tokenize(inner, {
@ -563,28 +621,44 @@ define(function(require, exports, module) {
i += expr.length;
pi = i + 1;
}
if ((i > pi && pi < str.length)) tokens.push(['NEOSTRING', str.slice(pi)]);
if (regex) return tokens;
if (!tokens.length) return this.token('STRING', '""');
if (tokens[0][0] !== 'NEOSTRING') tokens.unshift(['', '']);
if (interpolated = tokens.length > 1) this.token('(', '(');
if ((i > pi && pi < str.length)) {
tokens.push(['NEOSTRING', str.slice(pi)]);
}
if (regex) {
return tokens;
}
if (!tokens.length) {
return this.token('STRING', '""');
}
if (tokens[0][0] !== 'NEOSTRING') {
tokens.unshift(['', '']);
}
if (interpolated = tokens.length > 1) {
this.token('(', '(');
}
for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) {
_ref3 = tokens[i], tag = _ref3[0], value = _ref3[1];
if (i) this.token('+', '+');
if (i) {
this.token('+', '+');
}
if (tag === 'TOKENS') {
(_ref4 = this.tokens).push.apply(_ref4, value);
} else {
this.token('STRING', this.makeString(value, '"', heredoc));
}
}
if (interpolated) this.token(')', ')');
if (interpolated) {
this.token(')', ')');
}
return tokens;
};
Lexer.prototype.pair = function(tag) {
var size, wanted;
if (tag !== (wanted = last(this.ends))) {
if ('OUTDENT' !== wanted) this.error("unmatched " + tag);
if ('OUTDENT' !== wanted) {
this.error("unmatched " + tag);
}
this.indent -= size = last(this.indents);
this.outdentToken(size, true);
return this.pair(tag);
@ -616,7 +690,9 @@ define(function(require, exports, module) {
};
Lexer.prototype.makeString = function(body, quote, heredoc) {
if (!body) return quote + quote;
if (!body) {
return quote + quote;
}
body = body.replace(/\\([\s\S])/g, function(match, contents) {
if (contents === '\n' || contents === quote) {
return contents;
@ -663,7 +739,7 @@ define(function(require, exports, module) {
COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES);
RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield'];
RESERVED = ['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'];
STRICT_PROSCRIBED = ['arguments', 'eval'];
@ -723,17 +799,17 @@ define(function(require, exports, module) {
RELATION = ['IN', 'OF', 'INSTANCEOF'];
BOOL = ['TRUE', 'FALSE', 'NULL', 'UNDEFINED'];
BOOL = ['TRUE', 'FALSE'];
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', '++', '--', ']'];
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--', ']'];
NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING');
CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];
INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL');
INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED');
LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR'];
});
});

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 Jeremy Ashkenas
/**
* Copyright (c) 2009-2012 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@ -24,7 +24,7 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.2.1-pre
// Generated by CoffeeScript 1.3.3
var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
@ -32,8 +32,6 @@ define(function(require, exports, module) {
exports.Rewriter = (function() {
Rewriter.name = 'Rewriter';
function Rewriter() {}
Rewriter.prototype.rewrite = function(tokens) {
@ -67,7 +65,9 @@ define(function(require, exports, module) {
if (levels === 0 && condition.call(this, token, i)) {
return action.call(this, token, i);
}
if (!token || levels < 0) return action.call(this, token, i - 1);
if (!token || levels < 0) {
return action.call(this, token, i - 1);
}
if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) {
levels += 1;
} else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) {
@ -83,9 +83,13 @@ define(function(require, exports, module) {
_ref = this.tokens;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
tag = _ref[i][0];
if (tag !== 'TERMINATOR') break;
if (tag !== 'TERMINATOR') {
break;
}
}
if (i) {
return this.tokens.splice(0, i);
}
if (i) return this.tokens.splice(0, i);
};
Rewriter.prototype.removeMidExpressionNewlines = function() {
@ -109,7 +113,9 @@ define(function(require, exports, module) {
return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
};
return this.scanTokens(function(token, i) {
if (token[0] === 'CALL_START') this.detectEnd(i + 1, condition, action);
if (token[0] === 'CALL_START') {
this.detectEnd(i + 1, condition, action);
}
return 1;
});
};
@ -124,25 +130,32 @@ define(function(require, exports, module) {
return token[0] = 'INDEX_END';
};
return this.scanTokens(function(token, i) {
if (token[0] === 'INDEX_START') this.detectEnd(i + 1, condition, action);
if (token[0] === 'INDEX_START') {
this.detectEnd(i + 1, condition, action);
}
return 1;
});
};
Rewriter.prototype.addImplicitBraces = function() {
var action, condition, sameLine, stack, start, startIndent, startsLine;
var action, condition, sameLine, stack, start, startIndent, startIndex, startsLine;
stack = [];
start = null;
startsLine = null;
sameLine = true;
startIndent = 0;
startIndex = 0;
condition = function(token, i) {
var one, tag, three, two, _ref, _ref1;
_ref = this.tokens.slice(i + 1, (i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2];
if ('HERECOMMENT' === (one != null ? one[0] : void 0)) return false;
_ref = this.tokens.slice(i + 1, +(i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2];
if ('HERECOMMENT' === (one != null ? one[0] : void 0)) {
return false;
}
tag = token[0];
if (__indexOf.call(LINEBREAKS, tag) >= 0) sameLine = false;
return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine)) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT'));
if (__indexOf.call(LINEBREAKS, tag) >= 0) {
sameLine = false;
}
return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine && !(i - startIndex === 1))) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT'));
};
action = function(token, i) {
var tok;
@ -163,6 +176,7 @@ define(function(require, exports, module) {
return 1;
}
sameLine = true;
startIndex = i + 1;
stack.push(['{']);
idx = ago === '@' ? i - 2 : i - 1;
while (this.tag(idx - 2) === 'HERECOMMENT') {
@ -185,7 +199,9 @@ define(function(require, exports, module) {
condition = function(token, i) {
var post, tag, _ref, _ref1;
tag = token[0];
if (!seenSingle && token.fromThen) return true;
if (!seenSingle && token.fromThen) {
return true;
}
if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') {
seenSingle = true;
}
@ -206,19 +222,27 @@ define(function(require, exports, module) {
if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') {
noCall = true;
}
_ref = tokens.slice(i - 1, (i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2];
_ref = tokens.slice(i - 1, +(i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2];
callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0);
seenSingle = false;
seenControl = false;
if (__indexOf.call(LINEBREAKS, tag) >= 0) noCall = false;
if (prev && !prev.spaced && tag === '?') token.call = true;
if (token.fromThen) return 1;
if (__indexOf.call(LINEBREAKS, tag) >= 0) {
noCall = false;
}
if (prev && !prev.spaced && tag === '?') {
token.call = true;
}
if (token.fromThen) {
return 1;
}
if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) {
return 1;
}
tokens.splice(i, 0, this.generate('CALL_START', '(', token[2]));
this.detectEnd(i + 1, condition, action);
if (prev[0] === '?') prev[0] = 'FUNC_EXIST';
if (prev[0] === '?') {
prev[0] = 'FUNC_EXIST';
}
return 2;
});
};
@ -251,10 +275,14 @@ define(function(require, exports, module) {
if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
starter = tag;
_ref1 = this.indentation(token, true), indent = _ref1[0], outdent = _ref1[1];
if (starter === 'THEN') indent.fromThen = true;
if (starter === 'THEN') {
indent.fromThen = true;
}
tokens.splice(i + 1, 0, indent);
this.detectEnd(i + 2, condition, action);
if (tag === 'THEN') tokens.splice(i, 1);
if (tag === 'THEN') {
tokens.splice(i, 1);
}
return 1;
}
return 1;
@ -274,7 +302,9 @@ define(function(require, exports, module) {
}
};
return this.scanTokens(function(token, i) {
if (token[0] !== 'IF') return 1;
if (token[0] !== 'IF') {
return 1;
}
original = token;
this.detectEnd(i + 1, condition, action);
return 1;
@ -283,10 +313,14 @@ define(function(require, exports, module) {
Rewriter.prototype.indentation = function(token, implicit) {
var indent, outdent;
if (implicit == null) implicit = false;
if (implicit == null) {
implicit = false;
}
indent = ['INDENT', 2, token[2]];
outdent = ['OUTDENT', 2, token[2]];
if (implicit) indent.generated = outdent.generated = true;
if (implicit) {
indent.generated = outdent.generated = true;
}
return [indent, outdent];
};
@ -324,7 +358,7 @@ define(function(require, exports, module) {
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++'];
IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++'];
IMPLICIT_UNSPACED_CALL = ['+', '-'];
@ -339,4 +373,4 @@ define(function(require, exports, module) {
LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
});
});

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 Jeremy Ashkenas
/**
* Copyright (c) 2009-2012 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@ -24,7 +24,7 @@
*/
define(function(require, exports, module) {
// Generated by CoffeeScript 1.2.1-pre
// Generated by CoffeeScript 1.3.3
var Scope, extend, last, _ref;
@ -32,8 +32,6 @@ define(function(require, exports, module) {
exports.Scope = Scope = (function() {
Scope.name = 'Scope';
Scope.root = null;
function Scope(parent, expressions, method) {
@ -47,11 +45,15 @@ define(function(require, exports, module) {
}
];
this.positions = {};
if (!this.parent) Scope.root = this;
if (!this.parent) {
Scope.root = this;
}
}
Scope.prototype.add = function(name, type, immediate) {
if (this.shared && !immediate) return this.parent.add(name, type, immediate);
if (this.shared && !immediate) {
return this.parent.add(name, type, immediate);
}
if (Object.prototype.hasOwnProperty.call(this.positions, name)) {
return this.variables[this.positions[name]].type = type;
} else {
@ -62,22 +64,31 @@ define(function(require, exports, module) {
}
};
Scope.prototype.find = function(name, options) {
if (this.check(name, options)) return true;
Scope.prototype.namedMethod = function() {
if (this.method.name || !this.parent) {
return this.method;
}
return this.parent.namedMethod();
};
Scope.prototype.find = function(name) {
if (this.check(name)) {
return true;
}
this.add(name, 'var');
return false;
};
Scope.prototype.parameter = function(name) {
if (this.shared && this.parent.check(name, true)) return;
if (this.shared && this.parent.check(name, true)) {
return;
}
return this.add(name, 'param');
};
Scope.prototype.check = function(name, immediate) {
var found, _ref1;
found = !!this.type(name);
if (found || immediate) return found;
return !!((_ref1 = this.parent) != null ? _ref1.check(name) : void 0);
Scope.prototype.check = function(name) {
var _ref1;
return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0));
};
Scope.prototype.temporary = function(name, index) {
@ -93,19 +104,25 @@ define(function(require, exports, module) {
_ref1 = this.variables;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
v = _ref1[_i];
if (v.name === name) return v.type;
if (v.name === name) {
return v.type;
}
}
return null;
};
Scope.prototype.freeVariable = function(name, reserve) {
var index, temp;
if (reserve == null) reserve = true;
if (reserve == null) {
reserve = true;
}
index = 0;
while (this.check((temp = this.temporary(name, index)))) {
index++;
}
if (reserve) this.add(temp, 'var', true);
if (reserve) {
this.add(temp, 'var', true);
}
return temp;
};
@ -141,7 +158,9 @@ define(function(require, exports, module) {
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
v = _ref1[_i];
if (v.type.assigned) _results.push("" + v.name + " = " + v.type.value);
if (v.type.assigned) {
_results.push("" + v.name + " = " + v.type.value);
}
}
return _results;
};
@ -151,4 +170,4 @@ define(function(require, exports, module) {
})();
});
});

View file

@ -45,25 +45,28 @@ define(function(require, exports, module) {
};
var keywords = (
"this|throw|then|try|typeof|super|switch|return|break|by)|continue|" +
"this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
"catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" +
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
"or|on|unless|until|and|yes"
);
var langConstant = (
"true|false|null|undefined"
"true|false|null|undefined|NaN|Infinity"
);
var illegal = (
"case|const|default|function|var|void|with|enum|export|implements|" +
"interface|let|package|private|protected|public|static|yield|" +
"__hasProp|extends|slice|bind|indexOf"
"__hasProp|slice|bind|indexOf"
);
var supportClass = (
"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|" +
"String|RangeError|SyntaxError|Error|EvalError|TypeError|URIError"
"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
"SyntaxError|TypeError|URIError|" +
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
);
var supportFunction = (
@ -71,26 +74,41 @@ define(function(require, exports, module) {
"encodeURIComponent|decodeURI|decodeURIComponent|String|"
);
var variableLanguage = (
"window|arguments|prototype|document"
);
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"constant.language": langConstant,
"invalid.illegal": illegal,
"language.support.class": supportClass,
"language.support.function": supportFunction,
"variable.language": variableLanguage
}, "identifier");
var functionRules = {
"({args})->": {
token: ["paren.lparen", "text", "paren.lparen", "text", "variable.parameter", "text", "paren.rparen", "text", "paren.rparen", "text", "storage.type"],
regex: "(\\()(\\s*)(\\{)(\\s*)([$@A-Za-z_\\x7f-\\uffff][$@\\w\\s,\\x7f-\\uffff]*)(\\s*)(\\})(\\s*)(\\))(\\s*)([\\-=]>)"
},
"({})->": {
token: ["paren.lparen", "text", "paren.lparen", "text", "paren.rparen", "text", "paren.rparen", "text", "storage.type"],
regex: "(\\()(\\s*)(\\{)(\\s*)(\\})(\\s*)(\\))(\\s*)([\\-=]>)"
},
"(args)->": {
token: ["paren.lparen", "text", "variable.parameter", "text", "paren.rparen", "text", "storage.type"],
regex: "(\\()(\\s*)([$@A-Za-z_\\x7f-\\uffff][\\s\\x21-\\uffff]*)(\\s*)(\\))(\\s*)([\\-=]>)"
},
"()->": {
token: ["paren.lparen", "text", "paren.rparen", "text", "storage.type"],
regex: "(\\()(\\s*)(\\))(\\s*)([\\-=]>)"
}
};
this.$rules = {
start : [
{
token : "identifier",
regex : "(?:(?:\\.|::)\\s*)" + identifier
}, {
token : "variable",
regex : "@(?:" + identifier + ")?"
}, {
token: keywordMapper,
regex : identifier
}, {
token : "constant.numeric",
regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
}, {
@ -134,12 +152,109 @@ define(function(require, exports, module) {
}, {
token : "comment",
regex : "#.*"
}, {
token : [
"punctuation.operator", "identifier"
],
regex : "(\\.)(" + illegal + ")"
}, {
token : "punctuation.operator",
regex : "\\."
}, {
//class A extends B
token : [
"keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"
],
regex : "(class)(\\s+)(" + identifier + ")(\\s+)(extends)(\\s+)(" + identifier + ")"
}, {
//class A
token : [
"keyword", "text", "language.support.class"
],
regex : "(class)(\\s+)(" + identifier + ")"
}, {
//play = ({args}) ->
token : [
"entity.name.function", "text", "keyword.operator", "text"
].concat(functionRules["({args})->"].token),
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["({args})->"].regex
}, {
//play : ({args}) ->
token : [
"entity.name.function", "text", "punctuation.operator", "text"
].concat(functionRules["({args})->"].token),
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["({args})->"].regex
}, {
//play = ({}) ->
token : [
"entity.name.function", "text", "keyword.operator", "text"
].concat(functionRules["({})->"].token),
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["({})->"].regex
}, {
//play : ({}) ->
token : [
"entity.name.function", "text", "punctuation.operator", "text"
].concat(functionRules["({})->"].token),
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["({})->"].regex
}, {
//play = (args) ->
token : [
"entity.name.function", "text", "keyword.operator", "text"
].concat(functionRules["(args)->"].token),
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["(args)->"].regex
}, {
//play : (args) ->
token : [
"entity.name.function", "text", "punctuation.operator", "text"
].concat(functionRules["(args)->"].token),
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["(args)->"].regex
}, {
//play = () ->
token : [
"entity.name.function", "text", "keyword.operator", "text"
].concat(functionRules["()->"].token),
regex : "(" + identifier + ")(\\s*)(=)(\\s*)" + functionRules["()->"].regex
}, {
//play : () ->
token : [
"entity.name.function", "text", "punctuation.operator", "text"
].concat(functionRules["()->"].token),
regex : "(" + identifier + ")(\\s*)(:)(\\s*)" + functionRules["()->"].regex
}, {
//play = ->
token : [
"entity.name.function", "text", "keyword.operator", "text", "storage.type"
],
regex : "(" + identifier + ")(\\s*)(=)(\\s*)([\\-=]>)"
}, {
//play : ->
token : [
"entity.name.function", "text", "punctuation.operator", "text", "storage.type"
],
regex : "(" + identifier + ")(\\s*)(:)(\\s*)([\\-=]>)"
},
functionRules["({args})->"],
functionRules["({})->"],
functionRules["(args)->"],
functionRules["()->"]
, {
token : "identifier",
regex : "(?:(?:\\.|::)\\s*)" + identifier
}, {
token : "variable",
regex : "@(?:" + identifier + ")?"
}, {
token: keywordMapper,
regex : identifier
}, {
token : "punctuation.operator",
regex : "\\?|\\:|\\,|\\."
}, {
token : "storage.type",
regex : "[\\-=]>"
}, {
token : "keyword.operator",
regex : "(?:[\\-=]>|[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
}, {
token : "paren.lparen",
regex : "[({[]"

View file

@ -41,6 +41,12 @@ var assert = require("../test/assertions");
module.exports = {
setUp : function() {
this.tokenizer = new Mode().getTokenizer();
this.testTokens = function(tokens, correct) {
assert.equal(tokens.length, correct.length);
correct.forEach(function(type, i) {
assert.equal(tokens[i].type, type);
});
};
},
"test: tokenize keyword": function() {
@ -55,6 +61,195 @@ module.exports = {
assert.equal(tokens[0].type, "string.regex");
},
"test: tokenize function: 'foo = ({args}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = ({args}) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "paren.lparen", "variable.parameter", "paren.rparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = ({a1, a2}) ->", "start").tokens;
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = ({@a1, a2}) ->", "start").tokens;
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo : ({args}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo : ({args}) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text",
"paren.lparen", "paren.lparen", "variable.parameter", "paren.rparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: invalid case: 'foo = ({args}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = ({0abc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({/abc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({abc/}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({#abc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({abc#}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({)abc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({abc)}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
tokens = this.tokenizer.getLineTokens("foo = ({a{bc}) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
},
"test: tokenize function: 'foo = ({}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = ({}) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "paren.lparen", "paren.rparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = ({ }) ->", "start").tokens;
correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "paren.lparen", "text", "paren.rparen", "paren.rparen", "text", "storage.type"
];
assert.equal(tokens.length, 11);
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo : ({}) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo : ({}) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text",
"paren.lparen", "paren.lparen", "paren.rparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo = (args) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = (args) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = (arg1, arg2) ->", "start").tokens;
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = (arg1 = 1, arg2 = 'name') ->", "start").tokens;
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = (@arg1 = /abc/, arg2 = 'name') ->", "start").tokens;
this.testTokens(tokens, correct);
},
"test: tokenize function: invalid case: 'foo=(args) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo=(/args) ->", "start").tokens;
assert.notEqual(tokens[0].type, "entity.name.function");
},
"test: tokenize function: 'foo = () ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = () ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo = ( ) ->", "start").tokens;
correct = [
"entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "text", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo : () ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo : () ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text",
"paren.lparen", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
tokens = this.tokenizer.getLineTokens("foo : ( ) ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text",
"paren.lparen", "text", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'window.foo = (args) ->'": function() {
var tokens = this.tokenizer.getLineTokens("window.foo = (args) ->", "start").tokens;
var correct = [
"variable.language", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text",
"paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo = ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo = ->", "start").tokens;
var correct = [
"entity.name.function", "text", "keyword.operator", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize function: 'foo : ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo : ->", "start").tokens;
var correct = [
"entity.name.function", "text", "punctuation.operator", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize callback function: 'foo bar: 1, (args) ->'": function() {
var tokens = this.tokenizer.getLineTokens("foo bar: 1, (args) ->", "start").tokens;
var correct = [
"identifier", "text", "identifier", "punctuation.operator", "text", "constant.numeric", "punctuation.operator", "text",
"paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"
];
this.testTokens(tokens, correct);
},
"test: tokenize class: 'class Foo'": function() {
var tokens = this.tokenizer.getLineTokens("class Foo", "start").tokens;
var correct = [
"keyword", "text", "language.support.class"
];
this.testTokens(tokens, correct);
},
"test: tokenize class 'class Foo extends Bar'": function() {
var tokens = this.tokenizer.getLineTokens("class Foo extends Bar", "start").tokens;
var correct = [
"keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"
];
this.testTokens(tokens, correct);
},
"test: tokenize illegal name property: 'foo.static.function'": function() {
var tokens = this.tokenizer.getLineTokens("foo.static.function", "start").tokens;
var correct = [
"identifier", "punctuation.operator", "identifier", "punctuation.operator", "identifier"
];
this.testTokens(tokens, correct);
},
// TODO: disable. not yet implemented
"!test tokenize string with interpolation": function() {
var tokens = this.tokenizer.getLineTokens('"#{ 22 / 7 } is a decent approximation of π"', "start").tokens;

View file

@ -49,7 +49,7 @@ var ColdfusionHighlightRules = function() {
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml_pe",
token : "xml-pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",

View file

@ -74,25 +74,19 @@ oop.inherits(Mode, TextMode);
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
worker.attachToDocument(session.getDocument());
worker.on("csslint", function(e) {
var errors = [];
e.data.forEach(function(message) {
errors.push({
row: message.line - 1,
column: message.col - 1,
text: message.message,
type: message.type,
lint: message
});
});
session.setAnnotations(errors);
session.setAnnotations(e.data);
});
worker.on("terminate", function() {
session.clearAnnotations();
});
return worker;
};

View file

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* Build time: 2-March-2012 02:47:11 */
/* Build time: 14-May-2012 10:24:48 */
/*!
Parser-Lib
@ -47,7 +47,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
/* Version v0.1.7, Build time: 4-May-2012 03:57:04 */
var parserlib = {};
(function(){
@ -957,7 +957,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* Version v0.1.6, Build time: 2-March-2012 02:44:32 */
/* Version v0.1.7, Build time: 4-May-2012 03:57:04 */
(function(){
var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase,
@ -2171,7 +2171,7 @@ Parser.prototype = function(){
//there must be a next selector
if (nextSelector === null){
this._unexpectedToken(this.LT(1));
this._unexpectedToken(tokenStream.LT(1));
} else {
//nextSelector is an instance of SelectorPart
@ -2666,7 +2666,8 @@ Parser.prototype = function(){
expr = null,
prio = null,
error = null,
invalid = null;
invalid = null,
propertyName= "";
property = this._property();
if (property !== null){
@ -2683,8 +2684,20 @@ Parser.prototype = function(){
prio = this._prio();
/*
* If hacks should be allowed, then only check the root
* property. If hacks should not be allowed, treat
* _property or *property as invalid properties.
*/
propertyName = property.toString();
if (this.options.starHack && property.hack == "*" ||
this.options.underscoreHack && property.hack == "_") {
propertyName = property.text;
}
try {
this._validateProperty(property, expr);
this._validateProperty(propertyName, expr);
} catch (ex) {
invalid = ex;
}
@ -3525,6 +3538,7 @@ var Properties = {
"background-repeat" : { multi: "<repeat-style>" },
"background-size" : { multi: "<bg-size>", comma: true },
"baseline-shift" : "baseline | sub | super | <percentage> | <length>",
"behavior" : 1,
"binding" : 1,
"bleed" : "<length>",
"bookmark-label" : "<content> | <attr> | <string>",
@ -3871,6 +3885,7 @@ var Properties = {
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
"text-outline" : 1,
"text-overflow" : 1,
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
"text-shadow" : 1,
"text-transform" : "capitalize | uppercase | lowercase | none | inherit",
"text-wrap" : "normal | none | avoid",
@ -5950,7 +5965,7 @@ var ValidationTypes = {
i, len, found = false;
for (i=0,len=args.length; i < len && !found; i++){
if (text == args[i]){
if (text == args[i].toLowerCase()){
found = true;
}
}
@ -6042,7 +6057,7 @@ var ValidationTypes = {
},
"<gradient>": function(part) {
return part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial|linear)\-gradient/i.test(part);
return part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part);
},
"<box>": function(part){
@ -6134,6 +6149,18 @@ var ValidationTypes = {
part,
i, len;
/*
<position> = [
[ left | center | right | top | bottom | <percentage> | <length> ]
|
[ left | center | right | <percentage> | <length> ]
[ top | center | bottom | <percentage> | <length> ]
|
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]
*/
if (ValidationTypes.isAny(expression, "top | bottom")) {
result = true;
@ -6306,7 +6333,7 @@ var CSSLint = (function(){
formatters = [],
api = new parserlib.util.EventTarget();
api.version = "0.9.7";
api.version = "0.9.8";
//-------------------------------------------------------------------------
// Rule Management
@ -7633,7 +7660,7 @@ CSSLint.addRule({
parser.addListener("endstylesheet", function(){
reporter.stat("important", count);
if (count >= 10){
reporter.rollupWarn("Too many !important declarations (" + count + "), try to use less than 10 to avoid specifity issues.", rule);
reporter.rollupWarn("Too many !important declarations (" + count + "), try to use less than 10 to avoid specificity issues.", rule);
}
});
}
@ -8290,8 +8317,35 @@ CSSLint.addRule({
});
/*
* Rule: Don't use text-indent for image replacement if you need to support rtl.
*
* Rule: Don't use properties with a star prefix.
*
*/
/*global CSSLint*/
CSSLint.addRule({
//rule information
id: "star-property-hack",
name: "Disallow properties with a star prefix",
desc: "Checks for the star property hack (targets IE6/7)",
browsers: "All",
//initialization
init: function(parser, reporter){
var rule = this;
//check if property name starts with "*"
parser.addListener("property", function(event){
var property = event.property;
if (property.hack == "*") {
reporter.report("Property with star prefix found.", event.property.line, event.property.col, rule);
}
});
}
});
/*
* Rule: Don't use text-indent for image replacement if you need to support rtl.
*
*/
/*global CSSLint*/
CSSLint.addRule({
@ -8301,27 +8355,29 @@ CSSLint.addRule({
name: "Disallow negative text-indent",
desc: "Checks for text indent less than -99px",
browsers: "All",
//initialization
init: function(parser, reporter){
var rule = this,
textIndent = false;
textIndent,
direction;
function startRule(event){
textIndent = false;
direction = "inherit";
}
//event handler for end of rules
function endRule(event){
if (textIndent){
if (textIndent && direction != "ltr"){
reporter.report("Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.", textIndent.line, textIndent.col, rule);
}
}
}
parser.addListener("startrule", startRule);
parser.addListener("startfontface", startRule);
//check for use of "font-size"
parser.addListener("property", function(event){
var name = event.property.toString().toLowerCase(),
@ -8330,16 +8386,43 @@ CSSLint.addRule({
if (name == "text-indent" && value.parts[0].value < -99){
textIndent = event.property;
} else if (name == "direction" && value == "ltr"){
textIndent = false;
direction = "ltr";
}
});
parser.addListener("endrule", endRule);
parser.addListener("endfontface", endRule);
parser.addListener("endfontface", endRule);
}
});
/*
* Rule: Don't use properties with a underscore prefix.
*
*/
/*global CSSLint*/
CSSLint.addRule({
//rule information
id: "underscore-property-hack",
name: "Disallow properties with an underscore prefix",
desc: "Checks for the underscore property hack (targets IE6)",
browsers: "All",
//initialization
init: function(parser, reporter){
var rule = this;
//check if property name starts with "_"
parser.addListener("property", function(event){
var property = event.property;
if (property.hack == "_") {
reporter.report("Property with underscore prefix found.", event.property.line, event.property.col, rule);
}
});
}
});
/*
* Rule: Headings (h1-h6) should be defined only once.
*/
@ -8669,343 +8752,6 @@ CSSLint.addRule({
});
/*global CSSLint*/
CSSLint.addFormatter({
//format information
id: "checkstyle-xml",
name: "Checkstyle XML format",
/**
* Return opening root XML tag.
* @return {String} to prepend before all results
*/
startFormat: function(){
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle>";
},
/**
* Return closing root XML tag.
* @return {String} to append after all results
*/
endFormat: function(){
return "</checkstyle>";
},
/**
* Given CSS Lint results for a file, return output for this format.
* @param results {Object} with error and warning messages
* @param filename {String} relative file path
* @param options {Object} (UNUSED for now) specifies special handling of output
* @return {String} output for results
*/
formatResults: function(results, filename, options) {
var messages = results.messages,
output = [];
/**
* Generate a source string for a rule.
* Checkstyle source strings usually resemble Java class names e.g
* net.csslint.SomeRuleName
* @param {Object} rule
* @return rule source as {String}
*/
var generateSource = function(rule) {
if (!rule || !('name' in rule)) {
return "";
}
return 'net.csslint.' + rule.name.replace(/\s/g,'');
};
/**
* Replace special characters before write to output.
*
* Rules:
* - single quotes is the escape sequence for double-quotes
* - &lt; is the escape sequence for <
* - &gt; is the escape sequence for >
*
* @param {String} message to escape
* @return escaped message as {String}
*/
var escapeSpecialCharacters = function(str) {
if (!str || str.constructor !== String) {
return "";
}
return str.replace(/\"/g, "'").replace(/</g, "&lt;").replace(/>/g, "&gt;");
};
if (messages.length > 0) {
output.push("<file name=\""+filename+"\">");
CSSLint.Util.forEach(messages, function (message, i) {
//ignore rollups for now
if (!message.rollup) {
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
" message=\"" + escapeSpecialCharacters(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>");
}
});
output.push("</file>");
}
return output.join("");
}
});
/*global CSSLint*/
CSSLint.addFormatter({
//format information
id: "compact",
name: "Compact, 'porcelain' format",
/**
* Return content to be printed before all file results.
* @return {String} to prepend before all results
*/
startFormat: function() {
return "";
},
/**
* Return content to be printed after all file results.
* @return {String} to append after all results
*/
endFormat: function() {
return "";
},
/**
* Given CSS Lint results for a file, return output for this format.
* @param results {Object} with error and warning messages
* @param filename {String} relative file path
* @param options {Object} (Optional) specifies special handling of output
* @return {String} output for results
*/
formatResults: function(results, filename, options) {
var messages = results.messages,
output = "";
options = options || {};
/**
* Capitalize and return given string.
* @param str {String} to capitalize
* @return {String} capitalized
*/
var capitalize = function(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
};
if (messages.length === 0) {
return options.quiet ? "" : filename + ": Lint Free!";
}
CSSLint.Util.forEach(messages, function(message, i) {
if (message.rollup) {
output += filename + ": " + capitalize(message.type) + " - " + message.message + "\n";
} else {
output += filename + ": " + "line " + message.line +
", col " + message.col + ", " + capitalize(message.type) + " - " + message.message + "\n";
}
});
return output;
}
});
/*global CSSLint*/
CSSLint.addFormatter({
//format information
id: "csslint-xml",
name: "CSSLint XML format",
/**
* Return opening root XML tag.
* @return {String} to prepend before all results
*/
startFormat: function(){
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><csslint>";
},
/**
* Return closing root XML tag.
* @return {String} to append after all results
*/
endFormat: function(){
return "</csslint>";
},
/**
* Given CSS Lint results for a file, return output for this format.
* @param results {Object} with error and warning messages
* @param filename {String} relative file path
* @param options {Object} (UNUSED for now) specifies special handling of output
* @return {String} output for results
*/
formatResults: function(results, filename, options) {
var messages = results.messages,
output = [];
/**
* Replace special characters before write to output.
*
* Rules:
* - single quotes is the escape sequence for double-quotes
* - &lt; is the escape sequence for <
* - &gt; is the escape sequence for >
*
* @param {String} message to escape
* @return escaped message as {String}
*/
var escapeSpecialCharacters = function(str) {
if (!str || str.constructor !== String) {
return "";
}
return str.replace(/\"/g, "'").replace(/</g, "&lt;").replace(/>/g, "&gt;");
};
if (messages.length > 0) {
output.push("<file name=\""+filename+"\">");
CSSLint.Util.forEach(messages, function (message, i) {
if (message.rollup) {
output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
} else {
output.push("<issue line=\"" + message.line + "\" char=\"" + message.col + "\" severity=\"" + message.type + "\"" +
" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
}
});
output.push("</file>");
}
return output.join("");
}
});
/*global CSSLint*/
CSSLint.addFormatter({
//format information
id: "lint-xml",
name: "Lint XML format",
/**
* Return opening root XML tag.
* @return {String} to prepend before all results
*/
startFormat: function(){
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><lint>";
},
/**
* Return closing root XML tag.
* @return {String} to append after all results
*/
endFormat: function(){
return "</lint>";
},
/**
* Given CSS Lint results for a file, return output for this format.
* @param results {Object} with error and warning messages
* @param filename {String} relative file path
* @param options {Object} (UNUSED for now) specifies special handling of output
* @return {String} output for results
*/
formatResults: function(results, filename, options) {
var messages = results.messages,
output = [];
/**
* Replace special characters before write to output.
*
* Rules:
* - single quotes is the escape sequence for double-quotes
* - &lt; is the escape sequence for <
* - &gt; is the escape sequence for >
*
* @param {String} message to escape
* @return escaped message as {String}
*/
var escapeSpecialCharacters = function(str) {
if (!str || str.constructor !== String) {
return "";
}
return str.replace(/\"/g, "'").replace(/</g, "&lt;").replace(/>/g, "&gt;");
};
if (messages.length > 0) {
output.push("<file name=\""+filename+"\">");
CSSLint.Util.forEach(messages, function (message, i) {
if (message.rollup) {
output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
} else {
output.push("<issue line=\"" + message.line + "\" char=\"" + message.col + "\" severity=\"" + message.type + "\"" +
" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
}
});
output.push("</file>");
}
return output.join("");
}
});
/*global CSSLint*/
CSSLint.addFormatter({
//format information
id: "text",
name: "Plain Text",
/**
* Return content to be printed before all file results.
* @return {String} to prepend before all results
*/
startFormat: function() {
return "";
},
/**
* Return content to be printed after all file results.
* @return {String} to append after all results
*/
endFormat: function() {
return "";
},
/**
* Given CSS Lint results for a file, return output for this format.
* @param results {Object} with error and warning messages
* @param filename {String} relative file path
* @param options {Object} (Optional) specifies special handling of output
* @return {String} output for results
*/
formatResults: function(results, filename, options) {
var messages = results.messages,
output = "";
options = options || {};
if (messages.length === 0) {
return options.quiet ? "" : "\n\ncsslint: No errors in " + filename + ".";
}
output = "\n\ncsslint: There are " + messages.length + " problems in " + filename + ".";
var pos = filename.lastIndexOf("/"),
shortFilename = filename;
if (pos === -1){
pos = filename.lastIndexOf("\\");
}
if (pos > -1){
shortFilename = filename.substring(pos+1);
}
CSSLint.Util.forEach(messages, function (message, i) {
output = output + "\n\n" + shortFilename;
if (message.rollup) {
output += "\n" + (i+1) + ": " + message.type;
output += "\n" + message.message;
} else {
output += "\n" + (i+1) + ": " + message.type + " at line " + message.line + ", col " + message.col;
output += "\n" + message.message;
output += "\n" + message.evidence;
}
});
return output;
}
});
exports.CSSLint = CSSLint;

View file

@ -27,33 +27,68 @@
* 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 lang = require("../lib/lang");
var Mirror = require("../worker/mirror").Mirror;
var CSSLint = require("./css/csslint").CSSLint;
var Worker = exports.Worker = function(sender) {
Mirror.call(this, sender);
this.setTimeout(200);
this.setTimeout(400);
this.ruleset = null;
this.setDisabledRules("");
this.setInfoRules("adjoining-classes|qualified-headings|zero-units|gradients|import|outline-none");
};
oop.inherits(Worker, Mirror);
(function() {
this.setInfoRules = function(ruleNames) {
if (typeof ruleNames == "string")
ruleNames = ruleNames.split("|");
this.infoRules = lang.arrayToMap(ruleNames);
this.doc.getValue() && this.deferredUpdate.schedule(100);
};
this.setDisabledRules = function(ruleNames) {
if (!ruleNames) {
this.ruleset = null;
} else {
if (typeof ruleNames == "string")
ruleNames = ruleNames.split("|");
var all = {};
CSSLint.getRules().forEach(function(x){
all[x.id] = true;
});
ruleNames.forEach(function(x) {
delete all[x];
});
console.log(all)
this.ruleset = all;
}
this.doc.getValue() && this.deferredUpdate.schedule(100);
};
this.onUpdate = function() {
var value = this.doc.getValue();
var result = CSSLint.verify(value);
var infoRules = this.infoRules;
var result = CSSLint.verify(value, this.ruleset);
this.sender.emit("csslint", result.messages.map(function(msg) {
delete msg.rule;
return msg;
return {
row: msg.line - 1,
column: msg.col - 1,
text: msg.message,
type: infoRules[msg.rule.id] ? "info" : msg.type
}
}));
};
}).call(Worker.prototype);
});

View file

@ -68,7 +68,7 @@ var HtmlHighlightRules = function() {
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml_pe",
token : "xml-pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",
@ -76,7 +76,7 @@ var HtmlHighlightRules = function() {
regex : "<\\!--",
next : "comment"
}, {
token : "xml_pe",
token : "xml-pe",
regex : "<\\!.*?>"
}, {
token : "meta.tag",

View file

@ -123,25 +123,9 @@ oop.inherits(Mode, TextMode);
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
worker.attachToDocument(session.getDocument());
worker.on("jslint", function(results) {
var errors = [];
for (var i=0; i<results.data.length; i++) {
var error = results.data[i];
if (error)
errors.push({
row: error.line-1,
column: error.character-1,
text: error.reason,
type: "warning",
lint: error
});
}
session.setAnnotations(errors);
});
worker.on("narcissus", function(e) {
session.setAnnotations([e.data]);
session.setAnnotations(results.data);
});
worker.on("terminate", function() {

File diff suppressed because it is too large Load diff

View file

@ -51,11 +51,11 @@ var JavaScriptHighlightRules = function() {
"JSON|Math|" + // Other
"this|arguments|prototype|window|document" , // Pseudo
"invalid.deprecated":
"__parent__|__count__|escape|unescape|with|__proto__|debugger",
"__parent__|__count__|escape|unescape|with|__proto__",
"keyword":
"const|yield|import|get|set" +
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|",
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger",
"storage.type":
"const|let|var|function",
"invalid.illegal":
@ -63,9 +63,10 @@ var JavaScriptHighlightRules = function() {
"public|interface|package|protected|static",
"constant.language":
"null|Infinity|NaN|undefined",
"support.function":
"alert",
}, "identifier");
// keywords which can be followed by regular expressions
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";

View file

@ -27,55 +27,158 @@
* 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 Mirror = require("../worker/mirror").Mirror;
var lint = require("../worker/jshint").JSHINT;
var parser = require("../narcissus/parser");
var lint = require("./javascript/jshint").JSHINT;
function startRegex(arr) {
return RegExp("^(" + arr.join("|") + ")");
}
var disabledWarningsRe = startRegex([
"Bad for in variable '(.+)'.",
'Missing "use strict"'
]);
var errorsRe = startRegex([
"Unexpected",
"Expected ",
"Confusing (plus|minus)",
"\\{a\\} unterminated regular expression",
"Unclosed ",
"Unmatched ",
"Unbegun comment",
"Bad invocation",
"Missing space after",
"Missing operator at"
]);
var infoRe = startRegex([
"Expected an assignment",
"Bad escapement of EOL",
"Unexpected comma",
"Unexpected space",
"Missing radix parameter.",
"A leading decimal point can",
"\\['\\{a\\}'\\] is better written in dot notation."
]);
var JavaScriptWorker = exports.JavaScriptWorker = function(sender) {
Mirror.call(this, sender);
this.setTimeout(500);
this.setOptions();
};
oop.inherits(JavaScriptWorker, Mirror);
(function() {
this.setOptions = function(options) {
this.options = options || {
// undef: true,
// unused: true,
es5: true,
esnext: true,
devel: true,
browser: true,
node: true,
laxcomma: true,
laxbreak: true,
lastsemic: true,
onevar: false,
passfail: false,
maxerr: 100,
expr: true,
multistr: true,
globalstrict: true
};
this.doc.getValue() && this.deferredUpdate.schedule(100);
};
this.changeOptions = function(newOptions) {
oop.mixin(this.options, newOptions);
this.doc.getValue() && this.deferredUpdate.schedule(100);
};
this.isValidJS = function(str) {
try {
// evaluated code can only create variables in this function
eval("throw 0;" + str);
} catch(e) {
if (e === 0)
return true;
}
return false
};
this.onUpdate = function() {
var value = this.doc.getValue();
value = value.replace(/^#!.*\n/, "\n");
// var start = new Date();
try {
parser.parse(value);
} catch(e) {
// console.log("narcissus")
// console.log(e);
var chunks = e.message.split(":")
var message = chunks.pop().trim();
var lineNumber = parseInt(chunks.pop().trim()) - 1;
this.sender.emit("narcissus", {
row: lineNumber,
column: null, // TODO convert e.cursor
text: message,
type: "error"
});
if (!value) {
this.sender.emit("jslint", []);
return;
} finally {
// console.log("parse time: " + (new Date() - start));
}
// var start = new Date();
// console.log("jslint")
lint(value, {undef: false, onevar: false, passfail: false});
this.sender.emit("jslint", lint.errors);
// console.log("lint time: " + (new Date() - start));
}
var errors = [];
// jshint reports many false errors
// report them as error only if code is actually invalid
var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
// var start = new Date();
lint(value, this.options);
var results = lint.errors;
var errorAdded = false
for (var i = 0; i < results.length; i++) {
var error = results[i];
if (!error)
continue;
var raw = error.raw;
var type = "warning";
if (raw == "Missing semicolon.") {
var str = error.evidence.substr(error.character);
str = str.charAt(str.search(/\S/));
if (maxErrorLevel == "error" && str && /[\w\d{(['"]/.test(str)) {
error.reason = 'Missing ";" before statement';
type = "error";
}
}
else if (disabledWarningsRe.test(raw)) {
continue;
}
else if (infoRe.test(raw)) {
type = "info"
}
else if (errorsRe.test(raw)) {
errorAdded = true;
type = maxErrorLevel;
}
else if (raw == "'{a}' is not defined.") {
type = "warning";
}
else if (raw == "'{a}' is defined but never used.") {
type = "info";
}
errors.push({
row: error.line-1,
column: error.character-1,
text: error.reason,
type: type,
raw: raw
});
if (errorAdded) {
// break;
}
}
// console.log("lint time: " + (new Date() - start));
this.sender.emit("jslint", errors);
};
}).call(JavaScriptWorker.prototype);
});

View file

@ -58,11 +58,11 @@ module.exports = {
worker.setValue("Juhu Kinners");
worker.deferredUpdate.call();
var error = this.sender.events[0][1];
assert.equal(error.text, "missing ; before statement");
var error = this.sender.events[0][1][0];
assert.equal(error.text, 'Missing ";" before statement');
assert.equal(error.type, "error");
assert.equal(error.row, 0);
assert.equal(error.column, null);
assert.equal(error.column, 4);
},
"test invalid multi line string": function() {
@ -70,18 +70,23 @@ module.exports = {
worker.setValue('"a\n\\nn"');
worker.deferredUpdate.call();
var error = this.sender.events[0][1];
assert.equal(error.text, "Unterminated string literal");
var error = this.sender.events[0][1][0];
assert.equal(error.text, "Unclosed string.");
assert.equal(error.type, "error");
assert.equal(error.row, 0);
assert.equal(error.column, null);
assert.equal(error.column, 0);
},
"test check for narcissus bug": function() {
"test another invalid string": function() {
var worker = new JavaScriptWorker(this.sender);
worker.setValue("if('");
worker.deferredUpdate.call();
assert.equal(this.sender.events[0][1].type, "error");
var error = this.sender.events[0][1][0];
assert.equal(error.text, "Unclosed string.");
assert.equal(error.type, "error");
assert.equal(error.row, 0);
assert.equal(error.column, 3);
}
};

View file

@ -87,7 +87,7 @@ var LiquidHighlightRules = function() {
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml_pe",
token : "xml-pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",

View file

@ -1,7 +1,7 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -26,23 +26,35 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
// Global variables to hide from the interpreter
exports.hiddenHostGlobals = { Narcissus: true };
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var TypeScriptHighlightRules = require("./typescript_highlight_rules").TypeScriptHighlightRules;
// Desugar SpiderMonkey language extensions?
exports.desugarExtensions = false;
var Mode = function() {
var highlighter = new TypeScriptHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
// Allow HTML comments?
exports.allowHTMLComments = false;
(function() {
// Extra logic goes here.
}).call(Mode.prototype);
// Allow non-standard Mozilla extensions?
exports.mozillaMode = true;
// Allow experimental paren-free mode?
exports.parenFreeMode = false;
});
exports.Mode = Mode;
});

View file

@ -0,0 +1,98 @@
/* ***** 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.
*
*
* Contributor(s):
*
* Garen J. Torikian <gjtorikian AT gmail DOT com>
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 21e323af-f665-4161-96e7-5087d262557e) */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
var TypeScriptHighlightRules = function() {
var tsRules = [
// Match stuff like: module name {...}
{
"token": ["keyword.operator.ts", "text", "variable.parameter.function.ts", "text"],
"regex": "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*\\{)"
},
// Match stuff like: super(argument, list)
{
"token": ["storage.type.variable.ts", "text", "keyword.other.ts", "text"],
"regex": "(super)(\\s*\\()([a-zA-Z0-9,_?.$\\s]+\\s*)(\\))"
},
// Match stuff like: function() {...}
{
"token": ["entity.name.function.ts","paren.lparen", "paren.rparen"],
"regex": "([a-zA-Z_?.$][\\w?.$]*)(\\()(\\))"
},
// Match stuff like: (function: return type)
{
"token": ["variable.parameter.function.ts", "text", "variable.parameter.function.ts"],
"regex": "([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*:\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)"
},
{
"token": ["keyword.operator.ts"],
"regex": "(?:\\b(constructor|declare|interface|as|AS|public|private|class|extends|export|super)\\b)"
},
{
"token": ["storage.type.variable.ts"],
"regex": "(?:\\b(this\\.|string\\b|bool\\b|number)\\b)"
},
{
"token": ["keyword.operator.ts", "storage.type.variable.ts", "keyword.operator.ts", "storage.type.variable.ts"],
"regex": "(class)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)(extends)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)?"
},
{
"token": "keyword",
"regex": "(?:super|export|class|extends|import)\\b"
}
];
var JSRules = new JavaScriptHighlightRules().getRules();
JSRules.start = tsRules.concat(JSRules.start);
this.$rules = JSRules;
};
oop.inherits(TypeScriptHighlightRules, JavaScriptHighlightRules);
exports.TypeScriptHighlightRules = TypeScriptHighlightRules;
});

View file

@ -45,7 +45,7 @@ var XmlHighlightRules = function() {
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml_pe",
token : "xml-pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",
@ -53,7 +53,7 @@ var XmlHighlightRules = function() {
regex : "<\\!--",
next : "comment"
}, {
token : "xml_pe",
token : "xml-pe",
regex : "<\\!.*?>"
}, {
token : "meta.tag", // opening tag

View file

@ -121,12 +121,12 @@ var XQueryParser = function(input, state) {
this.ap = function(token)
{
this.addToken(token, "xml_pe");
this.addToken(token, "xml-pe");
};
this.ax = function(start, stop)
{
this.highlighter.addToken(start.getStartIndex(), stop.getStopIndex(), "xml_pe");
this.highlighter.addToken(start.getStartIndex(), stop.getStopIndex(), "xml-pe");
};
this.at = function(start, stop)

View file

@ -48,7 +48,7 @@ var XQueryHighlightRules = function() {
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml_pe",
token : "xml-pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",

View file

@ -50,9 +50,13 @@ function GutterHandler(mouseHandler) {
if (e.getShiftKey())
selection.selectTo(row, 0);
else
else {
if (e.domEvent.detail == 2) {
editor.selectAll();
return e.preventDefault();
}
mouseHandler.$clickSelection = editor.selection.getLineRange(row);
}
mouseHandler.captureMouse(e, "selectByLines");
return e.preventDefault();
});
@ -61,7 +65,7 @@ function GutterHandler(mouseHandler) {
var tooltipTimeout, mouseEvent, tooltip, tooltipAnnotation;
function createTooltip() {
tooltip = dom.createElement("div");
tooltip.className = "ace_gutter_tooltip";
tooltip.className = "ace_gutter-tooltip";
tooltip.style.maxWidth = "500px";
tooltip.style.display = "none";
editor.container.appendChild(tooltip);
@ -86,7 +90,7 @@ function GutterHandler(mouseHandler) {
if (tooltipAnnotation == annotation)
return;
tooltipAnnotation = annotation.text.join("\n");
tooltipAnnotation = annotation.text.join("<br/>");
tooltip.style.display = "block";
tooltip.innerHTML = tooltipAnnotation;
@ -130,7 +134,7 @@ function GutterHandler(mouseHandler) {
return;
tooltipTimeout = setTimeout(function() {
tooltipTimeout = null;
if (mouseEvent)
if (mouseEvent && !mouseHandler.isMousePressed)
showTooltip();
else
hideTooltip();

View file

@ -115,6 +115,8 @@ var MouseHandler = function(editor) {
this.x = ev.x;
this.y = ev.y;
this.isMousePressed = true;
// do not move textarea during selection
var renderer = this.editor.renderer;
@ -135,6 +137,7 @@ var MouseHandler = function(editor) {
renderer.$keepTextAreaAtCursor = true;
renderer.$moveTextAreaToCursor();
}
self.isMousePressed = false;
};
var onCaptureInterval = function() {

View file

@ -399,7 +399,7 @@ var Editor = require("./editor").Editor;
return;
this.inMultiSelectMode = true;
this.setStyle("multiselect");
this.setStyle("ace_multiselect");
this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
this.commands.on("exec", this.$onMultiSelectExec);
@ -412,7 +412,7 @@ var Editor = require("./editor").Editor;
return;
this.inMultiSelectMode = false;
this.unsetStyle("multiselect");
this.unsetStyle("ace_multiselect");
this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
this.commands.removeEventListener("exec", this.$onMultiSelectExec);

View file

@ -1,683 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, 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 ***** */
/*
* Narcissus - JS implemented in JS.
*
* Well-known constants and lookup tables. Many consts are generated from the
* tokens table via eval to minimize redundancy, so consumers must be compiled
* separately to take advantage of the simple switch-case constant propagation
* done by SpiderMonkey.
*/
define(function(require, exports, module) {
var tokens = [
// End of source.
"END",
// Operators and punctuators. Some pair-wise order matters, e.g. (+, -)
// and (UNARY_PLUS, UNARY_MINUS).
"\n", ";",
",",
"=",
"?", ":", "CONDITIONAL",
"||",
"&&",
"|",
"^",
"&",
"==", "!=", "===", "!==",
"<", "<=", ">=", ">",
"<<", ">>", ">>>",
"+", "-",
"*", "/", "%",
"!", "~", "UNARY_PLUS", "UNARY_MINUS",
"++", "--",
".",
"[", "]",
"{", "}",
"(", ")",
// Nonterminal tree node type codes.
"SCRIPT", "BLOCK", "LABEL", "FOR_IN", "CALL", "NEW_WITH_ARGS", "INDEX",
"ARRAY_INIT", "OBJECT_INIT", "PROPERTY_INIT", "GETTER", "SETTER",
"GROUP", "LIST", "LET_BLOCK", "ARRAY_COMP", "GENERATOR", "COMP_TAIL",
// Contextual keywords.
"IMPLEMENTS", "INTERFACE", "LET", "MODULE", "PACKAGE", "PRIVATE",
"PROTECTED", "PUBLIC", "STATIC", "USE", "YIELD",
// Terminals.
"IDENTIFIER", "NUMBER", "STRING", "REGEXP",
// Keywords.
"break",
"case", "catch", "const", "continue",
"debugger", "default", "delete", "do",
"else", "export",
"false", "finally", "for", "function",
"if", "import", "in", "instanceof",
"new", "null",
"return",
"switch",
"this", "throw", "true", "try", "typeof",
"var", "void",
"while", "with",
];
var strictKeywords = {
__proto__: null,
"implements": true,
"interface": true,
"let": true,
//"module": true,
"package": true,
"private": true,
"protected": true,
"public": true,
"static": true,
"use": true,
"yield": true
};
var statementStartTokens = [
"break",
"const", "continue",
"debugger", "do",
"for",
"if",
"let",
"return",
"switch",
"throw", "try",
"var",
"yield",
"while", "with",
];
// Whitespace characters (see ECMA-262 7.2)
var whitespaceChars = [
// normal whitespace:
"\u0009", "\u000B", "\u000C", "\u0020", "\u00A0", "\uFEFF",
// high-Unicode whitespace:
"\u1680", "\u180E",
"\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006",
"\u2007", "\u2008", "\u2009", "\u200A",
"\u202F", "\u205F", "\u3000"
];
var whitespace = {};
for (var i = 0; i < whitespaceChars.length; i++) {
whitespace[whitespaceChars[i]] = true;
}
// Operator and punctuator mapping from token to tree node type name.
// NB: because the lexer doesn't backtrack, all token prefixes must themselves
// be valid tokens (e.g. !== is acceptable because its prefixes are the valid
// tokens != and !).
var opTypeNames = {
'\n': "NEWLINE",
';': "SEMICOLON",
',': "COMMA",
'?': "HOOK",
':': "COLON",
'||': "OR",
'&&': "AND",
'|': "BITWISE_OR",
'^': "BITWISE_XOR",
'&': "BITWISE_AND",
'===': "STRICT_EQ",
'==': "EQ",
'=': "ASSIGN",
'!==': "STRICT_NE",
'!=': "NE",
'<<': "LSH",
'<=': "LE",
'<': "LT",
'>>>': "URSH",
'>>': "RSH",
'>=': "GE",
'>': "GT",
'++': "INCREMENT",
'--': "DECREMENT",
'+': "PLUS",
'-': "MINUS",
'*': "MUL",
'/': "DIV",
'%': "MOD",
'!': "NOT",
'~': "BITWISE_NOT",
'.': "DOT",
'[': "LEFT_BRACKET",
']': "RIGHT_BRACKET",
'{': "LEFT_CURLY",
'}': "RIGHT_CURLY",
'(': "LEFT_PAREN",
')': "RIGHT_PAREN"
};
// Hash of keyword identifier to tokens index. NB: we must null __proto__ to
// avoid toString, etc. namespace pollution.
var keywords = {__proto__: null};
var mozillaKeywords = {__proto__: null};
// Define const END, etc., based on the token names. Also map name to index.
var tokenIds = {};
var hostSupportsEvalConst = (function() {
try {
return eval("(function(s) { eval(s); return x })('const x = true;')");
} catch (e) {
return false;
}
})();
// Building up a string to be eval'd in different contexts.
var consts = hostSupportsEvalConst ? "const " : "var ";
for (var i = 0, j = tokens.length; i < j; i++) {
if (i > 0)
consts += ", ";
var t = tokens[i];
var name;
if (/^[a-z]/.test(t)) {
name = t.toUpperCase();
if (name === "LET" || name === "YIELD")
mozillaKeywords[name] = i;
if (strictKeywords[name])
strictKeywords[name] = i;
keywords[t] = i;
} else {
name = (/^\W/.test(t) ? opTypeNames[t] : t);
}
consts += name + " = " + i;
tokenIds[name] = i;
tokens[t] = i;
}
consts += ";";
var isStatementStartCode = {__proto__: null};
for (i = 0, j = statementStartTokens.length; i < j; i++)
isStatementStartCode[keywords[statementStartTokens[i]]] = true;
// Map assignment operators to their indexes in the tokens array.
var assignOps = ['|', '^', '&', '<<', '>>', '>>>', '+', '-', '*', '/', '%'];
for (i = 0, j = assignOps.length; i < j; i++) {
t = assignOps[i];
assignOps[t] = tokens[t];
}
function defineGetter(obj, prop, fn, dontDelete, dontEnum) {
Object.defineProperty(obj, prop,
{ get: fn, configurable: !dontDelete, enumerable: !dontEnum });
}
function defineGetterSetter(obj, prop, getter, setter, dontDelete, dontEnum) {
Object.defineProperty(obj, prop, {
get: getter,
set: setter,
configurable: !dontDelete,
enumerable: !dontEnum
});
}
function defineMemoGetter(obj, prop, fn, dontDelete, dontEnum) {
Object.defineProperty(obj, prop, {
get: function() {
var val = fn();
defineProperty(obj, prop, val, dontDelete, true, dontEnum);
return val;
},
configurable: true,
enumerable: !dontEnum
});
}
function defineProperty(obj, prop, val, dontDelete, readOnly, dontEnum) {
Object.defineProperty(obj, prop,
{ value: val, writable: !readOnly, configurable: !dontDelete,
enumerable: !dontEnum });
}
// Returns true if fn is a native function. (Note: SpiderMonkey specific.)
function isNativeCode(fn) {
// Relies on the toString method to identify native code.
return ((typeof fn) === "function") && fn.toString().match(/\[native code\]/);
}
var Fpapply = Function.prototype.apply;
function apply(f, o, a) {
return Fpapply.call(f, [o].concat(a));
}
var applyNew;
// ES5's bind is a simpler way to implement applyNew
if (Function.prototype.bind) {
applyNew = function applyNew(f, a) {
return new (f.bind.apply(f, [,].concat(Array.prototype.slice.call(a))))();
};
} else {
applyNew = function applyNew(f, a) {
switch (a.length) {
case 0:
return new f();
case 1:
return new f(a[0]);
case 2:
return new f(a[0], a[1]);
case 3:
return new f(a[0], a[1], a[2]);
default:
var argStr = "a[0]";
for (var i = 1, n = a.length; i < n; i++)
argStr += ",a[" + i + "]";
return eval("new f(" + argStr + ")");
}
};
}
function getPropertyDescriptor(obj, name) {
while (obj) {
if (({}).hasOwnProperty.call(obj, name))
return Object.getOwnPropertyDescriptor(obj, name);
obj = Object.getPrototypeOf(obj);
}
}
function getPropertyNames(obj) {
var table = Object.create(null, {});
while (obj) {
var names = Object.getOwnPropertyNames(obj);
for (var i = 0, n = names.length; i < n; i++)
table[names[i]] = true;
obj = Object.getPrototypeOf(obj);
}
return Object.keys(table);
}
function getOwnProperties(obj) {
var map = {};
for (var name in Object.getOwnPropertyNames(obj))
map[name] = Object.getOwnPropertyDescriptor(obj, name);
return map;
}
function blacklistHandler(target, blacklist) {
var mask = Object.create(null, {});
var redirect = Dict.create(blacklist).mapObject(function(name) { return mask; });
return mixinHandler(redirect, target);
}
function whitelistHandler(target, whitelist) {
var catchall = Object.create(null, {});
var redirect = Dict.create(whitelist).mapObject(function(name) { return target; });
return mixinHandler(redirect, catchall);
}
/*
* Mixin proxies break the single-inheritance model of prototypes, so
* the handler treats all properties as own-properties:
*
* X
* |
* +------------+------------+
* | O |
* | | |
* | O O O |
* | | | | |
* | O O O O |
* | | | | | |
* | O O O O O |
* | | | | | | |
* +-(*)--(w)--(x)--(y)--(z)-+
*/
function mixinHandler(redirect, catchall) {
function targetFor(name) {
return hasOwn(redirect, name) ? redirect[name] : catchall;
}
function getMuxPropertyDescriptor(name) {
var desc = getPropertyDescriptor(targetFor(name), name);
if (desc)
desc.configurable = true;
return desc;
}
function getMuxPropertyNames() {
var names1 = Object.getOwnPropertyNames(redirect).filter(function(name) {
return name in redirect[name];
});
var names2 = getPropertyNames(catchall).filter(function(name) {
return !hasOwn(redirect, name);
});
return names1.concat(names2);
}
function enumerateMux() {
var result = Object.getOwnPropertyNames(redirect).filter(function(name) {
return name in redirect[name];
});
for (name in catchall) {
if (!hasOwn(redirect, name))
result.push(name);
};
return result;
}
function hasMux(name) {
return name in targetFor(name);
}
return {
getOwnPropertyDescriptor: getMuxPropertyDescriptor,
getPropertyDescriptor: getMuxPropertyDescriptor,
getOwnPropertyNames: getMuxPropertyNames,
defineProperty: function(name, desc) {
Object.defineProperty(targetFor(name), name, desc);
},
"delete": function(name) {
var target = targetFor(name);
return delete target[name];
},
// FIXME: ha ha ha
fix: function() { },
has: hasMux,
hasOwn: hasMux,
get: function(receiver, name) {
var target = targetFor(name);
return target[name];
},
set: function(receiver, name, val) {
var target = targetFor(name);
target[name] = val;
return true;
},
enumerate: enumerateMux,
keys: enumerateMux
};
}
function makePassthruHandler(obj) {
// Handler copied from
// http://wiki.ecmascript.org/doku.php?id=harmony:proxies&s=proxy%20object#examplea_no-op_forwarding_proxy
return {
getOwnPropertyDescriptor: function(name) {
var desc = Object.getOwnPropertyDescriptor(obj, name);
// a trapping proxy's properties must always be configurable
desc.configurable = true;
return desc;
},
getPropertyDescriptor: function(name) {
var desc = getPropertyDescriptor(obj, name);
// a trapping proxy's properties must always be configurable
desc.configurable = true;
return desc;
},
getOwnPropertyNames: function() {
return Object.getOwnPropertyNames(obj);
},
defineProperty: function(name, desc) {
Object.defineProperty(obj, name, desc);
},
"delete": function(name) { return delete obj[name]; },
fix: function() {
if (Object.isFrozen(obj)) {
return getOwnProperties(obj);
}
// As long as obj is not frozen, the proxy won't allow itself to be fixed.
return undefined; // will cause a TypeError to be thrown
},
has: function(name) { return name in obj; },
hasOwn: function(name) { return ({}).hasOwnProperty.call(obj, name); },
get: function(receiver, name) { return obj[name]; },
// bad behavior when set fails in non-strict mode
set: function(receiver, name, val) { obj[name] = val; return true; },
enumerate: function() {
var result = [];
for (name in obj) { result.push(name); };
return result;
},
keys: function() { return Object.keys(obj); }
};
}
var hasOwnProperty = ({}).hasOwnProperty;
function hasOwn(obj, name) {
return hasOwnProperty.call(obj, name);
}
function Dict(table, size) {
this.table = table || Object.create(null, {});
this.size = size || 0;
}
Dict.create = function(table) {
var init = Object.create(null, {});
var size = 0;
var names = Object.getOwnPropertyNames(table);
for (var i = 0, n = names.length; i < n; i++) {
var name = names[i];
init[name] = table[name];
size++;
}
return new Dict(init, size);
};
Dict.prototype = {
has: function(x) { return hasOwnProperty.call(this.table, x); },
set: function(x, v) {
if (!hasOwnProperty.call(this.table, x))
this.size++;
this.table[x] = v;
},
get: function(x) { return this.table[x]; },
getDef: function(x, thunk) {
if (!hasOwnProperty.call(this.table, x)) {
this.size++;
this.table[x] = thunk();
}
return this.table[x];
},
forEach: function(f) {
var table = this.table;
for (var key in table)
f.call(this, key, table[key]);
},
map: function(f) {
var table1 = this.table;
var table2 = Object.create(null, {});
this.forEach(function(key, val) {
table2[key] = f.call(this, val, key);
});
return new Dict(table2, this.size);
},
mapObject: function(f) {
var table1 = this.table;
var table2 = Object.create(null, {});
this.forEach(function(key, val) {
table2[key] = f.call(this, val, key);
});
return table2;
},
toObject: function() {
return this.mapObject(function(val) { return val; });
},
choose: function() {
return Object.getOwnPropertyNames(this.table)[0];
},
remove: function(x) {
if (hasOwnProperty.call(this.table, x)) {
this.size--;
delete this.table[x];
}
},
copy: function() {
var table = Object.create(null, {});
for (var key in this.table)
table[key] = this.table[key];
return new Dict(table, this.size);
},
keys: function() {
return Object.keys(this.table);
},
toString: function() { return "[object Dict]" }
};
var _WeakMap = typeof WeakMap === "function" ? WeakMap : (function() {
// shim for ES6 WeakMap with poor asymptotics
function WeakMap(array) {
this.array = array || [];
}
function searchMap(map, key, found, notFound) {
var a = map.array;
for (var i = 0, n = a.length; i < n; i++) {
var pair = a[i];
if (pair.key === key)
return found(pair, i);
}
return notFound();
}
WeakMap.prototype = {
has: function(x) {
return searchMap(this, x, function() { return true }, function() { return false });
},
set: function(x, v) {
var a = this.array;
searchMap(this, x,
function(pair) { pair.value = v },
function() { a.push({ key: x, value: v }) });
},
get: function(x) {
return searchMap(this, x,
function(pair) { return pair.value },
function() { return null });
},
"delete": function(x) {
var a = this.array;
searchMap(this, x,
function(pair, i) { a.splice(i, 1) },
function() { });
},
toString: function() { return "[object WeakMap]" }
};
return WeakMap;
})();
// non-destructive stack
function Stack(elts) {
this.elts = elts || null;
}
Stack.prototype = {
push: function(x) {
return new Stack({ top: x, rest: this.elts });
},
top: function() {
if (!this.elts)
throw new Error("empty stack");
return this.elts.top;
},
isEmpty: function() {
return this.top === null;
},
find: function(test) {
for (var elts = this.elts; elts; elts = elts.rest) {
if (test(elts.top))
return elts.top;
}
return null;
},
has: function(x) {
return Boolean(this.find(function(elt) { return elt === x }));
},
forEach: function(f) {
for (var elts = this.elts; elts; elts = elts.rest) {
f(elts.top);
}
}
};
if (!Array.prototype.copy) {
defineProperty(Array.prototype, "copy",
function() {
var result = [];
for (var i = 0, n = this.length; i < n; i++)
result[i] = this[i];
return result;
}, false, false, true);
}
if (!Array.prototype.top) {
defineProperty(Array.prototype, "top",
function() {
return this.length && this[this.length-1];
}, false, false, true);
}
exports.tokens = tokens;
exports.whitespace = whitespace;
exports.opTypeNames = opTypeNames;
exports.keywords = keywords;
exports.mozillaKeywords = mozillaKeywords;
exports.strictKeywords = strictKeywords;
exports.isStatementStartCode = isStatementStartCode;
exports.tokenIds = tokenIds;
exports.consts = consts;
exports.assignOps = assignOps;
exports.defineGetter = defineGetter;
exports.defineGetterSetter = defineGetterSetter;
exports.defineMemoGetter = defineMemoGetter;
exports.defineProperty = defineProperty;
exports.isNativeCode = isNativeCode;
exports.apply = apply;
exports.applyNew = applyNew;
exports.mixinHandler = mixinHandler;
exports.whitelistHandler = whitelistHandler;
exports.blacklistHandler = blacklistHandler;
exports.makePassthruHandler = makePassthruHandler;
exports.Dict = Dict;
exports.WeakMap = _WeakMap;
exports.Stack = Stack;
});

View file

@ -1,584 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, 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 ***** */
/*
* Narcissus - JS implemented in JS.
*
* Lexical scanner.
*/
define(function(require, exports, module) {
var definitions = require('./definitions');
// Set constants in the local scope.
eval(definitions.consts);
// Build up a trie of operator tokens.
var opTokens = {};
for (var op in definitions.opTypeNames) {
if (op === '\n' || op === '.')
continue;
var node = opTokens;
for (var i = 0; i < op.length; i++) {
var ch = op[i];
if (!(ch in node))
node[ch] = {};
node = node[ch];
node.op = op;
}
}
/*
* Since JavaScript provides no convenient way to determine if a
* character is in a particular Unicode category, we use
* metacircularity to accomplish this (oh yeaaaah!)
*/
function isValidIdentifierChar(ch, first) {
// check directly for ASCII
if (ch <= "\u007F") {
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch === '$' || ch === '_' ||
(!first && (ch >= '0' && ch <= '9'))) {
return true;
}
return false;
}
// create an object to test this in
var x = {};
x["x"+ch] = true;
x[ch] = true;
// then use eval to determine if it's a valid character
var valid = false;
try {
valid = (Function("x", "return (x." + (first?"":"x") + ch + ");")(x) === true);
} catch (ex) {}
return valid;
}
function isIdentifier(str) {
if (typeof str !== "string")
return false;
if (str.length === 0)
return false;
if (!isValidIdentifierChar(str[0], true))
return false;
for (var i = 1; i < str.length; i++) {
if (!isValidIdentifierChar(str[i], false))
return false;
}
return true;
}
/*
* Tokenizer :: (source, filename, line number, boolean) -> Tokenizer
*/
function Tokenizer(s, f, l, allowHTMLComments) {
this.cursor = 0;
this.source = String(s);
this.tokens = [];
this.tokenIndex = 0;
this.lookahead = 0;
this.scanNewlines = false;
this.filename = f || "";
this.lineno = l || 1;
this.allowHTMLComments = allowHTMLComments;
this.blockComments = null;
}
Tokenizer.prototype = {
get done() {
// We need to set scanOperand to true here because the first thing
// might be a regexp.
return this.peek(true) === END;
},
get token() {
return this.tokens[this.tokenIndex];
},
match: function (tt, scanOperand, keywordIsName) {
return this.get(scanOperand, keywordIsName) === tt || this.unget();
},
mustMatch: function (tt, keywordIsName) {
if (!this.match(tt, false, keywordIsName)) {
throw this.newSyntaxError("Missing " +
definitions.tokens[tt].toLowerCase());
}
return this.token;
},
peek: function (scanOperand) {
var tt, next;
if (this.lookahead) {
next = this.tokens[(this.tokenIndex + this.lookahead) & 3];
tt = (this.scanNewlines && next.lineno !== this.lineno)
? NEWLINE
: next.type;
} else {
tt = this.get(scanOperand);
this.unget();
}
return tt;
},
peekOnSameLine: function (scanOperand) {
this.scanNewlines = true;
var tt = this.peek(scanOperand);
this.scanNewlines = false;
return tt;
},
lastBlockComment: function() {
var length = this.blockComments.length;
return length ? this.blockComments[length - 1] : null;
},
// Eat comments and whitespace.
skip: function () {
var input = this.source;
this.blockComments = [];
for (;;) {
var ch = input[this.cursor++];
var next = input[this.cursor];
// handle \r, \r\n and (always preferable) \n
if (ch === '\r') {
// if the next character is \n, we don't care about this at all
if (next === '\n') continue;
// otherwise, we want to consider this as a newline
ch = '\n';
}
if (ch === '\n' && !this.scanNewlines) {
this.lineno++;
} else if (ch === '/' && next === '*') {
var commentStart = ++this.cursor;
for (;;) {
ch = input[this.cursor++];
if (ch === undefined)
throw this.newSyntaxError("Unterminated comment");
if (ch === '*') {
next = input[this.cursor];
if (next === '/') {
var commentEnd = this.cursor - 1;
this.cursor++;
break;
}
} else if (ch === '\n') {
this.lineno++;
}
}
this.blockComments.push(input.substring(commentStart, commentEnd));
} else if ((ch === '/' && next === '/') ||
(this.allowHTMLComments && ch === '<' && next === '!' &&
input[this.cursor + 1] === '-' && input[this.cursor + 2] === '-' &&
(this.cursor += 2))) {
this.cursor++;
for (;;) {
ch = input[this.cursor++];
next = input[this.cursor];
if (ch === undefined)
return;
if (ch === '\r') {
// check for \r\n
if (next !== '\n') ch = '\n';
}
if (ch === '\n') {
if (this.scanNewlines) {
this.cursor--;
} else {
this.lineno++;
}
break;
}
}
} else if (!(ch in definitions.whitespace)) {
this.cursor--;
return;
}
}
},
// Lex the exponential part of a number, if present. Return true iff an
// exponential part was found.
lexExponent: function() {
var input = this.source;
var next = input[this.cursor];
if (next === 'e' || next === 'E') {
this.cursor++;
ch = input[this.cursor++];
if (ch === '+' || ch === '-')
ch = input[this.cursor++];
if (ch < '0' || ch > '9')
throw this.newSyntaxError("Missing exponent");
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '9');
this.cursor--;
return true;
}
return false;
},
lexZeroNumber: function (ch) {
var token = this.token, input = this.source;
token.type = NUMBER;
ch = input[this.cursor++];
if (ch === '.') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '9');
this.cursor--;
this.lexExponent();
token.value = parseFloat(
input.substring(token.start, this.cursor));
} else if (ch === 'x' || ch === 'X') {
do {
ch = input[this.cursor++];
} while ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') ||
(ch >= 'A' && ch <= 'F'));
this.cursor--;
token.value = parseInt(input.substring(token.start, this.cursor));
} else if (ch >= '0' && ch <= '7') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '7');
this.cursor--;
token.value = parseInt(input.substring(token.start, this.cursor));
} else {
this.cursor--;
this.lexExponent(); // 0E1, &c.
token.value = 0;
}
},
lexNumber: function (ch) {
var token = this.token, input = this.source;
token.type = NUMBER;
var floating = false;
do {
ch = input[this.cursor++];
if (ch === '.' && !floating) {
floating = true;
ch = input[this.cursor++];
}
} while (ch >= '0' && ch <= '9');
this.cursor--;
var exponent = this.lexExponent();
floating = floating || exponent;
var str = input.substring(token.start, this.cursor);
token.value = floating ? parseFloat(str) : parseInt(str);
},
lexDot: function (ch) {
var token = this.token, input = this.source;
var next = input[this.cursor];
if (next >= '0' && next <= '9') {
do {
ch = input[this.cursor++];
} while (ch >= '0' && ch <= '9');
this.cursor--;
this.lexExponent();
token.type = NUMBER;
token.value = parseFloat(
input.substring(token.start, this.cursor));
} else {
token.type = DOT;
token.assignOp = null;
token.value = '.';
}
},
lexString: function (ch) {
var token = this.token, input = this.source;
token.type = STRING;
var hasEscapes = false;
var delim = ch;
if (input.length <= this.cursor)
throw this.newSyntaxError("Unterminated string literal");
while ((ch = input[this.cursor++]) !== delim) {
if (ch == '\n' || ch == '\r')
throw this.newSyntaxError("Unterminated string literal");
if (this.cursor == input.length)
throw this.newSyntaxError("Unterminated string literal");
if (ch === '\\') {
hasEscapes = true;
if (++this.cursor == input.length)
throw this.newSyntaxError("Unterminated string literal");
}
}
token.value = hasEscapes
? eval(input.substring(token.start, this.cursor))
: input.substring(token.start + 1, this.cursor - 1);
},
lexRegExp: function (ch) {
var token = this.token, input = this.source;
token.type = REGEXP;
do {
ch = input[this.cursor++];
if (ch === '\\') {
this.cursor++;
} else if (ch === '[') {
do {
if (ch === undefined)
throw this.newSyntaxError("Unterminated character class");
if (ch === '\\')
this.cursor++;
ch = input[this.cursor++];
} while (ch !== ']');
} else if (ch === undefined) {
throw this.newSyntaxError("Unterminated regex");
}
} while (ch !== '/');
do {
ch = input[this.cursor++];
} while (ch >= 'a' && ch <= 'z');
this.cursor--;
token.value = eval(input.substring(token.start, this.cursor));
},
lexOp: function (ch) {
var token = this.token, input = this.source;
// A bit ugly, but it seems wasteful to write a trie lookup routine
// for only 3 characters...
var node = opTokens[ch];
var next = input[this.cursor];
if (next in node) {
node = node[next];
this.cursor++;
next = input[this.cursor];
if (next in node) {
node = node[next];
this.cursor++;
next = input[this.cursor];
}
}
var op = node.op;
if (definitions.assignOps[op] && input[this.cursor] === '=') {
this.cursor++;
token.type = ASSIGN;
token.assignOp = definitions.tokenIds[definitions.opTypeNames[op]];
op += '=';
} else {
token.type = definitions.tokenIds[definitions.opTypeNames[op]];
token.assignOp = null;
}
token.value = op;
},
// FIXME: Unicode escape sequences
lexIdent: function (ch, keywordIsName) {
var token = this.token;
var id = ch;
while ((ch = this.getValidIdentifierChar(false)) !== null) {
id += ch;
}
token.type = IDENTIFIER;
token.value = id;
if (keywordIsName)
return;
var kw;
if (this.parser.mozillaMode) {
kw = definitions.mozillaKeywords[id];
if (kw) {
token.type = kw;
return;
}
}
if (this.parser.x.strictMode) {
kw = definitions.strictKeywords[id];
if (kw) {
token.type = kw;
return;
}
}
kw = definitions.keywords[id];
if (kw)
token.type = kw;
},
/*
* Tokenizer.get :: ([boolean[, boolean]]) -> token type
*
* Consume input *only* if there is no lookahead.
* Dispatch to the appropriate lexing function depending on the input.
*/
get: function (scanOperand, keywordIsName) {
var token;
while (this.lookahead) {
--this.lookahead;
this.tokenIndex = (this.tokenIndex + 1) & 3;
token = this.tokens[this.tokenIndex];
if (token.type !== NEWLINE || this.scanNewlines)
return token.type;
}
this.skip();
this.tokenIndex = (this.tokenIndex + 1) & 3;
token = this.tokens[this.tokenIndex];
if (!token)
this.tokens[this.tokenIndex] = token = {};
var input = this.source;
if (this.cursor >= input.length)
return token.type = END;
token.start = this.cursor;
token.lineno = this.lineno;
var ich = this.getValidIdentifierChar(true);
var ch = (ich === null) ? input[this.cursor++] : null;
if (ich !== null) {
this.lexIdent(ich, keywordIsName);
} else if (scanOperand && ch === '/') {
this.lexRegExp(ch);
} else if (ch in opTokens) {
this.lexOp(ch);
} else if (ch === '.') {
this.lexDot(ch);
} else if (ch >= '1' && ch <= '9') {
this.lexNumber(ch);
} else if (ch === '0') {
this.lexZeroNumber(ch);
} else if (ch === '"' || ch === "'") {
this.lexString(ch);
} else if (this.scanNewlines && (ch === '\n' || ch === '\r')) {
// if this was a \r, look for \r\n
if (ch === '\r' && input[this.cursor] === '\n') this.cursor++;
token.type = NEWLINE;
token.value = '\n';
this.lineno++;
} else {
throw this.newSyntaxError("Illegal token");
}
token.end = this.cursor;
return token.type;
},
/*
* Tokenizer.unget :: void -> undefined
*
* Match depends on unget returning undefined.
*/
unget: function () {
if (++this.lookahead === 4) throw "PANIC: too much lookahead!";
this.tokenIndex = (this.tokenIndex - 1) & 3;
},
newSyntaxError: function (m) {
m = (this.filename ? this.filename + ":" : "") + this.lineno + ": " + m;
var e = new SyntaxError(m, this.filename, this.lineno);
e.source = this.source;
e.cursor = this.lookahead
? this.tokens[(this.tokenIndex + this.lookahead) & 3].start
: this.cursor;
return e;
},
/* Gets a single valid identifier char from the input stream, or null
* if there is none.
*/
getValidIdentifierChar: function(first) {
var input = this.source;
if (this.cursor >= input.length) return null;
var ch = input[this.cursor];
// first check for \u escapes
if (ch === '\\' && input[this.cursor+1] === 'u') {
// get the character value
try {
ch = String.fromCharCode(parseInt(
input.substring(this.cursor + 2, this.cursor + 6),
16));
} catch (ex) {
return null;
}
this.cursor += 5;
}
var valid = isValidIdentifierChar(ch, first);
if (valid) this.cursor++;
return (valid ? ch : null);
},
};
exports.isIdentifier = isIdentifier;
exports.Tokenizer = Tokenizer;
});

File diff suppressed because it is too large Load diff

View file

@ -52,9 +52,10 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
**/
var ScrollBar = function(parent) {
this.element = dom.createElement("div");
this.element.className = "ace_sb";
this.element.className = "ace_scrollbar";
this.inner = dom.createElement("div");
this.inner.className = "ace_scrollbar-inner";
this.element.appendChild(this.inner);
parent.appendChild(this.element);

View file

@ -1,16 +1,5 @@
.ace-ambiance {
background-color: #202020;
}
.ace-ambiance .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-ambiance .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-ambiance .ace_gutter {
background-color: #3d3d3d;
background-image: -moz-linear-gradient(left, #3D3D3D, #333);
background-image: -ms-linear-gradient(left, #3D3D3D, #333);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#3D3D3D), to(#333));
@ -18,51 +7,46 @@
background-image: -o-linear-gradient(left, #3D3D3D, #333);
background-image: linear-gradient(left, #3D3D3D, #333);
background-repeat: repeat-x;
border-right: 1px solid #4d4d4d;
text-shadow: 0px 1px 1px #4d4d4d;
color: #222;
border-right: 1px solid #4d4d4d;
overflow : hidden;
}
.ace-ambiance .ace_gutter-layer {
background: repeat left top;
width: 100%;
text-align: right;
}
.ace-ambiance .ace_gutter-layer .ace_gutter-cell .ace_fold-widget {
position: absolute;
right: 2px;
margin: 0;
vertical-align: middle;
height: inherit;
width: auto;
.ace-ambiance .ace_fold-widget {
text-align: center;
}
.ace-ambiance .ace_fold-widget:hover {
color: #777;
}
.ace-ambiance .ace_fold-widget.ace_start,
.ace-ambiance .ace_fold-widget.ace_end,
.ace-ambiance .ace_fold-widget.ace_closed{
background: none;
border: none;
box-shadow: none;
outline: none;
}
.ace-ambiance .ace_gutter-layer .ace_gutter-cell .ace_fold-widget:hover {
color: #777;
}
.ace-ambiance .ace_gutter-layer .ace_gutter-cell .ace_fold-widget:hover {
color: #777;
}
.ace-ambiance .ace_gutter-layer .ace_gutter-cell .ace_fold-widget.open:after {
.ace-ambiance .ace_fold-widget.ace_start:after {
content: '▾'
}
.ace-ambiance .ace_gutter-layer .ace_gutter-cell .ace_fold-widget.closed:after {
.ace-ambiance .ace_fold-widget.ace_end:after {
content: '▴'
}
.ace-ambiance .ace_fold-widget.ace_closed:after {
content: '‣'
}
.ace-ambiance .ace_print_margin {
.ace-ambiance .ace_print-margin {
border-left: 1px dotted #2D2D2D;
width: 100%;
right: 0;
background: #262626;
}
@ -75,9 +59,7 @@
}
.ace-ambiance .ace_text-layer {
cursor: text;
color: #E6E1DC;
background: url("noise.png") repeat left top;
}
.ace-ambiance .ace_cursor {
@ -97,7 +79,7 @@
background: rgba(221, 240, 255, 0.20);
}
.ace-ambiance .ace_marker-layer .ace_selected_word {
.ace-ambiance .ace_marker-layer .ace_selected-word {
border-radius: 4px;
border: 8px solid #3f475d;
box-shadow: 0 0 4px black;
@ -112,12 +94,10 @@
border: 1px solid rgba(255, 255, 255, 0.25);
}
.ace-ambiance .ace_marker-layer .ace_active_line {
.ace-ambiance .ace_marker-layer .ace_active-line {
background: rgba(255, 255, 255, 0.031);
}
.ace-ambiance .ace_invisible {
color: #333;
}
@ -223,7 +203,7 @@
color: #9b859d;
}
.ace-ambiance .ace_xml_pe {
.ace-ambiance .ace_xml-pe {
color: #494949;
}

View file

@ -1,18 +1,10 @@
.ace-chrome .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-chrome .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-chrome .ace_gutter {
background: #ebebeb;
color: #333;
overflow : hidden;
}
.ace-chrome .ace_print_margin {
.ace-chrome .ace_print-margin {
width: 1px;
background: #e8e8e8;
}
@ -30,41 +22,41 @@
border-bottom: 1px solid black;
}
.ace-chrome .ace_line .ace_invisible {
.ace-chrome .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-chrome .ace_line .ace_constant.ace_buildin {
.ace-chrome .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-chrome .ace_line .ace_constant.ace_language {
.ace-chrome .ace_constant.ace_language {
color: rgb(88, 92, 246);
}
.ace-chrome .ace_line .ace_constant.ace_library {
.ace-chrome .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-chrome .ace_line .ace_invalid {
.ace-chrome .ace_invalid {
background-color: rgb(153, 0, 0);
color: white;
}
.ace-chrome .ace_line .ace_fold {
.ace-chrome .ace_fold {
}
.ace-chrome .ace_line .ace_support.ace_function {
.ace-chrome .ace_support.ace_function {
color: rgb(60, 76, 114);
}
.ace-chrome .ace_line .ace_support.ace_constant {
.ace-chrome .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-chrome .ace_line .ace_support.ace_type,
.ace-chrome .ace_line .ace_support.ace_class
.ace-chrome .ace_line .ace_support.ace_other, {
.ace-chrome .ace_support.ace_type,
.ace-chrome .ace_support.ace_class
.ace-chrome .ace_support.ace_other {
color: rgb(109, 121, 222);
}
@ -72,31 +64,31 @@
font-style:italic;
color:#FD971F;
}
.ace-chrome .ace_line .ace_keyword.ace_operator {
.ace-chrome .ace_keyword.ace_operator {
color: rgb(104, 118, 135);
}
.ace-chrome .ace_line .ace_comment {
.ace-chrome .ace_comment {
color: #236e24;
}
.ace-chrome .ace_line .ace_comment.ace_doc {
.ace-chrome .ace_comment.ace_doc {
color: #236e24;
}
.ace-chrome .ace_line .ace_comment.ace_doc.ace_tag {
.ace-chrome .ace_comment.ace_doc.ace_tag {
color: #236e24;
}
.ace-chrome .ace_line .ace_constant.ace_numeric {
.ace-chrome .ace_constant.ace_numeric {
color: rgb(0, 0, 205);
}
.ace-chrome .ace_line .ace_variable {
.ace-chrome .ace_variable {
color: rgb(49, 132, 149);
}
.ace-chrome .ace_line .ace_xml_pe {
.ace-chrome .ace_xml-pe {
color: rgb(104, 104, 91);
}
@ -130,21 +122,21 @@
border: 1px solid rgb(192, 192, 192);
}
.ace-chrome .ace_marker-layer .ace_active_line {
.ace-chrome .ace_marker-layer .ace_active-line {
background: rgba(0, 0, 0, 0.07);
}
.ace-chrome .ace_gutter_active_line {
.ace-chrome .ace_gutter-active-line {
background-color : #dcdcdc;
}
.ace-chrome .ace_marker-layer .ace_selected_word {
.ace-chrome .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}
.ace-chrome .ace_storage,
.ace-chrome .ace_line .ace_keyword,
.ace-chrome .ace_keyword,
.ace-chrome .ace_meta.ace_tag {
color: rgb(147, 15, 128);
}
@ -153,7 +145,7 @@
color: rgb(255, 0, 0)
}
.ace-chrome .ace_line .ace_string {
.ace-chrome .ace_string {
color: #1A1AA6;
}

View file

@ -1,17 +1,9 @@
.ace-clouds .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-clouds .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-clouds .ace_gutter {
background: #ebebeb;
color: #333
}
.ace-clouds .ace_print_margin {
.ace-clouds .ace_print-margin {
width: 1px;
background: #e8e8e8
}
@ -37,7 +29,7 @@
background: #BDD5FC
}
.ace-clouds.multiselect .ace_selection.start {
.ace-clouds.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #BFBFBF
}
.ace-clouds .ace_marker-layer .ace_active_line {
.ace-clouds .ace_marker-layer .ace_active-line {
background: #FFFBD1
}
.ace-clouds .ace_gutter_active_line {
.ace-clouds .ace_gutter-active-line {
background-color : #dcdcdc
}
.ace-clouds .ace_marker-layer .ace_selected_word {
.ace-clouds .ace_marker-layer .ace_selected-word {
border: 1px solid #BDD5FC
}

View file

@ -1,17 +1,9 @@
.ace-clouds-midnight .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-clouds-midnight .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-clouds-midnight .ace_gutter {
background: #232323;
color: #929292
}
.ace-clouds-midnight .ace_print_margin {
.ace-clouds-midnight .ace_print-margin {
width: 1px;
background: #232323
}
@ -37,7 +29,7 @@
background: #000000
}
.ace-clouds-midnight.multiselect .ace_selection.start {
.ace-clouds-midnight.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #191919;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #BFBFBF
}
.ace-clouds-midnight .ace_marker-layer .ace_active_line {
.ace-clouds-midnight .ace_marker-layer .ace_active-line {
background: rgba(215, 215, 215, 0.031)
}
.ace-clouds-midnight .ace_gutter_active_line {
.ace-clouds-midnight .ace_gutter-active-line {
background-color: rgba(215, 215, 215, 0.031)
}
.ace-clouds-midnight .ace_marker-layer .ace_selected_word {
.ace-clouds-midnight .ace_marker-layer .ace_selected-word {
border: 1px solid #000000
}

View file

@ -1,17 +1,9 @@
.ace-cobalt .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-cobalt .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-cobalt .ace_gutter {
background: #011e3a;
color: #fff
}
.ace-cobalt .ace_print_margin {
.ace-cobalt .ace_print-margin {
width: 1px;
background: #011e3a
}
@ -37,7 +29,7 @@
background: rgba(179, 101, 57, 0.75)
}
.ace-cobalt.multiselect .ace_selection.start {
.ace-cobalt.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #002240;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid rgba(255, 255, 255, 0.15)
}
.ace-cobalt .ace_marker-layer .ace_active_line {
.ace-cobalt .ace_marker-layer .ace_active-line {
background: rgba(0, 0, 0, 0.35)
}
.ace-cobalt .ace_gutter_active_line {
.ace-cobalt .ace_gutter-active-line {
background-color: rgba(0, 0, 0, 0.35)
}
.ace-cobalt .ace_marker-layer .ace_selected_word {
.ace-cobalt .ace_marker-layer .ace_selected-word {
border: 1px solid rgba(179, 101, 57, 0.75)
}
@ -105,6 +97,14 @@
color: #FFEE80
}
.ace-cobalt .ace_entity {
color: #FFDD00
}
.ace-cobalt .ace_string {
color: #3AD900
}
.ace-cobalt .ace_string.ace_regexp {
color: #80FFC2
}

View file

@ -1,11 +1,3 @@
.ace-crimson-editor .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-crimson-editor .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-crimson-editor .ace_gutter {
background: #ebebeb;
color: #333;
@ -17,7 +9,7 @@
text-align: right;
}
.ace-crimson-editor .ace_print_margin {
.ace-crimson-editor .ace_print-margin {
width: 1px;
background: #e8e8e8;
}
@ -39,80 +31,80 @@
border-bottom: 1px solid black;
}
.ace-crimson-editor .ace_line .ace_invisible {
.ace-crimson-editor .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-crimson-editor .ace_line .ace_identifier {
.ace-crimson-editor .ace_identifier {
color: black;
}
.ace-crimson-editor .ace_line .ace_keyword {
.ace-crimson-editor .ace_keyword {
color: blue;
}
.ace-crimson-editor .ace_line .ace_constant.ace_buildin {
.ace-crimson-editor .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-crimson-editor .ace_line .ace_constant.ace_language {
.ace-crimson-editor .ace_constant.ace_language {
color: rgb(255, 156, 0);
}
.ace-crimson-editor .ace_line .ace_constant.ace_library {
.ace-crimson-editor .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-crimson-editor .ace_line .ace_invalid {
.ace-crimson-editor .ace_invalid {
text-decoration: line-through;
color: rgb(224, 0, 0);
}
.ace-crimson-editor .ace_line .ace_fold {
.ace-crimson-editor .ace_fold {
}
.ace-crimson-editor .ace_line .ace_support.ace_function {
.ace-crimson-editor .ace_support.ace_function {
color: rgb(192, 0, 0);
}
.ace-crimson-editor .ace_line .ace_support.ace_constant {
.ace-crimson-editor .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-crimson-editor .ace_line .ace_support.ace_type,
.ace-crimson-editor .ace_line .ace_support.ace_class {
.ace-crimson-editor .ace_support.ace_type,
.ace-crimson-editor .ace_support.ace_class {
color: rgb(109, 121, 222);
}
.ace-crimson-editor .ace_line .ace_keyword.ace_operator {
.ace-crimson-editor .ace_keyword.ace_operator {
color: rgb(49, 132, 149);
}
.ace-crimson-editor .ace_line .ace_string {
.ace-crimson-editor .ace_string {
color: rgb(128, 0, 128);
}
.ace-crimson-editor .ace_line .ace_comment {
.ace-crimson-editor .ace_comment {
color: rgb(76, 136, 107);
}
.ace-crimson-editor .ace_line .ace_comment.ace_doc {
.ace-crimson-editor .ace_comment.ace_doc {
color: rgb(0, 102, 255);
}
.ace-crimson-editor .ace_line .ace_comment.ace_doc.ace_tag {
.ace-crimson-editor .ace_comment.ace_doc.ace_tag {
color: rgb(128, 159, 191);
}
.ace-crimson-editor .ace_line .ace_constant.ace_numeric {
.ace-crimson-editor .ace_constant.ace_numeric {
color: rgb(0, 0, 64);
}
.ace-crimson-editor .ace_line .ace_variable {
.ace-crimson-editor .ace_variable {
color: rgb(0, 64, 128);
}
.ace-crimson-editor .ace_line .ace_xml_pe {
.ace-crimson-editor .ace_xml-pe {
color: rgb(104, 104, 91);
}
@ -133,11 +125,11 @@
border: 1px solid rgb(192, 192, 192);
}
.ace-crimson-editor .ace_marker-layer .ace_active_line {
.ace-crimson-editor .ace_marker-layer .ace_active-line {
background: rgb(232, 242, 254);
}
.ace-crimson-editor .ace_gutter_active_line {
.ace-crimson-editor .ace_gutter-active-line {
background-color : #dcdcdc;
}
@ -145,7 +137,7 @@
color:rgb(28, 2, 255);
}
.ace-crimson-editor .ace_marker-layer .ace_selected_word {
.ace-crimson-editor .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}

View file

@ -1,17 +1,9 @@
.ace-dawn .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-dawn .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-dawn .ace_gutter {
background: #ebebeb;
color: #333
}
.ace-dawn .ace_print_margin {
.ace-dawn .ace_print-margin {
width: 1px;
background: #e8e8e8
}
@ -37,7 +29,7 @@
background: rgba(39, 95, 255, 0.30)
}
.ace-dawn.multiselect .ace_selection.start {
.ace-dawn.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #F9F9F9;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid rgba(75, 75, 126, 0.50)
}
.ace-dawn .ace_marker-layer .ace_active_line {
.ace-dawn .ace_marker-layer .ace_active-line {
background: rgba(36, 99, 180, 0.12)
}
.ace-dawn .ace_gutter_active_line {
.ace-dawn .ace_gutter-active-line {
background-color : #dcdcdc
}
.ace-dawn .ace_marker-layer .ace_selected_word {
.ace-dawn .ace_marker-layer .ace_selected-word {
border: 1px solid rgba(39, 95, 255, 0.30)
}

View file

@ -1,17 +1,9 @@
.ace-dreamweaver .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-dreamweaver .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-dreamweaver .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-dreamweaver .ace_print_margin {
.ace-dreamweaver .ace_print-margin {
width: 1px;
background: #e8e8e8;
}
@ -36,78 +28,78 @@
border-bottom: 1px solid black;
}
.ace-dreamweaver .ace_line .ace_invisible {
.ace-dreamweaver .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-dreamweaver .ace_line .ace_storage,
.ace-dreamweaver .ace_line .ace_keyword {
.ace-dreamweaver .ace_storage,
.ace-dreamweaver .ace_keyword {
color: blue;
}
.ace-dreamweaver .ace_line .ace_constant.ace_buildin {
.ace-dreamweaver .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-dreamweaver .ace_line .ace_constant.ace_language {
.ace-dreamweaver .ace_constant.ace_language {
color: rgb(88, 92, 246);
}
.ace-dreamweaver .ace_line .ace_constant.ace_library {
.ace-dreamweaver .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-dreamweaver .ace_line .ace_invalid {
.ace-dreamweaver .ace_invalid {
background-color: rgb(153, 0, 0);
color: white;
}
.ace-dreamweaver .ace_line .ace_support.ace_function {
.ace-dreamweaver .ace_support.ace_function {
color: rgb(60, 76, 114);
}
.ace-dreamweaver .ace_line .ace_support.ace_constant {
.ace-dreamweaver .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-dreamweaver .ace_line .ace_support.ace_type,
.ace-dreamweaver .ace_line .ace_support.ace_class {
.ace-dreamweaver .ace_support.ace_type,
.ace-dreamweaver .ace_support.ace_class {
color: #009;
}
.ace-dreamweaver .ace_line .ace_support.ace_php_tag {
.ace-dreamweaver .ace_support.ace_php_tag {
color: #f00;
}
.ace-dreamweaver .ace_line .ace_keyword.ace_operator {
.ace-dreamweaver .ace_keyword.ace_operator {
color: rgb(104, 118, 135);
}
.ace-dreamweaver .ace_line .ace_string {
.ace-dreamweaver .ace_string {
color: #00F;
}
.ace-dreamweaver .ace_line .ace_comment {
.ace-dreamweaver .ace_comment {
color: rgb(76, 136, 107);
}
.ace-dreamweaver .ace_line .ace_comment.ace_doc {
.ace-dreamweaver .ace_comment.ace_doc {
color: rgb(0, 102, 255);
}
.ace-dreamweaver .ace_line .ace_comment.ace_doc.ace_tag {
.ace-dreamweaver .ace_comment.ace_doc.ace_tag {
color: rgb(128, 159, 191);
}
.ace-dreamweaver .ace_line .ace_constant.ace_numeric {
.ace-dreamweaver .ace_constant.ace_numeric {
color: rgb(0, 0, 205);
}
.ace-dreamweaver .ace_line .ace_variable {
.ace-dreamweaver .ace_variable {
color: #06F
}
.ace-dreamweaver .ace_line .ace_xml_pe {
.ace-dreamweaver .ace_xml-pe {
color: rgb(104, 104, 91);
}
@ -141,11 +133,11 @@
border: 1px solid rgb(192, 192, 192);
}
.ace-dreamweaver .ace_marker-layer .ace_active_line {
.ace-dreamweaver .ace_marker-layer .ace_active-line {
background: rgba(0, 0, 0, 0.07);
}
.ace-dreamweaver .ace_marker-layer .ace_selected_word {
.ace-dreamweaver .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}

View file

@ -1,18 +1,10 @@
.ace-eclipse .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-eclipse .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-eclipse .ace_gutter {
background: #ebebeb;
border-right: 1px solid rgb(159, 159, 159);
color: rgb(136, 136, 136);
}
.ace-eclipse .ace_print_margin {
.ace-eclipse .ace_print-margin {
width: 1px;
background: #ebebeb;
}
@ -32,52 +24,52 @@
border-left: 2px solid black;
}
.ace-eclipse .ace_line .ace_storage,
.ace-eclipse .ace_line .ace_keyword,
.ace-eclipse .ace_line .ace_variable {
.ace-eclipse .ace_storage,
.ace-eclipse .ace_keyword,
.ace-eclipse .ace_variable {
color: rgb(127, 0, 85);
}
.ace-eclipse .ace_line .ace_constant.ace_buildin {
.ace-eclipse .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-eclipse .ace_line .ace_constant.ace_library {
.ace-eclipse .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-eclipse .ace_line .ace_function {
.ace-eclipse .ace_function {
color: rgb(60, 76, 114);
}
.ace-eclipse .ace_line .ace_string {
.ace-eclipse .ace_string {
color: rgb(42, 0, 255);
}
.ace-eclipse .ace_line .ace_comment {
.ace-eclipse .ace_comment {
color: rgb(63, 127, 95);
}
.ace-eclipse .ace_line .ace_comment.ace_doc {
.ace-eclipse .ace_comment.ace_doc {
color: rgb(63, 95, 191);
}
.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {
.ace-eclipse .ace_comment.ace_doc.ace_tag {
color: rgb(127, 159, 191);
}
.ace-eclipse .ace_line .ace_constant.ace_numeric {
.ace-eclipse .ace_constant.ace_numeric {
}
.ace-eclipse .ace_line .ace_tag {
.ace-eclipse .ace_tag {
color: rgb(63, 127, 127);
}
.ace-eclipse .ace_line .ace_type {
.ace-eclipse .ace_type {
color: rgb(127, 0, 127);
}
.ace-eclipse .ace_line .ace_xml_pe {
.ace-eclipse .ace_xml-pe {
color: rgb(104, 104, 91);
}
@ -90,7 +82,7 @@
border: 1px solid rgb(192, 192, 192);
}
.ace-eclipse .ace_line .ace_meta.ace_tag {
.ace-eclipse .ace_meta.ace_tag {
color:rgb(63, 127, 127);
}
@ -101,11 +93,11 @@
background: rgb(255, 255, 0);
}
.ace-eclipse .ace_marker-layer .ace_active_line {
.ace-eclipse .ace_marker-layer .ace_active-line {
background: rgb(232, 242, 254);
}
.ace-eclipse .ace_marker-layer .ace_selected_word {
.ace-eclipse .ace_marker-layer .ace_selected-word {
border: 1px solid rgb(181, 213, 255);
}

View file

@ -1,18 +1,5 @@
/* CSS style content from github's default pygments highlighter template.
Cursor and selection styles from textmate.css. */
.ace-github .ace_editor {
color: #333;
background-color: #F8F8F8;
border: 1px solid #CCC;
font: 13px 'Bitstream Vera Sans Mono', Courier, monospace !important;
line-height: 19px !important;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
position: relative;
margin-bottom: 15px;
}
.ace-github .ace_gutter {
background: #e8e8e8;
color: #AAA;
@ -68,7 +55,7 @@
font-weight: normal;
}
.ace-github .ace_variable.ace_instancce {
.ace-github .ace_variable.ace_instance {
color: teal;
}
@ -88,19 +75,21 @@
border-bottom: 1px solid black;
}
.ace-github .ace_marker-layer .ace_active_line {
.ace-github .ace_marker-layer .ace_active-line {
background: rgb(255, 255, 204);
}
.ace-github .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-github.multiselect .ace_selection.start {
.ace-github.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px white;
border-radius: 2px;
}
/* bold keywords cause cursor issues for some fonts */
/* this disables bold style for editor and keeps for static highlighter */
.ace-github.ace_editor .ace_line > span {
.ace-github.ace_nobold .ace_line > span {
font-weight: normal !important;
}
@ -117,17 +106,17 @@
border: 1px solid rgb(192, 192, 192);
}
.ace-github .ace_gutter_active_line {
.ace-github .ace_gutter-active-line {
background-color : rgba(0, 0, 0, 0.07);
}
.ace-github .ace_marker-layer .ace_selected_word {
.ace-github .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}
.ace-github .ace_print_margin {
.ace-github .ace_print-margin {
width: 1px;
background: #e8e8e8;
}

View file

@ -1,17 +1,9 @@
.ace-idle-fingers .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-idle-fingers .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-idle-fingers .ace_gutter {
background: #3b3b3b;
color: #fff
}
.ace-idle-fingers .ace_print_margin {
.ace-idle-fingers .ace_print-margin {
width: 1px;
background: #3b3b3b
}
@ -37,7 +29,7 @@
background: rgba(90, 100, 126, 0.88)
}
.ace-idle-fingers.multiselect .ace_selection.start {
.ace-idle-fingers.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #323232;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #404040
}
.ace-idle-fingers .ace_marker-layer .ace_active_line {
.ace-idle-fingers .ace_marker-layer .ace_active-line {
background: #353637
}
.ace-idle-fingers .ace_gutter_active_line {
.ace-idle-fingers .ace_gutter-active-line {
background-color: #353637
}
.ace-idle-fingers .ace_marker-layer .ace_selected_word {
.ace-idle-fingers .ace_marker-layer .ace_selected-word {
border: 1px solid rgba(90, 100, 126, 0.88)
}

View file

@ -1,17 +1,9 @@
.ace-kr-theme .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-kr-theme .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-kr-theme .ace_gutter {
background: #1c1917;
color: #FCFFE0
}
.ace-kr-theme .ace_print_margin {
.ace-kr-theme .ace_print-margin {
width: 1px;
background: #1c1917
}
@ -37,7 +29,7 @@
background: rgba(170, 0, 255, 0.45)
}
.ace-kr-theme.multiselect .ace_selection.start {
.ace-kr-theme.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #0B0A09;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid rgba(255, 177, 111, 0.32)
}
.ace-kr-theme .ace_marker-layer .ace_active_line {
.ace-kr-theme .ace_marker-layer .ace_active-line {
background: #38403D
}
.ace-kr-theme .ace_gutter_active_line {
.ace-kr-theme .ace_gutter-active-line {
background-color : #38403D
}
.ace-kr-theme .ace_marker-layer .ace_selected_word {
.ace-kr-theme .ace_marker-layer .ace_selected-word {
border: 1px solid rgba(170, 0, 255, 0.45)
}
@ -105,6 +97,10 @@
color: #FFEE80
}
.ace-kr-theme .ace_string {
color: rgba(164, 161, 181, 0.8)
}
.ace-kr-theme .ace_string.ace_regexp {
color: rgba(125, 255, 192, 0.65)
}

View file

@ -1,17 +1,9 @@
.ace-merbivore .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-merbivore .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-merbivore .ace_gutter {
background: #202020;
color: #E6E1DC
}
.ace-merbivore .ace_print_margin {
.ace-merbivore .ace_print-margin {
width: 1px;
background: #555651
}
@ -37,7 +29,7 @@
background: #454545
}
.ace-merbivore.multiselect .ace_selection.start {
.ace-merbivore.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #161616;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #404040
}
.ace-merbivore .ace_marker-layer .ace_active_line {
.ace-merbivore .ace_marker-layer .ace_active-line {
background: #333435
}
.ace-merbivore .ace_gutter_active_line {
.ace-merbivore .ace_gutter-active-line {
background-color: #333435
}
.ace-merbivore .ace_marker-layer .ace_selected_word {
.ace-merbivore .ace_marker-layer .ace_selected-word {
border: 1px solid #454545
}

View file

@ -1,17 +1,9 @@
.ace-merbivore-soft .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-merbivore-soft .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-merbivore-soft .ace_gutter {
background: #262424;
color: #E6E1DC
}
.ace-merbivore-soft .ace_print_margin {
.ace-merbivore-soft .ace_print-margin {
width: 1px;
background: #262424
}
@ -37,7 +29,7 @@
background: #494949
}
.ace-merbivore-soft.multiselect .ace_selection.start {
.ace-merbivore-soft.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #1C1C1C;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #404040
}
.ace-merbivore-soft .ace_marker-layer .ace_active_line {
.ace-merbivore-soft .ace_marker-layer .ace_active-line {
background: #333435
}
.ace-merbivore-soft .ace_gutter_active_line {
.ace-merbivore-soft .ace_gutter-active-line {
background-color: #333435
}
.ace-merbivore-soft .ace_marker-layer .ace_selected_word {
.ace-merbivore-soft .ace_marker-layer .ace_selected-word {
border: 1px solid #494949
}

View file

@ -1,17 +1,9 @@
.ace-mono-industrial .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-mono-industrial .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-mono-industrial .ace_gutter {
background: #1d2521;
color: #C5C9C9
}
.ace-mono-industrial .ace_print_margin {
.ace-mono-industrial .ace_print-margin {
width: 1px;
background: #555651
}
@ -37,7 +29,7 @@
background: rgba(145, 153, 148, 0.40)
}
.ace-mono-industrial.multiselect .ace_selection.start {
.ace-mono-industrial.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #222C28;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid rgba(102, 108, 104, 0.50)
}
.ace-mono-industrial .ace_marker-layer .ace_active_line {
.ace-mono-industrial .ace_marker-layer .ace_active-line {
background: rgba(12, 13, 12, 0.25)
}
.ace-mono-industrial .ace_gutter_active_line {
.ace-mono-industrial .ace_gutter-active-line {
background-color: rgba(12, 13, 12, 0.25)
}
.ace-mono-industrial .ace_marker-layer .ace_selected_word {
.ace-mono-industrial .ace_marker-layer .ace_selected-word {
border: 1px solid rgba(145, 153, 148, 0.40)
}
@ -67,6 +59,11 @@
color: rgba(102, 108, 104, 0.50)
}
.ace-mono-industrial .ace_string {
background-color: #151C19;
color: #FFFFFF
}
.ace-mono-industrial .ace_keyword,
.ace-mono-industrial .ace_meta {
color: #A39E64

View file

@ -1,17 +1,9 @@
.ace-monokai .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-monokai .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-monokai .ace_gutter {
background: #2f3129;
color: #f1f1f1
}
.ace-monokai .ace_print_margin {
.ace-monokai .ace_print-margin {
width: 1px;
background: #555651
}
@ -37,7 +29,7 @@
background: #49483E
}
.ace-monokai.multiselect .ace_selection.start {
.ace-monokai.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #272822;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #49483E
}
.ace-monokai .ace_marker-layer .ace_active_line {
.ace-monokai .ace_marker-layer .ace_active-line {
background: #202020
}
.ace-monokai .ace_gutter_active_line {
.ace-monokai .ace_gutter-active-line {
background-color: #272727
}
.ace-monokai .ace_marker-layer .ace_selected_word {
.ace-monokai .ace_marker-layer .ace_selected-word {
border: 1px solid #49483E
}

View file

@ -1,17 +1,9 @@
.ace-pastel-on-dark .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-pastel-on-dark .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-pastel-on-dark .ace_gutter {
background: #353030;
color: #8F938F
}
.ace-pastel-on-dark .ace_print_margin {
.ace-pastel-on-dark .ace_print-margin {
width: 1px;
background: #353030
}
@ -37,7 +29,7 @@
background: rgba(221, 240, 255, 0.20)
}
.ace-pastel-on-dark.multiselect .ace_selection.start {
.ace-pastel-on-dark.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #2C2828;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid rgba(255, 255, 255, 0.25)
}
.ace-pastel-on-dark .ace_marker-layer .ace_active_line {
.ace-pastel-on-dark .ace_marker-layer .ace_active-line {
background: rgba(255, 255, 255, 0.031)
}
.ace-pastel-on-dark .ace_gutter_active_line {
.ace-pastel-on-dark .ace_gutter-active-line {
background-color: rgba(255, 255, 255, 0.031)
}
.ace-pastel-on-dark .ace_marker-layer .ace_selected_word {
.ace-pastel-on-dark .ace_marker-layer .ace_selected-word {
border: 1px solid rgba(221, 240, 255, 0.20)
}
@ -136,7 +128,7 @@
color: #C1C144
}
.ace-pastel-on-dark .ace_xml_pe {
.ace-pastel-on-dark .ace_xml-pe {
color: #494949
}

View file

@ -1,17 +1,9 @@
.ace-solarized-dark .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-solarized-dark .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-solarized-dark .ace_gutter {
background: #01313f;
color: #d0edf7
}
.ace-solarized-dark .ace_print_margin {
.ace-solarized-dark .ace_print-margin {
width: 1px;
background: #33555E
}
@ -35,12 +27,12 @@
border-bottom: 1px solid #D30102
}
.ace-solarized-dark .ace_marker-layer .ace_active_line,
.ace-solarized-dark .ace_marker-layer .ace_active-line,
.ace-solarized-dark .ace_marker-layer .ace_selection {
background: rgba(255, 255, 255, 0.1)
}
.ace-solarized-dark.multiselect .ace_selection.start {
.ace-solarized-dark.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #002B36;
border-radius: 2px
}
@ -54,11 +46,11 @@
border: 1px solid rgba(147, 161, 161, 0.50)
}
.ace-solarized-dark .ace_gutter_active_line {
.ace-solarized-dark .ace_gutter-active-line {
background-color: #0d3440
}
.ace-solarized-dark .ace_marker-layer .ace_selected_word {
.ace-solarized-dark .ace_marker-layer .ace_selected-word {
border: 1px solid #073642
}

View file

@ -1,17 +1,9 @@
.ace-solarized-light .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-solarized-light .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-solarized-light .ace_gutter {
background: #fbf1d3;
color: #333
}
.ace-solarized-light .ace_print_margin {
.ace-solarized-light .ace_print-margin {
width: 1px;
background: #e8e8e8
}
@ -37,7 +29,7 @@
background: #073642
}
.ace-solarized-light.multiselect .ace_selection.start {
.ace-solarized-light.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FDF6E3;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid rgba(147, 161, 161, 0.50)
}
.ace-solarized-light .ace_marker-layer .ace_active_line {
.ace-solarized-light .ace_marker-layer .ace_active-line {
background: #EEE8D5
}
.ace-solarized-light .ace_gutter_active_line {
.ace-solarized-light .ace_gutter-active-line {
background-color : #dcdcdc
}
.ace-solarized-light .ace_marker-layer .ace_selected_word {
.ace-solarized-light .ace_marker-layer .ace_selected-word {
border: 1px solid #073642
}

View file

@ -1,17 +1,9 @@
.ace-tm .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-tm .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-tm .ace_gutter {
background: #f0f0f0;
color: #333;
}
.ace-tm .ace_print_margin {
.ace-tm .ace_print-margin {
width: 1px;
background: #e8e8e8;
}
@ -33,78 +25,78 @@
border-bottom: 1px solid black;
}
.ace-tm .ace_line .ace_invisible {
.ace-tm .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-tm .ace_line .ace_storage,
.ace-tm .ace_line .ace_keyword {
.ace-tm .ace_storage,
.ace-tm .ace_keyword {
color: blue;
}
.ace-tm .ace_line .ace_constant {
.ace-tm .ace_constant {
color: rgb(197, 6, 11);
}
.ace-tm .ace_line .ace_constant.ace_buildin {
.ace-tm .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-tm .ace_line .ace_constant.ace_language {
.ace-tm .ace_constant.ace_language {
color: rgb(88, 92, 246);
}
.ace-tm .ace_line .ace_constant.ace_library {
.ace-tm .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-tm .ace_line .ace_invalid {
.ace-tm .ace_invalid {
background-color: rgba(255, 0, 0, 0.1);
color: red;
}
.ace-tm .ace_line .ace_support.ace_function {
.ace-tm .ace_support.ace_function {
color: rgb(60, 76, 114);
}
.ace-tm .ace_line .ace_support.ace_constant {
.ace-tm .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-tm .ace_line .ace_support.ace_type,
.ace-tm .ace_line .ace_support.ace_class {
.ace-tm .ace_support.ace_type,
.ace-tm .ace_support.ace_class {
color: rgb(109, 121, 222);
}
.ace-tm .ace_line .ace_keyword.ace_operator {
.ace-tm .ace_keyword.ace_operator {
color: rgb(104, 118, 135);
}
.ace-tm .ace_line .ace_string {
.ace-tm .ace_string {
color: rgb(3, 106, 7);
}
.ace-tm .ace_line .ace_comment {
.ace-tm .ace_comment {
color: rgb(76, 136, 107);
}
.ace-tm .ace_line .ace_comment.ace_doc {
.ace-tm .ace_comment.ace_doc {
color: rgb(0, 102, 255);
}
.ace-tm .ace_line .ace_comment.ace_doc.ace_tag {
.ace-tm .ace_comment.ace_doc.ace_tag {
color: rgb(128, 159, 191);
}
.ace-tm .ace_line .ace_constant.ace_numeric {
.ace-tm .ace_constant.ace_numeric {
color: rgb(0, 0, 205);
}
.ace-tm .ace_line .ace_variable {
.ace-tm .ace_variable {
color: rgb(49, 132, 149);
}
.ace-tm .ace_line .ace_xml_pe {
.ace-tm .ace_xml-pe {
color: rgb(104, 104, 91);
}
@ -132,7 +124,7 @@
.ace-tm .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-tm.multiselect .ace_selection.start {
.ace-tm.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px white;
border-radius: 2px;
}
@ -149,15 +141,15 @@
border: 1px solid rgb(192, 192, 192);
}
.ace-tm .ace_marker-layer .ace_active_line {
.ace-tm .ace_marker-layer .ace_active-line {
background: rgba(0, 0, 0, 0.07);
}
.ace-tm .ace_gutter_active_line {
.ace-tm .ace_gutter-active-line {
background-color : #dcdcdc;
}
.ace-tm .ace_marker-layer .ace_selected_word {
.ace-tm .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}

View file

@ -1,17 +1,9 @@
.ace-tomorrow .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-tomorrow .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-tomorrow .ace_gutter {
background: #f6f6f6;
color: #4D4D4C
}
.ace-tomorrow .ace_print_margin {
.ace-tomorrow .ace_print-margin {
width: 1px;
background: #f6f6f6
}
@ -37,7 +29,7 @@
background: #D6D6D6
}
.ace-tomorrow.multiselect .ace_selection.start {
.ace-tomorrow.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #D1D1D1
}
.ace-tomorrow .ace_marker-layer .ace_active_line {
.ace-tomorrow .ace_marker-layer .ace_active-line {
background: #EFEFEF
}
.ace-tomorrow .ace_gutter_active_line {
.ace-tomorrow .ace_gutter-active-line {
background-color : #dcdcdc
}
.ace-tomorrow .ace_marker-layer .ace_selected_word {
.ace-tomorrow .ace_marker-layer .ace_selected-word {
border: 1px solid #D6D6D6
}

View file

@ -1,17 +1,9 @@
.ace-tomorrow-night .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-tomorrow-night .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-tomorrow-night .ace_gutter {
background: #25282c;
color: #C5C8C6
}
.ace-tomorrow-night .ace_print_margin {
.ace-tomorrow-night .ace_print-margin {
width: 1px;
background: #25282c
}
@ -37,7 +29,7 @@
background: #373B41
}
.ace-tomorrow-night.multiselect .ace_selection.start {
.ace-tomorrow-night.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #1D1F21;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #4B4E55
}
.ace-tomorrow-night .ace_marker-layer .ace_active_line {
.ace-tomorrow-night .ace_marker-layer .ace_active-line {
background: #282A2E
}
.ace-tomorrow-night .ace_gutter_active_line {
.ace-tomorrow-night .ace_gutter-active-line {
background-color: #282A2E
}
.ace-tomorrow-night .ace_marker-layer .ace_selected_word {
.ace-tomorrow-night .ace_marker-layer .ace_selected-word {
border: 1px solid #373B41
}

View file

@ -1,17 +1,9 @@
.ace-tomorrow-night-blue .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-tomorrow-night-blue .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-tomorrow-night-blue .ace_gutter {
background: #00204b;
color: #7388b5
}
.ace-tomorrow-night-blue .ace_print_margin {
.ace-tomorrow-night-blue .ace_print-margin {
width: 1px;
background: #00204b
}
@ -38,7 +30,7 @@
background: #003F8E
}
.ace-tomorrow-night-blue.multiselect .ace_selection.start {
.ace-tomorrow-night-blue.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #002451;
border-radius: 2px
}
@ -52,15 +44,15 @@
border: 1px solid #404F7D
}
.ace-tomorrow-night-blue .ace_marker-layer .ace_active_line {
.ace-tomorrow-night-blue .ace_marker-layer .ace_active-line {
background: #00346E
}
.ace-tomorrow-night-blue .ace_gutter_active_line {
.ace-tomorrow-night-blue .ace_gutter-active-line {
background-color: #022040
}
.ace-tomorrow-night-blue .ace_marker-layer .ace_selected_word {
.ace-tomorrow-night-blue .ace_marker-layer .ace_selected-word {
border: 1px solid #003F8E
}

View file

@ -1,17 +1,9 @@
.ace-tomorrow-night-bright .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-tomorrow-night-bright .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-tomorrow-night-bright .ace_gutter {
background: #1a1a1a;
color: #DEDEDE
}
.ace-tomorrow-night-bright .ace_print_margin {
.ace-tomorrow-night-bright .ace_print-margin {
width: 1px;
background: #1a1a1a
}
@ -37,7 +29,7 @@
background: #424242
}
.ace-tomorrow-night-bright.multiselect .ace_selection.start {
.ace-tomorrow-night-bright.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #000000;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #343434
}
.ace-tomorrow-night-bright .ace_marker-layer .ace_active_line {
.ace-tomorrow-night-bright .ace_marker-layer .ace_active-line {
background: #2A2A2A
}
.ace-tomorrow-night-bright .ace_gutter_active_line {
.ace-tomorrow-night-bright .ace_gutter-active-line {
background-color: #2A2A2A
}
.ace-tomorrow-night-bright .ace_marker-layer .ace_selected_word {
.ace-tomorrow-night-bright .ace_marker-layer .ace_selected-word {
border: 1px solid #424242
}

View file

@ -1,17 +1,9 @@
.ace-tomorrow-night-eighties .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-tomorrow-night-eighties .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-tomorrow-night-eighties .ace_gutter {
background: #272727;
color: #CCC
}
.ace-tomorrow-night-eighties .ace_print_margin {
.ace-tomorrow-night-eighties .ace_print-margin {
width: 1px;
background: #272727
}
@ -38,7 +30,7 @@
background: #515151
}
.ace-tomorrow-night-eighties.multiselect .ace_selection.start {
.ace-tomorrow-night-eighties.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #2D2D2D;
border-radius: 2px
}
@ -52,15 +44,15 @@
border: 1px solid #6A6A6A
}
.ace-tomorrow-night-eighties .ace_marker-layer .ace_active_line {
.ace-tomorrow-night-eighties .ace_marker-layer .ace_active-line {
background: #393939
}
.ace-tomorrow-night-eighties .ace_gutter_active_line {
.ace-tomorrow-night-eighties .ace_gutter-active-line {
background-color: #393939
}
.ace-tomorrow-night-eighties .ace_marker-layer .ace_selected_word {
.ace-tomorrow-night-eighties .ace_marker-layer .ace_selected-word {
border: 1px solid #515151
}

View file

@ -1,17 +1,9 @@
.ace-twilight .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-twilight .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-twilight .ace_gutter {
background: #232323;
color: #E2E2E2
}
.ace-twilight .ace_print_margin {
.ace-twilight .ace_print-margin {
width: 1px;
background: #232323
}
@ -37,7 +29,7 @@
background: rgba(221, 240, 255, 0.20)
}
.ace-twilight.multiselect .ace_selection.start {
.ace-twilight.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #141414;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid rgba(255, 255, 255, 0.25)
}
.ace-twilight .ace_marker-layer .ace_active_line {
.ace-twilight .ace_marker-layer .ace_active-line {
background: rgba(255, 255, 255, 0.031)
}
.ace-twilight .ace_gutter_active_line {
.ace-twilight .ace_gutter-active-line {
background-color: rgba(255, 255, 255, 0.031)
}
.ace-twilight .ace_marker-layer .ace_selected_word {
.ace-twilight .ace_marker-layer .ace_selected-word {
border: 1px solid rgba(221, 240, 255, 0.20)
}
@ -133,7 +125,7 @@
color: #7587A6
}
.ace-twilight .ace_xml_pe {
.ace-twilight .ace_xml-pe {
color: #494949
}

View file

@ -1,17 +1,9 @@
.ace-vibrant-ink .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-vibrant-ink .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-vibrant-ink .ace_gutter {
background: #1a1a1a;
color: #BEBEBE
}
.ace-vibrant-ink .ace_print_margin {
.ace-vibrant-ink .ace_print-margin {
width: 1px;
background: #1a1a1a
}
@ -37,7 +29,7 @@
background: #6699CC
}
.ace-vibrant-ink.multiselect .ace_selection.start {
.ace-vibrant-ink.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #0F0F0F;
border-radius: 2px
}
@ -51,15 +43,15 @@
border: 1px solid #404040
}
.ace-vibrant-ink .ace_marker-layer .ace_active_line {
.ace-vibrant-ink .ace_marker-layer .ace_active-line {
background: #333333
}
.ace-vibrant-ink .ace_gutter_active_line {
.ace-vibrant-ink .ace_gutter-active-line {
background-color: #333333
}
.ace-vibrant-ink .ace_marker-layer .ace_selected_word {
.ace-vibrant-ink .ace_marker-layer .ace_selected-word {
border: 1px solid #6699CC
}

View file

@ -1,18 +1,11 @@
/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: EE3AD170-2B7F-4DE1-B724-C75F13FE0085) */
.ace-xcode .ace_editor {
border: 2px solid rgb(159, 159, 159)
}
.ace-xcode .ace_editor.ace_focus {
border: 2px solid #327fbd
}
.ace-xcode .ace_gutter {
background: #e8e8e8;
color: #333
}
.ace-xcode .ace_print_margin {
.ace-xcode .ace_print-margin {
width: 1px;
background: #e8e8e8
}
@ -38,7 +31,7 @@
background: #B5D5FF
}
.ace-xcode.multiselect .ace_selection.start {
.ace-xcode.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF;
border-radius: 2px
}
@ -52,15 +45,15 @@
border: 1px solid #BFBFBF
}
.ace-xcode .ace_marker-layer .ace_active_line {
.ace-xcode .ace_marker-layer .ace_active-line {
background: rgba(0, 0, 0, 0.071)
}
.ace-xcode .ace_gutter_active_line {
.ace-xcode .ace_gutter-active-line {
background-color: rgba(0, 0, 0, 0.071)
}
.ace-xcode .ace_marker-layer .ace_selected_word {
.ace-xcode .ace_marker-layer .ace_selected-word {
border: 1px solid #B5D5FF
}

View file

@ -103,9 +103,6 @@ var VirtualRenderer = function(container, theme) {
this.$markerFront = new MarkerLayer(this.content);
this.characterWidth = textLayer.getCharacterWidth();
this.lineHeight = textLayer.getLineHeight();
this.$cursorLayer = new CursorLayer(this.content);
this.$cursorPadding = 8;
@ -136,12 +133,8 @@ var VirtualRenderer = function(container, theme) {
};
this.$textLayer.addEventListener("changeCharacterSize", function() {
_self.characterWidth = textLayer.getCharacterWidth();
_self.lineHeight = textLayer.getLineHeight();
_self.$updatePrintMargin();
_self.updateCharacterSize();
_self.onResize(true);
_self.$loop.schedule(_self.CHANGE_FULL);
});
this.$size = {
@ -172,7 +165,7 @@ var VirtualRenderer = function(container, theme) {
this.$loop.schedule(this.CHANGE_FULL);
this.setPadding(4);
this.$updatePrintMargin();
this.updateCharacterSize();
};
(function() {
@ -191,6 +184,17 @@ var VirtualRenderer = function(container, theme) {
this.CHANGE_H_SCROLL = 1024;
oop.implement(this, EventEmitter);
this.updateCharacterSize = function() {
if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
this.setStyle("ace_nobold", !this.$allowBoldFonts);
}
this.characterWidth = this.$textLayer.getCharacterWidth();
this.lineHeight = this.$textLayer.getLineHeight();
this.$updatePrintMargin();
};
/**
* VirtualRenderer.setSession(session)
@ -484,7 +488,7 @@ var VirtualRenderer = function(container, theme) {
if (!this.$gutterLineHighlight) {
this.$gutterLineHighlight = dom.createElement("div");
this.$gutterLineHighlight.className = "ace_gutter_active_line";
this.$gutterLineHighlight.className = "ace_gutter-active-line";
this.$gutter.appendChild(this.$gutterLineHighlight);
return;
}
@ -512,11 +516,11 @@ var VirtualRenderer = function(container, theme) {
if (!this.$printMarginEl) {
containerEl = dom.createElement("div");
containerEl.className = "ace_print_margin_layer";
containerEl.className = "ace_layer ace_print-margin-layer";
this.$printMarginEl = dom.createElement("div");
this.$printMarginEl.className = "ace_print_margin";
this.$printMarginEl.className = "ace_print-margin";
containerEl.appendChild(this.$printMarginEl);
this.content.insertBefore(containerEl, this.$textLayer.element);
this.content.insertBefore(containerEl, this.content.firstChild);
}
var style = this.$printMarginEl.style;
@ -686,7 +690,7 @@ var VirtualRenderer = function(container, theme) {
this.scrollLeft = scrollLeft;
this.session.setScrollLeft(scrollLeft);
this.scroller.className = this.scrollLeft == 0 ? "ace_scroller" : "ace_scroller horscroll";
this.scroller.className = this.scrollLeft == 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
}
// full
@ -1362,8 +1366,8 @@ var VirtualRenderer = function(container, theme) {
*
* [Adds a new class, `style`, to the editor.]{: #VirtualRenderer.setStyle}
**/
this.setStyle = function setStyle(style) {
dom.addCssClass(this.container, style);
this.setStyle = function setStyle(style, include) {
dom.setCssClass(this.container, style, include != false);
};
/**
@ -1373,7 +1377,7 @@ var VirtualRenderer = function(container, theme) {
* [Removes the class `style` from the editor.]{: #VirtualRenderer.unsetStyle}
**/
this.unsetStyle = function unsetStyle(style) {
dom.removeCssClass(this.container, style);
dom.removeCssClass(this.container, style);
};
/**

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,8 @@
"lib": "lib/ace"
},
"scripts": {
"test": "node lib/ace/test/all.js"
"test": "node lib/ace/test/all.js",
"postinstall": "node ./install.js"
},
"config": {
"github.com/sourcemint/bundler-js/0/-meta/config/0": {

View file

@ -1,19 +1,11 @@
/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: %uuid%) */
.%cssClass% .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.%cssClass% .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.%cssClass% .ace_gutter {
background: #e8e8e8;
color: #333;
}
.%cssClass% .ace_print_margin {
.%cssClass% .ace_print-margin {
width: 1px;
background: %printMargin%;
}
@ -39,7 +31,7 @@
background: %selection%;
}
.%cssClass%.multiselect .ace_selection.start {
.%cssClass%.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px %background%;
border-radius: 2px;
}
@ -53,15 +45,15 @@
border: 1px solid %bracket%;
}
.%cssClass% .ace_marker-layer .ace_active_line {
.%cssClass% .ace_marker-layer .ace_active-line {
background: %active_line%;
}
.%cssClass% .ace_gutter_active_line {
.%cssClass% .ace_gutter-active-line {
background-color: %active_line%;
}
.%cssClass% .ace_marker-layer .ace_selected_word {
.%cssClass% .ace_marker-layer .ace_selected-word {
%selected_word_highlight%
}

View file

@ -270,11 +270,13 @@ function convertLanguage(name) {
var languageHighlightRules = fillTemplate(modeHighlightTemplate, {
language: languageNameSanitized,
languageTokens: patterns,
respositoryRules: "/*** START REPOSITORY RULES\n" + repository + "\nEND REPOSITORY RULES ***/",
respositoryRules: "/*** START REPOSITORY RULES\n" + (Object.keys(repository).length === 0 ? "" : repository) + "\nEND REPOSITORY RULES ***/",
uuid: language.uuid
});
if (devMode) {
console.log(languageMode)
console.log(languageHighlightRules)
console.log("Not writing, 'cause we're in dev mode, baby.");
}
else {

View file

@ -60,7 +60,7 @@ var supportedScopes = {
"variable.parameter": "variable.parameter",
"meta": "meta",
"meta.tag.sgml.doctype": "xml_pe",
"meta.tag.sgml.doctype": "xml-pe",
"meta.tag": "meta.tag",
"meta.selector": "meta.selector",

View file

@ -6,13 +6,15 @@ var https = require("https")
var rootDir = __dirname + "/../lib/ace/"
var deps = [{
path: "worker/jshint.js",
path: "mode/javascript/jshint.js",
url: "https://raw.github.com/jshint/jshint/master/jshint.js",
needsFixup: true
}, {
path: "worker/jslint.js",
url: "https://raw.github.com/douglascrockford/JSLint/master/jslint.js",
needsFixup: true
needsFixup: true,
postProcess: function(t) {
return t.replace(
/"Expected a conditional expression and instead saw an assignment."/g,
'"Assignment in conditional expression"'
);
}
}, {
path: "mode/css/csslint.js",
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint-node.js",
@ -43,7 +45,9 @@ var getDep = function(dep) {
data = "define(function(require, exports, module) {\n"
+ data
+ "\n});"
if (dep.postProcess)
data = dep.postProcess(data)
fs.writeFile(rootDir + dep.path, data, "utf-8", function(err){
if (err) throw err
console.log("File " + dep.path + " saved.")