diff --git a/lib/ace/mode/php.js b/lib/ace/mode/php.js
index 6312840d..f774aa13 100644
--- a/lib/ace/mode/php.js
+++ b/lib/ace/mode/php.js
@@ -38,6 +38,7 @@ var PhpHighlightRules = require("./php_highlight_rules").PhpHighlightRules;
var PhpLangHighlightRules = require("./php_highlight_rules").PhpLangHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Range = require("../range").Range;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var unicode = require("../unicode");
@@ -137,6 +138,21 @@ oop.inherits(Mode, TextMode);
this.$outdent.autoOutdent(doc, row);
};
+ this.createWorker = function(session) {
+ var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker");
+ worker.attachToDocument(session.getDocument());
+
+ worker.on("error", function(e) {
+ session.setAnnotations(e.data);
+ });
+
+ worker.on("ok", function() {
+ session.clearAnnotations();
+ });
+
+ return worker;
+ };
+
}).call(Mode.prototype);
exports.Mode = Mode;
diff --git a/lib/ace/mode/php/php.js b/lib/ace/mode/php/php.js
new file mode 100644
index 00000000..19459a54
--- /dev/null
+++ b/lib/ace/mode/php/php.js
@@ -0,0 +1,4839 @@
+/*
+ php.js 0.1.0
+ Copyright (c) 2013 Niklas von Hertzen
+
+ Released under MIT License
+
+ This file contains:
+ - [var PHP = {Constants:{}};]
+ - src/modules/tokenizer/constants.js
+ - src/parser/lexer.js
+ - src/parser/parser.js
+ - src/parser/yyn.js
+ - src/parser/yyn_stmt.js
+ - src/parser/yyn_expr.js
+ - src/parser/yyn_scalar.js
+*/
+
+
+
+define(function(require, exports, module) {
+
+var PHP = {Constants:{}};
+
+
+
+
+
+
+PHP.Constants.T_INCLUDE = 262;
+PHP.Constants.T_INCLUDE_ONCE = 261;
+PHP.Constants.T_EVAL = 260;
+PHP.Constants.T_REQUIRE = 259;
+PHP.Constants.T_REQUIRE_ONCE = 258;
+PHP.Constants.T_LOGICAL_OR = 263;
+PHP.Constants.T_LOGICAL_XOR = 264;
+PHP.Constants.T_LOGICAL_AND = 265;
+PHP.Constants.T_PRINT = 266;
+PHP.Constants.T_PLUS_EQUAL = 277;
+PHP.Constants.T_MINUS_EQUAL = 276;
+PHP.Constants.T_MUL_EQUAL = 275;
+PHP.Constants.T_DIV_EQUAL = 274;
+PHP.Constants.T_CONCAT_EQUAL = 273;
+PHP.Constants.T_MOD_EQUAL = 272;
+PHP.Constants.T_AND_EQUAL = 271;
+PHP.Constants.T_OR_EQUAL = 270;
+PHP.Constants.T_XOR_EQUAL = 269;
+PHP.Constants.T_SL_EQUAL = 268;
+PHP.Constants.T_SR_EQUAL = 267;
+PHP.Constants.T_BOOLEAN_OR = 278;
+PHP.Constants.T_BOOLEAN_AND = 279;
+PHP.Constants.T_IS_EQUAL = 283;
+PHP.Constants.T_IS_NOT_EQUAL = 282;
+PHP.Constants.T_IS_IDENTICAL = 281;
+PHP.Constants.T_IS_NOT_IDENTICAL = 280;
+PHP.Constants.T_IS_SMALLER_OR_EQUAL = 285;
+PHP.Constants.T_IS_GREATER_OR_EQUAL = 284;
+PHP.Constants.T_SL = 287;
+PHP.Constants.T_SR = 286;
+PHP.Constants.T_INSTANCEOF = 288;
+PHP.Constants.T_INC = 297;
+PHP.Constants.T_DEC = 296;
+PHP.Constants.T_INT_CAST = 295;
+PHP.Constants.T_DOUBLE_CAST = 294;
+PHP.Constants.T_STRING_CAST = 293;
+PHP.Constants.T_ARRAY_CAST = 292;
+PHP.Constants.T_OBJECT_CAST = 291;
+PHP.Constants.T_BOOL_CAST = 290;
+PHP.Constants.T_UNSET_CAST = 289;
+PHP.Constants.T_NEW = 299;
+PHP.Constants.T_CLONE = 298;
+PHP.Constants.T_EXIT = 300;
+PHP.Constants.T_IF = 301;
+PHP.Constants.T_ELSEIF = 302;
+PHP.Constants.T_ELSE = 303;
+PHP.Constants.T_ENDIF = 304;
+PHP.Constants.T_LNUMBER = 305;
+PHP.Constants.T_DNUMBER = 306;
+PHP.Constants.T_STRING = 307;
+PHP.Constants.T_STRING_VARNAME = 308;
+PHP.Constants.T_VARIABLE = 309;
+PHP.Constants.T_NUM_STRING = 310;
+PHP.Constants.T_INLINE_HTML = 311;
+PHP.Constants.T_CHARACTER = 312;
+PHP.Constants.T_BAD_CHARACTER = 313;
+PHP.Constants.T_ENCAPSED_AND_WHITESPACE = 314;
+PHP.Constants.T_CONSTANT_ENCAPSED_STRING = 315;
+PHP.Constants.T_ECHO = 316;
+PHP.Constants.T_DO = 317;
+PHP.Constants.T_WHILE = 318;
+PHP.Constants.T_ENDWHILE = 319;
+PHP.Constants.T_FOR = 320;
+PHP.Constants.T_ENDFOR = 321;
+PHP.Constants.T_FOREACH = 322;
+PHP.Constants.T_ENDFOREACH = 323;
+PHP.Constants.T_DECLARE = 324;
+PHP.Constants.T_ENDDECLARE = 325;
+PHP.Constants.T_AS = 326;
+PHP.Constants.T_SWITCH = 327;
+PHP.Constants.T_ENDSWITCH = 328;
+PHP.Constants.T_CASE = 329;
+PHP.Constants.T_DEFAULT = 330;
+PHP.Constants.T_BREAK = 331;
+PHP.Constants.T_CONTINUE = 332;
+PHP.Constants.T_GOTO = 333;
+PHP.Constants.T_FUNCTION = 334;
+PHP.Constants.T_CONST = 335;
+PHP.Constants.T_RETURN = 336;
+PHP.Constants.T_TRY = 337;
+PHP.Constants.T_CATCH = 338;
+PHP.Constants.T_THROW = 339;
+PHP.Constants.T_USE = 340;
+//PHP.Constants.T_INSTEADOF = ;
+PHP.Constants.T_GLOBAL = 341;
+PHP.Constants.T_STATIC = 347;
+PHP.Constants.T_ABSTRACT = 346;
+PHP.Constants.T_FINAL = 345;
+PHP.Constants.T_PRIVATE = 344;
+PHP.Constants.T_PROTECTED = 343;
+PHP.Constants.T_PUBLIC = 342;
+PHP.Constants.T_VAR = 348;
+PHP.Constants.T_UNSET = 349;
+PHP.Constants.T_ISSET = 350;
+PHP.Constants.T_EMPTY = 351;
+PHP.Constants.T_HALT_COMPILER = 352;
+PHP.Constants.T_CLASS = 353;
+//PHP.Constants.T_TRAIT = ;
+PHP.Constants.T_INTERFACE = 354;
+PHP.Constants.T_EXTENDS = 355;
+PHP.Constants.T_IMPLEMENTS = 356;
+PHP.Constants.T_OBJECT_OPERATOR = 357;
+PHP.Constants.T_DOUBLE_ARROW = 358;
+PHP.Constants.T_LIST = 359;
+PHP.Constants.T_ARRAY = 360;
+//PHP.Constants.T_CALLABLE = ;
+PHP.Constants.T_CLASS_C = 361;
+PHP.Constants.T_TRAIT_C = 381;
+PHP.Constants.T_METHOD_C = 362;
+PHP.Constants.T_FUNC_C = 363;
+PHP.Constants.T_LINE = 364;
+PHP.Constants.T_FILE = 365;
+PHP.Constants.T_COMMENT = 366;
+PHP.Constants.T_DOC_COMMENT = 367;
+PHP.Constants.T_OPEN_TAG = 368;
+PHP.Constants.T_OPEN_TAG_WITH_ECHO = 369;
+PHP.Constants.T_CLOSE_TAG = 370;
+PHP.Constants.T_WHITESPACE = 371;
+PHP.Constants.T_START_HEREDOC = 372;
+PHP.Constants.T_END_HEREDOC = 373;
+PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES = 374;
+PHP.Constants.T_CURLY_OPEN = 375;
+PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM = 376;
+PHP.Constants.T_DOUBLE_COLON = 376;
+PHP.Constants.T_NAMESPACE = 377;
+PHP.Constants.T_NS_C = 378;
+PHP.Constants.T_DIR = 379;
+PHP.Constants.T_NS_SEPARATOR = 380;
+PHP.Lexer = function( src, ini ) {
+
+
+ var heredoc,
+ lineBreaker = function( result ) {
+ if (result.match(/\n/) !== null) {
+ var quote = result.substring(0, 1);
+ result = '[' + result.split(/\n/).join( quote + "," + quote ) + '].join("\\n")';
+
+ }
+
+ return result;
+ },
+ prev,
+
+ openTag = (ini === undefined || (/^(on|true|1)$/i.test(ini.short_open_tag) ) ? /(\<\?php\s|\<\?|\<\%|\