Merge /Users/wcandillon/Dropbox/ace
Conflicts: build/demo/kitchen-sink/mode-xquery-uncompressed.js
This commit is contained in:
commit
dce9577ca4
17 changed files with 145860 additions and 8 deletions
|
|
@ -231,7 +231,7 @@ function buildAce(aceProject, options) {
|
||||||
"tomorrow_night_blue", "tomorrow_night_bright", "tomorrow_night_eighties",
|
"tomorrow_night_blue", "tomorrow_night_bright", "tomorrow_night_eighties",
|
||||||
"twilight", "vibrant_ink"
|
"twilight", "vibrant_ink"
|
||||||
],
|
],
|
||||||
workers: ["javascript", "coffee", "css", "json"],
|
workers: ["javascript", "coffee", "css", "json", "xquery"],
|
||||||
keybindings: ["vim", "emacs"]
|
keybindings: ["vim", "emacs"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,16 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
|
define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
=======
|
||||||
|
define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
|
>>>>>>> 667fb57f7a6cc03a0e0dc709cc3545e4565ebeb7
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var TextMode = require("./text").Mode;
|
var TextMode = require("./text").Mode;
|
||||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
|
|
@ -96,10 +103,198 @@ oop.inherits(Mode, TextMode);
|
||||||
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "worker-xquery.js", "ace/mode/xquery_worker", "XQueryWorker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("error", function(e) {
|
||||||
|
session.setAnnotations([e.data]);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("ok", function(e) {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
|
>>>>>>> 667fb57f7a6cc03a0e0dc709cc3545e4565ebeb7
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
});
|
});
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define('ace/worker/worker_client', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/config'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||||
|
var config = require("../config");
|
||||||
|
|
||||||
|
var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
|
||||||
|
|
||||||
|
this.changeListener = this.changeListener.bind(this);
|
||||||
|
|
||||||
|
if (config.get("packaged")) {
|
||||||
|
this.$worker = new Worker(config.get("workerPath") + "/" + packagedJs);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
|
||||||
|
this.$worker = new Worker(workerUrl);
|
||||||
|
|
||||||
|
var tlns = {};
|
||||||
|
for (var i=0; i<topLevelNamespaces.length; i++) {
|
||||||
|
var ns = topLevelNamespaces[i];
|
||||||
|
var path = this.$normalizePath(require.nameToUrl(ns, null, "_").replace(/.js$/, ""));
|
||||||
|
|
||||||
|
tlns[ns] = path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$worker.postMessage({
|
||||||
|
init : true,
|
||||||
|
tlns: tlns,
|
||||||
|
module: mod,
|
||||||
|
classname: classname
|
||||||
|
});
|
||||||
|
|
||||||
|
this.callbackId = 1;
|
||||||
|
this.callbacks = {};
|
||||||
|
|
||||||
|
var _self = this;
|
||||||
|
this.$worker.onerror = function(e) {
|
||||||
|
window.console && console.log && console.log(e);
|
||||||
|
throw e;
|
||||||
|
};
|
||||||
|
this.$worker.onmessage = function(e) {
|
||||||
|
var msg = e.data;
|
||||||
|
switch(msg.type) {
|
||||||
|
case "log":
|
||||||
|
window.console && console.log && console.log(msg.data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "event":
|
||||||
|
_self._emit(msg.name, {data: msg.data});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "call":
|
||||||
|
var callback = _self.callbacks[msg.id];
|
||||||
|
if (callback) {
|
||||||
|
callback(msg.data);
|
||||||
|
delete _self.callbacks[msg.id];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
|
this.$normalizePath = function(path) {
|
||||||
|
path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it
|
||||||
|
path = location.protocol + "//" + location.host
|
||||||
|
// paths starting with a slash are relative to the root (host)
|
||||||
|
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
|
||||||
|
+ "/" + path.replace(/^[\/]+/, "");
|
||||||
|
return path;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.terminate = function() {
|
||||||
|
this._emit("terminate", {});
|
||||||
|
this.$worker.terminate();
|
||||||
|
this.$worker = null;
|
||||||
|
this.$doc.removeEventListener("change", this.changeListener);
|
||||||
|
this.$doc = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.send = function(cmd, args) {
|
||||||
|
this.$worker.postMessage({command: cmd, args: args});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.call = function(cmd, args, callback) {
|
||||||
|
if (callback) {
|
||||||
|
var id = this.callbackId++;
|
||||||
|
this.callbacks[id] = callback;
|
||||||
|
args.push(id);
|
||||||
|
}
|
||||||
|
this.send(cmd, args);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.emit = function(event, data) {
|
||||||
|
try {
|
||||||
|
// firefox refuses to clone objects which have function properties
|
||||||
|
// TODO: cleanup event
|
||||||
|
this.$worker.postMessage({event: event, data: {data: data.data}});
|
||||||
|
}
|
||||||
|
catch(ex) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.attachToDocument = function(doc) {
|
||||||
|
if(this.$doc)
|
||||||
|
this.terminate();
|
||||||
|
|
||||||
|
this.$doc = doc;
|
||||||
|
this.call("setValue", [doc.getValue()]);
|
||||||
|
doc.on("change", this.changeListener);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.changeListener = function(e) {
|
||||||
|
e.range = {
|
||||||
|
start: e.data.range.start,
|
||||||
|
end: e.data.range.end
|
||||||
|
};
|
||||||
|
this.emit("change", e);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(WorkerClient.prototype);
|
||||||
|
|
||||||
|
exports.WorkerClient = WorkerClient;
|
||||||
|
|
||||||
|
});
|
||||||
|
>>>>>>> 667fb57f7a6cc03a0e0dc709cc3545e4565ebeb7
|
||||||
/*
|
/*
|
||||||
* eXide - web-based XQuery IDE
|
* eXide - web-based XQuery IDE
|
||||||
*
|
*
|
||||||
|
|
|
||||||
48847
build/demo/kitchen-sink/worker-xquery.js
Normal file
48847
build/demo/kitchen-sink/worker-xquery.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -10,9 +10,8 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Ace
|
Ace
|
||||||
version 0.2.0
|
version
|
||||||
commit 517e88f2f077263e49159c7b1742b5f3a7c605b4
|
commit
|
||||||
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -16,9 +16,10 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
ace.define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
|
ace.define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var TextMode = require("./text").Mode;
|
var TextMode = require("./text").Mode;
|
||||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
|
|
@ -96,6 +97,22 @@ oop.inherits(Mode, TextMode);
|
||||||
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "worker-xquery.js", "ace/mode/xquery_worker", "XQueryWorker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("error", function(e) {
|
||||||
|
session.setAnnotations([e.data]);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("ok", function(e) {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
|
define('ace/mode/xquery', ['require', 'exports', 'module' , 'ace/worker/worker_client', 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xquery_highlight_rules', 'ace/mode/behaviour/xquery', 'ace/range'], function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var TextMode = require("./text").Mode;
|
var TextMode = require("./text").Mode;
|
||||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
|
|
@ -96,6 +97,22 @@ oop.inherits(Mode, TextMode);
|
||||||
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "worker-xquery.js", "ace/mode/xquery_worker", "XQueryWorker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("error", function(e) {
|
||||||
|
session.setAnnotations([e.data]);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("ok", function(e) {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
48847
build/src/worker-xquery.js
Normal file
48847
build/src/worker-xquery.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -19,6 +19,7 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var TextMode = require("./text").Mode;
|
var TextMode = require("./text").Mode;
|
||||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
|
|
@ -96,6 +97,22 @@ oop.inherits(Mode, TextMode);
|
||||||
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
var worker = new WorkerClient(["ace"], "worker-xquery.js", "ace/mode/xquery_worker", "XQueryWorker");
|
||||||
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
|
worker.on("error", function(e) {
|
||||||
|
session.setAnnotations([e.data]);
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.on("ok", function(e) {
|
||||||
|
session.clearAnnotations();
|
||||||
|
});
|
||||||
|
|
||||||
|
return worker;
|
||||||
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
1652
lib/ace/mode/xquery/StringLexer.js
Normal file
1652
lib/ace/mode/xquery/StringLexer.js
Normal file
File diff suppressed because it is too large
Load diff
28
lib/ace/mode/xquery/XQDTLexer.js
Normal file
28
lib/ace/mode/xquery/XQDTLexer.js
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
define(function(require, exports, module){
|
||||||
|
|
||||||
|
var org = require("./antlr3-all").org;
|
||||||
|
|
||||||
|
var XQDTLexer = exports.XQDTLexer = function(input, state)
|
||||||
|
{
|
||||||
|
XQDTLexer.superclass.constructor.call(this, input, state);
|
||||||
|
};
|
||||||
|
|
||||||
|
org.antlr.lang.extend(XQDTLexer, org.antlr.runtime.Lexer, {
|
||||||
|
|
||||||
|
isWsExplicit: false,
|
||||||
|
|
||||||
|
setIsWsExplicit: function (wsExplicit) {
|
||||||
|
isWsExplicit = wsExplicit;
|
||||||
|
},
|
||||||
|
|
||||||
|
addToStack: function (stack) {
|
||||||
|
stack.push(this);
|
||||||
|
},
|
||||||
|
|
||||||
|
rewindToIndex: function(index) {
|
||||||
|
var stream = this.input;
|
||||||
|
stream.seek(index);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
9236
lib/ace/mode/xquery/XQueryLexer.js
Normal file
9236
lib/ace/mode/xquery/XQueryLexer.js
Normal file
File diff suppressed because it is too large
Load diff
30883
lib/ace/mode/xquery/XQueryParser.js
Normal file
30883
lib/ace/mode/xquery/XQueryParser.js
Normal file
File diff suppressed because one or more lines are too long
5963
lib/ace/mode/xquery/antlr3-all.js
Normal file
5963
lib/ace/mode/xquery/antlr3-all.js
Normal file
File diff suppressed because it is too large
Load diff
51
lib/ace/mode/xquery/xquery.js
Normal file
51
lib/ace/mode/xquery/xquery.js
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* William Candillon <wcandillon AT gmail DOT com>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
|
||||||
|
var org = require("./antlr3-all").org;
|
||||||
|
var XQueryLexer = require("./XQueryLexer").XQueryLexer;
|
||||||
|
var XQueryParser = require("./XQueryParser").XQueryParser;
|
||||||
|
|
||||||
|
exports.parse = function(code) {
|
||||||
|
var cstream = new org.antlr.runtime.ANTLRStringStream(code);
|
||||||
|
var lexer = new XQueryLexer(cstream);
|
||||||
|
var tstream = new org.antlr.runtime.CommonTokenStream(lexer);
|
||||||
|
var parser = new XQueryParser(tstream);
|
||||||
|
parser.p_Module();
|
||||||
|
};
|
||||||
|
});
|
||||||
100
lib/ace/mode/xquery_worker.js
Normal file
100
lib/ace/mode/xquery_worker.js
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* William Candillon <wcandillon AT gmail DOT com>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var Mirror = require("../worker/mirror").Mirror;
|
||||||
|
var xquery = require("../mode/xquery/xquery");
|
||||||
|
|
||||||
|
window.addEventListener = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
var XQueryWorker = exports.XQueryWorker = function(sender) {
|
||||||
|
Mirror.call(this, sender);
|
||||||
|
this.setTimeout(200);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(XQueryWorker, Mirror);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.onUpdate = function() {
|
||||||
|
var value = this.doc.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
xquery.parse(value);
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
|
var m = e.match(/line (\d+):\-?(\d+) (.*)/);
|
||||||
|
|
||||||
|
if (m) {
|
||||||
|
var line = parseInt(m[1]) - 1;
|
||||||
|
line = line <= 0 ? 0 : line;
|
||||||
|
var col = parseInt(m[2]);
|
||||||
|
console.log("Row: " + line);
|
||||||
|
console.log("Col: " + col);
|
||||||
|
this.sender.emit("error", {
|
||||||
|
row: line,
|
||||||
|
column: col,
|
||||||
|
text: m[3],
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (e instanceof SyntaxError) {
|
||||||
|
var m = e.message.match(/ on line (\d+)/);
|
||||||
|
if (m) {
|
||||||
|
this.sender.emit("error", {
|
||||||
|
row: parseInt(m[1]) - 1,
|
||||||
|
column: null,
|
||||||
|
text: e.message.replace(m[0], ""),
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.sender.emit("ok");
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(XQueryWorker.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue