Merge remote-tracking branch 'remotes/origin/master' into v-1.2
Conflicts: build lib/ace/document.js lib/ace/editor.js
This commit is contained in:
commit
29023787e5
125 changed files with 89027 additions and 86666 deletions
4
.gitmodules
vendored
4
.gitmodules
vendored
|
|
@ -1,6 +1,6 @@
|
|||
[submodule "doc/wiki"]
|
||||
path = doc/wiki
|
||||
url = git://github.com/ajaxorg/ace.wiki.git
|
||||
url = https://github.com/ajaxorg/ace.wiki.git
|
||||
[submodule "build"]
|
||||
path = build
|
||||
url = git://github.com/ajaxorg/ace-builds.git
|
||||
url = https://github.com/ajaxorg/ace-builds.git
|
||||
|
|
|
|||
|
|
@ -1,3 +1,31 @@
|
|||
2014.09.21 Version 1.1.7
|
||||
|
||||
* Bugfixes
|
||||
- fix several bugs in autocompletion
|
||||
- workaround for inaccurate getBoundingClientRect on chrome 37
|
||||
|
||||
2014.08.17 Version 1.1.6
|
||||
|
||||
* Bugfixes
|
||||
- fix regression in double tap to highlight
|
||||
- Improved Latex Mode (Daniel Felder)
|
||||
|
||||
* API Changes
|
||||
- editor.destroy destroys editor.session too (call editor.setSession(null) to prevent that)
|
||||
|
||||
* new language modes
|
||||
- Praat (José Joaquín Atria)
|
||||
- Eiffel (Victorien Elvinger)
|
||||
- G-code (Adam Joseph Cook)
|
||||
|
||||
2014.07.09 Version 1.1.5
|
||||
|
||||
* Bugfixes
|
||||
- fix regression in autocomplete popup
|
||||
|
||||
* new language modes
|
||||
- gitignore (Devon Carew)
|
||||
|
||||
2014.07.01 Version 1.1.4
|
||||
|
||||
* New Features
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ function buildAce(options) {
|
|||
buildSubmodule(options, {
|
||||
projectType: "theme",
|
||||
require: ["ace/theme/" + name]
|
||||
}, "theme-" + name.replace("_theme", ""));
|
||||
}, "theme-" + name);
|
||||
});
|
||||
// keybindings
|
||||
["vim", "emacs"].forEach(function(name) {
|
||||
|
|
@ -536,7 +536,7 @@ function generateThemesModule(themes) {
|
|||
function addSnippetFile(modeName) {
|
||||
var snippetFilePath = ACE_HOME + "/lib/ace/snippets/" + modeName;
|
||||
if (!fs.existsSync(snippetFilePath + ".js")) {
|
||||
copy.file(ACE_HOME + "/tool/snippets.tmpl.js", snippetFilePath + ".js", function(t) {
|
||||
copy.file(ACE_HOME + "/tool/templates/snippets.js", snippetFilePath + ".js", function(t) {
|
||||
return t.replace(/%modeName%/g, modeName);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ Take Ace for a spin!
|
|||
|
||||
Check out the Ace live [demo](http://ace.c9.io/build/kitchen-sink.html) or get a [Cloud9 IDE account](https://c9.io/) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.io/ace/build/textarea/editor.html).
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.io/ace/build/demo/bookmarklet/index.html).
|
||||
|
||||
Embedding Ace
|
||||
-------------
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@
|
|||
<article id="Selection" data-title="Selection (class)" class="article">
|
||||
<div class="section description">
|
||||
<div class="memberContent"><p>Contains the cursor position and the text selection of an edit session.</p>
|
||||
<p>The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.</p>
|
||||
<p>The row/columns used in the selection are in document coordinates representing the coordinates as they appear in the document before applying soft wrap and folding.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1778,4 +1778,4 @@
|
|||
<script defer src="./resources/javascripts/disqus-ext.js"></script>
|
||||
<script defer src="./resources/javascripts/ga.js"></script>
|
||||
<div id="disqus_thread"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ function foo() {
|
|||
|
||||
function inject(options, callback) {
|
||||
var baseUrl = options.baseUrl || "../../src-noconflict";
|
||||
|
||||
|
||||
var load = function(path, callback) {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
|
@ -87,7 +87,7 @@ function inject(options, callback) {
|
|||
// Call the inject function to load the ace files.
|
||||
var textAce;
|
||||
inject({}, function () {
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
var t = document.querySelector("textarea");
|
||||
textAce = ace.require("ace/ext/textarea").transformTextarea(t);
|
||||
setTimeout(function(){textAce.setDisplaySettings(true)});
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#editor {
|
||||
|
||||
#editor {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
alert("Ace Rocks " + items[i]);
|
||||
}
|
||||
}</pre>
|
||||
|
||||
|
||||
<script src="src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
var editor = ace.edit("editor");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* 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
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* * 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
|
||||
|
|
@ -65,7 +65,7 @@ var _define = function(module, deps, payload) {
|
|||
_define.modules = {};
|
||||
_define.payloads = {};
|
||||
}
|
||||
|
||||
|
||||
_define.payloads[module] = payload;
|
||||
_define.modules[module] = null;
|
||||
};
|
||||
|
|
@ -160,7 +160,7 @@ var lookup = function(parentId, moduleName) {
|
|||
function exportAce(ns) {
|
||||
var require = function(module, callback) {
|
||||
return _require("", module, callback);
|
||||
};
|
||||
};
|
||||
|
||||
var root = global;
|
||||
if (ns) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ body {
|
|||
margin:0;
|
||||
padding:0;
|
||||
background-color:#e6f5fc;
|
||||
|
||||
|
||||
}
|
||||
|
||||
H2, H3, H4 {
|
||||
|
|
@ -58,7 +58,7 @@ PRE{
|
|||
position:relative;
|
||||
overflow:hidden;
|
||||
background: url(images/background.png) repeat-x 0 0;
|
||||
border-bottom:1px solid #c9e8fa;
|
||||
border-bottom:1px solid #c9e8fa;
|
||||
}
|
||||
|
||||
#header .content .signature {
|
||||
|
|
@ -224,7 +224,3 @@ UL.menu-footer LI A {
|
|||
UL.menu-footer LI A:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -415,28 +415,11 @@ bindDropdown("folding", function(value) {
|
|||
});
|
||||
|
||||
bindDropdown("soft_wrap", function(value) {
|
||||
var session = env.editor.session;
|
||||
var renderer = env.editor.renderer;
|
||||
switch (value) {
|
||||
case "off":
|
||||
session.setUseWrapMode(false);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "free":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(null, null);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
default:
|
||||
session.setUseWrapMode(true);
|
||||
var col = parseInt(value, 10);
|
||||
session.setWrapLimitRange(col, col);
|
||||
renderer.setPrintMarginColumn(col);
|
||||
}
|
||||
env.editor.setOption("wrap", value);
|
||||
});
|
||||
|
||||
bindCheckbox("select_style", function(checked) {
|
||||
env.editor.setSelectionStyle(checked ? "line" : "text");
|
||||
env.editor.setOption("selectionStyle", checked ? "line" : "text");
|
||||
});
|
||||
|
||||
bindCheckbox("highlight_active", function(checked) {
|
||||
|
|
@ -592,7 +575,7 @@ env.editSnippets = function() {
|
|||
require("ace/ext/language_tools");
|
||||
env.editor.setOptions({
|
||||
enableBasicAutocompletion: true,
|
||||
enableLiveAutocompletion: true,
|
||||
enableLiveAutocompletion: false,
|
||||
enableSnippets: true
|
||||
});
|
||||
|
||||
|
|
|
|||
11
demo/kitchen-sink/docs/.gitignore
vendored
Normal file
11
demo/kitchen-sink/docs/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# A sample .gitignore file.
|
||||
|
||||
.buildlog
|
||||
.DS_Store
|
||||
.svn
|
||||
|
||||
# Negated patterns:
|
||||
!foo.bar
|
||||
|
||||
# Also ignore user settings...
|
||||
/.settings
|
||||
|
|
@ -1,28 +1,18 @@
|
|||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12pX;
|
||||
font: 12px Monaco, "Courier New", monospace;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.blinker {
|
||||
animation-duration: 1s;
|
||||
animation-name: blink;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
animation-timing-function: linear;
|
||||
animation: blink 1s linear infinite alternate;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
0% {
|
||||
0%, 40% {
|
||||
opacity: 0;
|
||||
}
|
||||
40% {
|
||||
opacity: 0;
|
||||
}
|
||||
40.5% {
|
||||
opacity: 1
|
||||
}
|
||||
100% {
|
||||
|
||||
40.5%, 100% {
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
30
demo/kitchen-sink/docs/eiffel.e
Normal file
30
demo/kitchen-sink/docs/eiffel.e
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
note
|
||||
description: "Represents a person."
|
||||
|
||||
class
|
||||
PERSON
|
||||
|
||||
create
|
||||
make, make_unknown
|
||||
|
||||
feature {NONE} -- Creation
|
||||
|
||||
make (a_name: like name)
|
||||
-- Create a person with `a_name' as `name'.
|
||||
do
|
||||
name := a_name
|
||||
ensure
|
||||
name = a_name
|
||||
end
|
||||
|
||||
make_unknown
|
||||
do ensure
|
||||
name = Void
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: detachable STRING
|
||||
-- Full name or Void if unknown.
|
||||
|
||||
end
|
||||
31
demo/kitchen-sink/docs/gcode.gcode
Normal file
31
demo/kitchen-sink/docs/gcode.gcode
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
O003 (DIAMOND SQUARE)
|
||||
N2 G54 G90 G49 G80
|
||||
N3 M6 T1 (1.ENDMILL)
|
||||
N4 M3 S1800
|
||||
N5 G0 X-.6 Y2.050
|
||||
N6 G43 H1 Z.1
|
||||
N7 G1 Z-.3 F50.
|
||||
N8 G41 D1 Y1.45
|
||||
N9 G1 X0 F20.
|
||||
N10 G2 J-1.45
|
||||
(CUTTER COMP CANCEL)
|
||||
N11 G1 Z-.2 F50.
|
||||
N12 Y-.990
|
||||
N13 G40
|
||||
N14 G0 X-.6 Y1.590
|
||||
N15 G0 Z.1
|
||||
N16 M5 G49 G28 G91 Z0
|
||||
N17 CALL O9456
|
||||
N18 #500=0.004
|
||||
N19 #503=[#500+#501]
|
||||
N20 VC45=0.0006
|
||||
VS4=0.0007
|
||||
N21 G90 G10 L20 P3 X5.Y4. Z6.567
|
||||
N22 G0 X5000
|
||||
N23 IF [#1 LT 0.370] GOTO 49
|
||||
N24 X-0.678 Y+.990
|
||||
N25 G84.3 X-0.1
|
||||
N26 #4=#5*COS[45]
|
||||
N27 #4=#5*SIN[45]
|
||||
N28 VZOFZ=652.9658
|
||||
%
|
||||
6
demo/kitchen-sink/docs/io.io
Normal file
6
demo/kitchen-sink/docs/io.io
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// computes factorial of a number
|
||||
factorial := method(n,
|
||||
if(n == 0, return 1)
|
||||
res := 1
|
||||
Range 1 to(n) foreach(i, res = res * i)
|
||||
)
|
||||
|
|
@ -1 +1,17 @@
|
|||
TODO
|
||||
%{
|
||||
%{
|
||||
Ace Matlab demo
|
||||
%}
|
||||
%}
|
||||
|
||||
classdef hello
|
||||
methods
|
||||
function greet(this)
|
||||
disp('Hello!') % say hi
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% transpose
|
||||
a = [ 'x''y', "x\n\
|
||||
y", 1' ]' + 2'
|
||||
148
demo/kitchen-sink/docs/praat.praat
Normal file
148
demo/kitchen-sink/docs/praat.praat
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
form Highlighter test
|
||||
sentence My_sentence This should all be a string
|
||||
text My_text This should also all be a string
|
||||
word My_word Only the first word is a string, the rest is invalid
|
||||
boolean Binary 1
|
||||
boolean Text no
|
||||
boolean Quoted "yes"
|
||||
comment This should be a string
|
||||
real left_Range -123.6
|
||||
positive right_Range_max 3.3
|
||||
integer Int 4
|
||||
natural Nat 4
|
||||
endform
|
||||
|
||||
# External scripts
|
||||
include /path/to/file
|
||||
runScript: "/path/to/file"
|
||||
execute /path/to/file
|
||||
|
||||
stopwatch
|
||||
|
||||
# old-style procedure call
|
||||
call oldStyle "quoted" 2 unquoted string
|
||||
assert oldStyle.local = 1
|
||||
|
||||
# New-style procedure call with parens
|
||||
@newStyle("quoted", 2, "quoted string")
|
||||
if praatVersion >= 5364
|
||||
# New-style procedure call with colon
|
||||
@newStyle: "quoted", 2, "quoted string"
|
||||
endif
|
||||
|
||||
# if-block with built-in variables
|
||||
if windows
|
||||
# We are on Windows
|
||||
elsif unix = 1 or !macintosh
|
||||
exitScript: "We are on Linux"
|
||||
else macintosh == 1
|
||||
exit We are on Mac
|
||||
endif
|
||||
|
||||
# inline if with inline comment
|
||||
var = if macintosh = 1 then 0 else 1 fi ; This is an inline comment
|
||||
|
||||
# for-loop with explicit from using local variable
|
||||
# and paren-style function calls and variable interpolation
|
||||
n = numberOfSelected("Sound")
|
||||
for i from newStyle.local to n
|
||||
sound'i' = selected("Sound", i)
|
||||
sound[i] = sound'i'
|
||||
endfor
|
||||
|
||||
for i from 1 to n
|
||||
# Different styles of object selection
|
||||
select sound'i'
|
||||
sound = selected()
|
||||
sound$ = selected$("Sound")
|
||||
select Sound 'sound$'
|
||||
selectObject(sound[i])
|
||||
selectObject: sound
|
||||
|
||||
# Pause commands
|
||||
beginPause("Viewing " + sound$)
|
||||
if i > 1
|
||||
button = endPause("Stop", "Previous",
|
||||
...if i = total_sounds then "Finish" else "Next" fi,
|
||||
...3, 1)
|
||||
else
|
||||
button = endPause("Stop",
|
||||
...if i = total_sounds then "Finish" else "Next" fi,
|
||||
...2, 1)
|
||||
endif
|
||||
editor_name$ = if total_textgrids then "TextGrid " else "Sound " fi + name$
|
||||
nocheck editor 'editor_name$'
|
||||
nocheck Close
|
||||
nocheck endeditor
|
||||
|
||||
# New-style standalone command call
|
||||
Rename: "SomeName"
|
||||
|
||||
# Command call with assignment
|
||||
duration = Get total duration
|
||||
|
||||
# Multi-line command with modifier
|
||||
pitch = noprogress To Pitch (ac): 0, 75, 15, "no",
|
||||
...0.03, 0.45, 0.01, 0.35, 0.14, 600
|
||||
|
||||
# do-style command with assignment
|
||||
minimum = do("Get minimum...", 0, 0, "Hertz", "Parabolic")
|
||||
|
||||
# New-style multi-line command call with broken strings
|
||||
table = Create Table with column names: "table", 0,
|
||||
..."file subject speaker
|
||||
...f0 f1 f2 f3 " +
|
||||
..."duration response"
|
||||
|
||||
removeObject: pitch, table
|
||||
|
||||
# Picture window commands
|
||||
selectObject: sound
|
||||
# do-style command
|
||||
do("Select inner viewport...", 1, 6, 0.5, 1.5)
|
||||
Black
|
||||
Draw... 0 0 0 0 "no" Curve
|
||||
Draw inner box
|
||||
Text bottom: "yes", sound$
|
||||
Erase all
|
||||
|
||||
# Demo window commands
|
||||
demo Erase all
|
||||
demo Select inner viewport... 0 100 0 100
|
||||
demo Axes... 0 100 0 100
|
||||
demo Paint rectangle... white 0 100 0 100
|
||||
demo Text... 50 centre 50 half Click to finish
|
||||
demoWaitForInput ( )
|
||||
demo Erase all
|
||||
demo Text: 50, "centre", 50, "half", "Finished"
|
||||
endfor
|
||||
|
||||
# An old-style sendpraat block
|
||||
sendpraat Praat
|
||||
...'newline$' Create Sound as pure tone... "tone" 1 0 0.4 44100 440 0.2 0.01 0.01
|
||||
...'newline$' Play
|
||||
...'newline$' Remove
|
||||
|
||||
# A new-style sendpraat block
|
||||
beginSendPraat: "Praat"
|
||||
Create Sound as pure tone: "tone", 1, 0, 0.4, 44100, 440, 0.2, 0.01, 0.01
|
||||
duration = Get total duration
|
||||
Remove
|
||||
endSendPraat: "duration"
|
||||
appendInfoLine: "The generated sound lasted for ", duration, "seconds"
|
||||
|
||||
time = stopwatch
|
||||
clearinfo
|
||||
echo This script took
|
||||
print 'time' seconds to
|
||||
printline execute.
|
||||
|
||||
# Old-style procedure declaration
|
||||
procedure oldStyle .str1$ .num .str2$
|
||||
.local = 1
|
||||
endproc
|
||||
|
||||
# New-style procedure declaration
|
||||
procedure newStyle (.str1$, .num, .str2$)
|
||||
.local = 1
|
||||
endproc
|
||||
|
|
@ -46,4 +46,10 @@ body {
|
|||
position: absolute;
|
||||
right: 0;
|
||||
border-left: 1px solid;
|
||||
}
|
||||
}
|
||||
|
||||
/* .ace_text-input {
|
||||
z-index: 10!important;
|
||||
opacity: 1!important;
|
||||
background: rgb(84, 0, 255)!important;
|
||||
}*/
|
||||
|
|
|
|||
|
|
@ -1,39 +1,49 @@
|
|||
var editor;
|
||||
var embedded_editor;
|
||||
$(function() {
|
||||
ace.config.set("workerPath", "build/src-min");
|
||||
editor = ace.edit("ace_editor_demo");
|
||||
editor.container.style.opacity = "";
|
||||
embedded_editor = ace.edit("embedded_ace_code");
|
||||
embedded_editor.container.style.opacity = "";
|
||||
embedded_editor.session.setMode("ace/mode/html");
|
||||
embedded_editor.setAutoScrollEditorIntoView(true);
|
||||
embedded_editor.setOption("maxLines", 40);
|
||||
|
||||
editor.setOptions({
|
||||
maxLines: 30,
|
||||
mode: "ace/mode/javascript",
|
||||
autoScrollEditorIntoView: true
|
||||
});
|
||||
|
||||
ace.config.loadModule("ace/ext/emmet", function() {
|
||||
ace.require("ace/lib/net").loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() {
|
||||
embedded_editor.setOption("enableEmmet", true);
|
||||
editor.setOption("enableEmmet", true);
|
||||
});
|
||||
});
|
||||
|
||||
ace.config.loadModule("ace/ext/language_tools", function() {
|
||||
embedded_editor.setOptions({
|
||||
enableSnippets: true,
|
||||
enableBasicAutocompletion: true
|
||||
});
|
||||
if (typeof ace !== "undefined") {
|
||||
ace.config.set("workerPath", "build/src-min");
|
||||
editor = ace.edit("ace_editor_demo");
|
||||
editor.container.style.opacity = "";
|
||||
embedded_editor = ace.edit("embedded_ace_code");
|
||||
embedded_editor.container.style.opacity = "";
|
||||
embedded_editor.session.setMode("ace/mode/html");
|
||||
embedded_editor.setAutoScrollEditorIntoView(true);
|
||||
embedded_editor.setOption("maxLines", 40);
|
||||
|
||||
editor.setOptions({
|
||||
enableSnippets: true,
|
||||
enableBasicAutocompletion: true
|
||||
maxLines: 30,
|
||||
mode: "ace/mode/javascript",
|
||||
autoScrollEditorIntoView: true
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
ace.config.loadModule("ace/ext/emmet", function() {
|
||||
ace.require("ace/lib/net").loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() {
|
||||
embedded_editor.setOption("enableEmmet", true);
|
||||
editor.setOption("enableEmmet", true);
|
||||
});
|
||||
});
|
||||
|
||||
ace.config.loadModule("ace/ext/language_tools", function() {
|
||||
embedded_editor.setOptions({
|
||||
enableSnippets: true,
|
||||
enableBasicAutocompletion: true
|
||||
});
|
||||
editor.setOptions({
|
||||
enableSnippets: true,
|
||||
enableBasicAutocompletion: true
|
||||
});
|
||||
});
|
||||
} else {
|
||||
document.body.insertAdjacentHTML("afterbegin", '<div class="bs-docs-example">\
|
||||
<div class="alert alert-error">\
|
||||
<button type="button" class="close" data-dismiss="alert">\xd7</button>\
|
||||
<strong>Oh No!</strong> Couldn\'t load <code>build/src/ace.js</code>.<br>\
|
||||
You can build it by running <code>node Makefile.dryice.js</code><br>\
|
||||
Or download older version by running <code>git submodule update --init --recursive</code><br>\
|
||||
</div>\
|
||||
</div>');
|
||||
}
|
||||
$("ul.menu-list").mousedown(function(e) {
|
||||
if (e.button === 1) {
|
||||
e.preventDefault();
|
||||
|
|
@ -137,22 +147,22 @@ $(function() {
|
|||
});
|
||||
});
|
||||
|
||||
$(window).on("hashchange", function(e) {
|
||||
_gaq.push(['_trackPageview',location.pathname + location.search + location.hash]);
|
||||
tabs.each(function() {
|
||||
$(window).on("hashchange", function(e) {
|
||||
_gaq.push(['_trackPageview',location.pathname + location.search + location.hash]);
|
||||
tabs.each(function() {
|
||||
var idx = $.bbq.getState("nav") || "about";
|
||||
var section = e.fragment.split("&")[1] || "";
|
||||
$(this).find(tab_a_selector + "[href='#" + idx + "']").triggerHandler('click');
|
||||
|
||||
|
||||
// handles dropping in from new link
|
||||
var api = $.bbq.getState("api");
|
||||
if (api) {
|
||||
$(tab_a_selector + "[href='./api/" + api + ".html']").triggerHandler('click');
|
||||
}
|
||||
});
|
||||
}).trigger("hashchange");
|
||||
});
|
||||
}).trigger("hashchange");
|
||||
|
||||
highlight();
|
||||
highlight();
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -161,7 +171,11 @@ function highlight() {
|
|||
var highlighter = ace.require("ace/ext/static_highlight")
|
||||
var dom = ace.require("ace/lib/dom")
|
||||
function qsa(sel) {
|
||||
return Array.apply(null, document.querySelectorAll(sel));
|
||||
var els = document.querySelectorAll(sel);
|
||||
var result = [];
|
||||
for (var i = 0, l = els.length; i < l; i++)
|
||||
result[i] = els[i];
|
||||
return result;
|
||||
}
|
||||
|
||||
qsa("code[class]").forEach(function(el) {
|
||||
|
|
|
|||
|
|
@ -79,11 +79,21 @@ exports.edit = function(el) {
|
|||
throw new Error("ace.edit can't find div #" + _id);
|
||||
}
|
||||
|
||||
if (el.env && el.env.editor instanceof Editor)
|
||||
if (el && el.env && el.env.editor instanceof Editor)
|
||||
return el.env.editor;
|
||||
|
||||
var doc = exports.createEditSession(dom.getInnerText(el));
|
||||
el.innerHTML = '';
|
||||
var value = "";
|
||||
if (el && /input|textarea/i.test(el.tagName)) {
|
||||
var oldNode = el;
|
||||
value = oldNode.value;
|
||||
el = dom.createElement("pre");
|
||||
oldNode.parentNode.replaceChild(el, oldNode);
|
||||
} else {
|
||||
value = dom.getInnerText(el);
|
||||
el.innerHTML = '';
|
||||
}
|
||||
|
||||
var doc = exports.createEditSession(value);
|
||||
|
||||
var editor = new Editor(new Renderer(el));
|
||||
editor.setSession(doc);
|
||||
|
|
@ -93,11 +103,13 @@ exports.edit = function(el) {
|
|||
editor: editor,
|
||||
onResize: editor.resize.bind(editor, null)
|
||||
};
|
||||
if (oldNode) env.textarea = oldNode;
|
||||
event.addListener(window, "resize", env.onResize);
|
||||
editor.on("destroy", function() {
|
||||
event.removeListener(window, "resize", env.onResize);
|
||||
env.editor.container.env = null; // prevent memory leak on old ie
|
||||
});
|
||||
el.env = editor.env = env;
|
||||
editor.container.env = editor.env = env;
|
||||
return editor;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ var Autocomplete = function() {
|
|||
pos.left += renderer.$gutterLayer.gutterWidth;
|
||||
|
||||
this.popup.show(pos, lineHeight);
|
||||
} else if (keepPopupPosition && !prefix) {
|
||||
this.detach();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -101,12 +103,12 @@ var Autocomplete = function() {
|
|||
this.changeTimer.cancel();
|
||||
|
||||
if (this.popup && this.popup.isOpen) {
|
||||
this.gatherCompletionsId = this.gatherCompletionsId + 1;
|
||||
}
|
||||
|
||||
if (this.popup)
|
||||
this.gatherCompletionsId += 1;
|
||||
this.popup.hide();
|
||||
|
||||
}
|
||||
|
||||
if (this.base)
|
||||
this.base.detach();
|
||||
this.activated = false;
|
||||
this.completions = this.base = null;
|
||||
};
|
||||
|
|
@ -205,9 +207,9 @@ var Autocomplete = function() {
|
|||
var line = session.getLine(pos.row);
|
||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
||||
|
||||
this.base = editor.getCursorPosition();
|
||||
this.base.column -= prefix.length;
|
||||
|
||||
this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
|
||||
this.base.$insertRight = true;
|
||||
|
||||
var matches = [];
|
||||
var total = editor.completers.length;
|
||||
editor.completers.forEach(function(completer, i) {
|
||||
|
|
@ -298,7 +300,7 @@ var Autocomplete = function() {
|
|||
return detachIfFinished();
|
||||
|
||||
// Autoinsert if one result
|
||||
if (this.autoInsert && filtered.length == 1)
|
||||
if (this.autoInsert && filtered.length == 1 && results.finished)
|
||||
return this.insertMatch(filtered[0]);
|
||||
|
||||
this.openPopup(this.editor, prefix, keepPopupPosition);
|
||||
|
|
@ -346,7 +348,7 @@ var FilteredList = function(array, filterText, mutateData) {
|
|||
// make unique
|
||||
var prev = null;
|
||||
matches = matches.filter(function(item){
|
||||
var caption = item.value || item.caption || item.snippet;
|
||||
var caption = item.snippet || item.caption || item.value;
|
||||
if (caption === prev) return false;
|
||||
prev = caption;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ var $singleLineEditor = function(el) {
|
|||
editor.renderer.setHighlightGutterLine(false);
|
||||
|
||||
editor.$mouseHandler.$focusWaitTimout = 0;
|
||||
editor.$highlightTagPending = true;
|
||||
|
||||
return editor;
|
||||
};
|
||||
|
|
@ -67,6 +68,7 @@ var AcePopup = function(parentNode) {
|
|||
popup.renderer.setStyle("ace_autocomplete");
|
||||
|
||||
popup.setOption("displayIndentGuides", false);
|
||||
popup.setOption("dragDelay", 150);
|
||||
|
||||
var noop = function(){};
|
||||
|
||||
|
|
@ -102,7 +104,7 @@ var AcePopup = function(parentNode) {
|
|||
popup.session.removeMarker(hoverMarker.id);
|
||||
hoverMarker.id = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
popup.setSelectOnHover(false);
|
||||
popup.on("mousemove", function(e) {
|
||||
if (!lastMouseEvent) {
|
||||
|
|
@ -170,15 +172,15 @@ var AcePopup = function(parentNode) {
|
|||
};
|
||||
|
||||
var bgTokenizer = popup.session.bgTokenizer;
|
||||
bgTokenizer.$tokenizeRow = function(i) {
|
||||
var data = popup.data[i];
|
||||
bgTokenizer.$tokenizeRow = function(row) {
|
||||
var data = popup.data[row];
|
||||
var tokens = [];
|
||||
if (!data)
|
||||
return tokens;
|
||||
if (typeof data == "string")
|
||||
data = {value: data};
|
||||
if (!data.caption)
|
||||
data.caption = data.value;
|
||||
data.caption = data.value || data.name;
|
||||
|
||||
var last = -1;
|
||||
var flag, c;
|
||||
|
|
@ -205,7 +207,7 @@ var AcePopup = function(parentNode) {
|
|||
|
||||
popup.session.$computeWidth = function() {
|
||||
return this.screenWidth = 0;
|
||||
}
|
||||
};
|
||||
|
||||
// public
|
||||
popup.isOpen = false;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ define(function(require, exports, module) {
|
|||
var wordList = Object.keys(wordScore);
|
||||
callback(null, wordList.map(function(word) {
|
||||
return {
|
||||
name: word,
|
||||
caption: word,
|
||||
value: word,
|
||||
score: wordScore[word],
|
||||
meta: "local"
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
|
||||
*
|
||||
* If a certain row is changed, everything below that row is re-tokenized.
|
||||
|
|
@ -50,8 +48,6 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
* @param {Tokenizer} tokenizer The tokenizer to use
|
||||
* @param {Editor} editor The editor to associate with
|
||||
*
|
||||
*
|
||||
*
|
||||
* @constructor
|
||||
**/
|
||||
|
||||
|
|
@ -89,10 +85,9 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
|
||||
// only check every 5 lines
|
||||
processedLines ++;
|
||||
if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
|
||||
if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) {
|
||||
self.running = setTimeout(self.$worker, 20);
|
||||
self.currentLine = currentLine;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.currentLine = currentLine;
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ exports.moduleUrl = function(name, component) {
|
|||
|
||||
// todo make this configurable or get rid of '-'
|
||||
var sep = component == "snippets" ? "/" : "-";
|
||||
var base = parts[parts.length - 1];
|
||||
if (sep == "-") {
|
||||
var base = parts[parts.length - 1];
|
||||
if (component == "worker" && sep == "-") {
|
||||
var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g");
|
||||
base = base.replace(re, "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ module.exports = {
|
|||
"test: path resolution" : function() {
|
||||
config.set("packaged", "true");
|
||||
var url = config.moduleUrl("kr_theme", "theme");
|
||||
assert.equal(url, "theme-kr.js");
|
||||
assert.equal(url, "theme-kr_theme.js");
|
||||
|
||||
config.set("basePath", "a/b");
|
||||
url = config.moduleUrl("m/theme", "theme");
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
.ace_editor {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
font-size: 12px;
|
||||
line-height: normal;
|
||||
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
|
|
@ -17,6 +15,7 @@
|
|||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.ace_content {
|
||||
|
|
@ -24,14 +23,9 @@
|
|||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
cursor: text;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.ace_dragging, .ace_dragging * {
|
||||
cursor: move !important;
|
||||
}
|
||||
|
||||
.ace_dragging .ace_scroller:before{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
|
@ -155,8 +149,8 @@
|
|||
}
|
||||
|
||||
.ace_text-input.ace_composition {
|
||||
background: #f8f8f8;
|
||||
color: #111;
|
||||
background: inherit;
|
||||
color: inherit;
|
||||
z-index: 1000;
|
||||
opacity: 1;
|
||||
text-indent: 0;
|
||||
|
|
@ -211,7 +205,7 @@
|
|||
}
|
||||
|
||||
.ace_overwrite-cursors .ace_cursor {
|
||||
border-left-width: 0px;
|
||||
border-left-width: 0;
|
||||
border-bottom: 1px solid;
|
||||
}
|
||||
|
||||
|
|
@ -220,10 +214,7 @@
|
|||
}
|
||||
|
||||
.ace_smooth-blinking .ace_cursor {
|
||||
-moz-transition: opacity 0.18s;
|
||||
-webkit-transition: opacity 0.18s;
|
||||
-o-transition: opacity 0.18s;
|
||||
-ms-transition: opacity 0.18s;
|
||||
transition: opacity 0.18s;
|
||||
}
|
||||
|
||||
|
|
@ -277,8 +268,6 @@
|
|||
color: transparent;
|
||||
|
||||
border: 1px solid black;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
|
||||
cursor: pointer;
|
||||
|
|
@ -302,7 +291,6 @@
|
|||
border-radius: 1px;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
|
||||
color: black;
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
padding: 3px 4px;
|
||||
position: fixed;
|
||||
|
|
@ -359,16 +347,12 @@
|
|||
.ace_fold-widget:hover {
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.ace_fold-widget:active {
|
||||
border: 1px solid rgba(0, 0, 0, 0.4);
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
||||
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
||||
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
/**
|
||||
|
|
@ -388,8 +372,6 @@
|
|||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.ace_dark .ace_fold-widget:active {
|
||||
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
||||
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
||||
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
|
|
@ -399,19 +381,13 @@
|
|||
}
|
||||
|
||||
.ace_fade-fold-widgets .ace_fold-widget {
|
||||
-moz-transition: opacity 0.4s ease 0.05s;
|
||||
-webkit-transition: opacity 0.4s ease 0.05s;
|
||||
-o-transition: opacity 0.4s ease 0.05s;
|
||||
-ms-transition: opacity 0.4s ease 0.05s;
|
||||
transition: opacity 0.4s ease 0.05s;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.ace_fade-fold-widgets:hover .ace_fold-widget {
|
||||
-moz-transition: opacity 0.05s ease 0.05s;
|
||||
-webkit-transition: opacity 0.05s ease 0.05s;
|
||||
-o-transition: opacity 0.05s ease 0.05s;
|
||||
-ms-transition: opacity 0.05s ease 0.05s;
|
||||
transition: opacity 0.05s ease 0.05s;
|
||||
opacity:1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ var EditSession = function(text, mode) {
|
|||
this.$informUndoManager.schedule();
|
||||
}
|
||||
|
||||
this.bgTokenizer.$updateOnChange(delta);
|
||||
this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta);
|
||||
this._signal("change", e);
|
||||
};
|
||||
|
||||
|
|
@ -276,8 +276,6 @@ var EditSession = function(text, mode) {
|
|||
* Sets the session text.
|
||||
* @param {String} text The new text to place
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.setValue = function(text) {
|
||||
this.doc.setValue(text);
|
||||
|
|
@ -950,6 +948,9 @@ var EditSession = function(text, mode) {
|
|||
|
||||
|
||||
if (!$isPlaceholder) {
|
||||
// experimental method, used by c9 findiniles
|
||||
if (mode.attachToSession)
|
||||
mode.attachToSession(this);
|
||||
this.$options.wrapMethod.set.call(this, this.$wrapMethod);
|
||||
this.$setFolding(mode.foldingRules);
|
||||
this.bgTokenizer.start(0);
|
||||
|
|
@ -957,26 +958,23 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
this.$stopWorker = function() {
|
||||
if (this.$worker)
|
||||
if (this.$worker) {
|
||||
this.$worker.terminate();
|
||||
|
||||
this.$worker = null;
|
||||
this.$worker = null;
|
||||
}
|
||||
};
|
||||
|
||||
this.$startWorker = function() {
|
||||
if (typeof Worker !== "undefined" && !require.noWorker) {
|
||||
try {
|
||||
this.$worker = this.$mode.createWorker(this);
|
||||
} catch (e) {
|
||||
try {
|
||||
this.$worker = this.$mode.createWorker(this);
|
||||
} catch (e) {
|
||||
if (typeof console == "object") {
|
||||
console.log("Could not load worker");
|
||||
console.log(e);
|
||||
this.$worker = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
this.$worker = null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1726,9 +1724,10 @@ var EditSession = function(text, mode) {
|
|||
// Inside of the foldLine range. Need to split stuff up.
|
||||
if (cmp == 0) {
|
||||
foldLine = foldLine.split(start.row, start.column);
|
||||
foldLine.shiftRow(len);
|
||||
foldLine.addRemoveChars(
|
||||
lastRow, 0, end.column - start.column);
|
||||
if (foldLine) {
|
||||
foldLine.shiftRow(len);
|
||||
foldLine.addRemoveChars(lastRow, 0, end.column - start.column);
|
||||
}
|
||||
} else
|
||||
// Infront of the foldLine but same row. Need to shift column.
|
||||
if (cmp == -1) {
|
||||
|
|
@ -1956,6 +1955,8 @@ var EditSession = function(text, mode) {
|
|||
split = lastSplit + wrapLimit;
|
||||
// The split is inside of a CHAR or CHAR_EXT token and no space
|
||||
// around -> force a split.
|
||||
if (tokens[split] == CHAR_EXT)
|
||||
split--;
|
||||
addSplit(split);
|
||||
}
|
||||
return splits;
|
||||
|
|
@ -2395,7 +2396,15 @@ var EditSession = function(text, mode) {
|
|||
*/
|
||||
this.$setFontMetrics = function(fm) {
|
||||
// todo
|
||||
}
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
if (this.bgTokenizer) {
|
||||
this.bgTokenizer.setDocument(null);
|
||||
this.bgTokenizer = null;
|
||||
}
|
||||
this.$stopWorker();
|
||||
};
|
||||
|
||||
// For every keystroke this gets called once per char in the whole doc!!
|
||||
// Wouldn't hurt to make it a bit faster for c >= 0x1100
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ function BracketMatch() {
|
|||
typeRe = new RegExp(
|
||||
"(\\.?" +
|
||||
token.type.replace(".", "\\.").replace("rparen", ".paren")
|
||||
.replace(/\b(?:end|start|begin)\b/, "")
|
||||
+ ")+"
|
||||
);
|
||||
}
|
||||
|
|
@ -173,6 +174,7 @@ function BracketMatch() {
|
|||
typeRe = new RegExp(
|
||||
"(\\.?" +
|
||||
token.type.replace(".", "\\.").replace("lparen", ".paren")
|
||||
.replace(/\b(?:end|start|begin)\b/, "")
|
||||
+ ")+"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function FoldLine(foldData, folds) {
|
|||
folds = this.folds = [ folds ];
|
||||
}
|
||||
|
||||
var last = folds[folds.length - 1]
|
||||
var last = folds[folds.length - 1];
|
||||
this.range = new Range(folds[0].start.row, folds[0].start.column,
|
||||
last.end.row, last.end.column);
|
||||
this.start = this.range.start;
|
||||
|
|
@ -66,7 +66,7 @@ function FoldLine(foldData, folds) {
|
|||
fold.start.row += shift;
|
||||
fold.end.row += shift;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.addFold = function(fold) {
|
||||
if (fold.sameRow) {
|
||||
|
|
@ -96,17 +96,17 @@ function FoldLine(foldData, folds) {
|
|||
throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");
|
||||
}
|
||||
fold.foldLine = this;
|
||||
}
|
||||
};
|
||||
|
||||
this.containsRow = function(row) {
|
||||
return row >= this.start.row && row <= this.end.row;
|
||||
}
|
||||
};
|
||||
|
||||
this.walk = function(callback, endRow, endColumn) {
|
||||
var lastEnd = 0,
|
||||
folds = this.folds,
|
||||
fold,
|
||||
comp, stop, isNewRow = true;
|
||||
cmp, stop, isNewRow = true;
|
||||
|
||||
if (endRow == null) {
|
||||
endRow = this.end.row;
|
||||
|
|
@ -116,9 +116,9 @@ function FoldLine(foldData, folds) {
|
|||
for (var i = 0; i < folds.length; i++) {
|
||||
fold = folds[i];
|
||||
|
||||
comp = fold.range.compareStart(endRow, endColumn);
|
||||
cmp = fold.range.compareStart(endRow, endColumn);
|
||||
// This fold is after the endRow/Column.
|
||||
if (comp == -1) {
|
||||
if (cmp == -1) {
|
||||
callback(null, endRow, endColumn, lastEnd, isNewRow);
|
||||
return;
|
||||
}
|
||||
|
|
@ -127,8 +127,8 @@ function FoldLine(foldData, folds) {
|
|||
stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
|
||||
|
||||
// If the user requested to stop the walk or endRow/endColumn is
|
||||
// inside of this fold (comp == 0), then end here.
|
||||
if (stop || comp == 0) {
|
||||
// inside of this fold (cmp == 0), then end here.
|
||||
if (stop || cmp === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ function FoldLine(foldData, folds) {
|
|||
lastEnd = fold.end.column;
|
||||
}
|
||||
callback(null, endRow, endColumn, lastEnd, isNewRow);
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextFoldTo = function(row, column) {
|
||||
var fold, cmp;
|
||||
|
|
@ -150,15 +150,15 @@ function FoldLine(foldData, folds) {
|
|||
fold: fold,
|
||||
kind: "after"
|
||||
};
|
||||
} else if (cmp == 0) {
|
||||
} else if (cmp === 0) {
|
||||
return {
|
||||
fold: fold,
|
||||
kind: "inside"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
this.addRemoveChars = function(row, column, len) {
|
||||
var ret = this.getNextFoldTo(row, column),
|
||||
|
|
@ -175,7 +175,7 @@ function FoldLine(foldData, folds) {
|
|||
} else if (fold.start.row == row) {
|
||||
folds = this.folds;
|
||||
var i = folds.indexOf(fold);
|
||||
if (i == 0) {
|
||||
if (i === 0) {
|
||||
this.start.column += len;
|
||||
}
|
||||
for (i; i < folds.length; i++) {
|
||||
|
|
@ -189,16 +189,18 @@ function FoldLine(foldData, folds) {
|
|||
this.end.column += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.split = function(row, column) {
|
||||
var fold = this.getNextFoldTo(row, column).fold;
|
||||
var pos = this.getNextFoldTo(row, column);
|
||||
|
||||
if (!pos || pos.kind == "inside")
|
||||
return null;
|
||||
|
||||
var fold = pos.fold;
|
||||
var folds = this.folds;
|
||||
var foldData = this.foldData;
|
||||
|
||||
if (!fold)
|
||||
return null;
|
||||
|
||||
|
||||
var i = folds.indexOf(fold);
|
||||
var foldBefore = folds[i - 1];
|
||||
this.end.row = foldBefore.end.row;
|
||||
|
|
@ -211,7 +213,7 @@ function FoldLine(foldData, folds) {
|
|||
var newFoldLine = new FoldLine(foldData, folds);
|
||||
foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
|
||||
return newFoldLine;
|
||||
}
|
||||
};
|
||||
|
||||
this.merge = function(foldLineNext) {
|
||||
var folds = foldLineNext.folds;
|
||||
|
|
@ -222,7 +224,7 @@ function FoldLine(foldData, folds) {
|
|||
// it's merged now with foldLineNext.
|
||||
var foldData = this.foldData;
|
||||
foldData.splice(foldData.indexOf(foldLineNext), 1);
|
||||
}
|
||||
};
|
||||
|
||||
this.toString = function() {
|
||||
var ret = [this.range.toString() + ": [" ];
|
||||
|
|
@ -230,13 +232,12 @@ function FoldLine(foldData, folds) {
|
|||
this.folds.forEach(function(fold) {
|
||||
ret.push(" " + fold.toString());
|
||||
});
|
||||
ret.push("]")
|
||||
ret.push("]");
|
||||
return ret.join("\n");
|
||||
}
|
||||
};
|
||||
|
||||
this.idxToPosition = function(idx) {
|
||||
var lastFoldEndColumn = 0;
|
||||
var fold;
|
||||
|
||||
for (var i = 0; i < this.folds.length; i++) {
|
||||
var fold = this.folds[i];
|
||||
|
|
@ -261,7 +262,7 @@ function FoldLine(foldData, folds) {
|
|||
row: this.end.row,
|
||||
column: this.end.column + idx
|
||||
};
|
||||
}
|
||||
};
|
||||
}).call(FoldLine.prototype);
|
||||
|
||||
exports.FoldLine = FoldLine;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ var Editor = function(renderer, session) {
|
|||
|
||||
this._$emitInputEvent = lang.delayedCall(function() {
|
||||
this._signal("input", {});
|
||||
this.session.bgTokenizer && this.session.bgTokenizer.scheduleStart();
|
||||
if (this.session && this.session.bgTokenizer)
|
||||
this.session.bgTokenizer.scheduleStart();
|
||||
}.bind(this));
|
||||
|
||||
this.on("change", function(_, _self) {
|
||||
|
|
@ -384,6 +385,9 @@ var Editor = function(renderer, session) {
|
|||
this.onChangeAnnotation();
|
||||
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
||||
this.renderer.updateFull();
|
||||
} else {
|
||||
this.selection = null;
|
||||
this.renderer.setSession(session);
|
||||
}
|
||||
|
||||
this._signal("changeSession", {
|
||||
|
|
@ -525,25 +529,23 @@ var Editor = function(renderer, session) {
|
|||
this.$highlightPending = true;
|
||||
setTimeout(function() {
|
||||
self.$highlightPending = false;
|
||||
|
||||
var pos = self.session.findMatchingBracket(self.getCursorPosition());
|
||||
var session = self.session;
|
||||
if (!session || !session.bgTokenizer) return;
|
||||
var pos = session.findMatchingBracket(self.getCursorPosition());
|
||||
if (pos) {
|
||||
var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
|
||||
} else if (self.session.$mode.getMatching) {
|
||||
var range = self.session.$mode.getMatching(self.session);
|
||||
var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);
|
||||
} else if (session.$mode.getMatching) {
|
||||
var range = session.$mode.getMatching(self.session);
|
||||
}
|
||||
if (range)
|
||||
self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text");
|
||||
session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text");
|
||||
}, 50);
|
||||
};
|
||||
|
||||
// todo: move to mode.getMatching
|
||||
this.$highlightTags = function() {
|
||||
var session = this.session;
|
||||
|
||||
if (this.$highlightTagPending) {
|
||||
if (this.$highlightTagPending)
|
||||
return;
|
||||
}
|
||||
|
||||
// perform highlight async to not block the browser during navigation
|
||||
var self = this;
|
||||
|
|
@ -551,6 +553,9 @@ var Editor = function(renderer, session) {
|
|||
setTimeout(function() {
|
||||
self.$highlightTagPending = false;
|
||||
|
||||
var session = self.session;
|
||||
if (!session || !session.bgTokenizer) return;
|
||||
|
||||
var pos = self.getCursorPosition();
|
||||
var iterator = new TokenIterator(self.session, pos.row, pos.column);
|
||||
var token = iterator.getCurrentToken();
|
||||
|
|
@ -572,28 +577,28 @@ var Editor = function(renderer, session) {
|
|||
token = iterator.stepForward();
|
||||
|
||||
if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
||||
if (prevToken.value==='<'){
|
||||
if (prevToken.value === '<'){
|
||||
depth++;
|
||||
} else if (prevToken.value==='</'){
|
||||
} else if (prevToken.value === '</'){
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
} while (token && depth>=0);
|
||||
}else{
|
||||
} while (token && depth >= 0);
|
||||
} else {
|
||||
//find opening tag
|
||||
do {
|
||||
token = prevToken;
|
||||
prevToken = iterator.stepBackward();
|
||||
|
||||
if(token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
||||
if (prevToken.value==='<') {
|
||||
if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
||||
if (prevToken.value === '<') {
|
||||
depth++;
|
||||
} else if( prevToken.value==='</') {
|
||||
} else if (prevToken.value === '</') {
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
} while (prevToken && depth<=0);
|
||||
} while (prevToken && depth <= 0);
|
||||
|
||||
//select tag again
|
||||
iterator.stepForward();
|
||||
|
|
@ -696,12 +701,15 @@ var Editor = function(renderer, session) {
|
|||
this.onDocumentChange = function(e) {
|
||||
// Rerender and emit "change" event.
|
||||
var delta = e.data;
|
||||
var wrap = this.session.$useWrapMode;
|
||||
var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);
|
||||
this.renderer.updateLines(delta.start.row, lastRow);
|
||||
this.renderer.updateLines(delta.start.row, lastRow, wrap);
|
||||
|
||||
this._signal("change", e);
|
||||
|
||||
// Update cursor because tab characters can influence the cursor position.
|
||||
this.$cursorChange();
|
||||
this.$updateHighlightActiveLine();
|
||||
};
|
||||
|
||||
this.onTokenizerUpdate = function(e) {
|
||||
|
|
@ -1990,17 +1998,13 @@ var Editor = function(renderer, session) {
|
|||
* Moves the cursor's row and column to the next matching bracket or HTML tag.
|
||||
*
|
||||
**/
|
||||
this.jumpToMatching = function(select) {
|
||||
this.jumpToMatching = function(select, expand) {
|
||||
var cursor = this.getCursorPosition();
|
||||
var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
|
||||
var prevToken = iterator.getCurrentToken();
|
||||
var token = prevToken;
|
||||
var token = prevToken || iterator.stepForward();
|
||||
|
||||
if (!token)
|
||||
token = iterator.stepForward();
|
||||
|
||||
if (!token)
|
||||
return;
|
||||
if (!token) return;
|
||||
|
||||
//get next closing tag or bracket
|
||||
var matchType;
|
||||
|
|
@ -2019,12 +2023,12 @@ var Editor = function(renderer, session) {
|
|||
|
||||
do {
|
||||
if (token.value.match(/[{}()\[\]]/g)) {
|
||||
for (; i<token.value.length && !found; i++) {
|
||||
for (; i < token.value.length && !found; i++) {
|
||||
if (!brackets[token.value[i]]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bracketType = brackets[token.value[i]]+'.'+token.type.replace("rparen", "lparen");
|
||||
bracketType = brackets[token.value[i]] + '.' + token.type.replace("rparen", "lparen");
|
||||
|
||||
if (isNaN(depth[bracketType])) {
|
||||
depth[bracketType] = 0;
|
||||
|
|
@ -2035,27 +2039,29 @@ var Editor = function(renderer, session) {
|
|||
case '[':
|
||||
case '{':
|
||||
depth[bracketType]++;
|
||||
break;
|
||||
break;
|
||||
case ')':
|
||||
case ']':
|
||||
case '}':
|
||||
depth[bracketType]--;
|
||||
|
||||
if (depth[bracketType]===-1) {
|
||||
|
||||
if (depth[bracketType] === -1) {
|
||||
matchType = 'bracket';
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (token && token.type.indexOf('tag-name') !== -1) {
|
||||
}
|
||||
else if (token && token.type.indexOf('tag-name') !== -1) {
|
||||
if (isNaN(depth[token.value])) {
|
||||
depth[token.value] = 0;
|
||||
}
|
||||
|
||||
if (prevToken.value === '<') {
|
||||
depth[token.value]++;
|
||||
} else if (prevToken.value === '</') {
|
||||
}
|
||||
else if (prevToken.value === '</') {
|
||||
depth[token.value]--;
|
||||
}
|
||||
|
||||
|
|
@ -2073,37 +2079,35 @@ var Editor = function(renderer, session) {
|
|||
} while (token && !found);
|
||||
|
||||
//no match found
|
||||
if (!matchType) {
|
||||
if (!matchType)
|
||||
return;
|
||||
}
|
||||
|
||||
var range;
|
||||
if (matchType==='bracket') {
|
||||
var range, pos;
|
||||
if (matchType === 'bracket') {
|
||||
range = this.session.getBracketRange(cursor);
|
||||
if (!range) {
|
||||
range = new Range(
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn()+i-1,
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn()+i-1
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn() + i - 1,
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn() + i - 1
|
||||
);
|
||||
if (!range)
|
||||
return;
|
||||
var pos = range.start;
|
||||
if (pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
||||
pos = range.start;
|
||||
if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
||||
range = this.session.getBracketRange(pos);
|
||||
}
|
||||
} else if(matchType==='tag') {
|
||||
if (token && token.type.indexOf('tag-name') !== -1)
|
||||
}
|
||||
else if (matchType === 'tag') {
|
||||
if (token && token.type.indexOf('tag-name') !== -1)
|
||||
var tag = token.value;
|
||||
else
|
||||
return;
|
||||
|
||||
var range = new Range(
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn()-2,
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn()-2
|
||||
range = new Range(
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn() - 2,
|
||||
iterator.getCurrentTokenRow(),
|
||||
iterator.getCurrentTokenColumn() - 2
|
||||
);
|
||||
|
||||
//find matching tag
|
||||
|
|
@ -2115,17 +2119,18 @@ var Editor = function(renderer, session) {
|
|||
|
||||
if (prevToken) {
|
||||
if (prevToken.type.indexOf('tag-close') !== -1) {
|
||||
range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn()+1);
|
||||
range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1);
|
||||
}
|
||||
|
||||
if (token.value === tag && token.type.indexOf('tag-name') !== -1) {
|
||||
if (prevToken.value === '<') {
|
||||
depth[tag]++;
|
||||
} else if ( prevToken.value === '</') {
|
||||
}
|
||||
else if (prevToken.value === '</') {
|
||||
depth[tag]--;
|
||||
}
|
||||
|
||||
if (depth[tag]===0)
|
||||
if (depth[tag] === 0)
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -2134,7 +2139,7 @@ var Editor = function(renderer, session) {
|
|||
|
||||
//we found it
|
||||
if (token && token.type.indexOf('tag-name')) {
|
||||
var pos = range.start;
|
||||
pos = range.start;
|
||||
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
||||
pos = range.end;
|
||||
}
|
||||
|
|
@ -2143,10 +2148,13 @@ var Editor = function(renderer, session) {
|
|||
pos = range && range.cursor || pos;
|
||||
if (pos) {
|
||||
if (select) {
|
||||
if (range && range.isEqual(this.getSelectionRange()))
|
||||
if (range && expand) {
|
||||
this.selection.setRange(range);
|
||||
} else if (range && range.isEqual(this.getSelectionRange())) {
|
||||
this.clearSelection();
|
||||
else
|
||||
} else {
|
||||
this.selection.selectTo(pos.row, pos.column);
|
||||
}
|
||||
} else {
|
||||
this.selection.moveTo(pos.row, pos.column);
|
||||
}
|
||||
|
|
@ -2504,6 +2512,9 @@ var Editor = function(renderer, session) {
|
|||
this.destroy = function() {
|
||||
this.renderer.destroy();
|
||||
this._signal("destroy", this);
|
||||
if (this.session) {
|
||||
this.session.destroy();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
var LineWidgets = require("ace/line_widgets").LineWidgets;
|
||||
var dom = require("ace/lib/dom");
|
||||
var Range = require("ace/range").Range;
|
||||
var LineWidgets = require("../line_widgets").LineWidgets;
|
||||
var dom = require("../lib/dom");
|
||||
var Range = require("../range").Range;
|
||||
|
||||
function binarySearch(array, needle, comparator) {
|
||||
var first = 0;
|
||||
|
|
|
|||
|
|
@ -161,10 +161,6 @@ var doLiveAutocomplete = function(e) {
|
|||
editor.completer.autoSelect = false;
|
||||
editor.completer.autoInsert = false;
|
||||
editor.completer.showPopup(editor);
|
||||
} else if (!prefix && hasCompleter) {
|
||||
// When the prefix is empty
|
||||
// close the autocomplete dialog
|
||||
editor.completer.detach();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -65,11 +65,14 @@ var supportedModes = {
|
|||
Diff: ["diff|patch"],
|
||||
Dockerfile: ["^Dockerfile"],
|
||||
Dot: ["dot"],
|
||||
Erlang: ["erl|hrl"],
|
||||
Eiffel: ["e"],
|
||||
EJS: ["ejs"],
|
||||
Erlang: ["erl|hrl"],
|
||||
Forth: ["frt|fs|ldr"],
|
||||
FTL: ["ftl"],
|
||||
Gcode: ["gcode"],
|
||||
Gherkin: ["feature"],
|
||||
Gitignore: ["^.gitignore"],
|
||||
Glsl: ["glsl|frag|vert"],
|
||||
golang: ["go"],
|
||||
Groovy: ["groovy"],
|
||||
|
|
@ -80,6 +83,7 @@ var supportedModes = {
|
|||
HTML: ["html|htm|xhtml"],
|
||||
HTML_Ruby: ["erb|rhtml|html.erb"],
|
||||
INI: ["ini|conf|cfg|prefs"],
|
||||
Io: ["io"],
|
||||
Jack: ["jack"],
|
||||
Jade: ["jade"],
|
||||
Java: ["java"],
|
||||
|
|
@ -100,11 +104,11 @@ var supportedModes = {
|
|||
LuaPage: ["lp"],
|
||||
Lucene: ["lucene"],
|
||||
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
|
||||
MATLAB: ["matlab"],
|
||||
Markdown: ["md|markdown"],
|
||||
MATLAB: ["matlab"],
|
||||
MEL: ["mel"],
|
||||
MySQL: ["mysql"],
|
||||
MUSHCode: ["mc|mush"],
|
||||
MySQL: ["mysql"],
|
||||
Nix: ["nix"],
|
||||
ObjectiveC: ["m|mm"],
|
||||
OCaml: ["ml|mli"],
|
||||
|
|
@ -113,6 +117,7 @@ var supportedModes = {
|
|||
pgSQL: ["pgsql"],
|
||||
PHP: ["php|phtml"],
|
||||
Powershell: ["ps1"],
|
||||
Praat: ["praat|praatscript|psc|proc"],
|
||||
Prolog: ["plg|prolog"],
|
||||
Properties: ["properties"],
|
||||
Protobuf: ["proto"],
|
||||
|
|
@ -125,14 +130,14 @@ var supportedModes = {
|
|||
SASS: ["sass"],
|
||||
SCAD: ["scad"],
|
||||
Scala: ["scala"],
|
||||
Smarty: ["smarty|tpl"],
|
||||
Scheme: ["scm|rkt"],
|
||||
SCSS: ["scss"],
|
||||
SH: ["sh|bash|^.bashrc"],
|
||||
SJS: ["sjs"],
|
||||
Space: ["space"],
|
||||
Smarty: ["smarty|tpl"],
|
||||
snippets: ["snippets"],
|
||||
Soy_Template:["soy"],
|
||||
Space: ["space"],
|
||||
SQL: ["sql"],
|
||||
Stylus: ["styl|stylus"],
|
||||
SVG: ["svg"],
|
||||
|
|
@ -144,9 +149,10 @@ var supportedModes = {
|
|||
Twig: ["twig"],
|
||||
Typescript: ["ts|typescript|str"],
|
||||
Vala: ["vala"],
|
||||
VBScript: ["vbs"],
|
||||
VBScript: ["vbs|vb"],
|
||||
Velocity: ["vm"],
|
||||
Verilog: ["v|vh|sv|svh"],
|
||||
VHDL: ["vhd|vhdl"],
|
||||
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
||||
XQuery: ["xq"],
|
||||
YAML: ["yaml|yml"]
|
||||
|
|
@ -156,7 +162,7 @@ var nameOverrides = {
|
|||
ObjectiveC: "Objective-C",
|
||||
CSharp: "C#",
|
||||
golang: "Go",
|
||||
C_Cpp: "C/C++",
|
||||
C_Cpp: "C and C++",
|
||||
coffee: "CoffeeScript",
|
||||
HTML_Ruby: "HTML (Ruby)",
|
||||
FTL: "FreeMarker"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
background-color: #ddd;
|
||||
border: 1px solid #cbcbcb;
|
||||
border-top: 0 none;
|
||||
max-width: 297px;
|
||||
max-width: 325px;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
|
|
@ -47,7 +47,6 @@
|
|||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 22px;
|
||||
outline: 0;
|
||||
|
|
@ -61,7 +60,6 @@
|
|||
border: 0 none;
|
||||
border-left: 1px solid #dcdcdc;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 22px;
|
||||
margin: 0;
|
||||
|
|
@ -94,12 +92,9 @@
|
|||
border: 0 none;
|
||||
color: #656565;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
float: right;
|
||||
font-family: Arial;
|
||||
font-size: 16px;
|
||||
font: 16px/16px Arial;
|
||||
height: 14px;
|
||||
line-height: 16px;
|
||||
margin: 5px 1px 9px 5px;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ var html = '<div class="ace_search right">\
|
|||
<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
|
||||
<button type="button" action="findNext" class="ace_searchbtn next"></button>\
|
||||
<button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
|
||||
<button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button>\
|
||||
</div>\
|
||||
<div class="ace_replace_form">\
|
||||
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
|
||||
|
|
@ -170,6 +171,11 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
|||
sb.replace();
|
||||
sb.findPrev();
|
||||
},
|
||||
"Alt-Return": function(sb) {
|
||||
if (sb.activeInput == sb.replaceInput)
|
||||
sb.replaceAll();
|
||||
sb.findAll();
|
||||
},
|
||||
"Tab": function(sb) {
|
||||
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
|
||||
}
|
||||
|
|
@ -229,6 +235,18 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
|||
this.findPrev = function() {
|
||||
this.find(true, true);
|
||||
};
|
||||
this.findAll = function(){
|
||||
var range = this.editor.findAll(this.searchInput.value, {
|
||||
regExp: this.regExpOption.checked,
|
||||
caseSensitive: this.caseSensitiveOption.checked,
|
||||
wholeWord: this.wholeWordOption.checked
|
||||
});
|
||||
var noMatch = !range && this.searchInput.value;
|
||||
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
||||
this.editor._emit("findSearchBox", { match: !noMatch });
|
||||
this.highlight();
|
||||
this.hide();
|
||||
};
|
||||
this.replace = function() {
|
||||
if (!this.editor.getReadOnly())
|
||||
this.editor.replace(this.replaceInput.value);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
.ace_static_highlight .ace_gutter {
|
||||
width: 25px !important;
|
||||
display: block;
|
||||
float: left;
|
||||
text-align: right;
|
||||
padding: 0 3px 0 0;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ var highlight = function(el, opts, callback) {
|
|||
* and `css`.
|
||||
* @returns {object} An object containing the properties `html` and `css`.
|
||||
*/
|
||||
|
||||
highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
|
||||
var waiting = 1;
|
||||
var modeCache = EditSession.prototype.$modes;
|
||||
|
|
@ -112,11 +111,17 @@ highlight.render = function(input, mode, theme, lineStart, disableGutter, callba
|
|||
--waiting || done();
|
||||
});
|
||||
}
|
||||
|
||||
// allow setting mode options e.h {path: "ace/mode/php", inline:true}
|
||||
var modeOptions;
|
||||
if (mode && typeof mode === "object" && !mode.getTokenizer) {
|
||||
modeOptions = mode;
|
||||
mode = modeOptions.path;
|
||||
}
|
||||
if (typeof mode == "string") {
|
||||
waiting++;
|
||||
config.loadModule(['mode', mode], function(m) {
|
||||
if (!modeCache[mode]) modeCache[mode] = new m.Mode();
|
||||
if (!modeCache[mode] || modeOptions)
|
||||
modeCache[mode] = new m.Mode(modeOptions);
|
||||
mode = modeCache[mode];
|
||||
--waiting || done();
|
||||
});
|
||||
|
|
@ -130,14 +135,13 @@ highlight.render = function(input, mode, theme, lineStart, disableGutter, callba
|
|||
return --waiting || done();
|
||||
};
|
||||
|
||||
/*
|
||||
/**
|
||||
* Transforms a given input code snippet into HTML using the given mode
|
||||
* @param {string} input Code snippet
|
||||
* @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode')
|
||||
* @param {string} r Code snippet
|
||||
* @returns {object} An object containing: html, css
|
||||
*/
|
||||
|
||||
highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
|
||||
lineStart = parseInt(lineStart || 1, 10);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,11 +76,14 @@ exports.$detectIndentation = function(lines, fallback) {
|
|||
var first = {score: 0, length: 0};
|
||||
var spaceIndents = 0;
|
||||
for (var i = 1; i < 12; i++) {
|
||||
var score = getScore(i);
|
||||
if (i == 1) {
|
||||
spaceIndents = getScore(i);
|
||||
var score = stats.length && 1;
|
||||
spaceIndents = score;
|
||||
score = stats[1] ? 0.9 : 0.8;
|
||||
if (!stats.length)
|
||||
score = 0
|
||||
} else
|
||||
var score = getScore(i) / spaceIndents;
|
||||
score /= spaceIndents;
|
||||
|
||||
if (changes[i])
|
||||
score += changes[i] / changesTotal;
|
||||
|
|
|
|||
|
|
@ -300,9 +300,12 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
|
|||
if (!command) return undefined;
|
||||
}
|
||||
|
||||
if (!command.readonly && !command.isYank)
|
||||
if (!command.readOnly && !command.isYank)
|
||||
data.lastCommand = null;
|
||||
|
||||
if (!command.readOnly && editor.emacsMark())
|
||||
editor.setEmacsMark(null)
|
||||
|
||||
if (data.count) {
|
||||
var count = data.count;
|
||||
data.count = 0;
|
||||
|
|
@ -384,7 +387,7 @@ exports.emacsKeys = {
|
|||
"M-y": "yankRotate",
|
||||
"C-g": "keyboardQuit",
|
||||
|
||||
"C-w": "killRegion",
|
||||
"C-w|C-S-W": "killRegion",
|
||||
"M-w": "killRingSave",
|
||||
"C-Space": "setMark",
|
||||
"C-x C-x": "exchangePointAndMark",
|
||||
|
|
@ -466,7 +469,7 @@ exports.handler.addCommands({
|
|||
editor.setEmacsMark(mark);
|
||||
editor.selection.setSelectionAnchor(mark.row, mark.column);
|
||||
},
|
||||
readonly: true,
|
||||
readOnly: true,
|
||||
handlesCount: true,
|
||||
multiSelectAction: "forEach"
|
||||
},
|
||||
|
|
@ -488,7 +491,7 @@ exports.handler.addCommands({
|
|||
}
|
||||
sel.setSelectionRange(range, !sel.isBackwards());
|
||||
},
|
||||
readonly: true,
|
||||
readOnly: true,
|
||||
handlesCount: true,
|
||||
multiSelectAction: "forEach"
|
||||
},
|
||||
|
|
@ -547,7 +550,7 @@ exports.handler.addCommands({
|
|||
exports.killRing.add(editor.getCopyText());
|
||||
editor.commands.byName.cut.exec(editor);
|
||||
},
|
||||
readonly: true,
|
||||
readOnly: true,
|
||||
multiSelectAction: "forEach"
|
||||
},
|
||||
killRingSave: {
|
||||
|
|
@ -560,7 +563,7 @@ exports.handler.addCommands({
|
|||
sel.clearSelection();
|
||||
}, 0);
|
||||
},
|
||||
readonly: true
|
||||
readOnly: true
|
||||
},
|
||||
keyboardQuit: function(editor) {
|
||||
editor.selection.clearSelection();
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ var TextInput = function(parentNode, host) {
|
|||
text.spellcheck = false;
|
||||
|
||||
text.style.opacity = "0";
|
||||
if (useragent.isOldIE) text.style.top = "-100px";
|
||||
parentNode.insertBefore(text, parentNode.firstChild);
|
||||
|
||||
var PLACEHOLDER = "\x01\x01";
|
||||
|
|
@ -255,7 +256,7 @@ var TextInput = function(parentNode, host) {
|
|||
} else {
|
||||
return clipboardData.getData(mime);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var doCopy = function(e, isCut) {
|
||||
var data = host.getCopyText();
|
||||
|
|
@ -280,11 +281,11 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var onCut = function(e) {
|
||||
doCopy(e, true);
|
||||
}
|
||||
};
|
||||
|
||||
var onCopy = function(e) {
|
||||
doCopy(e, false);
|
||||
}
|
||||
};
|
||||
|
||||
var onPaste = function(e) {
|
||||
var data = handleClipboardData(e);
|
||||
|
|
@ -335,7 +336,8 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
// COMPOSITION
|
||||
var onCompositionStart = function(e) {
|
||||
if (inComposition || !host.onCompositionStart) return;
|
||||
if (inComposition || !host.onCompositionStart || host.$readOnly)
|
||||
return;
|
||||
// console.log("onCompositionStart", inComposition)
|
||||
inComposition = {};
|
||||
host.onCompositionStart();
|
||||
|
|
@ -351,7 +353,8 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var onCompositionUpdate = function() {
|
||||
// console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value))
|
||||
if (!inComposition || !host.onCompositionUpdate) return;
|
||||
if (!inComposition || !host.onCompositionUpdate || host.$readOnly)
|
||||
return;
|
||||
var val = text.value.replace(/\x01/g, "");
|
||||
if (inComposition.lastValue === val) return;
|
||||
|
||||
|
|
@ -370,7 +373,7 @@ var TextInput = function(parentNode, host) {
|
|||
};
|
||||
|
||||
var onCompositionEnd = function(e) {
|
||||
if (!host.onCompositionEnd) return;
|
||||
if (!host.onCompositionEnd || host.$readOnly) return;
|
||||
// console.log("onCompositionEnd", inComposition &&inComposition.lastValue)
|
||||
var c = inComposition;
|
||||
inComposition = false;
|
||||
|
|
@ -379,7 +382,7 @@ var TextInput = function(parentNode, host) {
|
|||
var str = text.value.replace(/\x01/g, "");
|
||||
// console.log(str, c.lastValue)
|
||||
if (inComposition)
|
||||
return
|
||||
return;
|
||||
else if (str == c.lastValue)
|
||||
resetValue();
|
||||
else if (!c.lastValue && str) {
|
||||
|
|
@ -428,18 +431,25 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
this.onContextMenu = function(e) {
|
||||
afterContextMenu = true;
|
||||
if (!tempStyle)
|
||||
tempStyle = text.style.cssText;
|
||||
|
||||
text.style.cssText = "z-index:100000;" + (useragent.isIE ? "opacity:0.1;" : "");
|
||||
|
||||
resetSelection(host.selection.isEmpty());
|
||||
host._emit("nativecontextmenu", {target: host, domEvent: e});
|
||||
this.moveToMouse(e, true);
|
||||
};
|
||||
|
||||
this.moveToMouse = function(e, bringToFront) {
|
||||
if (!bringToFront && useragent.isOldIE)
|
||||
return;
|
||||
if (!tempStyle)
|
||||
tempStyle = text.style.cssText;
|
||||
text.style.cssText = (bringToFront ? "z-index:100000;" : "")
|
||||
+ "height:" + text.style.height + ";"
|
||||
+ (useragent.isIE ? "opacity:0.1;" : "");
|
||||
|
||||
var rect = host.container.getBoundingClientRect();
|
||||
var style = dom.computedStyle(host.container);
|
||||
var top = rect.top + (parseInt(style.borderTopWidth) || 0);
|
||||
var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);
|
||||
var maxTop = rect.bottom - top - text.clientHeight;
|
||||
var maxTop = rect.bottom - top - text.clientHeight -2;
|
||||
var move = function(e) {
|
||||
text.style.left = e.clientX - left - 2 + "px";
|
||||
text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px";
|
||||
|
|
@ -453,13 +463,15 @@ var TextInput = function(parentNode, host) {
|
|||
host.renderer.$keepTextAreaAtCursor = null;
|
||||
|
||||
// on windows context menu is opened after mouseup
|
||||
if (useragent.isWin)
|
||||
if (useragent.isWin && !useragent.isOldIE)
|
||||
event.capture(host.container, move, onContextMenuClose);
|
||||
};
|
||||
|
||||
this.onContextMenuClose = onContextMenuClose;
|
||||
var closeTimeout;
|
||||
function onContextMenuClose() {
|
||||
setTimeout(function () {
|
||||
clearTimeout(closeTimeout)
|
||||
closeTimeout = setTimeout(function () {
|
||||
if (tempStyle) {
|
||||
text.style.cssText = tempStyle;
|
||||
tempStyle = '';
|
||||
|
|
@ -468,18 +480,15 @@ var TextInput = function(parentNode, host) {
|
|||
host.renderer.$keepTextAreaAtCursor = true;
|
||||
host.renderer.$moveTextAreaToCursor();
|
||||
}
|
||||
}, 0);
|
||||
}, useragent.isOldIE ? 200 : 0);
|
||||
}
|
||||
|
||||
// firefox fires contextmenu event after opening it
|
||||
if (!useragent.isGecko || useragent.isMac) {
|
||||
var onContextMenu = function(e) {
|
||||
host.textInput.onContextMenu(e);
|
||||
onContextMenuClose();
|
||||
};
|
||||
event.addListener(host.renderer.scroller, "contextmenu", onContextMenu);
|
||||
event.addListener(text, "contextmenu", onContextMenu);
|
||||
}
|
||||
var onContextMenu = function(e) {
|
||||
host.textInput.onContextMenu(e);
|
||||
onContextMenuClose();
|
||||
};
|
||||
event.addListener(host.renderer.scroller, "contextmenu", onContextMenu);
|
||||
event.addListener(text, "contextmenu", onContextMenu);
|
||||
};
|
||||
|
||||
exports.TextInput = TextInput;
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ module.exports = {
|
|||
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (isRepeat && column == 0 && !(count > 1))
|
||||
var column = util.getRightNthChar(editor, cursor, param, 2);
|
||||
column = util.getRightNthChar(editor, cursor, param, 2);
|
||||
|
||||
if (typeof column === "number") {
|
||||
cursor.column += column + (isSel ? 1 : 0);
|
||||
|
|
@ -444,8 +444,8 @@ module.exports = {
|
|||
var cursor = editor.getCursorPosition();
|
||||
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (isRepeat && column == 0 && !(count > 1))
|
||||
var column = util.getLeftNthChar(editor, cursor, param, 2);
|
||||
if (isRepeat && column === 0 && !(count > 1))
|
||||
column = util.getLeftNthChar(editor, cursor, param, 2);
|
||||
|
||||
if (typeof column === "number") {
|
||||
cursor.column -= column;
|
||||
|
|
@ -558,7 +558,7 @@ module.exports = {
|
|||
content += "\n";
|
||||
|
||||
if (content.length) {
|
||||
editor.navigateLineEnd()
|
||||
editor.navigateLineEnd();
|
||||
editor.insert(content);
|
||||
util.insertMode(editor);
|
||||
}
|
||||
|
|
@ -575,7 +575,7 @@ module.exports = {
|
|||
if (content.length) {
|
||||
if(row > 0) {
|
||||
editor.navigateUp();
|
||||
editor.navigateLineEnd()
|
||||
editor.navigateLineEnd();
|
||||
editor.insert(content);
|
||||
} else {
|
||||
editor.session.insert({row: 0, column: 0}, content);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
|
|||
document.documentElement.appendChild(el);
|
||||
var w = el.getBoundingClientRect().width;
|
||||
if (w > 0 && w < 1)
|
||||
CHAR_COUNT = 1;
|
||||
CHAR_COUNT = 50;
|
||||
else
|
||||
CHAR_COUNT = 100;
|
||||
el.parentNode.removeChild(el);
|
||||
|
|
@ -127,11 +127,16 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
|
|||
};
|
||||
|
||||
this.$measureSizes = function() {
|
||||
if (CHAR_COUNT === 1) {
|
||||
var rect = this.$measureNode.getBoundingClientRect();
|
||||
if (CHAR_COUNT === 50) {
|
||||
var rect = null;
|
||||
try {
|
||||
rect = this.$measureNode.getBoundingClientRect();
|
||||
} catch(e) {
|
||||
rect = {width: 0, height:0 };
|
||||
};
|
||||
var size = {
|
||||
height: rect.height,
|
||||
width: rect.width
|
||||
width: rect.width / CHAR_COUNT
|
||||
};
|
||||
} else {
|
||||
var size = {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ var Gutter = function(parentEl) {
|
|||
if (this.session)
|
||||
this.session.removeEventListener("change", this.$updateAnnotations);
|
||||
this.session = session;
|
||||
session.on("change", this.$updateAnnotations);
|
||||
if (session)
|
||||
session.on("change", this.$updateAnnotations);
|
||||
};
|
||||
|
||||
this.addGutterDecoration = function(row, className){
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ var Marker = function(parentEl) {
|
|||
this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
|
||||
}
|
||||
}
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
this.element.innerHTML = html.join("");
|
||||
};
|
||||
|
||||
this.$getTop = function(row, layerConfig) {
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ var Text = function(parentEl) {
|
|||
};
|
||||
this.setSession = function(session) {
|
||||
this.session = session;
|
||||
this.$computeTabString();
|
||||
if (session)
|
||||
this.$computeTabString();
|
||||
};
|
||||
|
||||
this.showInvisibles = false;
|
||||
|
|
@ -203,7 +204,7 @@ var Text = function(parentEl) {
|
|||
html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
|
||||
);
|
||||
lineElement.style.height = config.lineHeight * this.session.getRowLength(row) + "px";
|
||||
dom.setInnerHtml(lineElement, html.join(""));
|
||||
lineElement.innerHTML = html.join("");
|
||||
}
|
||||
row++;
|
||||
}
|
||||
|
|
@ -310,7 +311,7 @@ var Text = function(parentEl) {
|
|||
|
||||
row++;
|
||||
}
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
this.element.innerHTML = html.join("");
|
||||
};
|
||||
|
||||
this.$textToken = {
|
||||
|
|
@ -321,7 +322,7 @@ var Text = function(parentEl) {
|
|||
|
||||
this.$renderToken = function(stringBuilder, screenColumn, token, value) {
|
||||
var self = this;
|
||||
var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
|
||||
var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
|
||||
var replaceFunc = function(c, a, b, tabIdx, idx4) {
|
||||
if (a) {
|
||||
return self.showInvisibles ?
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ exports.createElement = function(tag, ns) {
|
|||
};
|
||||
|
||||
exports.hasCssClass = function(el, name) {
|
||||
var classes = el.className.split(/\s+/g);
|
||||
var classes = (el.className || "").split(/\s+/g);
|
||||
return classes.indexOf(name) !== -1;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
|||
startY = e.clientY;
|
||||
}
|
||||
}
|
||||
|
||||
e._clicks = clicks;
|
||||
|
||||
eventHandler[callbackName]("mousedown", e);
|
||||
|
||||
|
|
@ -237,7 +239,7 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
|||
return;
|
||||
}
|
||||
if (keyCode === 18 || keyCode === 17) {
|
||||
var location = e.location || e.keyLocation;
|
||||
var location = "location" in e ? e.location : e.keyLocation;
|
||||
if (keyCode === 17 && location === 1) {
|
||||
ts = e.timeStamp;
|
||||
} else if (keyCode === 18 && hashId === 3 && location === 2) {
|
||||
|
|
@ -273,7 +275,8 @@ function normalizeCommandKeys(callback, e, keyCode) {
|
|||
}
|
||||
|
||||
if (!hashId && keyCode === 13) {
|
||||
if (e.location || e.keyLocation === 3) {
|
||||
var location = "location" in e ? e.location : e.keyLocation;
|
||||
if (location === 3) {
|
||||
callback(e, hashId, -keyCode);
|
||||
if (e.defaultPrevented)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ For more information about SproutCore, visit http://www.sproutcore.com
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
require("./fixoldbrowsers");
|
||||
|
||||
var oop = require("./oop");
|
||||
|
||||
/*
|
||||
|
|
@ -136,7 +138,7 @@ var Keys = (function() {
|
|||
|
||||
(function() {
|
||||
var mods = ["cmd", "ctrl", "alt", "shift"];
|
||||
for (var i = Math.pow(2, mods.length); i--;) {
|
||||
for (var i = Math.pow(2, mods.length); i--;) {
|
||||
ret.KEY_MODS[i] = mods.filter(function(x) {
|
||||
return i & ret.KEY_MODS[x];
|
||||
}).join("-") + "-";
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class Foo extends Bar
|
|||
foo.static.function
|
||||
#!test tokenize string with interpolation
|
||||
a = "#{ 22 / 7 + {x: "#{a + b}"} + 2}"
|
||||
" #{ "" + {} } )"
|
||||
"""heredoc
|
||||
"""
|
||||
do ->
|
||||
|
|
|
|||
24
lib/ace/mode/_test/text_php.txt
Normal file
24
lib/ace/mode/_test/text_php.txt
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
function nfact($n) {
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return $n * nfact($n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\nPlease enter a whole number ... ";
|
||||
$num = trim(fgets(STDIN));
|
||||
|
||||
// ===== PROCESS - Determing the factorial of the input number =====
|
||||
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
|
||||
echo $output;
|
||||
|
||||
?> <script> <?php
|
||||
echo '
|
||||
';
|
||||
?>
|
||||
/*this is js <?php echo ':)'; ?>
|
||||
</script> not &js;
|
||||
|
|
@ -466,6 +466,23 @@
|
|||
["constant.numeric","2"],
|
||||
["paren.string","}"],
|
||||
["string.end","\""]
|
||||
],[
|
||||
"start",
|
||||
["string.start","\""],
|
||||
["string"," "],
|
||||
["paren.string","#{"],
|
||||
["text"," "],
|
||||
["string.start","\""],
|
||||
["string.end","\""],
|
||||
["text"," "],
|
||||
["keyword.operator","+"],
|
||||
["text"," "],
|
||||
["paren","{}"],
|
||||
["text"," "],
|
||||
["paren.string","}"],
|
||||
["string"," )"],
|
||||
["string.end","\""],
|
||||
["text"," "]
|
||||
],[
|
||||
"qqdoc",
|
||||
["string","\"\"\"heredoc"]
|
||||
|
|
|
|||
33
lib/ace/mode/_test/tokens_gitignore.json
Normal file
33
lib/ace/mode/_test/tokens_gitignore.json
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
[[
|
||||
"start",
|
||||
["comment","# A sample .gitignore file."]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["text",".buildlog"]
|
||||
],[
|
||||
"start",
|
||||
["text",".DS_Store"]
|
||||
],[
|
||||
"start",
|
||||
["text",".svn"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["comment","# Negated patterns:"]
|
||||
],[
|
||||
"start",
|
||||
["keyword","!foo.bar"]
|
||||
],[
|
||||
"start"
|
||||
],[
|
||||
"start",
|
||||
["comment","# Also ignore user settings..."]
|
||||
],[
|
||||
"start",
|
||||
["text","/.settings"]
|
||||
],[
|
||||
"start"
|
||||
]]
|
||||
|
|
@ -288,9 +288,9 @@
|
|||
["string.regexp.charachterclass","r"],
|
||||
["constant.language.escape","-"],
|
||||
["string.regexp.charachterclass","o"],
|
||||
["regexp.keyword.operator","\\f\\f"],
|
||||
["regexp.charclass.keyword.operator","\\f\\f"],
|
||||
["string.regexp.charachterclass","["],
|
||||
["regexp.keyword.operator","\\f"],
|
||||
["regexp.charclass.keyword.operator","\\f"],
|
||||
["constant.language.escape","]?"],
|
||||
["string.regexp","r"],
|
||||
["invalid","{7}+"],
|
||||
|
|
@ -379,7 +379,7 @@
|
|||
["constant.numeric","1."],
|
||||
["text","00"],
|
||||
["identifier","E"],
|
||||
["text","^"],
|
||||
["keyword.operator","^"],
|
||||
["constant.numeric","1"],
|
||||
["punctuation.operator",","],
|
||||
["text"," "],
|
||||
|
|
|
|||
|
|
@ -2,37 +2,37 @@
|
|||
"start",
|
||||
["keyword","\\usepackage"],
|
||||
["lparen","{"],
|
||||
["text","amsmath"],
|
||||
["storage.type","amsmath"],
|
||||
["rparen","}"]
|
||||
],[
|
||||
"start",
|
||||
["keyword","\\title"],
|
||||
["storage.type","\\title"],
|
||||
["lparen","{"],
|
||||
["keyword","\\LaTeX"],
|
||||
["storage.type","\\LaTeX"],
|
||||
["rparen","}"]
|
||||
],[
|
||||
"start",
|
||||
["keyword","\\date"],
|
||||
["storage.type","\\date"],
|
||||
["lparen","{"],
|
||||
["rparen","}"]
|
||||
],[
|
||||
"start",
|
||||
["keyword","\\begin"],
|
||||
["storage.type","\\begin"],
|
||||
["lparen","{"],
|
||||
["text","document"],
|
||||
["variable.parameter","document"],
|
||||
["rparen","}"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","\\maketitle"]
|
||||
["storage.type","\\maketitle"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","\\LaTeX"],
|
||||
["storage.type","\\LaTeX"],
|
||||
["lparen","{"],
|
||||
["rparen","}"],
|
||||
["text"," is a document preparation system for the "],
|
||||
["keyword","\\TeX"],
|
||||
["storage.type","\\TeX"],
|
||||
["lparen","{"],
|
||||
["rparen","}"]
|
||||
],[
|
||||
|
|
@ -50,26 +50,26 @@
|
|||
],[
|
||||
"start",
|
||||
["text"," and much more. "],
|
||||
["keyword","\\LaTeX"],
|
||||
["storage.type","\\LaTeX"],
|
||||
["lparen","{"],
|
||||
["rparen","}"],
|
||||
["text"," was originally written in 1984 by Leslie"]
|
||||
],[
|
||||
"start",
|
||||
["text"," Lamport and has become the dominant method for using "],
|
||||
["keyword","\\TeX"],
|
||||
["storage.type","\\TeX"],
|
||||
["text","; few"]
|
||||
],[
|
||||
"start",
|
||||
["text"," people write in plain "],
|
||||
["keyword","\\TeX"],
|
||||
["storage.type","\\TeX"],
|
||||
["lparen","{"],
|
||||
["rparen","}"],
|
||||
["text"," anymore. The current version is"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","\\LaTeXe"],
|
||||
["storage.type","\\LaTeXe"],
|
||||
["text","."]
|
||||
],[
|
||||
"start",
|
||||
|
|
@ -85,26 +85,26 @@
|
|||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","\\begin"],
|
||||
["storage.type","\\begin"],
|
||||
["lparen","{"],
|
||||
["text","align"],
|
||||
["variable.parameter","align"],
|
||||
["rparen","}"]
|
||||
],[
|
||||
"start",
|
||||
["text"," E &= mc^2 "],
|
||||
["keyword","\\\\"]
|
||||
["constant.character.escape","\\\\"]
|
||||
],[
|
||||
"start",
|
||||
["text"," m &= "],
|
||||
["keyword","\\frac"],
|
||||
["storage.type","\\frac"],
|
||||
["lparen","{"],
|
||||
["text","m_0"],
|
||||
["rparen","}"],
|
||||
["lparen","{"],
|
||||
["keyword","\\sqrt"],
|
||||
["storage.type","\\sqrt"],
|
||||
["lparen","{"],
|
||||
["text","1-"],
|
||||
["keyword","\\frac"],
|
||||
["storage.type","\\frac"],
|
||||
["lparen","{"],
|
||||
["text","v^2"],
|
||||
["rparen","}"],
|
||||
|
|
@ -114,14 +114,14 @@
|
|||
],[
|
||||
"start",
|
||||
["text"," "],
|
||||
["keyword","\\end"],
|
||||
["storage.type","\\end"],
|
||||
["lparen","{"],
|
||||
["text","align"],
|
||||
["variable.parameter","align"],
|
||||
["rparen","}"]
|
||||
],[
|
||||
"start",
|
||||
["keyword","\\end"],
|
||||
["storage.type","\\end"],
|
||||
["lparen","{"],
|
||||
["text","document"],
|
||||
["variable.parameter","document"],
|
||||
["rparen","}"]
|
||||
]]
|
||||
|
|
@ -500,4 +500,4 @@
|
|||
["paren.rparen.lsl","}"]
|
||||
],[
|
||||
"start"
|
||||
]]
|
||||
]]
|
||||
|
|
@ -345,4 +345,4 @@
|
|||
["text"," "],
|
||||
["comment","--[[ blah ]]"],
|
||||
["paren.rparen",")"]
|
||||
]]
|
||||
]]
|
||||
|
|
@ -129,6 +129,43 @@
|
|||
],[
|
||||
"php-start"
|
||||
],[
|
||||
"start",
|
||||
["php-start","js-start"],
|
||||
["support.php_tag","?>"],
|
||||
["text.xml"," "],
|
||||
["meta.tag.punctuation.tag-open.xml","<"],
|
||||
["meta.tag.script.tag-name.xml","script"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"],
|
||||
["text"," "],
|
||||
["support.php_tag","<?php"]
|
||||
],[
|
||||
["#tmp","php-qstring","php-start","js-start"],
|
||||
["support.function","echo"],
|
||||
["text"," "],
|
||||
["string","'"]
|
||||
],[
|
||||
["php-start","js-start"],
|
||||
["string","'"],
|
||||
["text",";"]
|
||||
],[
|
||||
"js-start",
|
||||
["support.php_tag","?>"]
|
||||
],[
|
||||
"js-comment_regex_allowed",
|
||||
["comment","/*this is js "],
|
||||
["support.php_tag","<?php"],
|
||||
["text"," "],
|
||||
["support.function","echo"],
|
||||
["text"," "],
|
||||
["string","':)'"],
|
||||
["text","; "],
|
||||
["support.php_tag","?>"]
|
||||
],[
|
||||
"start",
|
||||
["meta.tag.punctuation.end-tag-open.xml","</"],
|
||||
["meta.tag.script.tag-name.xml","script"],
|
||||
["meta.tag.punctuation.tag-close.xml",">"],
|
||||
["text.xml"," not "],
|
||||
["constant.language.escape.reference.xml","&js;"]
|
||||
],[
|
||||
"start"
|
||||
]]
|
||||
158
lib/ace/mode/_test/tokens_vala.json
Normal file
158
lib/ace/mode/_test/tokens_vala.json
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
[[
|
||||
"start",
|
||||
["meta.using.vala",""],
|
||||
["keyword.other.using.vala","using"],
|
||||
["meta.using.vala"," "],
|
||||
["storage.modifier.using.vala","Gtk"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"start",
|
||||
["text"," "]
|
||||
],[
|
||||
"text0",
|
||||
["storage.type.primitive.array.vala","int"],
|
||||
["text"," main ("],
|
||||
["storage.type.primitive.array.vala","string"],
|
||||
["text","[] args) {"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," "],
|
||||
["storage.type.vala","Gtk"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","init ("],
|
||||
["storage.modifier.vala","ref"],
|
||||
["text"," args)"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," "],
|
||||
["storage.type.primitive.vala","var"],
|
||||
["text"," foo "],
|
||||
["keyword.operator.assignment.vala","="],
|
||||
["text"," "],
|
||||
["keyword.control.new.vala","new"],
|
||||
["text"," "],
|
||||
["storage.type.generic.vala","MyFoo<string[](), MyBar<string, int>>"],
|
||||
["text","()"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0"
|
||||
],[
|
||||
"text0",
|
||||
["text"," "],
|
||||
["storage.type.primitive.vala","var"],
|
||||
["text"," window "],
|
||||
["keyword.operator.assignment.vala","="],
|
||||
["text"," "],
|
||||
["keyword.control.new.vala","new"],
|
||||
["text"," "],
|
||||
["storage.type.vala","Window"],
|
||||
["text","()"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," window"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","title "],
|
||||
["keyword.operator.assignment.vala","="],
|
||||
["text"," "],
|
||||
["punctuation.definition.string.begin.vala","\""],
|
||||
["string.quoted.double.vala","Hello, World!"],
|
||||
["punctuation.definition.string.end.vala","\""],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," window"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","border_width "],
|
||||
["keyword.operator.assignment.vala","="],
|
||||
["text"," "],
|
||||
["constant.numeric.vala","10"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," window"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","window_position "],
|
||||
["keyword.operator.assignment.vala","="],
|
||||
["text"," "],
|
||||
["storage.type.vala","WindowPosition"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["constant.other.vala","CENTER"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," window"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","set_default_size("],
|
||||
["constant.numeric.vala","350"],
|
||||
["text",", "],
|
||||
["constant.numeric.vala","70"],
|
||||
["text",")"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," window"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","destroy"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","connect("],
|
||||
["storage.type.vala","Gtk"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","main_quit)"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," "]
|
||||
],[
|
||||
"text0",
|
||||
["text"," "],
|
||||
["storage.type.primitive.vala","var"],
|
||||
["text"," label "],
|
||||
["keyword.operator.assignment.vala","="],
|
||||
["text"," "],
|
||||
["keyword.control.new.vala","new"],
|
||||
["text"," "],
|
||||
["storage.type.vala","Label"],
|
||||
["text","("],
|
||||
["punctuation.definition.string.begin.vala","\""],
|
||||
["string.quoted.double.vala","Hello, World!"],
|
||||
["punctuation.definition.string.end.vala","\""],
|
||||
["text",")"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," "]
|
||||
],[
|
||||
"text0",
|
||||
["text"," window"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","add(label)"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," window"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","show_all()"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," "]
|
||||
],[
|
||||
"text0",
|
||||
["text"," "],
|
||||
["storage.type.vala","Gtk"],
|
||||
["keyword.operator.dereference.vala","."],
|
||||
["text","main()"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"text0",
|
||||
["text"," "],
|
||||
["keyword.control.vala","return"],
|
||||
["text"," "],
|
||||
["constant.numeric.vala","0"],
|
||||
["punctuation.terminator.vala",";"]
|
||||
],[
|
||||
"start",
|
||||
["text","}"]
|
||||
]]
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
[[
|
||||
"[\"start\"]",
|
||||
["keyword","xquery"],
|
||||
["text"," "],
|
||||
["keyword","version"],
|
||||
["text"," "],
|
||||
["string","\""],
|
||||
["string","1.0"],
|
||||
["string","\""],
|
||||
["text",";"]
|
||||
],[
|
||||
"[\"start\"]"
|
||||
],[
|
||||
"[\"start\"]",
|
||||
["keyword","let"],
|
||||
["text"," "],
|
||||
["variable","$message"],
|
||||
["text"," "],
|
||||
["keyword.operator",":="],
|
||||
["text"," "],
|
||||
["string","\""],
|
||||
["string","Hello World!"],
|
||||
["string","\""]
|
||||
],[
|
||||
"[\"start\",\"StartTag\",\"TagContent\"]",
|
||||
["keyword","return"],
|
||||
["text"," "],
|
||||
["meta.tag","<results"],
|
||||
["meta.tag",">"]
|
||||
],[
|
||||
"[\"start\",\"StartTag\",\"TagContent\"]",
|
||||
["text"," "],
|
||||
["meta.tag","<message"],
|
||||
["meta.tag",">"],
|
||||
["text","{"],
|
||||
["variable","$message"],
|
||||
["text","}"],
|
||||
["meta.tag","</message>"]
|
||||
],[
|
||||
"[\"start\"]",
|
||||
["meta.tag","</results>"]
|
||||
],[
|
||||
"[\"start\"]"
|
||||
]]
|
||||
|
|
@ -22,8 +22,9 @@ var c_cppHighlightRules = function() {
|
|||
);
|
||||
|
||||
var storageModifiers = (
|
||||
"const|extern|register|restrict|static|volatile|inline|private:|" +
|
||||
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
|
||||
"const|extern|register|restrict|static|volatile|inline|private|" +
|
||||
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
|
||||
"constexpr|new|delete"
|
||||
);
|
||||
|
||||
var keywordOperators = (
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -40,8 +40,11 @@ var Worker = exports.Worker = function(sender) {
|
|||
Mirror.call(this, sender);
|
||||
this.setTimeout(400);
|
||||
this.ruleset = null;
|
||||
this.setDisabledRules("ids");
|
||||
this.setInfoRules("adjoining-classes|qualified-headings|zero-units|gradients|import|outline-none");
|
||||
this.setDisabledRules("ids|order-alphabetical");
|
||||
this.setInfoRules(
|
||||
"adjoining-classes|qualified-headings|zero-units|gradients|" +
|
||||
"import|outline-none|vendor-prefix"
|
||||
);
|
||||
};
|
||||
|
||||
oop.inherits(Worker, Mirror);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ var DartHighlightRules = function() {
|
|||
},
|
||||
{
|
||||
token: "keyword.other.import.dart",
|
||||
regex: "(?:\\b)(?:library|import|export|part|of)(?:\\b)"
|
||||
regex: "(?:\\b)(?:library|import|export|part|of|show|hide)(?:\\b)"
|
||||
},
|
||||
{
|
||||
token : ["keyword.other.import.dart", "text"],
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ var DockerfileHighlightRules = function() {
|
|||
for (var i = 0; i < startRules.length; i++) {
|
||||
if (startRules[i].token == "variable.language") {
|
||||
startRules.splice(i, 0, {
|
||||
token: "variable.language",
|
||||
token: "constant.language",
|
||||
regex: "(?:^(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)\\b)",
|
||||
caseInsensitive: true
|
||||
});
|
||||
|
|
|
|||
52
lib/ace/mode/eiffel.js
Normal file
52
lib/ace/mode/eiffel.js
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2014, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var EiffelHighlightRules = require("./eiffel_highlight_rules").EiffelHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = EiffelHighlightRules;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.lineCommentStart = "--";
|
||||
this.$id = "ace/mode/eiffel";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
|
||||
143
lib/ace/mode/eiffel_highlight_rules.js
Normal file
143
lib/ace/mode/eiffel_highlight_rules.js
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2014, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var EiffelHighlightRules = function() {
|
||||
var keywords = "across|agent|alias|all|attached|as|assign|attribute|check|" +
|
||||
"class|convert|create|debug|deferred|detachable|do|else|elseif|end|" +
|
||||
"ensure|expanded|export|external|feature|from|frozen|if|inherit|" +
|
||||
"inspect|invariant|like|local|loop|not|note|obsolete|old|once|" +
|
||||
"Precursor|redefine|rename|require|rescue|retry|select|separate|" +
|
||||
"some|then|undefine|until|variant|when";
|
||||
|
||||
var operatorKeywords = "and|implies|or|xor";
|
||||
|
||||
var languageConstants = "Void";
|
||||
|
||||
var booleanConstants = "True|False";
|
||||
|
||||
var languageVariables = "Current|Result";
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"constant.language": languageConstants,
|
||||
"constant.language.boolean": booleanConstants,
|
||||
"variable.language": languageVariables,
|
||||
"keyword.operator": operatorKeywords,
|
||||
"keyword": keywords
|
||||
}, "identifier", true);
|
||||
|
||||
this.$rules = {
|
||||
"start": [{
|
||||
token : "comment.line.double-dash",
|
||||
regex : /--.*$/
|
||||
}, {
|
||||
token : "string.quoted.double",
|
||||
regex : /"(?:%"|[^%])*?"/
|
||||
}, {
|
||||
token : "string.quoted.other", // "[ ]" aligned verbatim string
|
||||
regex : /"\[/,
|
||||
next: "aligned_verbatim_string"
|
||||
}, {
|
||||
token : "string.quoted.other", // "{ }" non-aligned verbatim string
|
||||
regex : /"\{/,
|
||||
next: "non-aligned_verbatim_string"
|
||||
}, {
|
||||
token : "constant.character",
|
||||
regex : /'(?:%%|%T|%R|%N|%F|%'|[^%])'/
|
||||
}, {
|
||||
token : "constant.numeric", // real
|
||||
regex : /(?:\d(?:_?\d)*\.|\.\d)(?:\d*[eE][+-]?\d+)?\b/
|
||||
}, {
|
||||
token : "constant.numeric", // integer
|
||||
regex : /\d(?:_?\d)*\b/
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : /0[xX][a-fA-F\d](?:_?[a-fA-F\d])*\b/
|
||||
}, {
|
||||
token : "constant.numeric", // octal
|
||||
regex : /0[cC][0-7](?:_?[0-7])*\b/
|
||||
},{
|
||||
token : "constant.numeric", // bin
|
||||
regex : /0[bB][01](?:_?[01])*\b/
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : /\+|\-|\*|\/|\\\\|\/\/|\^|~|\/~|<|>|<=|>=|\/=|=|:=|\|\.\.\||\.\./
|
||||
}, {
|
||||
token : "keyword.operator", // punctuation
|
||||
regex : /\.|:|,|;\b/
|
||||
}, {
|
||||
token : function (v) {
|
||||
var result = keywordMapper (v);
|
||||
if (result === "identifier" && v === v.toUpperCase ()) {
|
||||
result = "entity.name.type";
|
||||
}
|
||||
return result;
|
||||
},
|
||||
regex : /[a-zA-Z][a-zA-Z\d_]*\b/
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : /[\[({]/
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : /[\])}]/
|
||||
}, {
|
||||
token : "text",
|
||||
regex : /\s+/
|
||||
}
|
||||
],
|
||||
"aligned_verbatim_string" : [{
|
||||
token : "string", // closing multi-line comment
|
||||
regex : /]"/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string", // comment spanning whole line
|
||||
regex : /[^(?:\]")]+/
|
||||
}
|
||||
],
|
||||
"non-aligned_verbatim_string" : [{
|
||||
token : "string.quoted.other", // closing multi-line comment
|
||||
regex : /}"/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string.quoted.other", // comment spanning whole line
|
||||
regex : /[^(?:\}")]+/
|
||||
}
|
||||
]};
|
||||
};
|
||||
|
||||
oop.inherits(EiffelHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.EiffelHighlightRules = EiffelHighlightRules;
|
||||
});
|
||||
|
|
@ -145,9 +145,9 @@ module.exports = {
|
|||
session.setFoldStyle("markbeginend");
|
||||
|
||||
assert.equal(session.getFoldWidget(0), "start");
|
||||
assert.equal(session.getFoldWidget(1), "");
|
||||
assert.equal(session.getFoldWidget(1), "start");
|
||||
assert.equal(session.getFoldWidget(2), "");
|
||||
assert.equal(session.getFoldWidget(3), "");
|
||||
assert.equal(session.getFoldWidget(3), "start");
|
||||
assert.equal(session.getFoldWidget(4), "");
|
||||
assert.equal(session.getFoldWidget(5), "end");
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
(function() {
|
||||
|
||||
this.foldingStartMarker = /^\s*\\(begin)|(section|subsection)\b|{\s*$/;
|
||||
this.foldingStartMarker = /^\s*\\(begin)|(section|subsection|paragraph)\b|{\s*$/;
|
||||
this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/;
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
|
|
@ -74,7 +74,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
var stream = new TokenIterator(session, row, column);
|
||||
var token = stream.getCurrentToken();
|
||||
if (!token || token.type !== "keyword")
|
||||
if (!token || !(token.type == "storage.type" || token.type == "constant.character.escape"))
|
||||
return;
|
||||
|
||||
var val = token.value;
|
||||
|
|
@ -96,7 +96,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
|
||||
while(token = stream.step()) {
|
||||
if (token.type !== "keyword")
|
||||
if (!token || !(token.type == "storage.type" || token.type == "constant.character.escape"))
|
||||
continue;
|
||||
var level = keywords[token.value];
|
||||
if (!level)
|
||||
|
|
@ -119,11 +119,11 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
};
|
||||
|
||||
this.latexSection = function(session, row, column) {
|
||||
var keywords = ["\\subsection", "\\section", "\\begin", "\\end"];
|
||||
var keywords = ["\\subsection", "\\section", "\\begin", "\\end", "\\paragraph"];
|
||||
|
||||
var stream = new TokenIterator(session, row, column);
|
||||
var token = stream.getCurrentToken();
|
||||
if (!token || token.type != "keyword")
|
||||
if (!token || token.type != "storage.type")
|
||||
return;
|
||||
|
||||
var startLevel = keywords.indexOf(token.value);
|
||||
|
|
@ -131,7 +131,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
var endRow = row;
|
||||
|
||||
while(token = stream.stepForward()) {
|
||||
if (token.type !== "keyword")
|
||||
if (token.type !== "storage.type")
|
||||
continue;
|
||||
var level = keywords.indexOf(token.value);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
|
|||
|
||||
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
|
||||
BaseFoldMode.call(this);
|
||||
// TODO folding support for optional end tags
|
||||
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
|
||||
this.voidElements = voidElements || {};
|
||||
this.optionalEndTags = oop.mixin({}, this.voidElements);
|
||||
if (optionalEndTags)
|
||||
oop.mixin(this.optionalEndTags, optionalEndTags);
|
||||
|
||||
};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
|
|
@ -189,10 +192,10 @@ function is(token, type) {
|
|||
if (!tag || top.tagName == tag.tagName) {
|
||||
return stack.pop();
|
||||
}
|
||||
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
|
||||
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
|
||||
return;
|
||||
}
|
||||
else if (this.voidElements.hasOwnProperty(top.tagName)) {
|
||||
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
|
||||
stack.pop();
|
||||
continue;
|
||||
} else {
|
||||
|
|
|
|||
51
lib/ace/mode/gcode.js
Normal file
51
lib/ace/mode/gcode.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* ***** 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 ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var GcodeHighlightRules = require("./gcode_highlight_rules").GcodeHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = GcodeHighlightRules;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.$id = "ace/mode/gcode";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
|
||||
94
lib/ace/mode/gcode_highlight_rules.js
Normal file
94
lib/ace/mode/gcode_highlight_rules.js
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var GcodeHighlightRules = function() {
|
||||
|
||||
var keywords = (
|
||||
"IF|DO|WHILE|ENDWHILE|CALL|ENDIF|SUB|ENDSUB|GOTO|REPEAT|ENDREPEAT|CALL"
|
||||
);
|
||||
|
||||
var builtinConstants = (
|
||||
"PI"
|
||||
);
|
||||
|
||||
var builtinFunctions = (
|
||||
"ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN"
|
||||
);
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"support.function": builtinFunctions,
|
||||
"keyword": keywords,
|
||||
"constant.language": builtinConstants
|
||||
}, "identifier", true);
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment",
|
||||
regex : "\\(.*\\)"
|
||||
}, {
|
||||
token : "comment", // block number
|
||||
regex : "([N])([0-9]+)"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : "([G])([0-9]+\\.?[0-9]?)"
|
||||
}, {
|
||||
token : "string", // ' string
|
||||
regex : "([M])([0-9]+\\.?[0-9]?)"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "([-+]?([0-9]*\\.?[0-9]+\\.?))|(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)"
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : "[A-Z]"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "EQ|LT|GT|NE|GE|LE|OR|XOR"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[\\[]"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\]]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
} ]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(GcodeHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.GcodeHighlightRules = GcodeHighlightRules;
|
||||
});
|
||||
19
lib/ace/mode/gitignore.js
Normal file
19
lib/ace/mode/gitignore.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var GitignoreHighlightRules = require("./gitignore_highlight_rules").GitignoreHighlightRules;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = GitignoreHighlightRules;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.$id = "ace/mode/gitignore";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
31
lib/ace/mode/gitignore_highlight_rules.js
Normal file
31
lib/ace/mode/gitignore_highlight_rules.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var GitignoreHighlightRules = function() {
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : /^\s*#.*$/
|
||||
}, {
|
||||
token : "keyword", // negated patterns
|
||||
regex : /^\s*!.*$/
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
GitignoreHighlightRules.metaData = {
|
||||
fileTypes: ['gitignore'],
|
||||
name: 'Gitignore'
|
||||
};
|
||||
|
||||
oop.inherits(GitignoreHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.GitignoreHighlightRules = GitignoreHighlightRules;
|
||||
});
|
||||
|
|
@ -43,7 +43,7 @@ var HtmlCompletions = require("./html_completions").HtmlCompletions;
|
|||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
|
||||
// http://www.w3.org/TR/html5/syntax.html#void-elements
|
||||
var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
||||
var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
|
||||
var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
|
||||
|
||||
var Mode = function(options) {
|
||||
|
|
|
|||
58
lib/ace/mode/io.js
Normal file
58
lib/ace/mode/io.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var IoHighlightRules = require("./io_highlight_rules").IoHighlightRules;
|
||||
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = IoHighlightRules;
|
||||
this.foldingRules = new FoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
// Extra logic goes here.
|
||||
this.$id = "ace/mode/io"
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
120
lib/ace/mode/io_highlight_rules.js
Normal file
120
lib/ace/mode/io_highlight_rules.js
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2012, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* This file was autogenerated from tm bundles\io.tmbundle/Syntaxes/io.plist (uuid: ) */
|
||||
/****************************************************************************************
|
||||
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
|
||||
* fileTypes *
|
||||
****************************************************************************************/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var IoHighlightRules = function() {
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = { start:
|
||||
[ { token: [ 'text', 'meta.empty-parenthesis.io' ],
|
||||
regex: '(\\()(\\))',
|
||||
comment: 'we match this to overload return inside () --Allan; scoping rules for what gets the scope have changed, so we now group the ) instead of the ( -- Rob' },
|
||||
{ token: [ 'text', 'meta.comma-parenthesis.io' ],
|
||||
regex: '(\\,)(\\))',
|
||||
comment: 'We want to do the same for ,) -- Seckar; same as above -- Rob' },
|
||||
{ token: 'keyword.control.io',
|
||||
regex: '\\b(?:if|ifTrue|ifFalse|ifTrueIfFalse|for|loop|reverseForeach|foreach|map|continue|break|while|do|return)\\b' },
|
||||
{ token: 'punctuation.definition.comment.io',
|
||||
regex: '/\\*',
|
||||
push:
|
||||
[ { token: 'punctuation.definition.comment.io',
|
||||
regex: '\\*/',
|
||||
next: 'pop' },
|
||||
{ defaultToken: 'comment.block.io' } ] },
|
||||
{ token: 'punctuation.definition.comment.io',
|
||||
regex: '//',
|
||||
push:
|
||||
[ { token: 'comment.line.double-slash.io',
|
||||
regex: '$',
|
||||
next: 'pop' },
|
||||
{ defaultToken: 'comment.line.double-slash.io' } ] },
|
||||
{ token: 'punctuation.definition.comment.io',
|
||||
regex: '#',
|
||||
push:
|
||||
[ { token: 'comment.line.number-sign.io', regex: '$', next: 'pop' },
|
||||
{ defaultToken: 'comment.line.number-sign.io' } ] },
|
||||
{ token: 'variable.language.io',
|
||||
regex: '\\b(?:self|sender|target|proto|protos|parent)\\b',
|
||||
comment: 'I wonder if some of this isn\'t variable.other.language? --Allan; scoping this as variable.language to match Objective-C\'s handling of \'self\', which is inconsistent with C++\'s handling of \'this\' but perhaps intentionally so -- Rob' },
|
||||
{ token: 'keyword.operator.io',
|
||||
regex: '<=|>=|=|:=|\\*|\\||\\|\\||\\+|-|/|&|&&|>|<|\\?|@|@@|\\b(?:and|or)\\b' },
|
||||
{ token: 'constant.other.io', regex: '\\bGL[\\w_]+\\b' },
|
||||
{ token: 'support.class.io', regex: '\\b[A-Z](?:\\w+)?\\b' },
|
||||
{ token: 'support.function.io',
|
||||
regex: '\\b(?:clone|call|init|method|list|vector|block|\\w+(?=\\s*\\())\\b' },
|
||||
{ token: 'support.function.open-gl.io',
|
||||
regex: '\\bgl(?:u|ut)?[A-Z]\\w+\\b' },
|
||||
{ token: 'punctuation.definition.string.begin.io',
|
||||
regex: '"""',
|
||||
push:
|
||||
[ { token: 'punctuation.definition.string.end.io',
|
||||
regex: '"""',
|
||||
next: 'pop' },
|
||||
{ token: 'constant.character.escape.io', regex: '\\\\.' },
|
||||
{ defaultToken: 'string.quoted.triple.io' } ] },
|
||||
{ token: 'punctuation.definition.string.begin.io',
|
||||
regex: '"',
|
||||
push:
|
||||
[ { token: 'punctuation.definition.string.end.io',
|
||||
regex: '"',
|
||||
next: 'pop' },
|
||||
{ token: 'constant.character.escape.io', regex: '\\\\.' },
|
||||
{ defaultToken: 'string.quoted.double.io' } ] },
|
||||
{ token: 'constant.numeric.io',
|
||||
regex: '\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\b' },
|
||||
{ token: 'variable.other.global.io', regex: 'Lobby\\b' },
|
||||
{ token: 'constant.language.io',
|
||||
regex: '\\b(?:TRUE|true|FALSE|false|NULL|null|Null|Nil|nil|YES|NO)\\b' } ] }
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
IoHighlightRules.metaData = { fileTypes: [ 'io' ],
|
||||
keyEquivalent: '^~I',
|
||||
name: 'Io',
|
||||
scopeName: 'source.io' }
|
||||
|
||||
|
||||
oop.inherits(IoHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.IoHighlightRules = IoHighlightRules;
|
||||
});
|
||||
|
|
@ -1979,7 +1979,7 @@ var JSHINT = (function () {
|
|||
|
||||
function doOption() {
|
||||
var nt = state.tokens.next;
|
||||
var body = nt.body.match(/(-\s+)?[^\s,:]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g);
|
||||
var body = nt.body.match(/(-\s+)?[^\s,:]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g) || [];
|
||||
var predef = {};
|
||||
|
||||
if (nt.type === "globals") {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ var oop = require("../lib/oop");
|
|||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var JavaScriptHighlightRules = function() {
|
||||
var JavaScriptHighlightRules = function(options) {
|
||||
// see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"variable.language":
|
||||
|
|
@ -187,11 +187,11 @@ var JavaScriptHighlightRules = function() {
|
|||
regex : identifierRe
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
|
||||
regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : /\?|\:|\,|\;|\./,
|
||||
regex : /[?:,;.]/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
|
|
@ -200,10 +200,6 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : /[\])}]/
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : /\/=?/,
|
||||
next : "start"
|
||||
}, {
|
||||
token: "comment",
|
||||
regex: /^#!.*$/
|
||||
|
|
@ -272,7 +268,7 @@ var JavaScriptHighlightRules = function() {
|
|||
],
|
||||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
token: "regexp.charclass.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
|
|
@ -354,9 +350,49 @@ var JavaScriptHighlightRules = function() {
|
|||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (!options || !options.noES6) {
|
||||
this.$rules.no_regex.unshift({
|
||||
regex: "[{}]", onMatch: function(val, state, stack) {
|
||||
this.next = val == "{" ? this.nextState : "";
|
||||
if (val == "{" && stack.length) {
|
||||
stack.unshift("start", state);
|
||||
return "paren";
|
||||
}
|
||||
if (val == "}" && stack.length) {
|
||||
stack.shift();
|
||||
this.next = stack.shift();
|
||||
if (this.next.indexOf("string") != -1)
|
||||
return "paren.quasi.end";
|
||||
}
|
||||
return val == "{" ? "paren.lparen" : "paren.rparen";
|
||||
},
|
||||
nextState: "start"
|
||||
}, {
|
||||
token : "string.quasi.start",
|
||||
regex : /`/,
|
||||
push : [{
|
||||
token : "constant.language.escape",
|
||||
regex : escapedRe
|
||||
}, {
|
||||
token : "paren.quasi.start",
|
||||
regex : /\${/,
|
||||
push : "start"
|
||||
}, {
|
||||
token : "string.quasi.end",
|
||||
regex : /`/,
|
||||
next : "pop"
|
||||
}, {
|
||||
defaultToken: "string.quasi"
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ var Mode = function() {
|
|||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.type = "text";
|
||||
|
||||
this.lineCommentStart = "%";
|
||||
|
||||
this.$id = "ace/mode/latex";
|
||||
|
|
|
|||
|
|
@ -4,12 +4,30 @@ define(function(require, exports, module) {
|
|||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var LatexHighlightRules = function() {
|
||||
var LatexHighlightRules = function() {
|
||||
|
||||
this.$rules = {
|
||||
"start" : [{
|
||||
// A comment. Tex comments start with % and go to
|
||||
// the end of the line
|
||||
token : "comment",
|
||||
regex : "%.*$"
|
||||
}, {
|
||||
// Documentclass and usepackage
|
||||
token : ["keyword", "lparen", "variable.parameter", "rparen", "lparen", "storage.type", "rparen"],
|
||||
regex : "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})"
|
||||
}, {
|
||||
// A label
|
||||
token : ["keyword","lparen", "variable.parameter", "rparen"],
|
||||
regex : "(\\\\label)(?:({)([^}]*)(}))?"
|
||||
}, {
|
||||
// A block
|
||||
token : ["storage.type", "lparen", "variable.parameter", "rparen"],
|
||||
regex : "(\\\\(?:begin|end))({)(\\w*)(})"
|
||||
}, {
|
||||
// A tex command e.g. \foo
|
||||
token : "keyword",
|
||||
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
|
||||
token : "storage.type",
|
||||
regex : "\\\\[a-zA-Z]+"
|
||||
}, {
|
||||
// Curly and square braces
|
||||
token : "lparen",
|
||||
|
|
@ -19,18 +37,35 @@ var LatexHighlightRules = function() {
|
|||
token : "rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
// Inline math between two $ symbols
|
||||
token : "string",
|
||||
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
|
||||
// Escaped character (including new line)
|
||||
token : "constant.character.escape",
|
||||
regex : "\\\\[^a-zA-Z]?"
|
||||
}, {
|
||||
// A comment. Tex comments start with % and go to
|
||||
// the end of the line
|
||||
// An equation
|
||||
token : "string",
|
||||
regex : "\\${1,2}",
|
||||
next : "equation"
|
||||
}],
|
||||
"equation" : [{
|
||||
token : "comment",
|
||||
regex : "%.*$"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "\\${1,2}",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "constant.character.escape",
|
||||
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
|
||||
}, {
|
||||
token : "error",
|
||||
regex : "^\\s*$",
|
||||
next : "start"
|
||||
}, {
|
||||
defaultToken : "string"
|
||||
}]
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(LatexHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.LatexHighlightRules = LatexHighlightRules;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -164,15 +164,53 @@ var keywords = (
|
|||
}, "identifier", true);
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
// allowQstring
|
||||
start: [{
|
||||
token : "string",
|
||||
regex : "'",
|
||||
stateName : "qstring",
|
||||
next : [{
|
||||
token : "constant.language.escape",
|
||||
regex : "''"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start"
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}]
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
regex: "",
|
||||
next: "noQstring"
|
||||
}],
|
||||
noQstring : [{
|
||||
regex: "^\\s*%{\\s*$",
|
||||
token: "comment.start",
|
||||
push: "blockComment"
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "%[^\r\n]*"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : '".*?"'
|
||||
}, {
|
||||
token : "string", // ' string
|
||||
regex : "'.*?'"
|
||||
token : "string",
|
||||
regex : '"',
|
||||
stateName : "qqstring",
|
||||
next : [{
|
||||
token : "constant.language.escape",
|
||||
regex : /\\./
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "\\\\$",
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start"
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}]
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
|
|
@ -181,21 +219,41 @@ var keywords = (
|
|||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\+|\\-|\\/|\\/\\/|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||
regex : "\\+|\\-|\\/|\\/\\/|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=",
|
||||
next: "start"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\;|\\."
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
||||
next: "start"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[\\(]"
|
||||
regex : "[({\\[]",
|
||||
next: "start"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : "[\\)]"
|
||||
regex : "[\\]})]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
} ]
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "$",
|
||||
next : "start"
|
||||
}],
|
||||
blockComment: [{
|
||||
regex: "^\\s*%{\\s*$",
|
||||
token: "comment.start",
|
||||
push: "blockComment"
|
||||
}, {
|
||||
regex: "^\\s*%}\\s*$",
|
||||
token: "comment.end",
|
||||
next: "pop"
|
||||
}, {
|
||||
defaultToken: "comment"
|
||||
}],
|
||||
};
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(MatlabHighlightRules, TextHighlightRules);
|
||||
|
|
|
|||
|
|
@ -1005,7 +1005,7 @@ var PhpLangHighlightRules = function() {
|
|||
return "string";
|
||||
stack.shift();
|
||||
stack.shift();
|
||||
return "markup.list"
|
||||
return "markup.list";
|
||||
},
|
||||
regex : "^\\w+(?=;?$)",
|
||||
next: "start"
|
||||
|
|
@ -1016,12 +1016,11 @@ var PhpLangHighlightRules = function() {
|
|||
],
|
||||
"comment" : [
|
||||
{
|
||||
token : "comment", // closing comment
|
||||
regex : ".*?\\*\\/",
|
||||
token : "comment",
|
||||
regex : "\\*\\/",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "comment", // comment spanning whole line
|
||||
regex : ".+"
|
||||
defaultToken : "comment"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
|
|
@ -1029,10 +1028,10 @@ var PhpLangHighlightRules = function() {
|
|||
token : "constant.language.escape",
|
||||
regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
|
||||
}, {
|
||||
token : "constant.language.escape",
|
||||
regex : /\$[\w]+(?:\[[\w\]+]|=>\w+)?/
|
||||
token : "variable",
|
||||
regex : /\$[\w]+(?:\[[\w\]+]|[=\-]>\w+)?/
|
||||
}, {
|
||||
token : "constant.language.escape",
|
||||
token : "variable",
|
||||
regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now
|
||||
},
|
||||
{token : "string", regex : '"', next : "start"},
|
||||
|
|
|
|||
84
lib/ace/mode/praat.js
Normal file
84
lib/ace/mode/praat.js
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/* ***** 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 ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var PraatHighlightRules = require("./praat_highlight_rules").PraatHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = PraatHighlightRules;
|
||||
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.lineCommentStart = "#";
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
if (state == "start") {
|
||||
var match = line.match(/^.*[\{\(\[\:]\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/praat";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
262
lib/ace/mode/praat_highlight_rules.js
Normal file
262
lib/ace/mode/praat_highlight_rules.js
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var PraatHighlightRules = function() {
|
||||
|
||||
var keywords = (
|
||||
"if|then|else|elsif|elif|endif|fi|" +
|
||||
"endfor|endproc|" + // related keywords specified below
|
||||
"while|endwhile|" +
|
||||
"repeat|until|" +
|
||||
"select|plus|minus|" +
|
||||
"assert"
|
||||
);
|
||||
|
||||
var predefinedVariables = (
|
||||
"macintosh|windows|unix|" +
|
||||
"praatVersion|praatVersion\\$" +
|
||||
"pi|undefined|" +
|
||||
"newline\\$|tab\\$|" +
|
||||
"shellDirectory\\$|homeDirectory\\$|preferencesDirectory\\$|" +
|
||||
"temporaryDirectory\\$|defaultDirectory\\$"
|
||||
);
|
||||
|
||||
// What is "endSendPraat"? Function? Directive?
|
||||
var directives = (
|
||||
"clearinfo|endSendPraat"
|
||||
);
|
||||
|
||||
var functions = (
|
||||
// Info functions
|
||||
"writeInfo|writeInfoLine|appendInfo|appendInfoLine|" +
|
||||
"writeFile|writeFileLine|appendFile|appendFileLine|" +
|
||||
// Math functions
|
||||
"abs|round|floor|ceiling|min|max|imin|imax|" +
|
||||
"sqrt|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi|" +
|
||||
"exp|ln|log10|log2|" +
|
||||
"sinh|cosh|tanh|arcsinh|arccosh|actanh|" +
|
||||
"sigmoid|invSigmoid|erf|erfc|" +
|
||||
"randomUniform|randomInteger|randomGauss|randomPoisson|" +
|
||||
"lnGamma|gaussP|gaussQ|invGaussQ|" +
|
||||
"chiSquareP|chiSquareQ|invChiSquareQ|studentP|studentQ|invStudentQ|" +
|
||||
"fisherP|fisherQ|invFisherQ|" +
|
||||
"binomialP|binomialQ|invBinomialP|invBinomialQ|" +
|
||||
"hertzToBark|barkToHerz|" +
|
||||
"hertzToMel|melToHertz|" +
|
||||
"hertzToSemitones|semitonesToHerz|" +
|
||||
"erb|hertzToErb|erbToHertz|" +
|
||||
"phonToDifferenceLimens|differenceLimensToPhon|" +
|
||||
"beta|besselI|besselK|" +
|
||||
// String functions
|
||||
"selected|selected\\$|numberOfSelected|variableExists|"+
|
||||
"index|rindex|startsWith|endsWith|"+
|
||||
"index_regex|rindex_regex|replace_regex\\$|"+
|
||||
"length|extractWord\\$|extractLine\\$|extractNumber|" +
|
||||
"left\\$|right\\$|mid\\$|replace\\$|" +
|
||||
// Pause functions
|
||||
"beginPause|endPause|" +
|
||||
// Demo functions
|
||||
"demoShow|demoWindowTitle|demoInput|demoWaitForInput|" +
|
||||
"demoClicked|demoClickedIn|demoX|demoY|" +
|
||||
"demoKeyPressed|demoKey\\$|" +
|
||||
"demoExtraControlKeyPressed|demoShiftKeyPressed|"+
|
||||
"demoCommandKeyPressed|demoOptionKeyPressed|" +
|
||||
// File functions
|
||||
"environment\\$|chooseReadFile\\$|" +
|
||||
"chooseDirectory\\$|createDirectory|fileReadable|deleteFile|" +
|
||||
"selectObject|removeObject|plusObject|minusObject|" +
|
||||
"runScript|exitScript|" +
|
||||
// sendpraat functions
|
||||
"beginSendPraat|endSendPraat"
|
||||
);
|
||||
|
||||
var objectTypes = (
|
||||
"Activation|AffineTransform|AmplitudeTier|Art|Artword|Autosegment|" +
|
||||
"BarkFilter|CCA|Categories|Cepstrum|Cepstrumc|ChebyshevSeries|" +
|
||||
"ClassificationTable|Cochleagram|Collection|Configuration|" +
|
||||
"Confusion|ContingencyTable|Corpus|Correlation|Covariance|" +
|
||||
"CrossCorrelationTable|CrossCorrelationTables|DTW|Diagonalizer|" +
|
||||
"Discriminant|Dissimilarity|Distance|Distributions|DurationTier|" +
|
||||
"EEG|ERP|ERPTier|Eigen|Excitation|Excitations|ExperimentMFC|FFNet|" +
|
||||
"FeatureWeights|Formant|FormantFilter|FormantGrid|FormantPoint|" +
|
||||
"FormantTier|GaussianMixture|HMM|HMM_Observation|" +
|
||||
"HMM_ObservationSequence|HMM_State|HMM_StateSequence|Harmonicity|" +
|
||||
"ISpline|Index|Intensity|IntensityTier|IntervalTier|KNN|KlattGrid|" +
|
||||
"KlattTable|LFCC|LPC|Label|LegendreSeries|LinearRegression|" +
|
||||
"LogisticRegression|LongSound|Ltas|MFCC|MSpline|ManPages|" +
|
||||
"Manipulation|Matrix|MelFilter|MixingMatrix|Movie|Network|" +
|
||||
"OTGrammar|OTHistory|OTMulti|PCA|PairDistribution|ParamCurve|" +
|
||||
"Pattern|Permutation|Pitch|PitchTier|PointProcess|Polygon|" +
|
||||
"Polynomial|Procrustes|RealPoint|RealTier|ResultsMFC|Roots|SPINET|" +
|
||||
"SSCP|SVD|Salience|ScalarProduct|Similarity|SimpleString|" +
|
||||
"SortedSetOfString|Sound|Speaker|Spectrogram|Spectrum|SpectrumTier|" +
|
||||
"SpeechSynthesizer|SpellingChecker|Strings|StringsIndex|Table|" +
|
||||
"TableOfReal|TextGrid|TextInterval|TextPoint|TextTier|Tier|" +
|
||||
"Transition|VocalTract|Weight|WordList"
|
||||
);
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
// Interpolated strings
|
||||
token : "string.interpolated",
|
||||
regex : /'((?:[a-z][a-zA-Z0-9_]*)(?:\$|#|:[0-9]+)?)'/
|
||||
}, {
|
||||
// stopwatch
|
||||
token : ["text", "text", "keyword.operator", "text", "keyword"],
|
||||
regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(stopwatch)/
|
||||
}, {
|
||||
// Directives which introduce unquoted strings
|
||||
token : ["text", "keyword", "text", "string"],
|
||||
regex : /(^\s*)(print(?:line)?|echo|exit|pause|sendpraat|include|execute)(\s+)(.*)/
|
||||
}, {
|
||||
// Directives with no arguments
|
||||
token : ["text", "keyword"],
|
||||
regex : "(^\\s*)(" + directives + ")$"
|
||||
}, {
|
||||
// Operators
|
||||
token : ["text", "keyword.operator", "text"],
|
||||
regex : /(\s+)((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)(\s+)/
|
||||
}, {
|
||||
// Commands
|
||||
token : ["text", "text", "keyword.operator", "text", "keyword", "text", "keyword"],
|
||||
regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(?:((?:no)?warn|nocheck|noprogress)(\s+))?((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
|
||||
}, {
|
||||
// Demo commands
|
||||
token : ["text", "keyword", "text", "keyword"],
|
||||
regex : /(^\s*)(?:(demo)?(\s+))((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
|
||||
}, {
|
||||
// Font-sizing commands
|
||||
token : ["text", "keyword", "text", "keyword"],
|
||||
regex : /^(\s*)(?:(demo)(\s+))?(10|12|14|16|24)$/
|
||||
}, {
|
||||
// do-style command calls
|
||||
token : ["text", "support.function", "text"],
|
||||
regex : /(\s*)(do\$?)(\s*:\s*|\s*\(\s*)/
|
||||
}, {
|
||||
// Object types
|
||||
token : "entity.name.type",
|
||||
regex : "(" + objectTypes + ")"
|
||||
}, {
|
||||
// Predefined variables
|
||||
token : "variable.language",
|
||||
regex : "(" + predefinedVariables + ")"
|
||||
}, {
|
||||
// Functions
|
||||
token : ["support.function", "text"],
|
||||
regex : "((?:" + functions + ")\\$?)(\\s*(?::|\\())"
|
||||
}, {
|
||||
// For-loop declarations
|
||||
token : "keyword",
|
||||
regex : /(\bfor\b)/,
|
||||
next : "for"
|
||||
}, {
|
||||
// Generic keywords
|
||||
token : "keyword",
|
||||
regex : "(\\b(?:" + keywords + ")\\b)"
|
||||
}, {
|
||||
// Generic strings
|
||||
token : "string",
|
||||
regex : /"[^"]*"/
|
||||
}, {
|
||||
// Multiline quoted strings
|
||||
token : "string",
|
||||
regex : /"[^"]*$/,
|
||||
next : "brokenstring"
|
||||
}, {
|
||||
// Form declarations
|
||||
token : ["text", "keyword", "text", "entity.name.section"],
|
||||
regex : /(^\s*)(\bform\b)(\s+)(.*)/,
|
||||
next : "form"
|
||||
}, {
|
||||
// Numeric constants
|
||||
token : "constant.numeric",
|
||||
regex : /\b[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||
}, {
|
||||
// Procedure declarations
|
||||
token : ["keyword", "text", "entity.name.function"],
|
||||
regex : /(procedure)(\s+)(\S+)/
|
||||
}, {
|
||||
// New-style procedure calls
|
||||
token : ["entity.name.function", "text"],
|
||||
regex : /(@\S+)(:|\s*\()/
|
||||
}, {
|
||||
// Old-style procedure calls
|
||||
token : ["text", "keyword", "text", "entity.name.function"],
|
||||
regex : /(^\s*)(call)(\s+)(\S+)/
|
||||
}, {
|
||||
// Comments
|
||||
token : "comment",
|
||||
regex : /(^\s*#|;).*$/
|
||||
}, {
|
||||
token : "text",
|
||||
regex : /\s+/
|
||||
}
|
||||
],
|
||||
"form" : [
|
||||
{
|
||||
token : ["keyword", "text", "constant.numeric"],
|
||||
regex : /((?:optionmenu|choice)\s+)(\S+:\s+)([0-9]+)/
|
||||
}, {
|
||||
token : ["keyword", "constant.numeric"],
|
||||
regex : /((?:option|button)\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
|
||||
}, {
|
||||
token : ["keyword", "string"],
|
||||
regex : /((?:option|button)\s+)(.*)/
|
||||
}, {
|
||||
token : ["keyword", "text", "string"],
|
||||
regex : /((?:sentence|text)\s+)(\S+\s*)(.*)/
|
||||
}, {
|
||||
token : ["keyword", "text", "string", "invalid.illegal"],
|
||||
regex : /(word\s+)(\S+\s*)(\S+)?(\s.*)?/
|
||||
}, {
|
||||
token : ["keyword", "text", "constant.language"],
|
||||
regex : /(boolean\s+)(\S+\s*)(0|1|"?(?:yes|no)"?)/
|
||||
}, {
|
||||
token : ["keyword", "text", "constant.numeric"],
|
||||
regex : /((?:real|natural|positive|integer)\s+)(\S+\s*)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b)/
|
||||
}, {
|
||||
token : ["keyword", "string"],
|
||||
regex : /(comment\s+)(.*)/
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex : 'endform',
|
||||
next : "start"
|
||||
}
|
||||
],
|
||||
"for" : [
|
||||
{
|
||||
token : ["keyword", "text", "constant.numeric", "text"],
|
||||
regex : /(from|to)(\s+)([+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?)(\s*)/
|
||||
}, {
|
||||
token : ["keyword", "text"],
|
||||
regex : /(from|to)(\s+\S+\s*)/
|
||||
}, {
|
||||
token : "text",
|
||||
regex : /$/,
|
||||
next : "start"
|
||||
}
|
||||
],
|
||||
"brokenstring" : [
|
||||
{
|
||||
token : ["text", "string"],
|
||||
regex : /(\s*\.{3})([^"]*)/
|
||||
}, {
|
||||
token : "string",
|
||||
regex : /"/,
|
||||
next : "start"
|
||||
}
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(PraatHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.PraatHighlightRules = PraatHighlightRules;
|
||||
});
|
||||
|
|
@ -36,11 +36,13 @@ var TextMode = require("./text").Mode;
|
|||
var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var FoldMode = require("./folding/coffee").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = RubyHighlightRules;
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
this.foldingRules = new FoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ var Mode = function() {
|
|||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.lineCommentStart = "/\\*";
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$id = "ace/mode/rust";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -99,6 +99,65 @@ var ShHighlightRules = function() {
|
|||
}, {
|
||||
defaultToken: "string"
|
||||
}]
|
||||
}, {
|
||||
regex : "<<<",
|
||||
token : "keyword.operator"
|
||||
}, {
|
||||
stateName: "heredoc",
|
||||
regex : "(<<)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
|
||||
onMatch : function(value, currentState, stack) {
|
||||
var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
|
||||
var tokens = value.split(this.splitRegex);
|
||||
stack.push(next, tokens[4]);
|
||||
return [
|
||||
{type:"constant", value: tokens[1]},
|
||||
{type:"text", value: tokens[2]},
|
||||
{type:"string", value: tokens[3]},
|
||||
{type:"support.class", value: tokens[4]},
|
||||
{type:"string", value: tokens[5]}
|
||||
];
|
||||
},
|
||||
rules: {
|
||||
heredoc: [{
|
||||
onMatch: function(value, currentState, stack) {
|
||||
if (value === stack[1]) {
|
||||
stack.shift();
|
||||
stack.shift();
|
||||
this.next = stack[0] || "start";
|
||||
return "support.class";
|
||||
}
|
||||
this.next = "";
|
||||
return "string";
|
||||
},
|
||||
regex: ".*$",
|
||||
next: "start"
|
||||
}],
|
||||
indentedHeredoc: [{
|
||||
token: "string",
|
||||
regex: "^\t+"
|
||||
}, {
|
||||
onMatch: function(value, currentState, stack) {
|
||||
if (value === stack[1]) {
|
||||
stack.shift();
|
||||
stack.shift();
|
||||
this.next = stack[0] || "start";
|
||||
return "support.class";
|
||||
}
|
||||
this.next = "";
|
||||
return "string";
|
||||
},
|
||||
regex: ".*$",
|
||||
next: "start"
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
regex : "$",
|
||||
token : "empty",
|
||||
next : function(currentState, stack) {
|
||||
if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
|
||||
return stack[0];
|
||||
return currentState;
|
||||
}
|
||||
}, {
|
||||
token : "variable.language",
|
||||
regex : builtinVariable
|
||||
|
|
@ -122,7 +181,7 @@ var ShHighlightRules = function() {
|
|||
regex : integer + "\\b"
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScrip
|
|||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var SJSHighlightRules = function() {
|
||||
var parent = new JavaScriptHighlightRules();
|
||||
var parent = new JavaScriptHighlightRules({noES6: true});
|
||||
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
||||
"u[0-9a-fA-F]{4}|" + // unicode
|
||||
"[0-2][0-7]{0,2}|" + // oct
|
||||
|
|
@ -177,10 +177,10 @@ var SJSHighlightRules = function() {
|
|||
// for use within interpreted contexts
|
||||
// without interfering with context nesting
|
||||
var embeddableRules = [];
|
||||
for (var i=0; i<this.$rules.no_regex.length; i++) {
|
||||
for (var i=0; i < this.$rules.no_regex.length; i++) {
|
||||
var rule = this.$rules.no_regex[i];
|
||||
var token = String(rule.token);
|
||||
if(token.indexOf('paren') == -1 && (!rule.next || rule.next.isContextAware)) {
|
||||
if (token.indexOf('paren') == -1 && (!rule.next || rule.next.isContextAware)) {
|
||||
embeddableRules.push(rule);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ oop.inherits(Mode, TextMode);
|
|||
|
||||
(function() {
|
||||
this.$indentWithTabs = true;
|
||||
this.lineCommentStart = "#";
|
||||
this.$id = "ace/mode/snippets";
|
||||
}).call(Mode.prototype);
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ var SqlHighlightRules = function() {
|
|||
|
||||
var keywords = (
|
||||
"select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" +
|
||||
"when|else|end|type|left|right|join|on|outer|desc|asc"
|
||||
"when|else|end|type|left|right|join|on|outer|desc|asc|union"
|
||||
);
|
||||
|
||||
var builtinConstants = (
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ var TextHighlightRules = function() {
|
|||
var state = rules[key];
|
||||
for (var i = 0; i < state.length; i++) {
|
||||
var rule = state[i];
|
||||
if (rule.next) {
|
||||
if (rule.next || rule.onMatch) {
|
||||
if (typeof rule.next != "string") {
|
||||
if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)
|
||||
rule.nextState = prefix + rule.nextState;
|
||||
|
|
@ -68,7 +68,6 @@ var TextHighlightRules = function() {
|
|||
if (rule.next.indexOf(prefix) !== 0)
|
||||
rule.next = prefix + rule.next;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
this.$rules[prefix + key] = state;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ var ValaHighlightRules = function() {
|
|||
[ { token: 'meta.class.vala',
|
||||
regex: '(?=\\w?[\\w\\s]*(?:class|(?:@)?interface|enum|struct|namespace)\\s+\\w+)',
|
||||
push:
|
||||
[ { token: 'punctuation.section.class.end.vala',
|
||||
[ { token: 'paren.vala',
|
||||
regex: '}',
|
||||
next: 'pop' },
|
||||
{ include: '#storage-modifiers' },
|
||||
|
|
@ -166,10 +166,10 @@ var ValaHighlightRules = function() {
|
|||
{ include: '#object-types-inherited' },
|
||||
{ include: '#comments' },
|
||||
{ defaultToken: 'meta.definition.class.implemented.interfaces.vala' } ] },
|
||||
{ token: 'meta.class.body.vala',
|
||||
{ token: 'paren.vala',
|
||||
regex: '{',
|
||||
push:
|
||||
[ { token: 'meta.class.body.vala', regex: '(?=})', next: 'pop' },
|
||||
[ { token: 'paren.vala', regex: '(?=})', next: 'pop' },
|
||||
{ include: '#class-body' },
|
||||
{ defaultToken: 'meta.class.body.vala' } ] },
|
||||
{ defaultToken: 'meta.class.vala' } ],
|
||||
|
|
@ -266,7 +266,7 @@ var ValaHighlightRules = function() {
|
|||
[ { token: 'meta.method.vala',
|
||||
regex: '(?!new)(?=\\w.*\\s+)(?=[^=]+\\()',
|
||||
push:
|
||||
[ { token: 'meta.method.vala', regex: '}|(?=;)', next: 'pop' },
|
||||
[ { token: 'paren.vala', regex: '}|(?=;)', next: 'pop' },
|
||||
{ include: '#storage-modifiers' },
|
||||
{ token: [ 'entity.name.function.vala', 'meta.method.identifier.vala' ],
|
||||
regex: '([\\~\\w\\.]+)(\\s*\\()',
|
||||
|
|
@ -285,10 +285,10 @@ var ValaHighlightRules = function() {
|
|||
{ include: '#all-types' },
|
||||
{ defaultToken: 'meta.method.return-type.vala' } ] },
|
||||
{ include: '#throws' },
|
||||
{ token: 'meta.method.body.vala',
|
||||
{ token: 'paren.vala',
|
||||
regex: '{',
|
||||
push:
|
||||
[ { token: 'meta.method.body.vala', regex: '(?=})', next: 'pop' },
|
||||
[ { token: 'paren.vala', regex: '(?=})', next: 'pop' },
|
||||
{ include: '#code' },
|
||||
{ defaultToken: 'meta.method.body.vala' } ] },
|
||||
{ defaultToken: 'meta.method.vala' } ] } ],
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -71,21 +71,20 @@ function DefaultHandlers(mouseHandler) {
|
|||
var selectionRange = editor.getSelectionRange();
|
||||
var selectionEmpty = selectionRange.isEmpty();
|
||||
|
||||
if (selectionEmpty) {
|
||||
if (selectionEmpty)
|
||||
editor.selection.moveToPosition(pos);
|
||||
}
|
||||
|
||||
// 2: contextmenu, 1: linux paste
|
||||
editor.textInput.onContextMenu(ev.domEvent);
|
||||
return; // stopping event here breaks contextmenu on ff mac
|
||||
}
|
||||
|
||||
this.mousedownEvent.time = Date.now();
|
||||
// if this click caused the editor to be focused should not clear the
|
||||
// selection
|
||||
if (inSelection && !editor.isFocused()) {
|
||||
editor.focus();
|
||||
if (this.$focusTimout && !this.$clickSelection && !editor.inMultiSelectMode) {
|
||||
this.mousedownEvent.time = Date.now();
|
||||
this.setState("focusWait");
|
||||
this.captureMouse(ev);
|
||||
return;
|
||||
|
|
@ -93,31 +92,21 @@ function DefaultHandlers(mouseHandler) {
|
|||
}
|
||||
|
||||
this.captureMouse(ev);
|
||||
if (!inSelection || this.$clickSelection || ev.getShiftKey() || editor.inMultiSelectMode) {
|
||||
// Directly pick STATE_SELECT, since the user is not clicking inside
|
||||
// a selection.
|
||||
this.startSelect(pos);
|
||||
} else if (inSelection) {
|
||||
this.mousedownEvent.time = Date.now();
|
||||
this.startSelect(pos);
|
||||
}
|
||||
this.startSelect(pos, ev.domEvent._clicks > 1);
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
this.startSelect = function(pos) {
|
||||
this.startSelect = function(pos, waitForClickSelection) {
|
||||
pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
|
||||
var editor = this.editor;
|
||||
// allow double/triple click handlers to change selection
|
||||
var shiftPressed = this.mousedownEvent.getShiftKey();
|
||||
setTimeout(function(){
|
||||
if (shiftPressed) {
|
||||
editor.selection.selectToPosition(pos);
|
||||
}
|
||||
else if (!this.$clickSelection) {
|
||||
editor.selection.moveToPosition(pos);
|
||||
}
|
||||
|
||||
if (this.mousedownEvent.getShiftKey())
|
||||
editor.selection.selectToPosition(pos);
|
||||
else if (!waitForClickSelection)
|
||||
editor.selection.moveToPosition(pos);
|
||||
if (!waitForClickSelection)
|
||||
this.select();
|
||||
}.bind(this), 0);
|
||||
if (editor.renderer.scroller.setCapture) {
|
||||
editor.renderer.scroller.setCapture();
|
||||
}
|
||||
|
|
@ -216,6 +205,7 @@ function DefaultHandlers(mouseHandler) {
|
|||
this.setState("selectByWords");
|
||||
}
|
||||
this.$clickSelection = range;
|
||||
this.select();
|
||||
};
|
||||
|
||||
this.onTripleClick = function(ev) {
|
||||
|
|
@ -230,6 +220,7 @@ function DefaultHandlers(mouseHandler) {
|
|||
} else {
|
||||
this.$clickSelection = editor.selection.getLineRange(pos.row);
|
||||
}
|
||||
this.select();
|
||||
};
|
||||
|
||||
this.onQuadClick = function(ev) {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ function DragdropHandler(mouseHandler) {
|
|||
if (useragent.isOpera) {
|
||||
editor.container.appendChild(blankImage);
|
||||
// force layout
|
||||
blankImage._top = blankImage.offsetTop;
|
||||
blankImage.scrollTop = 0;
|
||||
}
|
||||
dataTransfer.setDragImage && dataTransfer.setDragImage(blankImage, 0, 0);
|
||||
if (useragent.isOpera) {
|
||||
|
|
@ -110,11 +110,14 @@ function DragdropHandler(mouseHandler) {
|
|||
editor.renderer.$cursorLayer.setBlinking(true);
|
||||
}
|
||||
this.editor.unsetStyle("ace_dragging");
|
||||
this.editor.renderer.setCursorStyle("");
|
||||
};
|
||||
|
||||
this.onDragEnter = function(e) {
|
||||
if (editor.getReadOnly() || !canAccept(e.dataTransfer))
|
||||
return;
|
||||
x = e.clientX;
|
||||
y = e.clientY;
|
||||
if (!dragSelectionMarker)
|
||||
addDragMarker();
|
||||
counter++;
|
||||
|
|
@ -126,6 +129,8 @@ function DragdropHandler(mouseHandler) {
|
|||
this.onDragOver = function(e) {
|
||||
if (editor.getReadOnly() || !canAccept(e.dataTransfer))
|
||||
return;
|
||||
x = e.clientX;
|
||||
y = e.clientY;
|
||||
// Opera doesn't trigger dragenter event on drag start
|
||||
if (!dragSelectionMarker) {
|
||||
addDragMarker();
|
||||
|
|
@ -133,8 +138,6 @@ function DragdropHandler(mouseHandler) {
|
|||
}
|
||||
if (onMouseMoveTimer !== null)
|
||||
onMouseMoveTimer = null;
|
||||
x = e.clientX;
|
||||
y = e.clientY;
|
||||
|
||||
e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);
|
||||
return event.preventDefault(e);
|
||||
|
|
@ -150,7 +153,7 @@ function DragdropHandler(mouseHandler) {
|
|||
};
|
||||
|
||||
this.onDrop = function(e) {
|
||||
if (!dragSelectionMarker)
|
||||
if (!dragCursor)
|
||||
return;
|
||||
var dataTransfer = e.dataTransfer;
|
||||
if (isInternal) {
|
||||
|
|
@ -264,6 +267,7 @@ function DragdropHandler(mouseHandler) {
|
|||
if (editor.isFocused())
|
||||
editor.renderer.$cursorLayer.setBlinking(false);
|
||||
clearInterval(timerId);
|
||||
onDragInterval();
|
||||
timerId = setInterval(onDragInterval, 20);
|
||||
counter = 0;
|
||||
event.addListener(document, "mousemove", onMouseMove);
|
||||
|
|
@ -279,6 +283,7 @@ function DragdropHandler(mouseHandler) {
|
|||
if (editor.isFocused() && !isInternal)
|
||||
editor.renderer.$cursorLayer.setBlinking(!editor.getReadOnly());
|
||||
range = null;
|
||||
dragCursor = null;
|
||||
counter = 0;
|
||||
autoScrollStartTime = null;
|
||||
cursorMovedTime = null;
|
||||
|
|
@ -345,15 +350,19 @@ function DragdropHandler(mouseHandler) {
|
|||
this.dragReadyEnd = function(e) {
|
||||
this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());
|
||||
this.editor.unsetStyle("ace_dragging");
|
||||
this.editor.renderer.setCursorStyle("");
|
||||
this.dragWaitEnd();
|
||||
};
|
||||
|
||||
this.startDrag = function(){
|
||||
this.cancelDrag = false;
|
||||
var target = this.editor.container;
|
||||
var editor = this.editor;
|
||||
var target = editor.container;
|
||||
target.draggable = true;
|
||||
this.editor.renderer.$cursorLayer.setBlinking(false);
|
||||
this.editor.setStyle("ace_dragging");
|
||||
editor.renderer.$cursorLayer.setBlinking(false);
|
||||
editor.setStyle("ace_dragging");
|
||||
var cursorStyle = useragent.isWin ? "default" : "move";
|
||||
editor.renderer.setCursorStyle(cursorStyle);
|
||||
this.setState("dragReady");
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ var MouseHandler = function(editor) {
|
|||
|
||||
var focusEditor = function(e) {
|
||||
if (!editor.isFocused() && editor.textInput)
|
||||
editor.textInput.onContextMenu(e);
|
||||
editor.textInput.moveToMouse(e);
|
||||
editor.focus()
|
||||
};
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue