codemirror-rails 3.23 → 3.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codemirror/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/codemirror.js +51 -10
  4. data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +1 -1
  5. data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +13 -3
  6. data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +14 -9
  7. data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +8 -2
  8. data/vendor/assets/javascripts/codemirror/addons/search/search.js +14 -14
  9. data/vendor/assets/javascripts/codemirror/modes/clike.js +4 -3
  10. data/vendor/assets/javascripts/codemirror/modes/css.js +3 -3
  11. data/vendor/assets/javascripts/codemirror/modes/django.js +55 -0
  12. data/vendor/assets/javascripts/codemirror/modes/erlang.js +1 -1
  13. data/vendor/assets/javascripts/codemirror/modes/go.js +1 -0
  14. data/vendor/assets/javascripts/codemirror/modes/haxe.js +7 -3
  15. data/vendor/assets/javascripts/codemirror/modes/javascript.js +13 -7
  16. data/vendor/assets/javascripts/codemirror/modes/jinja2.js +111 -35
  17. data/vendor/assets/javascripts/codemirror/modes/livescript.js +4 -4
  18. data/vendor/assets/javascripts/codemirror/modes/php.js +99 -9
  19. data/vendor/assets/javascripts/codemirror/modes/r.js +3 -1
  20. data/vendor/assets/javascripts/codemirror/modes/verilog.js +237 -80
  21. data/vendor/assets/javascripts/codemirror/modes/xml.js +4 -1
  22. data/vendor/assets/stylesheets/codemirror.css +4 -3
  23. data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +0 -1
  24. data/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css +0 -4
  25. data/vendor/assets/stylesheets/codemirror/themes/mdn-like.css +1 -1
  26. data/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css +0 -1
  27. data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +0 -2
  28. data/vendor/assets/stylesheets/codemirror/themes/solarized.css +0 -1
  29. metadata +19 -18
@@ -348,7 +348,7 @@ CodeMirror.defineMode("erlang", function(cmCfg) {
348
348
  switch (type) {
349
349
  case "atom": return "atom";
350
350
  case "attribute": return "attribute";
351
- case "boolean": return "special";
351
+ case "boolean": return "atom";
352
352
  case "builtin": return "builtin";
353
353
  case "close_paren": return null;
354
354
  case "colon": return null;
@@ -159,6 +159,7 @@ CodeMirror.defineMode("go", function(config) {
159
159
  },
160
160
 
161
161
  electricChars: "{}):",
162
+ fold: "brace",
162
163
  blockCommentStart: "/*",
163
164
  blockCommentEnd: "*/",
164
165
  lineComment: "//"
@@ -16,7 +16,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
16
16
  "function": kw("function"), "catch": kw("catch"), "untyped": kw("untyped"), "callback": kw("cb"),
17
17
  "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
18
18
  "in": operator, "never": kw("property_access"), "trace":kw("trace"),
19
- "class": type, "enum":type, "interface":type, "typedef":type, "extends":type, "implements":type, "dynamic":type,
19
+ "class": type, "abstract":type, "enum":type, "interface":type, "typedef":type, "extends":type, "implements":type, "dynamic":type,
20
20
  "true": atom, "false": atom, "null": atom
21
21
  };
22
22
  }();
@@ -305,12 +305,13 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
305
305
 
306
306
  function importdef (type, value) {
307
307
  if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
308
- else if(type == "variable" || type == "property" || type == ".") return cont(importdef);
308
+ else if(type == "variable" || type == "property" || type == "." || value == "*") return cont(importdef);
309
309
  }
310
310
 
311
311
  function typedef (type, value)
312
312
  {
313
313
  if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
314
+ else if (type == "type" && /[A-Z]/.test(value.charAt(0))) { return cont(); }
314
315
  }
315
316
 
316
317
  function maybelabel(type) {
@@ -422,7 +423,10 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
422
423
  else return lexical.indented + (closing ? 0 : indentUnit);
423
424
  },
424
425
 
425
- electricChars: "{}"
426
+ electricChars: "{}",
427
+ blockCommentStart: "/*",
428
+ blockCommentEnd: "*/",
429
+ lineComment: "//"
426
430
  };
427
431
  });
428
432
 
@@ -314,7 +314,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
314
314
  if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
315
315
  if (type == "{") return cont(pushlex("}"), block, poplex);
316
316
  if (type == ";") return cont();
317
- if (type == "if") return cont(pushlex("form"), expression, statement, poplex, maybeelse);
317
+ if (type == "if") {
318
+ if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
319
+ cx.state.cc.pop()();
320
+ return cont(pushlex("form"), expression, statement, poplex, maybeelse);
321
+ }
318
322
  if (type == "function") return cont(functiondef);
319
323
  if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
320
324
  if (type == "variable") return cont(pushlex("stat"), maybelabel);
@@ -351,6 +355,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
351
355
  if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
352
356
  if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
353
357
  if (type == "{") return contCommasep(objprop, "}", null, maybeop);
358
+ if (type == "quasi") { return pass(quasi, maybeop); }
354
359
  return cont();
355
360
  }
356
361
  function maybeexpression(type) {
@@ -375,21 +380,22 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
375
380
  if (value == "?") return cont(expression, expect(":"), expr);
376
381
  return cont(expr);
377
382
  }
378
- if (type == "quasi") { cx.cc.push(me); return quasi(value); }
383
+ if (type == "quasi") { return pass(quasi, me); }
379
384
  if (type == ";") return;
380
385
  if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
381
386
  if (type == ".") return cont(property, me);
382
387
  if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
383
388
  }
384
- function quasi(value) {
385
- if (value.slice(value.length - 2) != "${") return cont();
389
+ function quasi(type, value) {
390
+ if (type != "quasi") return pass();
391
+ if (value.slice(value.length - 2) != "${") return cont(quasi);
386
392
  return cont(expression, continueQuasi);
387
393
  }
388
394
  function continueQuasi(type) {
389
395
  if (type == "}") {
390
396
  cx.marked = "string-2";
391
397
  cx.state.tokenize = tokenQuasi;
392
- return cont();
398
+ return cont(quasi);
393
399
  }
394
400
  }
395
401
  function arrowBody(type) {
@@ -482,7 +488,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
482
488
  if (type == ",") return cont(vardef);
483
489
  }
484
490
  function maybeelse(type, value) {
485
- if (type == "keyword b" && value == "else") return cont(pushlex("form"), statement, poplex);
491
+ if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
486
492
  }
487
493
  function forspec(type) {
488
494
  if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
@@ -595,7 +601,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
595
601
  if (state.tokenize != tokenBase) return 0;
596
602
  var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
597
603
  // Kludge to prevent 'maybelse' from blocking lexical scope pops
598
- for (var i = state.cc.length - 1; i >= 0; --i) {
604
+ if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
599
605
  var c = state.cc[i];
600
606
  if (c == poplex) lexical = lexical.prev;
601
607
  else if (c != maybeelse) break;
@@ -1,46 +1,122 @@
1
1
  CodeMirror.defineMode("jinja2", function() {
2
2
  var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif",
3
- "extends", "filter", "endfilter", "firstof", "for",
4
- "endfor", "if", "endif", "ifchanged", "endifchanged",
5
- "ifequal", "endifequal", "ifnotequal",
6
- "endifnotequal", "in", "include", "load", "not", "now", "or",
7
- "parsed", "regroup", "reversed", "spaceless",
8
- "endspaceless", "ssi", "templatetag", "openblock",
9
- "closeblock", "openvariable", "closevariable",
10
- "openbrace", "closebrace", "opencomment",
11
- "closecomment", "widthratio", "url", "with", "endwith",
12
- "get_current_language", "trans", "noop", "blocktrans",
13
- "endblocktrans", "get_available_languages",
14
- "get_current_language_bidi", "plural"];
15
- keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
3
+ "extends", "filter", "endfilter", "firstof", "for",
4
+ "endfor", "if", "endif", "ifchanged", "endifchanged",
5
+ "ifequal", "endifequal", "ifnotequal",
6
+ "endifnotequal", "in", "include", "load", "not", "now", "or",
7
+ "parsed", "regroup", "reversed", "spaceless",
8
+ "endspaceless", "ssi", "templatetag", "openblock",
9
+ "closeblock", "openvariable", "closevariable",
10
+ "openbrace", "closebrace", "opencomment",
11
+ "closecomment", "widthratio", "url", "with", "endwith",
12
+ "get_current_language", "trans", "endtrans", "noop", "blocktrans",
13
+ "endblocktrans", "get_available_languages",
14
+ "get_current_language_bidi", "plural"],
15
+ operator = /^[+\-*&%=<>!?|~^]/,
16
+ sign = /^[:\[\(\{]/,
17
+ atom = ["true", "false"],
18
+ number = /^(\d[+\-\*\/])?\d+(\.\d+)?/;
19
+
20
+ keywords = new RegExp("((" + keywords.join(")|(") + "))\\b");
21
+ atom = new RegExp("((" + atom.join(")|(") + "))\\b");
16
22
 
17
23
  function tokenBase (stream, state) {
18
- var ch = stream.next();
19
- if (ch == "{") {
20
- if (ch = stream.eat(/\{|%|#/)) {
21
- stream.eat("-");
22
- state.tokenize = inTag(ch);
23
- return "tag";
24
- }
24
+ var ch = stream.peek();
25
+
26
+ //Comment
27
+ if (state.incomment) {
28
+ if(!stream.skipTo("#}")) {
29
+ stream.skipToEnd();
30
+ } else {
31
+ stream.eatWhile(/\#|}/);
32
+ state.incomment = false;
25
33
  }
26
- }
27
- function inTag (close) {
28
- if (close == "{") {
29
- close = "}";
34
+ return "comment";
35
+ //Tag
36
+ } else if (state.intag) {
37
+ //After operator
38
+ if(state.operator) {
39
+ state.operator = false;
40
+ if(stream.match(atom)) {
41
+ return "atom";
42
+ }
43
+ if(stream.match(number)) {
44
+ return "number";
45
+ }
30
46
  }
31
- return function (stream, state) {
32
- var ch = stream.next();
33
- if ((ch == close || (ch == "-" && stream.eat(close)))
34
- && stream.eat("}")) {
35
- state.tokenize = tokenBase;
36
- return "tag";
47
+ //After sign
48
+ if(state.sign) {
49
+ state.sign = false;
50
+ if(stream.match(atom)) {
51
+ return "atom";
52
+ }
53
+ if(stream.match(number)) {
54
+ return "number";
55
+ }
56
+ }
57
+
58
+ if(state.instring) {
59
+ if(ch == state.instring) {
60
+ state.instring = false;
61
+ }
62
+ stream.next();
63
+ return "string";
64
+ } else if(ch == "'" || ch == '"') {
65
+ state.instring = ch;
66
+ stream.next();
67
+ return "string";
68
+ } else if(stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) {
69
+ state.intag = false;
70
+ return "tag";
71
+ } else if(stream.match(operator)) {
72
+ state.operator = true;
73
+ return "operator";
74
+ } else if(stream.match(sign)) {
75
+ state.sign = true;
76
+ } else {
77
+ if(stream.eat(" ") || stream.sol()) {
78
+ if(stream.match(keywords)) {
79
+ return "keyword";
80
+ }
81
+ if(stream.match(atom)) {
82
+ return "atom";
37
83
  }
38
- if (stream.match(keywords)) {
39
- return "keyword";
84
+ if(stream.match(number)) {
85
+ return "number";
40
86
  }
41
- return close == "#" ? "comment" : "string";
42
- };
43
- }
87
+ if(stream.sol()) {
88
+ stream.next();
89
+ }
90
+ } else {
91
+ stream.next();
92
+ }
93
+
94
+ }
95
+ return "variable";
96
+ } else if (stream.eat("{")) {
97
+ if (ch = stream.eat("#")) {
98
+ state.incomment = true;
99
+ if(!stream.skipTo("#}")) {
100
+ stream.skipToEnd();
101
+ } else {
102
+ stream.eatWhile(/\#|}/);
103
+ state.incomment = false;
104
+ }
105
+ return "comment";
106
+ //Open tag
107
+ } else if (ch = stream.eat(/\{|%/)) {
108
+ //Cache close tag
109
+ state.intag = ch;
110
+ if(ch == "{") {
111
+ state.intag = "}";
112
+ }
113
+ stream.eat("-");
114
+ return "tag";
115
+ }
116
+ }
117
+ stream.next();
118
+ };
119
+
44
120
  return {
45
121
  startState: function () {
46
122
  return {tokenize: tokenBase};
@@ -13,7 +13,7 @@
13
13
  for (i$ = 0, len$ = nr.length; i$ < len$; ++i$) {
14
14
  r = nr[i$];
15
15
  if (r.regex && (m = stream.match(r.regex))) {
16
- state.next = r.next;
16
+ state.next = r.next || state.next;
17
17
  return r.token;
18
18
  }
19
19
  }
@@ -192,7 +192,7 @@
192
192
  next: 'start'
193
193
  }, {
194
194
  token: 'text',
195
- regex: '.',
195
+ regex: '',
196
196
  next: 'start'
197
197
  }
198
198
  ],
@@ -254,11 +254,11 @@
254
254
  if (Array.isArray(r)) {
255
255
  for (var i = 0, len = r.length; i < len; ++i) {
256
256
  var rr = r[i];
257
- if (rr.regex) {
257
+ if (typeof rr.regex === 'string') {
258
258
  Rules[idx][i].regex = new RegExp('^' + rr.regex);
259
259
  }
260
260
  }
261
- } else if (r.regex) {
261
+ } else if (typeof rr.regex === 'string') {
262
262
  Rules[idx].regex = new RegExp('^' + r.regex);
263
263
  }
264
264
  }
@@ -11,17 +11,88 @@
11
11
  return "string";
12
12
  };
13
13
  }
14
+
15
+ // Helper for stringWithEscapes
16
+ function matchSequence(list) {
17
+ if (list.length == 0) return stringWithEscapes;
18
+ return function (stream, state) {
19
+ var patterns = list[0];
20
+ for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) {
21
+ state.tokenize = matchSequence(list.slice(1));
22
+ return patterns[i][1];
23
+ }
24
+ state.tokenize = stringWithEscapes;
25
+ return "string";
26
+ };
27
+ }
28
+ function stringWithEscapes(stream, state) {
29
+ var escaped = false, next, end = false;
30
+
31
+ if (stream.current() == '"') return "string";
32
+
33
+ // "Complex" syntax
34
+ if (stream.match("${", false) || stream.match("{$", false)) {
35
+ state.tokenize = null;
36
+ return "string";
37
+ }
38
+
39
+ // Simple syntax
40
+ if (stream.match(/\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
41
+ // After the variable name there may appear array or object operator.
42
+ if (stream.match("[", false)) {
43
+ // Match array operator
44
+ state.tokenize = matchSequence([
45
+ [["[", null]],
46
+ [[/\d[\w\.]*/, "number"],
47
+ [/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"],
48
+ [/[\w\$]+/, "variable"]],
49
+ [["]", null]]
50
+ ]);
51
+ }
52
+ if (stream.match(/\-\>\w/, false)) {
53
+ // Match object operator
54
+ state.tokenize = matchSequence([
55
+ [["->", null]],
56
+ [[/[\w]+/, "variable"]]
57
+ ]);
58
+ }
59
+ return "variable-2";
60
+ }
61
+
62
+ // Normal string
63
+ while (
64
+ !stream.eol() &&
65
+ (!stream.match("{$", false)) &&
66
+ (!stream.match(/(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false) || escaped)
67
+ ) {
68
+ next = stream.next();
69
+ if (!escaped && next == '"') { end = true; break; }
70
+ escaped = !escaped && next == "\\";
71
+ }
72
+ if (end) {
73
+ state.tokenize = null;
74
+ state.phpEncapsStack.pop();
75
+ }
76
+ return "string";
77
+ }
78
+
79
+ var phpKeywords = "abstract and array as break case catch class clone const continue declare default " +
80
+ "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " +
81
+ "for foreach function global goto if implements interface instanceof namespace " +
82
+ "new or private protected public static switch throw trait try use var while xor " +
83
+ "die echo empty exit eval include include_once isset list require require_once return " +
84
+ "print unset __halt_compiler self static parent yield insteadof finally";
85
+ var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__";
86
+ var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once";
87
+ CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" "));
88
+
14
89
  var phpConfig = {
15
90
  name: "clike",
16
- keywords: keywords("abstract and array as break case catch class clone const continue declare default " +
17
- "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " +
18
- "for foreach function global goto if implements interface instanceof namespace " +
19
- "new or private protected public static switch throw trait try use var while xor " +
20
- "die echo empty exit eval include include_once isset list require require_once return " +
21
- "print unset __halt_compiler self static parent yield insteadof finally"),
91
+ helperType: "php",
92
+ keywords: keywords(phpKeywords),
22
93
  blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"),
23
- atoms: keywords("true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"),
24
- builtin: keywords("func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once"),
94
+ atoms: keywords(phpAtoms),
95
+ builtin: keywords(phpBuiltin),
25
96
  multiLineStrings: true,
26
97
  hooks: {
27
98
  "$": function(stream) {
@@ -46,6 +117,24 @@
46
117
  return "comment";
47
118
  }
48
119
  return false;
120
+ },
121
+ '"': function(stream, state) {
122
+ if (!state.phpEncapsStack)
123
+ state.phpEncapsStack = [];
124
+ state.phpEncapsStack.push(0);
125
+ state.tokenize = stringWithEscapes;
126
+ return state.tokenize(stream, state);
127
+ },
128
+ "{": function(_stream, state) {
129
+ if (state.phpEncapsStack && state.phpEncapsStack.length > 0)
130
+ state.phpEncapsStack[state.phpEncapsStack.length - 1]++;
131
+ return false;
132
+ },
133
+ "}": function(_stream, state) {
134
+ if (state.phpEncapsStack && state.phpEncapsStack.length > 0)
135
+ if (--state.phpEncapsStack[state.phpEncapsStack.length - 1] == 0)
136
+ state.tokenize = stringWithEscapes;
137
+ return false;
49
138
  }
50
139
  }
51
140
  };
@@ -85,7 +174,8 @@
85
174
  state.curState = state.html;
86
175
  return "meta";
87
176
  } else {
88
- return phpMode.token(stream, state.curState);
177
+ var result = phpMode.token(stream, state.curState);
178
+ return (stream.pos <= stream.start) ? phpMode.token(stream, state.curState) : result;
89
179
  }
90
180
  }
91
181
 
@@ -138,7 +138,9 @@ CodeMirror.defineMode("r", function(config) {
138
138
  if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
139
139
  else if (ctx.align) return ctx.column + (closing ? 0 : 1);
140
140
  else return ctx.indent + (closing ? 0 : config.indentUnit);
141
- }
141
+ },
142
+
143
+ lineComment: "#"
142
144
  };
143
145
  });
144
146