Merge branch 'master' into bold_fonts

Conflicts:
	lib/ace/theme/github.css
This commit is contained in:
Mostafa Eweda 2012-10-03 11:50:21 +02:00
commit 04030e847e
84 changed files with 3789 additions and 12594 deletions

View file

@ -124,6 +124,7 @@ var modesByName = {
tcl: ["Tcl" , "tcl"], tcl: ["Tcl" , "tcl"],
text: ["Text" , "txt"], text: ["Text" , "txt"],
textile: ["Textile" , "textile"], textile: ["Textile" , "textile"],
typescript: ["Typescript" , "typescript|ts|str"],
xml: ["XML" , "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"], xml: ["XML" , "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
xquery: ["XQuery" , "xq"], xquery: ["XQuery" , "xq"],
yaml: ["YAML" , "yaml"] yaml: ["YAML" , "yaml"]
@ -205,6 +206,7 @@ var docs = {
"docs/svg.svg": "SVG", "docs/svg.svg": "SVG",
"docs/tcl.tcl": "Tcl", "docs/tcl.tcl": "Tcl",
"docs/textile.textile": {name: "Textile", wrapped: true}, "docs/textile.textile": {name: "Textile", wrapped: true},
"docs/typescript.ts": "Typescript",
"docs/xml.xml": "XML", "docs/xml.xml": "XML",
"docs/xquery.xq": "XQuery", "docs/xquery.xq": "XQuery",
"docs/yaml.yaml": "YAML", "docs/yaml.yaml": "YAML",

View file

@ -16,7 +16,7 @@ index 23fc3fc..ed3b273 100644
+ this.highlight = function(re) { + this.highlight = function(re) {
+ if (!this.$searchHighlight) { + 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 = this.addDynamicMarker(highlight);
+ } + }
+ this.$searchHighlight.setRegexp(re); + this.$searchHighlight.setRegexp(re);

View file

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

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"> <link href="./doc/resources/ace/skeleton/images/favicon.ico" rel="icon" type="image/x-icon">
</head> </head>
<body> <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 id="wrapper">
<div class="content"> <div class="content">
<div class="column2"> <div class="column2">
@ -157,7 +161,7 @@ console.log(addResult);</div>
return x; return x;
}&lt;/div> }&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> &lt;script>
var editor = ace.edit("editor"); var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai"); editor.setTheme("ace/theme/monokai");
@ -483,10 +487,15 @@ tests for the highlighting.</p>
</li> </li>
<li> <li>
<img src="doc/site/images/zorba-logo.png" <img src="doc/site/images/zorba-logo.png"
style="position: relative; left: -7px; top: 16px; style="position: relative; left: -5px; top: 16px;
padding: 6px 4px 6px 6px;" /> padding: 6px 4px 6px 6px; width: 100px" />
<a href="http://www.zorba-xquery.com/html/demo">Zorba XQuery</a> <a href="http://www.zorba-xquery.com/html/demo">Zorba XQuery</a>
</li> </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> <li>
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a> <a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
</li> </li>

View file

@ -12,9 +12,9 @@
.ace_content { .ace_content {
position: absolute; position: absolute;
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: text; cursor: text;
} }
@ -27,13 +27,13 @@
z-index: 4; z-index: 4;
} }
.ace_gutter_active_line { .ace_gutter-active-line {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
} }
.ace_scroller.horscroll { .ace_scroller.ace_scroll-left {
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset; 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="); 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; position: absolute;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
right: 0; right: 0;
} }
.ace_editor .ace_sb div { .ace_scrollbar-inner {
position: absolute; position: absolute;
width: 1px; width: 1px;
left: 0; left: 0;
} }
.ace_editor .ace_print_margin_layer { .ace_print-margin {
z-index: 0;
position: absolute;
overflow: hidden;
margin: 0;
left: 0;
height: 100%;
width: 100%;
}
.ace_editor .ace_print_margin {
position: absolute; position: absolute;
height: 100%; height: 100%;
} }
.ace_editor > textarea { .ace_text-input {
position: absolute; position: absolute;
z-index: 0; z-index: 0;
width: 0.5em; width: 0.5em;
height: 1em; height: 1em;
opacity: 0; opacity: 0;
background: transparent; background: transparent;
appearance: none;
-moz-appearance: none; -moz-appearance: none;
appearance: none;
border: none; border: none;
resize: none; resize: none;
outline: none; outline: none;
overflow: hidden; overflow: hidden;
} }
.ace_editor > textarea.ace_composition { .ace_text-input.ace_composition {
background: #fff; background: #fff;
color: #000; color: #000;
z-index: 1000; z-index: 1000;
@ -121,15 +111,15 @@
white-space: nowrap; white-space: nowrap;
height: 100%; height: 100%;
width: 100%; width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
/* setting pointer-events: auto; on node under the mouse, which changes /* setting pointer-events: auto; on node under the mouse, which changes
during scroll, will break mouse wheel scrolling in Safari */ during scroll, will break mouse wheel scrolling in Safari */
pointer-events: none; pointer-events: none;
} }
.ace_gutter .ace_layer { .ace_gutter-layer {
position: relative; position: relative;
width: auto; width: auto;
text-align: right; text-align: right;
@ -153,13 +143,16 @@
.ace_cursor { .ace_cursor {
z-index: 4; z-index: 4;
position: absolute; position: absolute;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
} }
.ace_cursor.ace_hidden { .ace_cursor.ace_hidden {
opacity: 0.2; opacity: 0.2;
} }
.ace_editor.multiselect .ace_cursor { .ace_editor.ace_multiselect .ace_cursor {
border-left-width: 1px; border-left-width: 1px;
} }
@ -182,23 +175,23 @@
z-index: 6; z-index: 6;
} }
.ace_marker-layer .ace_active_line { .ace_marker-layer .ace_active-line {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
} }
.ace_marker-layer .ace_selected_word { .ace_marker-layer .ace_selected-word {
position: absolute; position: absolute;
z-index: 4; z-index: 4;
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
} }
.ace_line .ace_fold { .ace_line .ace_fold {
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
display: inline-block; display: inline-block;
height: 11px; height: 11px;
@ -232,11 +225,11 @@
background-position: center center, top left; background-position: center center, top left;
} }
.ace_dragging .ace_content { .ace_editor.ace_dragging .ace_content {
cursor: move; cursor: move;
} }
.ace_gutter_tooltip { .ace_gutter-tooltip {
background-color: #FFFFD5; background-color: #FFFFD5;
border: 1px solid gray; border: 1px solid gray;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
@ -245,9 +238,9 @@
padding: 4px; padding: 4px;
position: absolute; position: absolute;
z-index: 300; z-index: 300;
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default; cursor: default;
} }
@ -256,9 +249,9 @@
} }
.ace_fold-widget { .ace_fold-widget {
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0 -12px 0 1px; margin: 0 -12px 0 1px;
display: inline-block; display: inline-block;
@ -274,11 +267,11 @@
border: 1px solid transparent; 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"); 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"); 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 { .ace_dark .ace_fold-widget {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC"); 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=="); 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=="); background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
} }
.ace_dark .ace_fold-widget:hover { .ace_dark .ace_fold-widget:hover {
@ -321,7 +314,7 @@
.ace_fold-widget.invalid { .ace_fold-widget.ace_invalid {
background-color: #FFB4B4; background-color: #FFB4B4;
border-color: #DE5555; border-color: #DE5555;
} }

View file

@ -378,7 +378,7 @@ var EditSession = function(text, mode) {
this.highlight = function(re) { this.highlight = function(re) {
if (!this.$searchHighlight) { 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 = this.addDynamicMarker(highlight);
} }
this.$searchHighlight.setRegexp(re); this.$searchHighlight.setRegexp(re);
@ -752,15 +752,7 @@ var EditSession = function(text, mode) {
* Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event. * Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event.
**/ **/
this.setAnnotations = function(annotations) { this.setAnnotations = function(annotations) {
this.$annotations = {}; this.$annotations = 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._emit("changeAnnotation", {}); this._emit("changeAnnotation", {});
}; };

View file

@ -497,7 +497,7 @@ var Editor = function(renderer, session) {
} else { } else {
range = new Range(cursor.row, 0, cursor.row+1, 0); 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{\ .emacs-mode .ace_cursor{\
border: 2px rgba(50,250,50,0.8) solid!important;\ border: 2px rgba(50,250,50,0.8) solid!important;\
-moz-box-sizing: border-box!important;\ -moz-box-sizing: border-box!important;\
-webkit-box-sizing: border-box!important;\
box-sizing: border-box!important;\ box-sizing: border-box!important;\
background-color: rgba(0,250,0,0.9);\ background-color: rgba(0,250,0,0.9);\
opacity: 0.5;\ opacity: 0.5;\

View file

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

View file

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

View file

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

View file

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

View file

@ -44,6 +44,7 @@ var Gutter = function(parentEl) {
this.gutterWidth = 0; this.gutterWidth = 0;
this.$annotations = []; this.$annotations = [];
this.$updateAnnotations = this.$updateAnnotations.bind(this);
}; };
(function() { (function() {
@ -51,7 +52,10 @@ var Gutter = function(parentEl) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
this.setSession = function(session) { this.setSession = function(session) {
if (this.session)
this.session.removeEventListener("change", this.$updateAnnotations);
this.session = session; this.session = session;
session.on("change", this.$updateAnnotations);
}; };
this.addGutterDecoration = function(row, className){ this.addGutterDecoration = function(row, className){
@ -68,18 +72,16 @@ var Gutter = function(parentEl) {
this.setAnnotations = function(annotations) { this.setAnnotations = function(annotations) {
// iterate over sparse array // iterate over sparse array
this.$annotations = []; this.$annotations = []
for (var row in annotations) if (annotations.hasOwnProperty(row)) { var rowInfo, row;
var rowAnnotations = annotations[row]; for (var i = 0; i < annotations.length; i++) {
if (!rowAnnotations) var annotation = annotations[i];
continue; var row = annotation.row;
var rowInfo = this.$annotations[row];
var rowInfo = this.$annotations[row] = { if (!rowInfo) {
text: [] rowInfo = this.$annotations[row] = {text: []};
}; }
for (var i=0; i<rowAnnotations.length; i++) { var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</g, "&lt;");
var annotation = rowAnnotations[i];
var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</, "&lt;");
if (rowInfo.text.indexOf(annoText) === -1) if (rowInfo.text.indexOf(annoText) === -1)
rowInfo.text.push(annoText); rowInfo.text.push(annoText);
var type = annotation.type; var type = annotation.type;
@ -90,6 +92,23 @@ var Gutter = function(parentEl) {
else if (type == "info" && (!rowInfo.className)) else if (type == "info" && (!rowInfo.className))
rowInfo.className = " ace_info"; 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); c = foldWidgets[i] = this.session.getFoldWidget(i);
if (c) if (c)
html.push( html.push(
"<span class='ace_fold-widget ", c, "<span class='ace_fold-widget ace_", c,
c == "start" && i == foldStart && i < fold.end.row ? " closed" : " open", c == "start" && i == foldStart && i < fold.end.row ? " ace_closed" : " ace_open",
"' style='height:", config.lineHeight, "px", "' style='height:", config.lineHeight, "px",
"'></span>" "'></span>"
); );

View file

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

View file

@ -193,7 +193,7 @@
"state": "start", "state": "start",
"data": [ "data": [
[ "support.constant", "+" ], [ "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", "state": "start",
"data": [ "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 * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@ -24,9 +24,9 @@
*/ */
define(function(require, exports, module) { 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) { exports.starts = function(string, literal, start) {
return literal === string.substr(start, literal.length); return literal === string.substr(start, literal.length);
@ -43,7 +43,9 @@ define(function(require, exports, module) {
_results = []; _results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) { for (_i = 0, _len = array.length; _i < _len; _i++) {
item = array[_i]; item = array[_i];
if (item) _results.push(item); if (item) {
_results.push(item);
}
} }
return _results; return _results;
}; };
@ -51,7 +53,9 @@ define(function(require, exports, module) {
exports.count = function(string, substr) { exports.count = function(string, substr) {
var num, pos; var num, pos;
num = pos = 0; num = pos = 0;
if (!substr.length) return 1 / 0; if (!substr.length) {
return 1 / 0;
}
while (pos = 1 + string.indexOf(substr, pos)) { while (pos = 1 + string.indexOf(substr, pos)) {
num++; num++;
} }
@ -96,5 +100,16 @@ define(function(require, exports, module) {
return array[array.length - (back || 0) - 1]; 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 * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@ -24,7 +24,7 @@
*/ */
define(function(require, exports, module) { 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, 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; }; __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() { exports.Lexer = Lexer = (function() {
Lexer.name = 'Lexer';
function Lexer() {} function Lexer() {}
Lexer.prototype.tokenize = function(code, opts) { Lexer.prototype.tokenize = function(code, opts) {
var i, tag; var i, tag;
if (opts == null) opts = {}; if (opts == null) {
if (WHITESPACE.test(code)) code = "\n" + code; opts = {};
}
if (WHITESPACE.test(code)) {
code = "\n" + code;
}
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
this.code = code; this.code = code;
this.line = opts.line || 0; 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(); i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
} }
this.closeIndentation(); this.closeIndentation();
if (tag = this.ends.pop()) this.error("missing " + tag); if (tag = this.ends.pop()) {
if (opts.rewrite === false) return this.tokens; this.error("missing " + tag);
}
if (opts.rewrite === false) {
return this.tokens;
}
return (new Rewriter).rewrite(this.tokens); return (new Rewriter).rewrite(this.tokens);
}; };
Lexer.prototype.identifierToken = function() { Lexer.prototype.identifierToken = function() {
var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3; 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]; input = match[0], id = match[1], colon = match[2];
if (id === 'own' && this.tag() === 'FOR') { if (id === 'own' && this.tag() === 'FOR') {
this.token('OWN', id); this.token('OWN', id);
@ -105,7 +113,9 @@ define(function(require, exports, module) {
} }
} }
if (!forcedIdentifier) { 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() { tag = (function() {
switch (id) { switch (id) {
case '!': case '!':
@ -118,8 +128,6 @@ define(function(require, exports, module) {
return 'LOGIC'; return 'LOGIC';
case 'true': case 'true':
case 'false': case 'false':
case 'null':
case 'undefined':
return 'BOOL'; return 'BOOL';
case 'break': case 'break':
case 'continue': case 'continue':
@ -130,29 +138,33 @@ define(function(require, exports, module) {
})(); })();
} }
this.token(tag, id); this.token(tag, id);
if (colon) this.token(':', ':'); if (colon) {
this.token(':', ':');
}
return input.length; return input.length;
}; };
Lexer.prototype.numberToken = function() { Lexer.prototype.numberToken = function() {
var binaryLiteral, lexedLength, match, number, octalLiteral; 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]; number = match[0];
if (/E/.test(number)) { if (/^0[BOX]/.test(number)) {
this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'");
} else if (/[BOX]/.test(number)) {
this.error("radix prefix '" + number + "' must be lowercase"); 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'"); 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'"); this.error("octal literal '" + number + "' must be prefixed with '0o'");
} }
lexedLength = number.length; lexedLength = number.length;
if (octalLiteral = /0o([0-7]+)/.exec(number)) { if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
number = (parseInt(octalLiteral[1], 8)).toString(); number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16);
} }
if (binaryLiteral = /0b([01]+)/.exec(number)) { if (binaryLiteral = /^0b([01]+)/.exec(number)) {
number = (parseInt(binaryLiteral[1], 2)).toString(); number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16);
} }
this.token('NUMBER', number); this.token('NUMBER', number);
return lexedLength; return lexedLength;
@ -162,11 +174,15 @@ define(function(require, exports, module) {
var match, octalEsc, string; var match, octalEsc, string;
switch (this.chunk.charAt(0)) { switch (this.chunk.charAt(0)) {
case "'": 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')); this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n'));
break; break;
case '"': case '"':
if (!(string = this.balancedString(this.chunk, '"'))) return 0; if (!(string = this.balancedString(this.chunk, '"'))) {
return 0;
}
if (0 < string.indexOf('#{', 1)) { if (0 < string.indexOf('#{', 1)) {
this.interpolateString(string.slice(1, -1)); this.interpolateString(string.slice(1, -1));
} else { } else {
@ -176,7 +192,7 @@ define(function(require, exports, module) {
default: default:
return 0; 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.error("octal escape sequences " + string + " are not allowed");
} }
this.line += count(string, '\n'); this.line += count(string, '\n');
@ -185,7 +201,9 @@ define(function(require, exports, module) {
Lexer.prototype.heredocToken = function() { Lexer.prototype.heredocToken = function() {
var doc, heredoc, match, quote; var doc, heredoc, match, quote;
if (!(match = HEREDOC.exec(this.chunk))) return 0; if (!(match = HEREDOC.exec(this.chunk))) {
return 0;
}
heredoc = match[0]; heredoc = match[0];
quote = heredoc.charAt(0); quote = heredoc.charAt(0);
doc = this.sanitizeHeredoc(match[2], { doc = this.sanitizeHeredoc(match[2], {
@ -205,7 +223,9 @@ define(function(require, exports, module) {
Lexer.prototype.commentToken = function() { Lexer.prototype.commentToken = function() {
var comment, here, match; 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]; comment = match[0], here = match[1];
if (here) { if (here) {
this.token('HERECOMMENT', this.sanitizeHeredoc(here, { this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
@ -223,12 +243,15 @@ define(function(require, exports, module) {
return 0; return 0;
} }
this.token('JS', (script = match[0]).slice(1, -1)); this.token('JS', (script = match[0]).slice(1, -1));
this.line += count(script, '\n');
return script.length; return script.length;
}; };
Lexer.prototype.regexToken = function() { Lexer.prototype.regexToken = function() {
var flags, length, match, prev, regex, _ref2, _ref3; 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)) { if (match = HEREGEX.exec(this.chunk)) {
length = this.heregexToken(match); length = this.heregexToken(match);
this.line += count(match[0], '\n'); 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)) { if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) {
return 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]; _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2];
if (regex.slice(0, 2) === '/*') { if (regex.slice(0, 2) === '/*') {
this.error('regular expressions cannot begin with `*`'); this.error('regular expressions cannot begin with `*`');
} }
if (regex === '//') regex = '/(?:)/'; if (regex === '//') {
regex = '/(?:)/';
}
this.token('REGEX', "" + regex + flags); this.token('REGEX', "" + regex + flags);
return match.length; return match.length;
}; };
@ -270,7 +297,9 @@ define(function(require, exports, module) {
if (tag === 'TOKENS') { if (tag === 'TOKENS') {
tokens.push.apply(tokens, value); tokens.push.apply(tokens, value);
} else { } else {
if (!(value = value.replace(HEREGEX_OMIT, ''))) continue; if (!(value = value.replace(HEREGEX_OMIT, ''))) {
continue;
}
value = value.replace(/\\/g, '\\\\'); value = value.replace(/\\/g, '\\\\');
tokens.push(['STRING', this.makeString(value, '"', true)]); tokens.push(['STRING', this.makeString(value, '"', true)]);
} }
@ -281,18 +310,21 @@ define(function(require, exports, module) {
this.tokens.push(['STRING', '""'], ['+', '+']); this.tokens.push(['STRING', '""'], ['+', '+']);
} }
(_ref5 = this.tokens).push.apply(_ref5, tokens); (_ref5 = this.tokens).push.apply(_ref5, tokens);
if (flags) this.tokens.push([',', ','], ['STRING', '"' + flags + '"']); if (flags) {
this.tokens.push([',', ','], ['STRING', '"' + flags + '"']);
}
this.token(')', ')'); this.token(')', ')');
return heregex.length; return heregex.length;
}; };
Lexer.prototype.lineToken = function() { Lexer.prototype.lineToken = function() {
var diff, indent, match, noNewlines, prev, size; var diff, indent, match, noNewlines, size;
if (!(match = MULTI_DENT.exec(this.chunk))) return 0; if (!(match = MULTI_DENT.exec(this.chunk))) {
return 0;
}
indent = match[0]; indent = match[0];
this.line += count(indent, '\n'); this.line += count(indent, '\n');
this.seenFor = false; this.seenFor = false;
prev = last(this.tokens, 1);
size = indent.length - 1 - indent.lastIndexOf('\n'); size = indent.length - 1 - indent.lastIndexOf('\n');
noNewlines = this.unfinished(); noNewlines = this.unfinished();
if (size - this.indebt === this.indent) { if (size - this.indebt === this.indent) {
@ -342,7 +374,9 @@ define(function(require, exports, module) {
this.token('OUTDENT', dent); this.token('OUTDENT', dent);
} }
} }
if (dent) this.outdebt -= moveOut; if (dent) {
this.outdebt -= moveOut;
}
while (this.value() === ';') { while (this.value() === ';') {
this.tokens.pop(); this.tokens.pop();
} }
@ -358,7 +392,9 @@ define(function(require, exports, module) {
return 0; return 0;
} }
prev = last(this.tokens); prev = last(this.tokens);
if (prev) prev[match ? 'spaced' : 'newLine'] = true; if (prev) {
prev[match ? 'spaced' : 'newLine'] = true;
}
if (match) { if (match) {
return match[0].length; return match[0].length;
} else { } else {
@ -370,12 +406,16 @@ define(function(require, exports, module) {
while (this.value() === ';') { while (this.value() === ';') {
this.tokens.pop(); this.tokens.pop();
} }
if (this.tag() !== 'TERMINATOR') this.token('TERMINATOR', '\n'); if (this.tag() !== 'TERMINATOR') {
this.token('TERMINATOR', '\n');
}
return this; return this;
}; };
Lexer.prototype.suppressNewlines = function() { Lexer.prototype.suppressNewlines = function() {
if (this.value() === '\\') this.tokens.pop(); if (this.value() === '\\') {
this.tokens.pop();
}
return this; return this;
}; };
@ -383,7 +423,9 @@ define(function(require, exports, module) {
var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
if (match = OPERATOR.exec(this.chunk)) { if (match = OPERATOR.exec(this.chunk)) {
value = match[0]; value = match[0];
if (CODE.test(value)) this.tagParameters(); if (CODE.test(value)) {
this.tagParameters();
}
} else { } else {
value = this.chunk.charAt(0); value = this.chunk.charAt(0);
} }
@ -416,7 +458,9 @@ define(function(require, exports, module) {
tag = 'LOGIC'; tag = 'LOGIC';
} else if (prev && !prev.spaced) { } else if (prev && !prev.spaced) {
if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { 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'; tag = 'CALL_START';
} else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) {
tag = 'INDEX_START'; tag = 'INDEX_START';
@ -448,7 +492,9 @@ define(function(require, exports, module) {
if (HEREDOC_ILLEGAL.test(doc)) { if (HEREDOC_ILLEGAL.test(doc)) {
this.error("block comment cannot contain \"*/\", starting"); this.error("block comment cannot contain \"*/\", starting");
} }
if (doc.indexOf('\n') <= 0) return doc; if (doc.indexOf('\n') <= 0) {
return doc;
}
} else { } else {
while (match = HEREDOC_INDENT.exec(doc)) { while (match = HEREDOC_INDENT.exec(doc)) {
attempt = match[1]; attempt = match[1];
@ -457,14 +503,20 @@ define(function(require, exports, module) {
} }
} }
} }
if (indent) doc = doc.replace(RegExp("\\n" + indent, "g"), '\n'); if (indent) {
if (!herecomment) doc = doc.replace(/^\n/, ''); doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
}
if (!herecomment) {
doc = doc.replace(/^\n/, '');
}
return doc; return doc;
}; };
Lexer.prototype.tagParameters = function() { Lexer.prototype.tagParameters = function() {
var i, stack, tok, tokens; var i, stack, tok, tokens;
if (this.tag() !== ')') return this; if (this.tag() !== ')') {
return this;
}
stack = []; stack = [];
tokens = this.tokens; tokens = this.tokens;
i = tokens.length; i = tokens.length;
@ -508,7 +560,9 @@ define(function(require, exports, module) {
continue; continue;
case end: case end:
stack.pop(); 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]; end = stack[stack.length - 1];
continue; continue;
} }
@ -528,7 +582,9 @@ define(function(require, exports, module) {
Lexer.prototype.interpolateString = function(str, options) { 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; 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; heredoc = options.heredoc, regex = options.regex;
tokens = []; tokens = [];
pi = 0; pi = 0;
@ -541,7 +597,9 @@ define(function(require, exports, module) {
if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) { if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) {
continue; 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); inner = expr.slice(1, -1);
if (inner.length) { if (inner.length) {
nested = new Lexer().tokenize(inner, { nested = new Lexer().tokenize(inner, {
@ -563,28 +621,44 @@ define(function(require, exports, module) {
i += expr.length; i += expr.length;
pi = i + 1; pi = i + 1;
} }
if ((i > pi && pi < str.length)) tokens.push(['NEOSTRING', str.slice(pi)]); if ((i > pi && pi < str.length)) {
if (regex) return tokens; tokens.push(['NEOSTRING', str.slice(pi)]);
if (!tokens.length) return this.token('STRING', '""'); }
if (tokens[0][0] !== 'NEOSTRING') tokens.unshift(['', '']); if (regex) {
if (interpolated = tokens.length > 1) this.token('(', '('); 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) { for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) {
_ref3 = tokens[i], tag = _ref3[0], value = _ref3[1]; _ref3 = tokens[i], tag = _ref3[0], value = _ref3[1];
if (i) this.token('+', '+'); if (i) {
this.token('+', '+');
}
if (tag === 'TOKENS') { if (tag === 'TOKENS') {
(_ref4 = this.tokens).push.apply(_ref4, value); (_ref4 = this.tokens).push.apply(_ref4, value);
} else { } else {
this.token('STRING', this.makeString(value, '"', heredoc)); this.token('STRING', this.makeString(value, '"', heredoc));
} }
} }
if (interpolated) this.token(')', ')'); if (interpolated) {
this.token(')', ')');
}
return tokens; return tokens;
}; };
Lexer.prototype.pair = function(tag) { Lexer.prototype.pair = function(tag) {
var size, wanted; var size, wanted;
if (tag !== (wanted = last(this.ends))) { 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.indent -= size = last(this.indents);
this.outdentToken(size, true); this.outdentToken(size, true);
return this.pair(tag); return this.pair(tag);
@ -616,7 +690,9 @@ define(function(require, exports, module) {
}; };
Lexer.prototype.makeString = function(body, quote, heredoc) { 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) { body = body.replace(/\\([\s\S])/g, function(match, contents) {
if (contents === '\n' || contents === quote) { if (contents === '\n' || contents === quote) {
return contents; return contents;
@ -663,7 +739,7 @@ define(function(require, exports, module) {
COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES); 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']; STRICT_PROSCRIBED = ['arguments', 'eval'];
@ -723,15 +799,15 @@ define(function(require, exports, module) {
RELATION = ['IN', 'OF', 'INSTANCEOF']; 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'); NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING');
CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER']; CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];
INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL'); INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED');
LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; 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 * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@ -24,7 +24,7 @@
*/ */
define(function(require, exports, module) { 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, 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; }, __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() { exports.Rewriter = (function() {
Rewriter.name = 'Rewriter';
function Rewriter() {} function Rewriter() {}
Rewriter.prototype.rewrite = function(tokens) { Rewriter.prototype.rewrite = function(tokens) {
@ -67,7 +65,9 @@ define(function(require, exports, module) {
if (levels === 0 && condition.call(this, token, i)) { if (levels === 0 && condition.call(this, token, i)) {
return action.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) { if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) {
levels += 1; levels += 1;
} else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) { } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) {
@ -83,9 +83,13 @@ define(function(require, exports, module) {
_ref = this.tokens; _ref = this.tokens;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
tag = _ref[i][0]; 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() { 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.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
}; };
return this.scanTokens(function(token, i) { 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; return 1;
}); });
}; };
@ -124,25 +130,32 @@ define(function(require, exports, module) {
return token[0] = 'INDEX_END'; return token[0] = 'INDEX_END';
}; };
return this.scanTokens(function(token, i) { 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; return 1;
}); });
}; };
Rewriter.prototype.addImplicitBraces = function() { Rewriter.prototype.addImplicitBraces = function() {
var action, condition, sameLine, stack, start, startIndent, startsLine; var action, condition, sameLine, stack, start, startIndent, startIndex, startsLine;
stack = []; stack = [];
start = null; start = null;
startsLine = null; startsLine = null;
sameLine = true; sameLine = true;
startIndent = 0; startIndent = 0;
startIndex = 0;
condition = function(token, i) { condition = function(token, i) {
var one, tag, three, two, _ref, _ref1; 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]; _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; if ('HERECOMMENT' === (one != null ? one[0] : void 0)) {
return false;
}
tag = token[0]; tag = token[0];
if (__indexOf.call(LINEBREAKS, tag) >= 0) sameLine = false; if (__indexOf.call(LINEBREAKS, tag) >= 0) {
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')); 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) { action = function(token, i) {
var tok; var tok;
@ -163,6 +176,7 @@ define(function(require, exports, module) {
return 1; return 1;
} }
sameLine = true; sameLine = true;
startIndex = i + 1;
stack.push(['{']); stack.push(['{']);
idx = ago === '@' ? i - 2 : i - 1; idx = ago === '@' ? i - 2 : i - 1;
while (this.tag(idx - 2) === 'HERECOMMENT') { while (this.tag(idx - 2) === 'HERECOMMENT') {
@ -185,7 +199,9 @@ define(function(require, exports, module) {
condition = function(token, i) { condition = function(token, i) {
var post, tag, _ref, _ref1; var post, tag, _ref, _ref1;
tag = token[0]; 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') { if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') {
seenSingle = true; seenSingle = true;
} }
@ -206,19 +222,27 @@ define(function(require, exports, module) {
if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') { if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') {
noCall = true; 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); callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0);
seenSingle = false; seenSingle = false;
seenControl = false; seenControl = false;
if (__indexOf.call(LINEBREAKS, tag) >= 0) noCall = false; if (__indexOf.call(LINEBREAKS, tag) >= 0) {
if (prev && !prev.spaced && tag === '?') token.call = true; noCall = false;
if (token.fromThen) return 1; }
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))) { 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; return 1;
} }
tokens.splice(i, 0, this.generate('CALL_START', '(', token[2])); tokens.splice(i, 0, this.generate('CALL_START', '(', token[2]));
this.detectEnd(i + 1, condition, action); this.detectEnd(i + 1, condition, action);
if (prev[0] === '?') prev[0] = 'FUNC_EXIST'; if (prev[0] === '?') {
prev[0] = 'FUNC_EXIST';
}
return 2; 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')) { if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
starter = tag; starter = tag;
_ref1 = this.indentation(token, true), indent = _ref1[0], outdent = _ref1[1]; _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); tokens.splice(i + 1, 0, indent);
this.detectEnd(i + 2, condition, action); this.detectEnd(i + 2, condition, action);
if (tag === 'THEN') tokens.splice(i, 1); if (tag === 'THEN') {
tokens.splice(i, 1);
}
return 1; return 1;
} }
return 1; return 1;
@ -274,7 +302,9 @@ define(function(require, exports, module) {
} }
}; };
return this.scanTokens(function(token, i) { return this.scanTokens(function(token, i) {
if (token[0] !== 'IF') return 1; if (token[0] !== 'IF') {
return 1;
}
original = token; original = token;
this.detectEnd(i + 1, condition, action); this.detectEnd(i + 1, condition, action);
return 1; return 1;
@ -283,10 +313,14 @@ define(function(require, exports, module) {
Rewriter.prototype.indentation = function(token, implicit) { Rewriter.prototype.indentation = function(token, implicit) {
var indent, outdent; var indent, outdent;
if (implicit == null) implicit = false; if (implicit == null) {
implicit = false;
}
indent = ['INDENT', 2, token[2]]; indent = ['INDENT', 2, token[2]];
outdent = ['OUTDENT', 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]; return [indent, outdent];
}; };
@ -324,7 +358,7 @@ define(function(require, exports, module) {
IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; 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 = ['+', '-']; IMPLICIT_UNSPACED_CALL = ['+', '-'];

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

View file

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

View file

@ -41,6 +41,12 @@ var assert = require("../test/assertions");
module.exports = { module.exports = {
setUp : function() { setUp : function() {
this.tokenizer = new Mode().getTokenizer(); 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() { "test: tokenize keyword": function() {
@ -49,6 +55,195 @@ module.exports = {
assert.equal(tokens[0].type, "keyword"); assert.equal(tokens[0].type, "keyword");
}, },
"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 // TODO: disable. not yet implemented
"!test tokenize string with interpolation": function() { "!test tokenize string with interpolation": function() {
var tokens = this.tokenizer.getLineTokens('"#{ 22 / 7 } is a decent approximation of π"', "start").tokens; 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\\[", regex : "<\\!\\[CDATA\\[",
next : "cdata" next : "cdata"
}, { }, {
token : "xml_pe", token : "xml-pe",
regex : "<\\?.*?\\?>" regex : "<\\?.*?\\?>"
}, { }, {
token : "comment", token : "comment",

View file

@ -80,19 +80,13 @@ oop.inherits(Mode, TextMode);
worker.attachToDocument(session.getDocument()); worker.attachToDocument(session.getDocument());
worker.on("csslint", function(e) { worker.on("csslint", function(e) {
var errors = []; session.setAnnotations(e.data);
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); worker.on("terminate", function() {
session.clearAnnotations();
}); });
return worker; 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. THE SOFTWARE.
*/ */
/* Build time: 2-March-2012 02:47:11 */ /* Build time: 14-May-2012 10:24:48 */
/*! /*!
Parser-Lib Parser-Lib
@ -47,7 +47,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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 = {}; var parserlib = {};
(function(){ (function(){
@ -957,7 +957,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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(){ (function(){
var EventTarget = parserlib.util.EventTarget, var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase, TokenStreamBase = parserlib.util.TokenStreamBase,
@ -2171,7 +2171,7 @@ Parser.prototype = function(){
//there must be a next selector //there must be a next selector
if (nextSelector === null){ if (nextSelector === null){
this._unexpectedToken(this.LT(1)); this._unexpectedToken(tokenStream.LT(1));
} else { } else {
//nextSelector is an instance of SelectorPart //nextSelector is an instance of SelectorPart
@ -2666,7 +2666,8 @@ Parser.prototype = function(){
expr = null, expr = null,
prio = null, prio = null,
error = null, error = null,
invalid = null; invalid = null,
propertyName= "";
property = this._property(); property = this._property();
if (property !== null){ if (property !== null){
@ -2683,8 +2684,20 @@ Parser.prototype = function(){
prio = this._prio(); 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 { try {
this._validateProperty(property, expr); this._validateProperty(propertyName, expr);
} catch (ex) { } catch (ex) {
invalid = ex; invalid = ex;
} }
@ -3525,6 +3538,7 @@ var Properties = {
"background-repeat" : { multi: "<repeat-style>" }, "background-repeat" : { multi: "<repeat-style>" },
"background-size" : { multi: "<bg-size>", comma: true }, "background-size" : { multi: "<bg-size>", comma: true },
"baseline-shift" : "baseline | sub | super | <percentage> | <length>", "baseline-shift" : "baseline | sub | super | <percentage> | <length>",
"behavior" : 1,
"binding" : 1, "binding" : 1,
"bleed" : "<length>", "bleed" : "<length>",
"bookmark-label" : "<content> | <attr> | <string>", "bookmark-label" : "<content> | <attr> | <string>",
@ -3871,6 +3885,7 @@ var Properties = {
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida", "text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
"text-outline" : 1, "text-outline" : 1,
"text-overflow" : 1, "text-overflow" : 1,
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
"text-shadow" : 1, "text-shadow" : 1,
"text-transform" : "capitalize | uppercase | lowercase | none | inherit", "text-transform" : "capitalize | uppercase | lowercase | none | inherit",
"text-wrap" : "normal | none | avoid", "text-wrap" : "normal | none | avoid",
@ -5950,7 +5965,7 @@ var ValidationTypes = {
i, len, found = false; i, len, found = false;
for (i=0,len=args.length; i < len && !found; i++){ for (i=0,len=args.length; i < len && !found; i++){
if (text == args[i]){ if (text == args[i].toLowerCase()){
found = true; found = true;
} }
} }
@ -6042,7 +6057,7 @@ var ValidationTypes = {
}, },
"<gradient>": function(part) { "<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){ "<box>": function(part){
@ -6134,6 +6149,18 @@ var ValidationTypes = {
part, part,
i, len; 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")) { if (ValidationTypes.isAny(expression, "top | bottom")) {
result = true; result = true;
@ -6306,7 +6333,7 @@ var CSSLint = (function(){
formatters = [], formatters = [],
api = new parserlib.util.EventTarget(); api = new parserlib.util.EventTarget();
api.version = "0.9.7"; api.version = "0.9.8";
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Rule Management // Rule Management
@ -7633,7 +7660,7 @@ CSSLint.addRule({
parser.addListener("endstylesheet", function(){ parser.addListener("endstylesheet", function(){
reporter.stat("important", count); reporter.stat("important", count);
if (count >= 10){ 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);
} }
}); });
} }
@ -8289,6 +8316,33 @@ CSSLint.addRule({
} }
}); });
/*
* 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. * Rule: Don't use text-indent for image replacement if you need to support rtl.
* *
@ -8305,16 +8359,18 @@ CSSLint.addRule({
//initialization //initialization
init: function(parser, reporter){ init: function(parser, reporter){
var rule = this, var rule = this,
textIndent = false; textIndent,
direction;
function startRule(event){ function startRule(event){
textIndent = false; textIndent = false;
direction = "inherit";
} }
//event handler for end of rules //event handler for end of rules
function endRule(event){ 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); 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);
} }
} }
@ -8330,7 +8386,7 @@ CSSLint.addRule({
if (name == "text-indent" && value.parts[0].value < -99){ if (name == "text-indent" && value.parts[0].value < -99){
textIndent = event.property; textIndent = event.property;
} else if (name == "direction" && value == "ltr"){ } else if (name == "direction" && value == "ltr"){
textIndent = false; direction = "ltr";
} }
}); });
@ -8340,6 +8396,33 @@ CSSLint.addRule({
} }
}); });
/*
* 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. * Rule: Headings (h1-h6) should be defined only once.
*/ */
@ -8669,343 +8752,6 @@ CSSLint.addRule({
}); });
/*global CSSLint*/ /*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; exports.CSSLint = CSSLint;

View file

@ -32,25 +32,60 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var Mirror = require("../worker/mirror").Mirror; var Mirror = require("../worker/mirror").Mirror;
var CSSLint = require("./css/csslint").CSSLint; var CSSLint = require("./css/csslint").CSSLint;
var Worker = exports.Worker = function(sender) { var Worker = exports.Worker = function(sender) {
Mirror.call(this, 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); oop.inherits(Worker, Mirror);
(function() { (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() { this.onUpdate = function() {
var value = this.doc.getValue(); var value = this.doc.getValue();
var infoRules = this.infoRules;
var result = CSSLint.verify(value); var result = CSSLint.verify(value, this.ruleset);
this.sender.emit("csslint", result.messages.map(function(msg) { this.sender.emit("csslint", result.messages.map(function(msg) {
delete msg.rule; return {
return msg; row: msg.line - 1,
column: msg.col - 1,
text: msg.message,
type: infoRules[msg.rule.id] ? "info" : msg.type
}
})); }));
}; };

View file

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

View file

@ -125,23 +125,7 @@ oop.inherits(Mode, TextMode);
worker.attachToDocument(session.getDocument()); worker.attachToDocument(session.getDocument());
worker.on("jslint", function(results) { worker.on("jslint", function(results) {
var errors = []; session.setAnnotations(results.data);
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]);
}); });
worker.on("terminate", function() { worker.on("terminate", function() {

File diff suppressed because it is too large Load diff

View file

@ -33,48 +33,151 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var Mirror = require("../worker/mirror").Mirror; var Mirror = require("../worker/mirror").Mirror;
var lint = require("../worker/jshint").JSHINT; var lint = require("./javascript/jshint").JSHINT;
var parser = require("../narcissus/parser");
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) { var JavaScriptWorker = exports.JavaScriptWorker = function(sender) {
Mirror.call(this, sender); Mirror.call(this, sender);
this.setTimeout(500); this.setTimeout(500);
this.setOptions();
}; };
oop.inherits(JavaScriptWorker, Mirror); oop.inherits(JavaScriptWorker, Mirror);
(function() { (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() { this.onUpdate = function() {
var value = this.doc.getValue(); var value = this.doc.getValue();
value = value.replace(/^#!.*\n/, "\n"); value = value.replace(/^#!.*\n/, "\n");
if (!value) {
// var start = new Date(); this.sender.emit("jslint", []);
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"
});
return; return;
} finally { }
// console.log("parse 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";
} }
// var start = new Date(); errors.push({
// console.log("jslint") row: error.line-1,
lint(value, {undef: false, onevar: false, passfail: false}); column: error.character-1,
this.sender.emit("jslint", lint.errors); text: error.reason,
// console.log("lint time: " + (new Date() - start)); type: type,
raw: raw
});
if (errorAdded) {
// break;
} }
}
// console.log("lint time: " + (new Date() - start));
this.sender.emit("jslint", errors);
};
}).call(JavaScriptWorker.prototype); }).call(JavaScriptWorker.prototype);

View file

@ -58,11 +58,11 @@ module.exports = {
worker.setValue("Juhu Kinners"); worker.setValue("Juhu Kinners");
worker.deferredUpdate.call(); worker.deferredUpdate.call();
var error = this.sender.events[0][1]; var error = this.sender.events[0][1][0];
assert.equal(error.text, "missing ; before statement"); assert.equal(error.text, 'Missing ";" before statement');
assert.equal(error.type, "error"); assert.equal(error.type, "error");
assert.equal(error.row, 0); assert.equal(error.row, 0);
assert.equal(error.column, null); assert.equal(error.column, 4);
}, },
"test invalid multi line string": function() { "test invalid multi line string": function() {
@ -70,18 +70,23 @@ module.exports = {
worker.setValue('"a\n\\nn"'); worker.setValue('"a\n\\nn"');
worker.deferredUpdate.call(); worker.deferredUpdate.call();
var error = this.sender.events[0][1]; var error = this.sender.events[0][1][0];
assert.equal(error.text, "Unterminated string literal"); assert.equal(error.text, "Unclosed string.");
assert.equal(error.type, "error"); assert.equal(error.type, "error");
assert.equal(error.row, 0); 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); var worker = new JavaScriptWorker(this.sender);
worker.setValue("if('"); worker.setValue("if('");
worker.deferredUpdate.call(); 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\\[", regex : "<\\!\\[CDATA\\[",
next : "cdata" next : "cdata"
}, { }, {
token : "xml_pe", token : "xml-pe",
regex : "<\\?.*?\\?>" regex : "<\\?.*?\\?>"
}, { }, {
token : "comment", token : "comment",

View file

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

View file

@ -121,12 +121,12 @@ var XQueryParser = function(input, state) {
this.ap = function(token) this.ap = function(token)
{ {
this.addToken(token, "xml_pe"); this.addToken(token, "xml-pe");
}; };
this.ax = function(start, stop) 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) this.at = function(start, stop)

View file

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

View file

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

View file

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

View file

@ -399,7 +399,7 @@ var Editor = require("./editor").Editor;
return; return;
this.inMultiSelectMode = true; this.inMultiSelectMode = true;
this.setStyle("multiselect"); this.setStyle("ace_multiselect");
this.keyBinding.addKeyboardHandler(commands.keyboardHandler); this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
this.commands.on("exec", this.$onMultiSelectExec); this.commands.on("exec", this.$onMultiSelectExec);
@ -412,7 +412,7 @@ var Editor = require("./editor").Editor;
return; return;
this.inMultiSelectMode = false; this.inMultiSelectMode = false;
this.unsetStyle("multiselect"); this.unsetStyle("ace_multiselect");
this.keyBinding.removeKeyboardHandler(commands.keyboardHandler); this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
this.commands.removeEventListener("exec", this.$onMultiSelectExec); 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) { var ScrollBar = function(parent) {
this.element = dom.createElement("div"); this.element = dom.createElement("div");
this.element.className = "ace_sb"; this.element.className = "ace_scrollbar";
this.inner = dom.createElement("div"); this.inner = dom.createElement("div");
this.inner.className = "ace_scrollbar-inner";
this.element.appendChild(this.inner); this.element.appendChild(this.inner);
parent.appendChild(this.element); 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 { .ace-ambiance .ace_gutter {
background-color: #3d3d3d;
background-image: -moz-linear-gradient(left, #3D3D3D, #333); background-image: -moz-linear-gradient(left, #3D3D3D, #333);
background-image: -ms-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)); 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: -o-linear-gradient(left, #3D3D3D, #333);
background-image: linear-gradient(left, #3D3D3D, #333); background-image: linear-gradient(left, #3D3D3D, #333);
background-repeat: repeat-x; background-repeat: repeat-x;
border-right: 1px solid #4d4d4d;
text-shadow: 0px 1px 1px #4d4d4d; text-shadow: 0px 1px 1px #4d4d4d;
color: #222; color: #222;
border-right: 1px solid #4d4d4d;
overflow : hidden;
} }
.ace-ambiance .ace_gutter-layer { .ace-ambiance .ace_gutter-layer {
background: repeat left top; background: repeat left top;
width: 100%;
text-align: right;
} }
.ace-ambiance .ace_gutter-layer .ace_gutter-cell .ace_fold-widget { .ace-ambiance .ace_fold-widget {
position: absolute; text-align: center;
right: 2px; }
margin: 0;
vertical-align: middle; .ace-ambiance .ace_fold-widget:hover {
height: inherit; color: #777;
width: auto; }
.ace-ambiance .ace_fold-widget.ace_start,
.ace-ambiance .ace_fold-widget.ace_end,
.ace-ambiance .ace_fold-widget.ace_closed{
background: none; background: none;
border: none; border: none;
box-shadow: none; box-shadow: none;
outline: none;
} }
.ace-ambiance .ace_gutter-layer .ace_gutter-cell .ace_fold-widget:hover { .ace-ambiance .ace_fold-widget.ace_start:after {
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 {
content: '▾' 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: '‣' content: '‣'
} }
.ace-ambiance .ace_print_margin { .ace-ambiance .ace_print-margin {
border-left: 1px dotted #2D2D2D; border-left: 1px dotted #2D2D2D;
width: 100%; right: 0;
background: #262626; background: #262626;
} }
@ -75,9 +59,7 @@
} }
.ace-ambiance .ace_text-layer { .ace-ambiance .ace_text-layer {
cursor: text;
color: #E6E1DC; color: #E6E1DC;
background: url("noise.png") repeat left top;
} }
.ace-ambiance .ace_cursor { .ace-ambiance .ace_cursor {
@ -97,7 +79,7 @@
background: rgba(221, 240, 255, 0.20); 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-radius: 4px;
border: 8px solid #3f475d; border: 8px solid #3f475d;
box-shadow: 0 0 4px black; box-shadow: 0 0 4px black;
@ -112,12 +94,10 @@
border: 1px solid rgba(255, 255, 255, 0.25); 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); background: rgba(255, 255, 255, 0.031);
} }
.ace-ambiance .ace_invisible { .ace-ambiance .ace_invisible {
color: #333; color: #333;
} }
@ -223,7 +203,7 @@
color: #9b859d; color: #9b859d;
} }
.ace-ambiance .ace_xml_pe { .ace-ambiance .ace_xml-pe {
color: #494949; 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 { .ace-chrome .ace_gutter {
background: #ebebeb; background: #ebebeb;
color: #333; color: #333;
overflow : hidden; overflow : hidden;
} }
.ace-chrome .ace_print_margin { .ace-chrome .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8; background: #e8e8e8;
} }
@ -64,7 +56,7 @@
.ace-chrome .ace_line .ace_support.ace_type, .ace-chrome .ace_line .ace_support.ace_type,
.ace-chrome .ace_line .ace_support.ace_class .ace-chrome .ace_line .ace_support.ace_class
.ace-chrome .ace_line .ace_support.ace_other, { .ace-chrome .ace_line .ace_support.ace_other {
color: rgb(109, 121, 222); color: rgb(109, 121, 222);
} }
@ -96,7 +88,7 @@
color: rgb(49, 132, 149); color: rgb(49, 132, 149);
} }
.ace-chrome .ace_line .ace_xml_pe { .ace-chrome .ace_line .ace_xml-pe {
color: rgb(104, 104, 91); color: rgb(104, 104, 91);
} }
@ -130,15 +122,15 @@
border: 1px solid rgb(192, 192, 192); 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); background: rgba(0, 0, 0, 0.07);
} }
.ace-chrome .ace_gutter_active_line { .ace-chrome .ace_gutter-active-line {
background-color : #dcdcdc; background-color : #dcdcdc;
} }
.ace-chrome .ace_marker-layer .ace_selected_word { .ace-chrome .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255); background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250); border: 1px solid rgb(200, 200, 250);
} }

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 { .ace-clouds .ace_gutter {
background: #ebebeb; background: #ebebeb;
color: #333 color: #333
} }
.ace-clouds .ace_print_margin { .ace-clouds .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8 background: #e8e8e8
} }
@ -37,7 +29,7 @@
background: #BDD5FC background: #BDD5FC
} }
.ace-clouds.multiselect .ace_selection.start { .ace-clouds.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF; box-shadow: 0 0 3px 0px #FFFFFF;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #BFBFBF border: 1px solid #BFBFBF
} }
.ace-clouds .ace_marker-layer .ace_active_line { .ace-clouds .ace_marker-layer .ace_active-line {
background: #FFFBD1 background: #FFFBD1
} }
.ace-clouds .ace_gutter_active_line { .ace-clouds .ace_gutter-active-line {
background-color : #dcdcdc background-color : #dcdcdc
} }
.ace-clouds .ace_marker-layer .ace_selected_word { .ace-clouds .ace_marker-layer .ace_selected-word {
border: 1px solid #BDD5FC 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 { .ace-clouds-midnight .ace_gutter {
background: #232323; background: #232323;
color: #929292 color: #929292
} }
.ace-clouds-midnight .ace_print_margin { .ace-clouds-midnight .ace_print-margin {
width: 1px; width: 1px;
background: #232323 background: #232323
} }
@ -37,7 +29,7 @@
background: #000000 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; box-shadow: 0 0 3px 0px #191919;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #BFBFBF 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) 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) 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 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 { .ace-cobalt .ace_gutter {
background: #011e3a; background: #011e3a;
color: #fff color: #fff
} }
.ace-cobalt .ace_print_margin { .ace-cobalt .ace_print-margin {
width: 1px; width: 1px;
background: #011e3a background: #011e3a
} }
@ -37,7 +29,7 @@
background: rgba(179, 101, 57, 0.75) 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; box-shadow: 0 0 3px 0px #002240;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid rgba(255, 255, 255, 0.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) 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) 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) border: 1px solid rgba(179, 101, 57, 0.75)
} }

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 { .ace-crimson-editor .ace_gutter {
background: #ebebeb; background: #ebebeb;
color: #333; color: #333;
@ -17,7 +9,7 @@
text-align: right; text-align: right;
} }
.ace-crimson-editor .ace_print_margin { .ace-crimson-editor .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8; background: #e8e8e8;
} }
@ -112,7 +104,7 @@
color: rgb(0, 64, 128); color: rgb(0, 64, 128);
} }
.ace-crimson-editor .ace_line .ace_xml_pe { .ace-crimson-editor .ace_line .ace_xml-pe {
color: rgb(104, 104, 91); color: rgb(104, 104, 91);
} }
@ -133,11 +125,11 @@
border: 1px solid rgb(192, 192, 192); 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); background: rgb(232, 242, 254);
} }
.ace-crimson-editor .ace_gutter_active_line { .ace-crimson-editor .ace_gutter-active-line {
background-color : #dcdcdc; background-color : #dcdcdc;
} }
@ -145,7 +137,7 @@
color:rgb(28, 2, 255); 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); background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250); 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 { .ace-dawn .ace_gutter {
background: #ebebeb; background: #ebebeb;
color: #333 color: #333
} }
.ace-dawn .ace_print_margin { .ace-dawn .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8 background: #e8e8e8
} }
@ -37,7 +29,7 @@
background: rgba(39, 95, 255, 0.30) 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; box-shadow: 0 0 3px 0px #F9F9F9;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid rgba(75, 75, 126, 0.50) 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) background: rgba(36, 99, 180, 0.12)
} }
.ace-dawn .ace_gutter_active_line { .ace-dawn .ace_gutter-active-line {
background-color : #dcdcdc 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) 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 { .ace-dreamweaver .ace_gutter {
background: #e8e8e8; background: #e8e8e8;
color: #333; color: #333;
} }
.ace-dreamweaver .ace_print_margin { .ace-dreamweaver .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8; background: #e8e8e8;
} }
@ -107,7 +99,7 @@
color: #06F color: #06F
} }
.ace-dreamweaver .ace_line .ace_xml_pe { .ace-dreamweaver .ace_line .ace_xml-pe {
color: rgb(104, 104, 91); color: rgb(104, 104, 91);
} }
@ -141,11 +133,11 @@
border: 1px solid rgb(192, 192, 192); 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); 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); background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250); 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 { .ace-eclipse .ace_gutter {
background: #ebebeb; background: #ebebeb;
border-right: 1px solid rgb(159, 159, 159); border-right: 1px solid rgb(159, 159, 159);
color: rgb(136, 136, 136); color: rgb(136, 136, 136);
} }
.ace-eclipse .ace_print_margin { .ace-eclipse .ace_print-margin {
width: 1px; width: 1px;
background: #ebebeb; background: #ebebeb;
} }
@ -77,7 +69,7 @@
color: rgb(127, 0, 127); color: rgb(127, 0, 127);
} }
.ace-eclipse .ace_line .ace_xml_pe { .ace-eclipse .ace_line .ace_xml-pe {
color: rgb(104, 104, 91); color: rgb(104, 104, 91);
} }
@ -101,11 +93,11 @@
background: rgb(255, 255, 0); 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); 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); border: 1px solid rgb(181, 213, 255);
} }

View file

@ -1,18 +1,5 @@
/* CSS style content from github's default pygments highlighter template. /* CSS style content from github's default pygments highlighter template.
Cursor and selection styles from textmate.css. */ 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 { .ace-github .ace_gutter {
background: #e8e8e8; background: #e8e8e8;
color: #AAA; color: #AAA;
@ -68,7 +55,7 @@
font-weight: normal; font-weight: normal;
} }
.ace-github .ace_variable.ace_instancce { .ace-github .ace_variable.ace_instance {
color: teal; color: teal;
} }
@ -88,13 +75,15 @@
border-bottom: 1px solid black; 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); background: rgb(255, 255, 204);
} }
.ace-github .ace_marker-layer .ace_selection { .ace-github .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255); 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; box-shadow: 0 0 3px 0px white;
border-radius: 2px; border-radius: 2px;
} }
@ -117,17 +106,17 @@
border: 1px solid rgb(192, 192, 192); 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); 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); background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250); border: 1px solid rgb(200, 200, 250);
} }
.ace-github .ace_print_margin { .ace-github .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8; 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 { .ace-idle-fingers .ace_gutter {
background: #3b3b3b; background: #3b3b3b;
color: #fff color: #fff
} }
.ace-idle-fingers .ace_print_margin { .ace-idle-fingers .ace_print-margin {
width: 1px; width: 1px;
background: #3b3b3b background: #3b3b3b
} }
@ -37,7 +29,7 @@
background: rgba(90, 100, 126, 0.88) 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; box-shadow: 0 0 3px 0px #323232;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #404040 border: 1px solid #404040
} }
.ace-idle-fingers .ace_marker-layer .ace_active_line { .ace-idle-fingers .ace_marker-layer .ace_active-line {
background: #353637 background: #353637
} }
.ace-idle-fingers .ace_gutter_active_line { .ace-idle-fingers .ace_gutter-active-line {
background-color: #353637 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) 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 { .ace-kr-theme .ace_gutter {
background: #1c1917; background: #1c1917;
color: #FCFFE0 color: #FCFFE0
} }
.ace-kr-theme .ace_print_margin { .ace-kr-theme .ace_print-margin {
width: 1px; width: 1px;
background: #1c1917 background: #1c1917
} }
@ -37,7 +29,7 @@
background: rgba(170, 0, 255, 0.45) 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; box-shadow: 0 0 3px 0px #0B0A09;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid rgba(255, 177, 111, 0.32) 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 background: #38403D
} }
.ace-kr-theme .ace_gutter_active_line { .ace-kr-theme .ace_gutter-active-line {
background-color : #38403D 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) border: 1px solid rgba(170, 0, 255, 0.45)
} }

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 { .ace-merbivore .ace_gutter {
background: #202020; background: #202020;
color: #E6E1DC color: #E6E1DC
} }
.ace-merbivore .ace_print_margin { .ace-merbivore .ace_print-margin {
width: 1px; width: 1px;
background: #555651 background: #555651
} }
@ -37,7 +29,7 @@
background: #454545 background: #454545
} }
.ace-merbivore.multiselect .ace_selection.start { .ace-merbivore.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #161616; box-shadow: 0 0 3px 0px #161616;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #404040 border: 1px solid #404040
} }
.ace-merbivore .ace_marker-layer .ace_active_line { .ace-merbivore .ace_marker-layer .ace_active-line {
background: #333435 background: #333435
} }
.ace-merbivore .ace_gutter_active_line { .ace-merbivore .ace_gutter-active-line {
background-color: #333435 background-color: #333435
} }
.ace-merbivore .ace_marker-layer .ace_selected_word { .ace-merbivore .ace_marker-layer .ace_selected-word {
border: 1px solid #454545 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 { .ace-merbivore-soft .ace_gutter {
background: #262424; background: #262424;
color: #E6E1DC color: #E6E1DC
} }
.ace-merbivore-soft .ace_print_margin { .ace-merbivore-soft .ace_print-margin {
width: 1px; width: 1px;
background: #262424 background: #262424
} }
@ -37,7 +29,7 @@
background: #494949 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; box-shadow: 0 0 3px 0px #1C1C1C;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #404040 border: 1px solid #404040
} }
.ace-merbivore-soft .ace_marker-layer .ace_active_line { .ace-merbivore-soft .ace_marker-layer .ace_active-line {
background: #333435 background: #333435
} }
.ace-merbivore-soft .ace_gutter_active_line { .ace-merbivore-soft .ace_gutter-active-line {
background-color: #333435 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 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 { .ace-mono-industrial .ace_gutter {
background: #1d2521; background: #1d2521;
color: #C5C9C9 color: #C5C9C9
} }
.ace-mono-industrial .ace_print_margin { .ace-mono-industrial .ace_print-margin {
width: 1px; width: 1px;
background: #555651 background: #555651
} }
@ -37,7 +29,7 @@
background: rgba(145, 153, 148, 0.40) 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; box-shadow: 0 0 3px 0px #222C28;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid rgba(102, 108, 104, 0.50) 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) 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) 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) border: 1px solid rgba(145, 153, 148, 0.40)
} }

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 { .ace-monokai .ace_gutter {
background: #2f3129; background: #2f3129;
color: #f1f1f1 color: #f1f1f1
} }
.ace-monokai .ace_print_margin { .ace-monokai .ace_print-margin {
width: 1px; width: 1px;
background: #555651 background: #555651
} }
@ -37,7 +29,7 @@
background: #49483E background: #49483E
} }
.ace-monokai.multiselect .ace_selection.start { .ace-monokai.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #272822; box-shadow: 0 0 3px 0px #272822;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #49483E border: 1px solid #49483E
} }
.ace-monokai .ace_marker-layer .ace_active_line { .ace-monokai .ace_marker-layer .ace_active-line {
background: #202020 background: #202020
} }
.ace-monokai .ace_gutter_active_line { .ace-monokai .ace_gutter-active-line {
background-color: #272727 background-color: #272727
} }
.ace-monokai .ace_marker-layer .ace_selected_word { .ace-monokai .ace_marker-layer .ace_selected-word {
border: 1px solid #49483E 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 { .ace-pastel-on-dark .ace_gutter {
background: #353030; background: #353030;
color: #8F938F color: #8F938F
} }
.ace-pastel-on-dark .ace_print_margin { .ace-pastel-on-dark .ace_print-margin {
width: 1px; width: 1px;
background: #353030 background: #353030
} }
@ -37,7 +29,7 @@
background: rgba(221, 240, 255, 0.20) 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; box-shadow: 0 0 3px 0px #2C2828;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid rgba(255, 255, 255, 0.25) 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) 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) 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) border: 1px solid rgba(221, 240, 255, 0.20)
} }
@ -136,7 +128,7 @@
color: #C1C144 color: #C1C144
} }
.ace-pastel-on-dark .ace_xml_pe { .ace-pastel-on-dark .ace_xml-pe {
color: #494949 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 { .ace-solarized-dark .ace_gutter {
background: #01313f; background: #01313f;
color: #d0edf7 color: #d0edf7
} }
.ace-solarized-dark .ace_print_margin { .ace-solarized-dark .ace_print-margin {
width: 1px; width: 1px;
background: #33555E background: #33555E
} }
@ -35,12 +27,12 @@
border-bottom: 1px solid #D30102 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 { .ace-solarized-dark .ace_marker-layer .ace_selection {
background: rgba(255, 255, 255, 0.1) 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; box-shadow: 0 0 3px 0px #002B36;
border-radius: 2px border-radius: 2px
} }
@ -54,11 +46,11 @@
border: 1px solid rgba(147, 161, 161, 0.50) 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 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 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 { .ace-solarized-light .ace_gutter {
background: #fbf1d3; background: #fbf1d3;
color: #333 color: #333
} }
.ace-solarized-light .ace_print_margin { .ace-solarized-light .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8 background: #e8e8e8
} }
@ -37,7 +29,7 @@
background: #073642 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; box-shadow: 0 0 3px 0px #FDF6E3;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid rgba(147, 161, 161, 0.50) 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 background: #EEE8D5
} }
.ace-solarized-light .ace_gutter_active_line { .ace-solarized-light .ace_gutter-active-line {
background-color : #dcdcdc 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 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 { .ace-tm .ace_gutter {
background: #f0f0f0; background: #f0f0f0;
color: #333; color: #333;
} }
.ace-tm .ace_print_margin { .ace-tm .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8; background: #e8e8e8;
} }
@ -104,7 +96,7 @@
color: rgb(49, 132, 149); color: rgb(49, 132, 149);
} }
.ace-tm .ace_line .ace_xml_pe { .ace-tm .ace_line .ace_xml-pe {
color: rgb(104, 104, 91); color: rgb(104, 104, 91);
} }
@ -132,7 +124,7 @@
.ace-tm .ace_marker-layer .ace_selection { .ace-tm .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255); 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; box-shadow: 0 0 3px 0px white;
border-radius: 2px; border-radius: 2px;
} }
@ -149,15 +141,15 @@
border: 1px solid rgb(192, 192, 192); 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); background: rgba(0, 0, 0, 0.07);
} }
.ace-tm .ace_gutter_active_line { .ace-tm .ace_gutter-active-line {
background-color : #dcdcdc; background-color : #dcdcdc;
} }
.ace-tm .ace_marker-layer .ace_selected_word { .ace-tm .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255); background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250); 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 { .ace-tomorrow .ace_gutter {
background: #f6f6f6; background: #f6f6f6;
color: #4D4D4C color: #4D4D4C
} }
.ace-tomorrow .ace_print_margin { .ace-tomorrow .ace_print-margin {
width: 1px; width: 1px;
background: #f6f6f6 background: #f6f6f6
} }
@ -37,7 +29,7 @@
background: #D6D6D6 background: #D6D6D6
} }
.ace-tomorrow.multiselect .ace_selection.start { .ace-tomorrow.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF; box-shadow: 0 0 3px 0px #FFFFFF;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #D1D1D1 border: 1px solid #D1D1D1
} }
.ace-tomorrow .ace_marker-layer .ace_active_line { .ace-tomorrow .ace_marker-layer .ace_active-line {
background: #EFEFEF background: #EFEFEF
} }
.ace-tomorrow .ace_gutter_active_line { .ace-tomorrow .ace_gutter-active-line {
background-color : #dcdcdc background-color : #dcdcdc
} }
.ace-tomorrow .ace_marker-layer .ace_selected_word { .ace-tomorrow .ace_marker-layer .ace_selected-word {
border: 1px solid #D6D6D6 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 { .ace-tomorrow-night .ace_gutter {
background: #25282c; background: #25282c;
color: #C5C8C6 color: #C5C8C6
} }
.ace-tomorrow-night .ace_print_margin { .ace-tomorrow-night .ace_print-margin {
width: 1px; width: 1px;
background: #25282c background: #25282c
} }
@ -37,7 +29,7 @@
background: #373B41 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; box-shadow: 0 0 3px 0px #1D1F21;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #4B4E55 border: 1px solid #4B4E55
} }
.ace-tomorrow-night .ace_marker-layer .ace_active_line { .ace-tomorrow-night .ace_marker-layer .ace_active-line {
background: #282A2E background: #282A2E
} }
.ace-tomorrow-night .ace_gutter_active_line { .ace-tomorrow-night .ace_gutter-active-line {
background-color: #282A2E 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 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 { .ace-tomorrow-night-blue .ace_gutter {
background: #00204b; background: #00204b;
color: #7388b5 color: #7388b5
} }
.ace-tomorrow-night-blue .ace_print_margin { .ace-tomorrow-night-blue .ace_print-margin {
width: 1px; width: 1px;
background: #00204b background: #00204b
} }
@ -38,7 +30,7 @@
background: #003F8E 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; box-shadow: 0 0 3px 0px #002451;
border-radius: 2px border-radius: 2px
} }
@ -52,15 +44,15 @@
border: 1px solid #404F7D 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 background: #00346E
} }
.ace-tomorrow-night-blue .ace_gutter_active_line { .ace-tomorrow-night-blue .ace_gutter-active-line {
background-color: #022040 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 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 { .ace-tomorrow-night-bright .ace_gutter {
background: #1a1a1a; background: #1a1a1a;
color: #DEDEDE color: #DEDEDE
} }
.ace-tomorrow-night-bright .ace_print_margin { .ace-tomorrow-night-bright .ace_print-margin {
width: 1px; width: 1px;
background: #1a1a1a background: #1a1a1a
} }
@ -37,7 +29,7 @@
background: #424242 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; box-shadow: 0 0 3px 0px #000000;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #343434 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 background: #2A2A2A
} }
.ace-tomorrow-night-bright .ace_gutter_active_line { .ace-tomorrow-night-bright .ace_gutter-active-line {
background-color: #2A2A2A 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 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 { .ace-tomorrow-night-eighties .ace_gutter {
background: #272727; background: #272727;
color: #CCC color: #CCC
} }
.ace-tomorrow-night-eighties .ace_print_margin { .ace-tomorrow-night-eighties .ace_print-margin {
width: 1px; width: 1px;
background: #272727 background: #272727
} }
@ -38,7 +30,7 @@
background: #515151 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; box-shadow: 0 0 3px 0px #2D2D2D;
border-radius: 2px border-radius: 2px
} }
@ -52,15 +44,15 @@
border: 1px solid #6A6A6A 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 background: #393939
} }
.ace-tomorrow-night-eighties .ace_gutter_active_line { .ace-tomorrow-night-eighties .ace_gutter-active-line {
background-color: #393939 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 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 { .ace-twilight .ace_gutter {
background: #232323; background: #232323;
color: #E2E2E2 color: #E2E2E2
} }
.ace-twilight .ace_print_margin { .ace-twilight .ace_print-margin {
width: 1px; width: 1px;
background: #232323 background: #232323
} }
@ -37,7 +29,7 @@
background: rgba(221, 240, 255, 0.20) 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; box-shadow: 0 0 3px 0px #141414;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid rgba(255, 255, 255, 0.25) 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) 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) 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) border: 1px solid rgba(221, 240, 255, 0.20)
} }
@ -133,7 +125,7 @@
color: #7587A6 color: #7587A6
} }
.ace-twilight .ace_xml_pe { .ace-twilight .ace_xml-pe {
color: #494949 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 { .ace-vibrant-ink .ace_gutter {
background: #1a1a1a; background: #1a1a1a;
color: #BEBEBE color: #BEBEBE
} }
.ace-vibrant-ink .ace_print_margin { .ace-vibrant-ink .ace_print-margin {
width: 1px; width: 1px;
background: #1a1a1a background: #1a1a1a
} }
@ -37,7 +29,7 @@
background: #6699CC 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; box-shadow: 0 0 3px 0px #0F0F0F;
border-radius: 2px border-radius: 2px
} }
@ -51,15 +43,15 @@
border: 1px solid #404040 border: 1px solid #404040
} }
.ace-vibrant-ink .ace_marker-layer .ace_active_line { .ace-vibrant-ink .ace_marker-layer .ace_active-line {
background: #333333 background: #333333
} }
.ace-vibrant-ink .ace_gutter_active_line { .ace-vibrant-ink .ace_gutter-active-line {
background-color: #333333 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 border: 1px solid #6699CC
} }

View file

@ -1,18 +1,11 @@
/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: EE3AD170-2B7F-4DE1-B724-C75F13FE0085) */ /* 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 { .ace-xcode .ace_gutter {
background: #e8e8e8; background: #e8e8e8;
color: #333 color: #333
} }
.ace-xcode .ace_print_margin { .ace-xcode .ace_print-margin {
width: 1px; width: 1px;
background: #e8e8e8 background: #e8e8e8
} }
@ -38,7 +31,7 @@
background: #B5D5FF background: #B5D5FF
} }
.ace-xcode.multiselect .ace_selection.start { .ace-xcode.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF; box-shadow: 0 0 3px 0px #FFFFFF;
border-radius: 2px border-radius: 2px
} }
@ -52,15 +45,15 @@
border: 1px solid #BFBFBF 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) 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) 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 border: 1px solid #B5D5FF
} }

View file

@ -488,7 +488,7 @@ var VirtualRenderer = function(container, theme) {
if (!this.$gutterLineHighlight) { if (!this.$gutterLineHighlight) {
this.$gutterLineHighlight = dom.createElement("div"); this.$gutterLineHighlight = dom.createElement("div");
this.$gutterLineHighlight.className = "ace_gutter_active_line"; this.$gutterLineHighlight.className = "ace_gutter-active-line";
this.$gutter.appendChild(this.$gutterLineHighlight); this.$gutter.appendChild(this.$gutterLineHighlight);
return; return;
} }
@ -516,11 +516,11 @@ var VirtualRenderer = function(container, theme) {
if (!this.$printMarginEl) { if (!this.$printMarginEl) {
containerEl = dom.createElement("div"); 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 = dom.createElement("div");
this.$printMarginEl.className = "ace_print_margin"; this.$printMarginEl.className = "ace_print-margin";
containerEl.appendChild(this.$printMarginEl); containerEl.appendChild(this.$printMarginEl);
this.content.insertBefore(containerEl, this.$textLayer.element); this.content.insertBefore(containerEl, this.content.firstChild);
} }
var style = this.$printMarginEl.style; var style = this.$printMarginEl.style;
@ -690,7 +690,7 @@ var VirtualRenderer = function(container, theme) {
this.scrollLeft = scrollLeft; this.scrollLeft = scrollLeft;
this.session.setScrollLeft(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 // full

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,8 @@
"lib": "lib/ace" "lib": "lib/ace"
}, },
"scripts": { "scripts": {
"test": "node lib/ace/test/all.js" "test": "node lib/ace/test/all.js",
"postinstall": "node ./install.js"
}, },
"config": { "config": {
"github.com/sourcemint/bundler-js/0/-meta/config/0": { "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%) */ /* 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 { .%cssClass% .ace_gutter {
background: #e8e8e8; background: #e8e8e8;
color: #333; color: #333;
} }
.%cssClass% .ace_print_margin { .%cssClass% .ace_print-margin {
width: 1px; width: 1px;
background: %printMargin%; background: %printMargin%;
} }
@ -39,7 +31,7 @@
background: %selection%; background: %selection%;
} }
.%cssClass%.multiselect .ace_selection.start { .%cssClass%.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px %background%; box-shadow: 0 0 3px 0px %background%;
border-radius: 2px; border-radius: 2px;
} }
@ -53,15 +45,15 @@
border: 1px solid %bracket%; border: 1px solid %bracket%;
} }
.%cssClass% .ace_marker-layer .ace_active_line { .%cssClass% .ace_marker-layer .ace_active-line {
background: %active_line%; background: %active_line%;
} }
.%cssClass% .ace_gutter_active_line { .%cssClass% .ace_gutter-active-line {
background-color: %active_line%; background-color: %active_line%;
} }
.%cssClass% .ace_marker-layer .ace_selected_word { .%cssClass% .ace_marker-layer .ace_selected-word {
%selected_word_highlight% %selected_word_highlight%
} }

View file

@ -270,11 +270,13 @@ function convertLanguage(name) {
var languageHighlightRules = fillTemplate(modeHighlightTemplate, { var languageHighlightRules = fillTemplate(modeHighlightTemplate, {
language: languageNameSanitized, language: languageNameSanitized,
languageTokens: patterns, 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 uuid: language.uuid
}); });
if (devMode) { if (devMode) {
console.log(languageMode)
console.log(languageHighlightRules)
console.log("Not writing, 'cause we're in dev mode, baby."); console.log("Not writing, 'cause we're in dev mode, baby.");
} }
else { else {

View file

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

View file

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