parent
20cd631f0a
commit
b204cd7236
1 changed files with 25 additions and 9 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010, Ajax.org B.V.
|
* Copyright (c) 2010, Ajax.org B.V.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* * Neither the name of Ajax.org B.V. nor the
|
* * Neither the name of Ajax.org B.V. nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* 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
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
|
@ -41,8 +41,11 @@ var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
var unicode = require("../unicode");
|
var unicode = require("../unicode");
|
||||||
|
var HtmlMode = require("./html").Mode;
|
||||||
|
var JavaScriptMode = require("./javascript").Mode;
|
||||||
|
var CssMode = require("./css").Mode;
|
||||||
|
|
||||||
var Mode = function(opts) {
|
var PhpMode = function(opts) {
|
||||||
this.inlinePhp = opts && opts.inline;
|
this.inlinePhp = opts && opts.inline;
|
||||||
var HighlightRules = this.inlinePhp ? PhpLangHighlightRules : PhpHighlightRules;
|
var HighlightRules = this.inlinePhp ? PhpLangHighlightRules : PhpHighlightRules;
|
||||||
this.HighlightRules = HighlightRules;
|
this.HighlightRules = HighlightRules;
|
||||||
|
|
@ -50,7 +53,18 @@ var Mode = function(opts) {
|
||||||
this.$behaviour = new CstyleBehaviour();
|
this.$behaviour = new CstyleBehaviour();
|
||||||
this.foldingRules = new CStyleFoldMode();
|
this.foldingRules = new CStyleFoldMode();
|
||||||
};
|
};
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(PhpMode, TextMode);
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
HtmlMode.call(this);
|
||||||
|
this.HighlightRules = PhpHighlightRules;
|
||||||
|
this.createModeDelegates({
|
||||||
|
"js-": JavaScriptMode,
|
||||||
|
"css-": CssMode,
|
||||||
|
"php-": PhpMode
|
||||||
|
});
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, HtmlMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
@ -60,7 +74,7 @@ oop.inherits(Mode, TextMode);
|
||||||
+ unicode.packages.Nd
|
+ unicode.packages.Nd
|
||||||
+ unicode.packages.Pc + "\_]+", "g"
|
+ unicode.packages.Pc + "\_]+", "g"
|
||||||
);
|
);
|
||||||
|
|
||||||
this.nonTokenRe = new RegExp("^(?:[^"
|
this.nonTokenRe = new RegExp("^(?:[^"
|
||||||
+ unicode.packages.L
|
+ unicode.packages.L
|
||||||
+ unicode.packages.Mn + unicode.packages.Mc
|
+ unicode.packages.Mn + unicode.packages.Mc
|
||||||
|
|
@ -68,7 +82,7 @@ oop.inherits(Mode, TextMode);
|
||||||
+ unicode.packages.Pc + "\_]|\s])+", "g"
|
+ unicode.packages.Pc + "\_]|\s])+", "g"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
this.lineCommentStart = ["//", "#"];
|
this.lineCommentStart = ["//", "#"];
|
||||||
this.blockComment = {start: "/*", end: "*/"};
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
|
||||||
|
|
@ -106,17 +120,19 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.checkOutdent = function(state, line, input) {
|
this.checkOutdent = function(state, line, input) {
|
||||||
return this.$outdent.checkOutdent(line, input);
|
if (this.$outdent)
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
this.$outdent.autoOutdent(doc, row);
|
if (this.$outdent)
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker");
|
var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker");
|
||||||
worker.attachToDocument(session.getDocument());
|
worker.attachToDocument(session.getDocument());
|
||||||
|
|
||||||
if (this.inlinePhp)
|
if (this.inlinePhp)
|
||||||
worker.call("setOptions", [{inline: true}]);
|
worker.call("setOptions", [{inline: true}]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue