diff --git a/COPYRIGHT b/COPYRIGHT index eaa3e2e963e..a5e1f4a4005 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -48,7 +48,7 @@ TCPDF 6.3.2 LGPL-3+ Yes TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement JS libraries: -Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea. +Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea. ChartJS 3.7.1 MIT License Yes JS library for graph jQuery 3.5.1 MIT License Yes JS library jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index af844edaa68..e601da43e06 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -1,7 +1,7 @@ . * Copyright (C) 2008-2011 Laurent Destailleur - * Copyright (C) 2020 Frédéric France + * Copyright (C) 2020 Frédéric France * * This program is free software; you can redistribute it and/or modifyion 2.0 (the "License"); * it under the terms of the GNU General Public License as published bypliance with the License. @@ -17,9 +17,6 @@ * or see https://www.gnu.org/ */ -if (!defined('REQUIRE_JQUERY_BLOCKUI')) { - define('REQUIRE_JQUERY_BLOCKUI', 1); -} if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', 1); } diff --git a/htdocs/admin/dolistore/css/dolistore.css b/htdocs/admin/dolistore/css/dolistore.css index 3d8f163caf2..c3a8b6ca7ce 100644 --- a/htdocs/admin/dolistore/css/dolistore.css +++ b/htdocs/admin/dolistore/css/dolistore.css @@ -67,9 +67,6 @@ div.divsearchfield { .tree li:last-child:after{ display: none } -.blockUI { - cursor: auto!important; -} .newAppParent{ position: relative; overflow: hidden; diff --git a/htdocs/includes/ace/.npmignore b/htdocs/includes/ace/.npmignore new file mode 100644 index 00000000000..b7e6c1b552d --- /dev/null +++ b/htdocs/includes/ace/.npmignore @@ -0,0 +1,3 @@ +demo/ +kitchen-sink.html +* * \ No newline at end of file diff --git a/htdocs/includes/ace/ChangeLog.txt b/htdocs/includes/ace/ChangeLog.txt index 824f8750e12..2819a6014d0 100644 --- a/htdocs/includes/ace/ChangeLog.txt +++ b/htdocs/includes/ace/ChangeLog.txt @@ -1,3 +1,26 @@ +2022.01.26 Version 1.4.14 +* update vim mode +* remove slow regex in beautify extension + +2021.09.30 Version 1.4.13 +* added useStrictCSP global option to use in environments where dynamic style creation is disabled + see demo/csp.html for an example of a page which loads external css files instead of generating styles with javascript +* updated vim mode, added support for gqq command + +2020.07.06 Version 1.4.12 +* removed unused es5-shim +* imporved ruby and vbscript highlighting and folding +* workaround for double space being converted to dot on mobile keyboards + +2020.04.15 Version 1.4.10 +* added workaround for chrome bug causing memory leak after calling editor.destroy +* added code folding support for vbscript mode + +2020.04.01 Version 1.4.9 +* added option to disable autoindent +* added new language modes +* fixed backspace not working with some mobile keyboards + 2020.01.14 Version 1.4.8 * highlight both matched braces, and highlight unmatched brace in red * improve snippet manager diff --git a/htdocs/includes/ace/ace-modules.d.ts b/htdocs/includes/ace/ace-modules.d.ts index a25e20c9c84..0f0bac5fbfd 100644 --- a/htdocs/includes/ace/ace-modules.d.ts +++ b/htdocs/includes/ace/ace-modules.d.ts @@ -1,7 +1,11 @@ +declare module 'ace-builds/webpack-resolver'; +declare module 'ace-builds/src-noconflict/ace'; declare module 'ace-builds/src-noconflict/ext-beautify'; +declare module 'ace-builds/src-noconflict/ext-code_lens'; declare module 'ace-builds/src-noconflict/ext-elastic_tabstops_lite'; declare module 'ace-builds/src-noconflict/ext-emmet'; declare module 'ace-builds/src-noconflict/ext-error_marker'; +declare module 'ace-builds/src-noconflict/ext-hardwrap'; declare module 'ace-builds/src-noconflict/ext-keybinding_menu'; declare module 'ace-builds/src-noconflict/ext-language_tools'; declare module 'ace-builds/src-noconflict/ext-linking'; @@ -21,10 +25,12 @@ declare module 'ace-builds/src-noconflict/ext-whitespace'; declare module 'ace-builds/src-noconflict/keybinding-emacs'; declare module 'ace-builds/src-noconflict/keybinding-sublime'; declare module 'ace-builds/src-noconflict/keybinding-vim'; +declare module 'ace-builds/src-noconflict/keybinding-vscode'; declare module 'ace-builds/src-noconflict/mode-abap'; declare module 'ace-builds/src-noconflict/mode-abc'; declare module 'ace-builds/src-noconflict/mode-actionscript'; declare module 'ace-builds/src-noconflict/mode-ada'; +declare module 'ace-builds/src-noconflict/mode-alda'; declare module 'ace-builds/src-noconflict/mode-apache_conf'; declare module 'ace-builds/src-noconflict/mode-apex'; declare module 'ace-builds/src-noconflict/mode-applescript'; @@ -34,7 +40,6 @@ declare module 'ace-builds/src-noconflict/mode-asl'; declare module 'ace-builds/src-noconflict/mode-assembly_x86'; declare module 'ace-builds/src-noconflict/mode-autohotkey'; declare module 'ace-builds/src-noconflict/mode-batchfile'; -declare module 'ace-builds/src-noconflict/mode-bro'; declare module 'ace-builds/src-noconflict/mode-c9search'; declare module 'ace-builds/src-noconflict/mode-cirru'; declare module 'ace-builds/src-noconflict/mode-clojure'; @@ -92,6 +97,7 @@ declare module 'ace-builds/src-noconflict/mode-jade'; declare module 'ace-builds/src-noconflict/mode-java'; declare module 'ace-builds/src-noconflict/mode-javascript'; declare module 'ace-builds/src-noconflict/mode-json'; +declare module 'ace-builds/src-noconflict/mode-json5'; declare module 'ace-builds/src-noconflict/mode-jsoniq'; declare module 'ace-builds/src-noconflict/mode-jsp'; declare module 'ace-builds/src-noconflict/mode-jssm'; @@ -99,6 +105,7 @@ declare module 'ace-builds/src-noconflict/mode-jsx'; declare module 'ace-builds/src-noconflict/mode-julia'; declare module 'ace-builds/src-noconflict/mode-kotlin'; declare module 'ace-builds/src-noconflict/mode-latex'; +declare module 'ace-builds/src-noconflict/mode-latte'; declare module 'ace-builds/src-noconflict/mode-less'; declare module 'ace-builds/src-noconflict/mode-liquid'; declare module 'ace-builds/src-noconflict/mode-lisp'; @@ -114,7 +121,9 @@ declare module 'ace-builds/src-noconflict/mode-markdown'; declare module 'ace-builds/src-noconflict/mode-mask'; declare module 'ace-builds/src-noconflict/mode-matlab'; declare module 'ace-builds/src-noconflict/mode-maze'; +declare module 'ace-builds/src-noconflict/mode-mediawiki'; declare module 'ace-builds/src-noconflict/mode-mel'; +declare module 'ace-builds/src-noconflict/mode-mips'; declare module 'ace-builds/src-noconflict/mode-mixal'; declare module 'ace-builds/src-noconflict/mode-mushcode'; declare module 'ace-builds/src-noconflict/mode-mysql'; @@ -122,11 +131,11 @@ declare module 'ace-builds/src-noconflict/mode-nginx'; declare module 'ace-builds/src-noconflict/mode-nim'; declare module 'ace-builds/src-noconflict/mode-nix'; declare module 'ace-builds/src-noconflict/mode-nsis'; +declare module 'ace-builds/src-noconflict/mode-nunjucks'; declare module 'ace-builds/src-noconflict/mode-objectivec'; declare module 'ace-builds/src-noconflict/mode-ocaml'; declare module 'ace-builds/src-noconflict/mode-pascal'; declare module 'ace-builds/src-noconflict/mode-perl'; -declare module 'ace-builds/src-noconflict/mode-perl6'; declare module 'ace-builds/src-noconflict/mode-pgsql'; declare module 'ace-builds/src-noconflict/mode-php'; declare module 'ace-builds/src-noconflict/mode-php_laravel_blade'; @@ -134,12 +143,15 @@ declare module 'ace-builds/src-noconflict/mode-pig'; declare module 'ace-builds/src-noconflict/mode-plain_text'; declare module 'ace-builds/src-noconflict/mode-powershell'; declare module 'ace-builds/src-noconflict/mode-praat'; +declare module 'ace-builds/src-noconflict/mode-prisma'; declare module 'ace-builds/src-noconflict/mode-prolog'; declare module 'ace-builds/src-noconflict/mode-properties'; declare module 'ace-builds/src-noconflict/mode-protobuf'; declare module 'ace-builds/src-noconflict/mode-puppet'; declare module 'ace-builds/src-noconflict/mode-python'; +declare module 'ace-builds/src-noconflict/mode-qml'; declare module 'ace-builds/src-noconflict/mode-r'; +declare module 'ace-builds/src-noconflict/mode-raku'; declare module 'ace-builds/src-noconflict/mode-razor'; declare module 'ace-builds/src-noconflict/mode-rdoc'; declare module 'ace-builds/src-noconflict/mode-red'; @@ -152,11 +164,13 @@ declare module 'ace-builds/src-noconflict/mode-sass'; declare module 'ace-builds/src-noconflict/mode-scad'; declare module 'ace-builds/src-noconflict/mode-scala'; declare module 'ace-builds/src-noconflict/mode-scheme'; +declare module 'ace-builds/src-noconflict/mode-scrypt'; declare module 'ace-builds/src-noconflict/mode-scss'; declare module 'ace-builds/src-noconflict/mode-sh'; declare module 'ace-builds/src-noconflict/mode-sjs'; declare module 'ace-builds/src-noconflict/mode-slim'; declare module 'ace-builds/src-noconflict/mode-smarty'; +declare module 'ace-builds/src-noconflict/mode-smithy'; declare module 'ace-builds/src-noconflict/mode-snippets'; declare module 'ace-builds/src-noconflict/mode-soy_template'; declare module 'ace-builds/src-noconflict/mode-space'; @@ -210,6 +224,8 @@ declare module 'ace-builds/src-noconflict/theme-merbivore'; declare module 'ace-builds/src-noconflict/theme-merbivore_soft'; declare module 'ace-builds/src-noconflict/theme-monokai'; declare module 'ace-builds/src-noconflict/theme-mono_industrial'; +declare module 'ace-builds/src-noconflict/theme-nord_dark'; +declare module 'ace-builds/src-noconflict/theme-one_dark'; declare module 'ace-builds/src-noconflict/theme-pastel_on_dark'; declare module 'ace-builds/src-noconflict/theme-solarized_dark'; declare module 'ace-builds/src-noconflict/theme-solarized_light'; @@ -228,6 +244,7 @@ declare module 'ace-builds/src-noconflict/snippets/abap'; declare module 'ace-builds/src-noconflict/snippets/abc'; declare module 'ace-builds/src-noconflict/snippets/actionscript'; declare module 'ace-builds/src-noconflict/snippets/ada'; +declare module 'ace-builds/src-noconflict/snippets/alda'; declare module 'ace-builds/src-noconflict/snippets/apache_conf'; declare module 'ace-builds/src-noconflict/snippets/apex'; declare module 'ace-builds/src-noconflict/snippets/applescript'; @@ -237,7 +254,6 @@ declare module 'ace-builds/src-noconflict/snippets/asl'; declare module 'ace-builds/src-noconflict/snippets/assembly_x86'; declare module 'ace-builds/src-noconflict/snippets/autohotkey'; declare module 'ace-builds/src-noconflict/snippets/batchfile'; -declare module 'ace-builds/src-noconflict/snippets/bro'; declare module 'ace-builds/src-noconflict/snippets/c9search'; declare module 'ace-builds/src-noconflict/snippets/cirru'; declare module 'ace-builds/src-noconflict/snippets/clojure'; @@ -295,6 +311,7 @@ declare module 'ace-builds/src-noconflict/snippets/jade'; declare module 'ace-builds/src-noconflict/snippets/java'; declare module 'ace-builds/src-noconflict/snippets/javascript'; declare module 'ace-builds/src-noconflict/snippets/json'; +declare module 'ace-builds/src-noconflict/snippets/json5'; declare module 'ace-builds/src-noconflict/snippets/jsoniq'; declare module 'ace-builds/src-noconflict/snippets/jsp'; declare module 'ace-builds/src-noconflict/snippets/jssm'; @@ -302,6 +319,7 @@ declare module 'ace-builds/src-noconflict/snippets/jsx'; declare module 'ace-builds/src-noconflict/snippets/julia'; declare module 'ace-builds/src-noconflict/snippets/kotlin'; declare module 'ace-builds/src-noconflict/snippets/latex'; +declare module 'ace-builds/src-noconflict/snippets/latte'; declare module 'ace-builds/src-noconflict/snippets/less'; declare module 'ace-builds/src-noconflict/snippets/liquid'; declare module 'ace-builds/src-noconflict/snippets/lisp'; @@ -317,7 +335,9 @@ declare module 'ace-builds/src-noconflict/snippets/markdown'; declare module 'ace-builds/src-noconflict/snippets/mask'; declare module 'ace-builds/src-noconflict/snippets/matlab'; declare module 'ace-builds/src-noconflict/snippets/maze'; +declare module 'ace-builds/src-noconflict/snippets/mediawiki'; declare module 'ace-builds/src-noconflict/snippets/mel'; +declare module 'ace-builds/src-noconflict/snippets/mips'; declare module 'ace-builds/src-noconflict/snippets/mixal'; declare module 'ace-builds/src-noconflict/snippets/mushcode'; declare module 'ace-builds/src-noconflict/snippets/mysql'; @@ -325,11 +345,11 @@ declare module 'ace-builds/src-noconflict/snippets/nginx'; declare module 'ace-builds/src-noconflict/snippets/nim'; declare module 'ace-builds/src-noconflict/snippets/nix'; declare module 'ace-builds/src-noconflict/snippets/nsis'; +declare module 'ace-builds/src-noconflict/snippets/nunjucks'; declare module 'ace-builds/src-noconflict/snippets/objectivec'; declare module 'ace-builds/src-noconflict/snippets/ocaml'; declare module 'ace-builds/src-noconflict/snippets/pascal'; declare module 'ace-builds/src-noconflict/snippets/perl'; -declare module 'ace-builds/src-noconflict/snippets/perl6'; declare module 'ace-builds/src-noconflict/snippets/pgsql'; declare module 'ace-builds/src-noconflict/snippets/php'; declare module 'ace-builds/src-noconflict/snippets/php_laravel_blade'; @@ -337,12 +357,15 @@ declare module 'ace-builds/src-noconflict/snippets/pig'; declare module 'ace-builds/src-noconflict/snippets/plain_text'; declare module 'ace-builds/src-noconflict/snippets/powershell'; declare module 'ace-builds/src-noconflict/snippets/praat'; +declare module 'ace-builds/src-noconflict/snippets/prisma'; declare module 'ace-builds/src-noconflict/snippets/prolog'; declare module 'ace-builds/src-noconflict/snippets/properties'; declare module 'ace-builds/src-noconflict/snippets/protobuf'; declare module 'ace-builds/src-noconflict/snippets/puppet'; declare module 'ace-builds/src-noconflict/snippets/python'; +declare module 'ace-builds/src-noconflict/snippets/qml'; declare module 'ace-builds/src-noconflict/snippets/r'; +declare module 'ace-builds/src-noconflict/snippets/raku'; declare module 'ace-builds/src-noconflict/snippets/razor'; declare module 'ace-builds/src-noconflict/snippets/rdoc'; declare module 'ace-builds/src-noconflict/snippets/red'; @@ -355,11 +378,13 @@ declare module 'ace-builds/src-noconflict/snippets/sass'; declare module 'ace-builds/src-noconflict/snippets/scad'; declare module 'ace-builds/src-noconflict/snippets/scala'; declare module 'ace-builds/src-noconflict/snippets/scheme'; +declare module 'ace-builds/src-noconflict/snippets/scrypt'; declare module 'ace-builds/src-noconflict/snippets/scss'; declare module 'ace-builds/src-noconflict/snippets/sh'; declare module 'ace-builds/src-noconflict/snippets/sjs'; declare module 'ace-builds/src-noconflict/snippets/slim'; declare module 'ace-builds/src-noconflict/snippets/smarty'; +declare module 'ace-builds/src-noconflict/snippets/smithy'; declare module 'ace-builds/src-noconflict/snippets/snippets'; declare module 'ace-builds/src-noconflict/snippets/soy_template'; declare module 'ace-builds/src-noconflict/snippets/space'; @@ -390,4 +415,3 @@ declare module 'ace-builds/src-noconflict/snippets/xml'; declare module 'ace-builds/src-noconflict/snippets/xquery'; declare module 'ace-builds/src-noconflict/snippets/yaml'; declare module 'ace-builds/src-noconflict/snippets/zeek'; -declare module 'ace-builds/webpack-resolver'; diff --git a/htdocs/includes/ace/ace.d.ts b/htdocs/includes/ace/ace.d.ts index dd1a2952a06..bdf62ffd3a4 100644 --- a/htdocs/includes/ace/ace.d.ts +++ b/htdocs/includes/ace/ace.d.ts @@ -21,10 +21,12 @@ export namespace Ace { getLine(row: number): string; getLines(firstRow: number, lastRow: number): string[]; getAllLines(): string[]; + getLength(): number; getTextRange(range: Range): string; getLinesForRange(range: Range): string[]; insert(position: Point, text: string): Point; insertInLine(position: Point, text: string): Point; + insertNewLine(position: Point): Point; clippedPos(row: number, column: number): Point; clonePos(pos: Point): Point; pos(row: number, column: number): Point; @@ -153,7 +155,7 @@ export namespace Ace { } export interface EditSessionOptions { - wrap: string | number; + wrap: "off" | "free" | "printmargin" | boolean | number; wrapMethod: 'code' | 'text' | 'auto'; indentedSoftWrap: boolean; firstLineNumber: number; @@ -212,6 +214,7 @@ export namespace Ace { mergeUndoDeltas: true | false | 'always'; behavioursEnabled: boolean; wrapBehavioursEnabled: boolean; + enableAutoIndent: boolean; autoScrollEditorIntoView: boolean; keyboardHandler: string; placeholder: string; @@ -228,7 +231,7 @@ export namespace Ace { range: Range; preserveCase: boolean; regExp: RegExp; - wholeWord: string; + wholeWord: boolean; caseSensitive: boolean; wrap: boolean; } @@ -362,7 +365,7 @@ export namespace Ace { moduleUrl(name: string, component?: string): string; setModuleUrl(name: string, subst: string): string; loadModule(moduleName: string | [string, string], - onLoad: (module: any) => void): void; + onLoad?: (module: any) => void): void; init(packaged: any): any; defineOptions(obj: any, path: string, options: { [key: string]: any }): Config; resetOptions(obj: any): void; @@ -398,6 +401,8 @@ export namespace Ace { export interface EditSession extends EventEmitter, OptionsProvider, Folding { selection: Selection; + // TODO: define BackgroundTokenizer + on(name: 'changeFold', callback: (obj: { data: Fold, action: string }) => void): Function; on(name: 'changeScrollLeft', callback: (scrollLeft: number) => void): Function; @@ -519,6 +524,8 @@ export namespace Ace { removeKeyboardHandler(handler: KeyboardHandler): boolean; getKeyboardHandler(): KeyboardHandler; getStatusText(): string; + onCommandKey(e: any, hashId: number, keyCode: number): boolean; + onTextInput(text: string): boolean; } interface CommandMap { @@ -549,10 +556,17 @@ export namespace Ace { toggleRecording(editor: Editor): void; replay(editor: Editor): void; addCommand(command: Command): void; - removeCommand(command: Command, keepCommand?: boolean): void; + addCommands(command: Command[]): void; + removeCommand(command: Command | string, keepCommand?: boolean): void; + removeCommands(command: Command[]): void; bindKey(key: string | { mac?: string, win?: string }, command: CommandLike, position?: number): void; + bindKeys(keys: {[s: string]: Function}): void; + parseKeys(keyPart: string): {key: string, hashId: number}; + findKeyCommand(hashId: number, keyString: string): string | undefined; + handleKeyboard(data: {}, hashId: number, keyString: string, keyCode: string | number): void | {command: string}; + getStatusText(editor: Editor, data: {}): string; } export interface VirtualRenderer extends OptionsProvider, EventEmitter { @@ -746,7 +760,7 @@ export namespace Ace { setFontSize(size: string): void; focus(): void; isFocused(): boolean; - flur(): void; + blur(): void; getSelectedText(): string; getCopyText(): string; execCommand(command: string | string[], args?: any): boolean; @@ -844,9 +858,10 @@ export namespace Ace { replace(replacement: string, options?: Partial): number; replaceAll(replacement: string, options?: Partial): number; getLastSearchOptions(): Partial; - find(needle: string, options?: Partial, animate?: boolean): void; + find(needle: string | RegExp, options?: Partial, animate?: boolean): Ace.Range | undefined; findNext(options?: Partial, animate?: boolean): void; findPrevious(options?: Partial, animate?: boolean): void; + findAll(needle: string | RegExp, options?: Partial, additive?: boolean): number; undo(): void; redo(): void; destroy(): void; @@ -857,6 +872,7 @@ export namespace Ace { type CompleterCallback = (error: any, completions: Completion[]) => void; interface Completer { + identifierRegexps?: Array, getCompletions(editor: Editor, session: EditSession, position: Point, diff --git a/htdocs/includes/ace/kitchen-sink.html b/htdocs/includes/ace/kitchen-sink.html index 27014fa6004..026b357ca4a 100644 --- a/htdocs/includes/ace/kitchen-sink.html +++ b/htdocs/includes/ace/kitchen-sink.html @@ -8,7 +8,7 @@ @@ -21,18 +21,18 @@
-
+
- - + +
diff --git a/htdocs/includes/ace/package.json b/htdocs/includes/ace/package.json index a00dddeb40a..5deb5e6d478 100644 --- a/htdocs/includes/ace/package.json +++ b/htdocs/includes/ace/package.json @@ -2,7 +2,7 @@ "name": "ace-builds", "main": "./src-noconflict/ace.js", "typings": "ace.d.ts", - "version": "1.4.8", + "version": "1.4.14", "description": "Ace (Ajax.org Cloud9 Editor)", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/htdocs/includes/ace/src/ace.js b/htdocs/includes/ace/src/ace.js index 43d9931a3c4..74913993af1 100644 --- a/htdocs/includes/ace/src/ace.js +++ b/htdocs/includes/ace/src/ace.js @@ -173,781 +173,8 @@ exportAce(ACE_NAMESPACE); })(); -define("ace/lib/regexp",["require","exports","module"], function(require, exports, module) { +define("ace/lib/fixoldbrowsers",["require","exports","module"], function(require, exports, module) { "use strict"; - - var real = { - exec: RegExp.prototype.exec, - test: RegExp.prototype.test, - match: String.prototype.match, - replace: String.prototype.replace, - split: String.prototype.split - }, - compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups - compliantLastIndexIncrement = function () { - var x = /^/g; - real.test.call(x, ""); - return !x.lastIndex; - }(); - - if (compliantLastIndexIncrement && compliantExecNpcg) - return; - RegExp.prototype.exec = function (str) { - var match = real.exec.apply(this, arguments), - name, r2; - if ( typeof(str) == 'string' && match) { - if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) { - r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", "")); - real.replace.call(str.slice(match.index), r2, function () { - for (var i = 1; i < arguments.length - 2; i++) { - if (arguments[i] === undefined) - match[i] = undefined; - } - }); - } - if (this._xregexp && this._xregexp.captureNames) { - for (var i = 1; i < match.length; i++) { - name = this._xregexp.captureNames[i - 1]; - if (name) - match[name] = match[i]; - } - } - if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - } - return match; - }; - if (!compliantLastIndexIncrement) { - RegExp.prototype.test = function (str) { - var match = real.exec.call(this, str); - if (match && this.global && !match[0].length && (this.lastIndex > match.index)) - this.lastIndex--; - return !!match; - }; - } - - function getNativeFlags (regex) { - return (regex.global ? "g" : "") + - (regex.ignoreCase ? "i" : "") + - (regex.multiline ? "m" : "") + - (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3 - (regex.sticky ? "y" : ""); - } - - function indexOf (array, item, from) { - if (Array.prototype.indexOf) // Use the native array method if available - return array.indexOf(item, from); - for (var i = from || 0; i < array.length; i++) { - if (array[i] === item) - return i; - } - return -1; - } - -}); - -define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) { - -function Empty() {} - -if (!Function.prototype.bind) { - Function.prototype.bind = function bind(that) { // .length is 1 - var target = this; - if (typeof target != "function") { - throw new TypeError("Function.prototype.bind called on incompatible " + target); - } - var args = slice.call(arguments, 1); // for normal call - var bound = function () { - - if (this instanceof bound) { - - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - - } - - }; - if(target.prototype) { - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; -} -var call = Function.prototype.call; -var prototypeOfArray = Array.prototype; -var prototypeOfObject = Object.prototype; -var slice = prototypeOfArray.slice; -var _toString = call.bind(prototypeOfObject.toString); -var owns = call.bind(prototypeOfObject.hasOwnProperty); -var defineGetter; -var defineSetter; -var lookupGetter; -var lookupSetter; -var supportsAccessors; -if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { - defineGetter = call.bind(prototypeOfObject.__defineGetter__); - defineSetter = call.bind(prototypeOfObject.__defineSetter__); - lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); - lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); -} -if ([1,2].splice(0).length != 2) { - if(function() { // test IE < 9 to splice bug - see issue #138 - function makeArray(l) { - var a = new Array(l+2); - a[0] = a[1] = 0; - return a; - } - var array = [], lengthBefore; - - array.splice.apply(array, makeArray(20)); - array.splice.apply(array, makeArray(26)); - - lengthBefore = array.length; //46 - array.splice(5, 0, "XXX"); // add one element - - lengthBefore + 1 == array.length - - if (lengthBefore + 1 == array.length) { - return true;// has right splice implementation without bugs - } - }()) {//IE 6/7 - var array_splice = Array.prototype.splice; - Array.prototype.splice = function(start, deleteCount) { - if (!arguments.length) { - return []; - } else { - return array_splice.apply(this, [ - start === void 0 ? 0 : start, - deleteCount === void 0 ? (this.length - start) : deleteCount - ].concat(slice.call(arguments, 2))) - } - }; - } else {//IE8 - Array.prototype.splice = function(pos, removeCount){ - var length = this.length; - if (pos > 0) { - if (pos > length) - pos = length; - } else if (pos == void 0) { - pos = 0; - } else if (pos < 0) { - pos = Math.max(length + pos, 0); - } - - if (!(pos+removeCount < length)) - removeCount = length - pos; - - var removed = this.slice(pos, pos+removeCount); - var insert = slice.call(arguments, 2); - var add = insert.length; - if (pos === length) { - if (add) { - this.push.apply(this, insert); - } - } else { - var remove = Math.min(removeCount, length - pos); - var tailOldPos = pos + remove; - var tailNewPos = tailOldPos + add - remove; - var tailCount = length - tailOldPos; - var lengthAfterRemove = length - remove; - - if (tailNewPos < tailOldPos) { // case A - for (var i = 0; i < tailCount; ++i) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } else if (tailNewPos > tailOldPos) { // case B - for (i = tailCount; i--; ) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } // else, add == remove (nothing to do) - - if (add && pos === lengthAfterRemove) { - this.length = lengthAfterRemove; // truncate array - this.push.apply(this, insert); - } else { - this.length = lengthAfterRemove + add; // reserves space - for (i = 0; i < add; ++i) { - this[pos+i] = insert[i]; - } - } - } - return removed; - }; - } -} -if (!Array.isArray) { - Array.isArray = function isArray(obj) { - return _toString(obj) == "[object Array]"; - }; -} -var boxedString = Object("a"), - splitString = boxedString[0] != "a" || !(0 in boxedString); - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function forEach(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - thisp = arguments[1], - i = -1, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(); // TODO message - } - - while (++i < length) { - if (i in self) { - fun.call(thisp, self[i], i, object); - } - } - }; -} -if (!Array.prototype.map) { - Array.prototype.map = function map(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = Array(length), - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) - result[i] = fun.call(thisp, self[i], i, object); - } - return result; - }; -} -if (!Array.prototype.filter) { - Array.prototype.filter = function filter(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = [], - value, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) { - value = self[i]; - if (fun.call(thisp, value, i, object)) { - result.push(value); - } - } - } - return result; - }; -} -if (!Array.prototype.every) { - Array.prototype.every = function every(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && !fun.call(thisp, self[i], i, object)) { - return false; - } - } - return true; - }; -} -if (!Array.prototype.some) { - Array.prototype.some = function some(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && fun.call(thisp, self[i], i, object)) { - return true; - } - } - return false; - }; -} -if (!Array.prototype.reduce) { - Array.prototype.reduce = function reduce(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduce of empty array with no initial value"); - } - - var i = 0; - var result; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i++]; - break; - } - if (++i >= length) { - throw new TypeError("reduce of empty array with no initial value"); - } - } while (true); - } - - for (; i < length; i++) { - if (i in self) { - result = fun.call(void 0, result, self[i], i, object); - } - } - - return result; - }; -} -if (!Array.prototype.reduceRight) { - Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - - var result, i = length - 1; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i--]; - break; - } - if (--i < 0) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - } while (true); - } - - do { - if (i in this) { - result = fun.call(void 0, result, self[i], i, object); - } - } while (i--); - - return result; - }; -} -if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { - Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - - var i = 0; - if (arguments.length > 1) { - i = toInteger(arguments[1]); - } - i = i >= 0 ? i : Math.max(0, length + i); - for (; i < length; i++) { - if (i in self && self[i] === sought) { - return i; - } - } - return -1; - }; -} -if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { - Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - var i = length - 1; - if (arguments.length > 1) { - i = Math.min(i, toInteger(arguments[1])); - } - i = i >= 0 ? i : length - Math.abs(i); - for (; i >= 0; i--) { - if (i in self && sought === self[i]) { - return i; - } - } - return -1; - }; -} -if (!Object.getPrototypeOf) { - Object.getPrototypeOf = function getPrototypeOf(object) { - return object.__proto__ || ( - object.constructor ? - object.constructor.prototype : - prototypeOfObject - ); - }; -} -if (!Object.getOwnPropertyDescriptor) { - var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + - "non-object: "; - Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT + object); - if (!owns(object, property)) - return; - - var descriptor, getter, setter; - descriptor = { enumerable: true, configurable: true }; - if (supportsAccessors) { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - - var getter = lookupGetter(object, property); - var setter = lookupSetter(object, property); - object.__proto__ = prototype; - - if (getter || setter) { - if (getter) descriptor.get = getter; - if (setter) descriptor.set = setter; - return descriptor; - } - } - descriptor.value = object[property]; - return descriptor; - }; -} -if (!Object.getOwnPropertyNames) { - Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - return Object.keys(object); - }; -} -if (!Object.create) { - var createEmpty; - if (Object.prototype.__proto__ === null) { - createEmpty = function () { - return { "__proto__": null }; - }; - } else { - createEmpty = function () { - var empty = {}; - for (var i in empty) - empty[i] = null; - empty.constructor = - empty.hasOwnProperty = - empty.propertyIsEnumerable = - empty.isPrototypeOf = - empty.toLocaleString = - empty.toString = - empty.valueOf = - empty.__proto__ = null; - return empty; - } - } - - Object.create = function create(prototype, properties) { - var object; - if (prototype === null) { - object = createEmpty(); - } else { - if (typeof prototype != "object") - throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); - var Type = function () {}; - Type.prototype = prototype; - object = new Type(); - object.__proto__ = prototype; - } - if (properties !== void 0) - Object.defineProperties(object, properties); - return object; - }; -} - -function doesDefinePropertyWork(object) { - try { - Object.defineProperty(object, "sentinel", {}); - return "sentinel" in object; - } catch (exception) { - } -} -if (Object.defineProperty) { - var definePropertyWorksOnObject = doesDefinePropertyWork({}); - var definePropertyWorksOnDom = typeof document == "undefined" || - doesDefinePropertyWork(document.createElement("div")); - if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { - var definePropertyFallback = Object.defineProperty; - } -} - -if (!Object.defineProperty || definePropertyFallback) { - var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; - var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " - var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + - "on this javascript engine"; - - Object.defineProperty = function defineProperty(object, property, descriptor) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT_TARGET + object); - if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) - throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); - if (definePropertyFallback) { - try { - return definePropertyFallback.call(Object, object, property, descriptor); - } catch (exception) { - } - } - if (owns(descriptor, "value")) { - - if (supportsAccessors && (lookupGetter(object, property) || - lookupSetter(object, property))) - { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - delete object[property]; - object[property] = descriptor.value; - object.__proto__ = prototype; - } else { - object[property] = descriptor.value; - } - } else { - if (!supportsAccessors) - throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); - if (owns(descriptor, "get")) - defineGetter(object, property, descriptor.get); - if (owns(descriptor, "set")) - defineSetter(object, property, descriptor.set); - } - - return object; - }; -} -if (!Object.defineProperties) { - Object.defineProperties = function defineProperties(object, properties) { - for (var property in properties) { - if (owns(properties, property)) - Object.defineProperty(object, property, properties[property]); - } - return object; - }; -} -if (!Object.seal) { - Object.seal = function seal(object) { - return object; - }; -} -if (!Object.freeze) { - Object.freeze = function freeze(object) { - return object; - }; -} -try { - Object.freeze(function () {}); -} catch (exception) { - Object.freeze = (function freeze(freezeObject) { - return function freeze(object) { - if (typeof object == "function") { - return object; - } else { - return freezeObject(object); - } - }; - })(Object.freeze); -} -if (!Object.preventExtensions) { - Object.preventExtensions = function preventExtensions(object) { - return object; - }; -} -if (!Object.isSealed) { - Object.isSealed = function isSealed(object) { - return false; - }; -} -if (!Object.isFrozen) { - Object.isFrozen = function isFrozen(object) { - return false; - }; -} -if (!Object.isExtensible) { - Object.isExtensible = function isExtensible(object) { - if (Object(object) === object) { - throw new TypeError(); // TODO message - } - var name = ''; - while (owns(object, name)) { - name += '?'; - } - object[name] = true; - var returnValue = owns(object, name); - delete object[name]; - return returnValue; - }; -} -if (!Object.keys) { - var hasDontEnumBug = true, - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ], - dontEnumsLength = dontEnums.length; - - for (var key in {"toString": null}) { - hasDontEnumBug = false; - } - - Object.keys = function keys(object) { - - if ( - (typeof object != "object" && typeof object != "function") || - object === null - ) { - throw new TypeError("Object.keys called on a non-object"); - } - - var keys = []; - for (var name in object) { - if (owns(object, name)) { - keys.push(name); - } - } - - if (hasDontEnumBug) { - for (var i = 0, ii = dontEnumsLength; i < ii; i++) { - var dontEnum = dontEnums[i]; - if (owns(object, dontEnum)) { - keys.push(dontEnum); - } - } - } - return keys; - }; - -} -if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; -} -var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" + - "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + - "\u2029\uFEFF"; -if (!String.prototype.trim) { - ws = "[" + ws + "]"; - var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), - trimEndRegexp = new RegExp(ws + ws + "*$"); - String.prototype.trim = function trim() { - return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); - }; -} - -function toInteger(n) { - n = +n; - if (n !== n) { // isNaN - n = 0; - } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - return n; -} - -function isPrimitive(input) { - var type = typeof input; - return ( - input === null || - type === "undefined" || - type === "boolean" || - type === "number" || - type === "string" - ); -} - -function toPrimitive(input) { - var val, valueOf, toString; - if (isPrimitive(input)) { - return input; - } - valueOf = input.valueOf; - if (typeof valueOf === "function") { - val = valueOf.call(input); - if (isPrimitive(val)) { - return val; - } - } - toString = input.toString; - if (typeof toString === "function") { - val = toString.call(input); - if (isPrimitive(val)) { - return val; - } - } - throw new TypeError(); -} -var toObject = function (o) { - if (o == null) { // this matches both null and undefined - throw new TypeError("can't convert "+o+" to object"); - } - return Object(o); -}; - -}); - -define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"], function(require, exports, module) { -"use strict"; - -require("./regexp"); -require("./es5-shim"); if (typeof Element != "undefined" && !Element.prototype.remove) { Object.defineProperty(Element.prototype, "remove", { enumerable: false, @@ -1026,8 +253,11 @@ exports.buildDom = function buildDom(arr, parent, refs) { return txt; } - if (!Array.isArray(arr)) + if (!Array.isArray(arr)) { + if (arr && arr.appendChild && parent) + parent.appendChild(arr); return arr; + } if (typeof arr[0] != "string" || !arr[0]) { var els = []; for (var i = 0; i < arr.length; i++) { @@ -1049,10 +279,12 @@ exports.buildDom = function buildDom(arr, parent, refs) { var val = options[n]; if (n === "class") { el.className = Array.isArray(val) ? val.join(" ") : val; - } else if (typeof val == "function" || n == "value") { + } else if (typeof val == "function" || n == "value" || n[0] == "$") { el[n] = val; } else if (n === "ref") { if (refs) refs[val] = el; + } else if (n === "style") { + if (typeof val == "string") el.style.cssText = val; } else if (val != null) { el.setAttribute(n, val); } @@ -1144,7 +376,34 @@ exports.hasCssString = function(id, doc) { } }; -exports.importCssString = function importCssString(cssText, id, target) { +var strictCSP; +var cssCache = []; +exports.useStrictCSP = function(value) { + strictCSP = value; + if (value == false) insertPendingStyles(); + else if (!cssCache) cssCache = []; +}; + +function insertPendingStyles() { + var cache = cssCache; + cssCache = null; + cache && cache.forEach(function(item) { + importCssString(item[0], item[1]); + }); +} + +function importCssString(cssText, id, target) { + if (typeof document == "undefined") + return; + if (cssCache) { + if (target) { + insertPendingStyles(); + } else if (target === false) { + return cssCache.push([cssText, id]); + } + } + if (strictCSP) return; + var container = target; if (!target || !target.getRootNode) { container = document; @@ -1169,7 +428,8 @@ exports.importCssString = function importCssString(cssText, id, target) { if (container == doc) container = exports.getDocumentHead(doc); container.insertBefore(style, container.firstChild); -}; +} +exports.importCssString = importCssString; exports.importCssStylsheet = function(uri, doc) { exports.buildDom(["link", {rel: "stylesheet", href: uri}], exports.getDocumentHead(doc)); @@ -1211,10 +471,6 @@ exports.scrollbarWidth = function(document) { return noScrollbar-withScrollbar; }; -if (typeof document == "undefined") { - exports.importCssString = function() {}; -} - exports.computedStyle = function(element, style) { return window.getComputedStyle(element, "") || {}; }; @@ -1231,6 +487,8 @@ exports.HI_DPI = useragent.isWin ? typeof window !== "undefined" && window.devicePixelRatio >= 1.5 : true; +if (useragent.isChromeOS) exports.HI_DPI = false; + if (typeof document !== "undefined") { var div = document.createElement("div"); if (exports.HI_DPI && div.style.transform !== undefined) @@ -1294,7 +552,8 @@ var Keys = (function() { KEY_MODS: { "ctrl": 1, "alt": 2, "option" : 2, "shift": 4, - "super": 8, "meta": 8, "command": 8, "cmd": 8 + "super": 8, "meta": 8, "command": 8, "cmd": 8, + "control": 1 }, FUNCTION_KEYS : { @@ -1422,12 +681,24 @@ function getListenerOptions() { return activeListenerOptions; } -exports.addListener = function(elem, type, callback) { - return elem.addEventListener(type, callback, getListenerOptions()); +function EventListener(elem, type, callback) { + this.elem = elem; + this.type = type; + this.callback = callback; +} +EventListener.prototype.destroy = function() { + removeListener(this.elem, this.type, this.callback); + this.elem = this.type = this.callback = undefined; }; -exports.removeListener = function(elem, type, callback) { - return elem.removeEventListener(type, callback, getListenerOptions()); +var addListener = exports.addListener = function(elem, type, callback, destroyer) { + elem.addEventListener(type, callback, getListenerOptions()); + if (destroyer) + destroyer.$toDestroy.push(new EventListener(elem, type, callback)); +}; + +var removeListener = exports.removeListener = function(elem, type, callback) { + elem.removeEventListener(type, callback, getListenerOptions()); }; exports.stopEvent = function(e) { exports.stopPropagation(e); @@ -1453,25 +724,26 @@ exports.getButton = function(e) { }; exports.capture = function(el, eventHandler, releaseCaptureHandler) { + var ownerDocument = el && el.ownerDocument || document; function onMouseUp(e) { eventHandler && eventHandler(e); releaseCaptureHandler && releaseCaptureHandler(e); - exports.removeListener(document, "mousemove", eventHandler, true); - exports.removeListener(document, "mouseup", onMouseUp, true); - exports.removeListener(document, "dragstart", onMouseUp, true); + removeListener(ownerDocument, "mousemove", eventHandler); + removeListener(ownerDocument, "mouseup", onMouseUp); + removeListener(ownerDocument, "dragstart", onMouseUp); } - exports.addListener(document, "mousemove", eventHandler, true); - exports.addListener(document, "mouseup", onMouseUp, true); - exports.addListener(document, "dragstart", onMouseUp, true); + addListener(ownerDocument, "mousemove", eventHandler); + addListener(ownerDocument, "mouseup", onMouseUp); + addListener(ownerDocument, "dragstart", onMouseUp); return onMouseUp; }; -exports.addMouseWheelListener = function(el, callback) { +exports.addMouseWheelListener = function(el, callback, destroyer) { if ("onmousewheel" in el) { - exports.addListener(el, "mousewheel", function(e) { + addListener(el, "mousewheel", function(e) { var factor = 8; if (e.wheelDeltaX !== undefined) { e.wheelX = -e.wheelDeltaX / factor; @@ -1481,9 +753,9 @@ exports.addMouseWheelListener = function(el, callback) { e.wheelY = -e.wheelDelta / factor; } callback(e); - }); + }, destroyer); } else if ("onwheel" in el) { - exports.addListener(el, "wheel", function(e) { + addListener(el, "wheel", function(e) { var factor = 0.35; switch (e.deltaMode) { case e.DOM_DELTA_PIXEL: @@ -1498,9 +770,9 @@ exports.addMouseWheelListener = function(el, callback) { } callback(e); - }); + }, destroyer); } else { - exports.addListener(el, "DOMMouseScroll", function(e) { + addListener(el, "DOMMouseScroll", function(e) { if (e.axis && e.axis == e.HORIZONTAL_AXIS) { e.wheelX = (e.detail || 0) * 5; e.wheelY = 0; @@ -1509,11 +781,11 @@ exports.addMouseWheelListener = function(el, callback) { e.wheelY = (e.detail || 0) * 5; } callback(e); - }); + }, destroyer); } }; -exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName) { +exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName, destroyer) { var clicks = 0; var startX, startY, timer; var eventNames = { @@ -1558,7 +830,7 @@ exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, c if (!Array.isArray(elements)) elements = [elements]; elements.forEach(function(el) { - exports.addListener(el, "mousedown", onMousedown); + addListener(el, "mousedown", onMousedown, destroyer); }); }; @@ -1623,16 +895,15 @@ function normalizeCommandKeys(callback, e, keyCode) { } -exports.addCommandKeyListener = function(el, callback) { - var addListener = exports.addListener; +exports.addCommandKeyListener = function(el, callback, destroyer) { if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) { var lastKeyDownKeyCode = null; addListener(el, "keydown", function(e) { lastKeyDownKeyCode = e.keyCode; - }); + }, destroyer); addListener(el, "keypress", function(e) { return normalizeCommandKeys(callback, e, lastKeyDownKeyCode); - }); + }, destroyer); } else { var lastDefaultPrevented = null; @@ -1641,18 +912,18 @@ exports.addCommandKeyListener = function(el, callback) { var result = normalizeCommandKeys(callback, e, e.keyCode); lastDefaultPrevented = e.defaultPrevented; return result; - }); + }, destroyer); addListener(el, "keypress", function(e) { if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) { exports.stopEvent(e); lastDefaultPrevented = null; } - }); + }, destroyer); addListener(el, "keyup", function(e) { pressedKeys[e.keyCode] = null; - }); + }, destroyer); if (!pressedKeys) { resetPressedKeys(); @@ -1673,12 +944,12 @@ if (typeof window == "object" && window.postMessage && !useragent.isOldIE) { var listener = function(e) { if (e.data == messageName) { exports.stopPropagation(e); - exports.removeListener(win, "message", listener); + removeListener(win, "message", listener); callback(); } }; - exports.addListener(win, "message", listener); + addListener(win, "message", listener); win.postMessage(messageName, "*"); }; } @@ -2181,6 +1452,7 @@ var KEYS = require("../lib/keys"); var MODS = KEYS.KEY_MODS; var isIOS = useragent.isIOS; var valueResetRegex = isIOS ? /\s/ : /\n/; +var isMobile = useragent.isMobile; var TextInput = function(parentNode, host) { var text = dom.createElement("textarea"); @@ -2200,7 +1472,7 @@ var TextInput = function(parentNode, host) { var sendingText = false; var tempStyle = ''; - if (!useragent.isMobile) + if (!isMobile) text.style.fontSize = "1px"; var commandMode = false; @@ -2216,7 +1488,7 @@ var TextInput = function(parentNode, host) { if (ignoreFocusEvents) return; host.onBlur(e); isFocused = false; - }); + }, host); event.addListener(text, "focus", function(e) { if (ignoreFocusEvents) return; isFocused = true; @@ -2231,7 +1503,7 @@ var TextInput = function(parentNode, host) { setTimeout(resetSelection); else resetSelection(); - }); + }, host); this.$focusScroll = false; this.focus = function() { if (tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser") @@ -2277,9 +1549,12 @@ var TextInput = function(parentNode, host) { }; host.on("beforeEndOperation", function() { - if (host.curOp && host.curOp.command.name == "insertstring") + var curOp = host.curOp; + var commandName = curOp && curOp.command && curOp.command.name; + if (commandName == "insertstring") return; - if (inComposition) { + var isUserAction = commandName && (curOp.docChanged || curOp.selectionChanged); + if (inComposition && isUserAction) { lastValue = text.value = ""; onCompositionEnd(); } @@ -2311,33 +1586,49 @@ var TextInput = function(parentNode, host) { return; inComposition = true; - var selection = host.selection; - var range = selection.getRange(); - var row = selection.cursor.row; - var selectionStart = range.start.column; - var selectionEnd = range.end.column; - var line = host.session.getLine(row); + var selectionStart = 0; + var selectionEnd = 0; + var line = ""; - if (range.start.row != row) { - var prevLine = host.session.getLine(row - 1); - selectionStart = range.start.row < row - 1 ? 0 : selectionStart; - selectionEnd += prevLine.length + 1; - line = prevLine + "\n" + line; - } - else if (range.end.row != row) { - var nextLine = host.session.getLine(row + 1); - selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd; - selectionEnd += line.length + 1; - line = line + "\n" + nextLine; - } + if (host.session) { + var selection = host.selection; + var range = selection.getRange(); + var row = selection.cursor.row; + selectionStart = range.start.column; + selectionEnd = range.end.column; + line = host.session.getLine(row); - if (line.length > MAX_LINE_LENGTH) { - if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) { - line = line.slice(0, MAX_LINE_LENGTH); - } else { - line = "\n"; - selectionStart = 0; - selectionEnd = 1; + if (range.start.row != row) { + var prevLine = host.session.getLine(row - 1); + selectionStart = range.start.row < row - 1 ? 0 : selectionStart; + selectionEnd += prevLine.length + 1; + line = prevLine + "\n" + line; + } + else if (range.end.row != row) { + var nextLine = host.session.getLine(row + 1); + selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd; + selectionEnd += line.length + 1; + line = line + "\n" + nextLine; + } + else if (isMobile && row > 0) { + line = "\n" + line; + selectionEnd += 1; + selectionStart += 1; + } + + if (line.length > MAX_LINE_LENGTH) { + if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) { + line = line.slice(0, MAX_LINE_LENGTH); + } else { + line = "\n"; + if (selectionStart == selectionEnd) { + selectionStart = selectionEnd = 0; + } + else { + selectionStart = 0; + selectionEnd = 1; + } + } } } @@ -2363,6 +1654,7 @@ var TextInput = function(parentNode, host) { } inComposition = false; }; + this.resetSelection = resetSelection; if (isFocused) host.onFocus(); @@ -2382,6 +1674,8 @@ var TextInput = function(parentNode, host) { } else if (isAllSelected(text)) { host.selectAll(); resetSelection(); + } else if (isMobile && text.selectionStart != lastSelectionStart) { + resetSelection(); } }; @@ -2432,6 +1726,12 @@ var TextInput = function(parentNode, host) { if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd) return ""; sendingText = true; + var shouldReset = false; + if (useragent.isAndroid && inserted == ". ") { + inserted = " "; + shouldReset = true; + } + if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || commandMode) { host.onTextInput(inserted); } else { @@ -2448,7 +1748,7 @@ var TextInput = function(parentNode, host) { lastSelectionStart = selectionStart; lastSelectionEnd = selectionEnd; lastRestoreEnd = restoreEnd; - return inserted; + return shouldReset ? "\n" : inserted; } }; var onInput = function(e) { @@ -2460,8 +1760,13 @@ var TextInput = function(parentNode, host) { } var data = text.value; var inserted = sendText(data, true); - if (data.length > MAX_LINE_LENGTH + 100 || valueResetRegex.test(inserted)) + if ( + data.length > MAX_LINE_LENGTH + 100 + || valueResetRegex.test(inserted) + || isMobile && lastSelectionStart < 1 && lastSelectionStart == lastSelectionEnd + ) { resetSelection(); + } }; var handleClipboardData = function(e, data, forceIEMime) { @@ -2533,14 +1838,14 @@ var TextInput = function(parentNode, host) { } }; - event.addCommandKeyListener(text, host.onCommandKey.bind(host)); + event.addCommandKeyListener(text, host.onCommandKey.bind(host), host); - event.addListener(text, "select", onSelect); - event.addListener(text, "input", onInput); + event.addListener(text, "select", onSelect, host); + event.addListener(text, "input", onInput, host); - event.addListener(text, "cut", onCut); - event.addListener(text, "copy", onCopy); - event.addListener(text, "paste", onPaste); + event.addListener(text, "cut", onCut, host); + event.addListener(text, "copy", onCopy, host); + event.addListener(text, "paste", onPaste, host); if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)) { event.addListener(parentNode, "keydown", function(e) { if ((useragent.isMac && !e.metaKey) || !e.ctrlKey) @@ -2557,7 +1862,7 @@ var TextInput = function(parentNode, host) { onCut(e); break; } - }); + }, host); } var onCompositionStart = function(e) { if (inComposition || !host.onCompositionStart || host.$readOnly) @@ -2568,7 +1873,11 @@ var TextInput = function(parentNode, host) { if (commandMode) return; + if (e.data) + inComposition.useTextareaForIME = false; + setTimeout(onCompositionUpdate, 0); + host._signal("compositionStart"); host.on("mousedown", cancelComposition); var range = host.getSelectionRange(); @@ -2579,8 +1888,7 @@ var TextInput = function(parentNode, host) { host.onCompositionStart(inComposition); if (inComposition.useTextareaForIME) { - text.value = ""; - lastValue = ""; + lastValue = text.value = ""; lastSelectionStart = 0; lastSelectionEnd = 0; } @@ -2643,11 +1951,11 @@ var TextInput = function(parentNode, host) { syncComposition(); } - event.addListener(text, "compositionstart", onCompositionStart); - event.addListener(text, "compositionupdate", onCompositionUpdate); - event.addListener(text, "keyup", onKeyup); - event.addListener(text, "keydown", syncComposition); - event.addListener(text, "compositionend", onCompositionEnd); + event.addListener(text, "compositionstart", onCompositionStart, host); + event.addListener(text, "compositionupdate", onCompositionUpdate, host); + event.addListener(text, "keyup", onKeyup, host); + event.addListener(text, "keydown", syncComposition, host); + event.addListener(text, "compositionend", onCompositionEnd, host); this.getElement = function() { return text; @@ -2718,13 +2026,13 @@ var TextInput = function(parentNode, host) { host.textInput.onContextMenu(e); onContextMenuClose(); }; - event.addListener(text, "mouseup", onContextMenu); + event.addListener(text, "mouseup", onContextMenu, host); event.addListener(text, "mousedown", function(e) { e.preventDefault(); onContextMenuClose(); - }); - event.addListener(host.renderer.scroller, "contextmenu", onContextMenu); - event.addListener(text, "contextmenu", onContextMenu); + }, host); + event.addListener(host.renderer.scroller, "contextmenu", onContextMenu, host); + event.addListener(text, "contextmenu", onContextMenu, host); if (isIOS) addIosSelectionHandler(parentNode, host, text); @@ -2810,10 +2118,13 @@ var TextInput = function(parentNode, host) { document.removeEventListener("selectionchange", detectArrowKeys); }); } - }; exports.TextInput = TextInput; +exports.$setUserAgentForTests = function(_isMobile, _isIOS) { + isMobile = _isMobile; + isIOS = _isIOS; +}; }); define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"], function(require, exports, module) { @@ -3243,7 +2554,7 @@ function GutterHandler(mouseHandler) { tooltip.hide(); tooltipAnnotation = null; editor._signal("hideGutterTooltip", tooltip); - editor.removeEventListener("mousewheel", hideTooltip); + editor.off("mousewheel", hideTooltip); } } @@ -3280,7 +2591,7 @@ function GutterHandler(mouseHandler) { tooltipTimeout = null; hideTooltip(); }, 50); - }); + }, editor); editor.on("changeSession", hideTooltip); } @@ -3405,18 +2716,16 @@ function DragdropHandler(mouseHandler) { var editor = mouseHandler.editor; - var blankImage = dom.createElement("img"); - blankImage.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; - if (useragent.isOpera) - blankImage.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;"; + var dragImage = dom.createElement("div"); + dragImage.style.cssText = "top:-100px;position:absolute;z-index:2147483647;opacity:0.5"; + dragImage.textContent = "\xa0"; var exports = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"]; - exports.forEach(function(x) { - mouseHandler[x] = this[x]; + exports.forEach(function(x) { + mouseHandler[x] = this[x]; }, this); - editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler)); - + editor.on("mousedown", this.onMouseDown.bind(mouseHandler)); var mouseTarget = editor.container; var dragSelectionMarker, x, y; @@ -3441,14 +2750,12 @@ function DragdropHandler(mouseHandler) { var dataTransfer = e.dataTransfer; dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove"; - if (useragent.isOpera) { - editor.container.appendChild(blankImage); - blankImage.scrollTop = 0; - } - dataTransfer.setDragImage && dataTransfer.setDragImage(blankImage, 0, 0); - if (useragent.isOpera) { - editor.container.removeChild(blankImage); - } + editor.container.appendChild(dragImage); + + dataTransfer.setDragImage && dataTransfer.setDragImage(dragImage, 0, 0); + setTimeout(function() { + editor.container.removeChild(dragImage); + }); dataTransfer.clearData(); dataTransfer.setData("Text", editor.session.getTextRange()); @@ -3540,12 +2847,12 @@ function DragdropHandler(mouseHandler) { return event.preventDefault(e); }; - event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler)); - event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler)); - event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler)); - event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler)); - event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler)); - event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler)); + event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler), editor); + event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler), editor); function scrollCursorIntoView(cursor, prevCursor) { var now = Date.now(); @@ -3860,9 +3167,17 @@ exports.addTouchListeners = function(el, editor) { if (!contextMenu) createContextMenu(); var cursor = editor.selection.cursor; var pagePos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column); + var leftOffset = editor.renderer.textToScreenCoordinates(0, 0).pageX; + var scrollLeft = editor.renderer.scrollLeft; var rect = editor.container.getBoundingClientRect(); contextMenu.style.top = pagePos.pageY - rect.top - 3 + "px"; - contextMenu.style.right = "10px"; + if (pagePos.pageX - rect.left < rect.width - 70) { + contextMenu.style.left = ""; + contextMenu.style.right = "10px"; + } else { + contextMenu.style.right = ""; + contextMenu.style.left = leftOffset + scrollLeft - rect.left + "px"; + } contextMenu.style.display = ""; contextMenu.firstChild.style.display = "none"; editor.on("input", hideContextMenu); @@ -3903,7 +3218,7 @@ exports.addTouchListeners = function(el, editor) { if (!pressed) return; var textarea = editor.textInput.getElement(); textarea.focus(); - }); + }, editor); event.addListener(el, "touchstart", function (e) { var touches = e.touches; if (longTouchTimer || touches.length > 1) { @@ -3945,6 +3260,8 @@ exports.addTouchListeners = function(el, editor) { var cursorPos = editor.renderer.$cursorLayer.getPixelPosition(cursor, true); var anchorPos = editor.renderer.$cursorLayer.getPixelPosition(anchor, true); var rect = editor.renderer.scroller.getBoundingClientRect(); + var offsetTop = editor.renderer.layerConfig.offset; + var offsetLeft = editor.renderer.scrollLeft; var weightedDistance = function(x, y) { x = x / w; y = y / h - 0.75; @@ -3957,12 +3274,12 @@ exports.addTouchListeners = function(el, editor) { } var diff1 = weightedDistance( - e.clientX - rect.left - cursorPos.left, - e.clientY - rect.top - cursorPos.top + e.clientX - rect.left - cursorPos.left + offsetLeft, + e.clientY - rect.top - cursorPos.top + offsetTop ); var diff2 = weightedDistance( - e.clientX - rect.left - anchorPos.left, - e.clientY - rect.top - anchorPos.top + e.clientX - rect.left - anchorPos.left + offsetLeft, + e.clientY - rect.top - anchorPos.top + offsetTop ); if (diff1 < 3.5 && diff2 < 3.5) mode = diff1 > diff2 ? "cursor" : "anchor"; @@ -3976,7 +3293,7 @@ exports.addTouchListeners = function(el, editor) { longTouchTimer = setTimeout(handleLongTap, 450); } touchStartT = t; - }); + }, editor); event.addListener(el, "touchend", function (e) { pressed = editor.$mouseHandler.isMousePressed = false; @@ -3990,14 +3307,13 @@ exports.addTouchListeners = function(el, editor) { showContextMenu(); } else if (mode == "scroll") { animate(); - e.preventDefault(); hideContextMenu(); } else { showContextMenu(); } clearTimeout(longTouchTimer); longTouchTimer = null; - }); + }, editor); event.addListener(el, "touchmove", function (e) { if (longTouchTimer) { clearTimeout(longTouchTimer); @@ -4053,7 +3369,7 @@ exports.addTouchListeners = function(el, editor) { editor.renderer.scrollCursorIntoView(pos); e.preventDefault(); } - }); + }, editor); function animate() { animationSteps += 60; @@ -4164,8 +3480,8 @@ EventEmitter._signal = function(eventName, e) { EventEmitter.once = function(eventName, callback) { var _self = this; - this.addEventListener(eventName, function newCallback() { - _self.removeEventListener(eventName, newCallback); + this.on(eventName, function newCallback() { + _self.off(eventName, newCallback); callback.apply(null, arguments); }); if (!callback) { @@ -4237,7 +3553,9 @@ EventEmitter.removeEventListener = function(eventName, callback) { }; EventEmitter.removeAllListeners = function(eventName) { - if (this._eventRegistry) this._eventRegistry[eventName] = []; + if (!eventName) this._eventRegistry = this._defaultHandlers = undefined; + if (this._eventRegistry) this._eventRegistry[eventName] = undefined; + if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined; }; exports.EventEmitter = EventEmitter; @@ -4376,12 +3694,13 @@ exports.AppConfig = AppConfig; }); -define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/app_config"], function(require, exports, module) { +define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/dom","ace/lib/app_config"], function(require, exports, module) { "no use strict"; var lang = require("./lib/lang"); var oop = require("./lib/oop"); var net = require("./lib/net"); +var dom = require("./lib/dom"); var AppConfig = require("./lib/app_config").AppConfig; module.exports = exports = new AppConfig(); @@ -4399,13 +3718,13 @@ var options = { suffix: ".js", $moduleUrls: {}, loadWorkerFromBlob: true, - sharedPopups: false + sharedPopups: false, + useStrictCSP: null }; exports.get = function(key) { if (!options.hasOwnProperty(key)) throw new Error("Unknown config key: " + key); - return options[key]; }; @@ -4414,6 +3733,8 @@ exports.set = function(key, value) { options[key] = value; else if (this.setDefaultValue("", key, value) == false) throw new Error("Unknown config key: " + key); + if (key == "useStrictCSP") + dom.useStrictCSP(value); }; exports.all = function() { @@ -4560,7 +3881,7 @@ function deHyphenate(str) { return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); }); } -exports.version = "1.4.8"; +exports.version = "1.4.14"; }); @@ -4593,28 +3914,28 @@ var MouseHandler = function(editor) { }; var mouseTarget = editor.renderer.getMouseEventTarget(); - event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click")); - event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove")); + event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"), editor); + event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"), editor); event.addMultiMouseDownListener([ mouseTarget, editor.renderer.scrollBarV && editor.renderer.scrollBarV.inner, editor.renderer.scrollBarH && editor.renderer.scrollBarH.inner, editor.textInput && editor.textInput.getElement() - ].filter(Boolean), [400, 300, 250], this, "onMouseEvent"); - event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel")); + ].filter(Boolean), [400, 300, 250], this, "onMouseEvent", editor); + event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"), editor); addTouchListeners(editor.container, editor); var gutterEl = editor.renderer.$gutter; - event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown")); - event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick")); - event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick")); - event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove")); + event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"), editor); + event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"), editor); + event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"), editor); + event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"), editor); - event.addListener(mouseTarget, "mousedown", focusEditor); - event.addListener(gutterEl, "mousedown", focusEditor); + event.addListener(mouseTarget, "mousedown", focusEditor, editor); + event.addListener(gutterEl, "mousedown", focusEditor, editor); if (useragent.isIE && editor.renderer.scrollBarV) { - event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor); - event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor); + event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor, editor); + event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor, editor); } editor.on("mousemove", function(e){ @@ -4630,11 +3951,12 @@ var MouseHandler = function(editor) { } else { renderer.setCursorStyle(""); } - }); + }, editor); }; (function() { this.onMouseEvent = function(name, e) { + if (!this.editor.session) return; this.editor._emit(name, new MouseEvent(e, this.editor)); }; @@ -4684,7 +4006,7 @@ var MouseHandler = function(editor) { var onCaptureEnd = function(e) { editor.off("beforeEndOperation", onOperationEnd); clearInterval(timerId); - onCaptureInterval(); + if (editor.session) onCaptureInterval(); self[self.state + "End"] && self[self.state + "End"](e); self.state = ""; self.isMousePressed = renderer.$isMousePressed = false; @@ -4732,6 +4054,9 @@ var MouseHandler = function(editor) { setTimeout(stop, 10); this.editor.on("nativecontextmenu", stop); }; + this.destroy = function() { + if (this.releaseMouse) this.releaseMouse(); + }; }).call(MouseHandler.prototype); config.defineOptions(MouseHandler.prototype, "mouseHandler", { @@ -6102,7 +5427,6 @@ var Selection = function(session) { this.detach = function() { this.lead.detach(); this.anchor.detach(); - this.session = this.doc = null; }; this.fromOrientedRange = function(range) { @@ -6318,7 +5642,7 @@ var Tokenizer = function(rules) { this.removeCapturingGroups = function(src) { var r = src.replace( - /\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!]|(\()/g, + /\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g, function(x, y) {return y ? "(?:" : x;} ); return r; @@ -6677,18 +6001,18 @@ var TextHighlightRules = function() { this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) { var keywords = Object.create(null); + this.$keywordList = []; Object.keys(map).forEach(function(className) { var a = map[className]; - if (ignoreCase) - a = a.toLowerCase(); var list = a.split(splitChar || "|"); - for (var i = list.length; i--; ) - keywords[list[i]] = className; - }); - if (Object.getPrototypeOf(keywords)) { - keywords.__proto__ = null; - } - this.$keywordList = Object.keys(keywords); + for (var i = list.length; i--; ) { + var word = list[i]; + this.$keywordList.push(word); + if (ignoreCase) + word = word.toLowerCase(); + keywords[word] = className; + } + }, this); map = null; return ignoreCase ? function(value) {return keywords[value.toLowerCase()] || defaultToken; } @@ -7751,7 +7075,7 @@ var Anchor = exports.Anchor = function(doc, row, column) { }); }; this.detach = function() { - this.document.removeEventListener("change", this.$onChange); + this.document.off("change", this.$onChange); }; this.attach = function(doc) { this.document = doc || this.document; @@ -8083,6 +7407,16 @@ var Document = function(textOrLines) { } }; + this.$safeApplyDelta = function(delta) { + var docLength = this.$lines.length; + if ( + delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength + || delta.action == "insert" && delta.start.row <= docLength + ) { + this.applyDelta(delta); + } + }; + this.$splitAndapplyLargeDelta = function(delta, MAX) { var lines = delta.lines; var l = lines.length - MAX + 1; @@ -8105,7 +7439,7 @@ var Document = function(textOrLines) { this.applyDelta(delta, true); }; this.revertDelta = function(delta) { - this.applyDelta({ + this.$safeApplyDelta({ start: this.clonePos(delta.start), end: this.clonePos(delta.end), action: (delta.action == "insert" ? "remove" : "insert"), @@ -9142,9 +8476,11 @@ function Folding() { var folds = this.getFoldsInRange(fold.range); if (folds.length > 0) { this.removeFolds(folds); - folds.forEach(function(subFold) { - fold.addSubFold(subFold); - }); + if (!fold.collapseChildren) { + folds.forEach(function(subFold) { + fold.addSubFold(subFold); + }); + } } for (var i = 0; i < foldData.length; i++) { @@ -9263,26 +8599,39 @@ function Folding() { var range, folds; if (location == null) { range = new Range(0, 0, this.getLength(), 0); - expandInner = true; - } else if (typeof location == "number") + if (expandInner == null) expandInner = true; + } else if (typeof location == "number") { range = new Range(location, 0, location, this.getLine(location).length); - else if ("row" in location) + } else if ("row" in location) { range = Range.fromPoints(location, location); - else + } else if (Array.isArray(location)) { + folds = []; + location.forEach(function(range) { + folds = folds.concat(this.unfold(range)); + }, this); + return folds; + } else { range = location; + } folds = this.getFoldsInRangeList(range); - if (expandInner) { + var outermostFolds = folds; + while ( + folds.length == 1 + && Range.comparePoints(folds[0].start, range.start) < 0 + && Range.comparePoints(folds[0].end, range.end) > 0 + ) { + this.expandFolds(folds); + folds = this.getFoldsInRangeList(range); + } + + if (expandInner != false) { this.removeFolds(folds); } else { - var subFolds = folds; - while (subFolds.length) { - this.expandFolds(subFolds); - subFolds = this.getFoldsInRangeList(range); - } + this.expandFolds(folds); } - if (folds.length) - return folds; + if (outermostFolds.length) + return outermostFolds; }; this.isRowFolded = function(docRow, startFoldRow) { return !!this.getFoldLine(docRow, startFoldRow); @@ -9416,7 +8765,7 @@ function Folding() { this.getCommentFoldRange = function(row, column, dir) { var iterator = new TokenIterator(this, row, column); var token = iterator.getCurrentToken(); - var type = token.type; + var type = token && token.type; if (token && /^comment|string/.test(type)) { type = type.match(/comment|string/)[0]; if (type == "comment") @@ -9457,7 +8806,7 @@ function Folding() { } }; - this.foldAll = function(startRow, endRow, depth) { + this.foldAll = function(startRow, endRow, depth, test) { if (depth == undefined) depth = 100000; // JSON.stringify doesn't hanle Infinity var foldWidgets = this.foldWidgets; @@ -9470,6 +8819,8 @@ function Folding() { foldWidgets[row] = this.getFoldWidget(row); if (foldWidgets[row] != "start") continue; + + if (test && !test(row)) continue; var range = this.getFoldWidgetRange(row); if (range && range.isMultiLine() @@ -9477,14 +8828,32 @@ function Folding() { && range.start.row >= startRow ) { row = range.end.row; - try { - var fold = this.addFold("...", range); - if (fold) - fold.collapseChildren = depth; - } catch(e) {} + range.collapseChildren = depth; + this.addFold("...", range); } } }; + + this.foldToLevel = function(level) { + this.foldAll(); + while (level-- > 0) + this.unfold(null, false); + }; + + this.foldAllComments = function() { + var session = this; + this.foldAll(null, null, null, function(row) { + var tokens = session.getTokens(row); + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (token.type == "text" && /^\s+$/.test(token.value)) + continue; + if (/comment/.test(token.type)) + return true; + return false; + } + }); + }; this.$foldStyles = { "manual": 1, "markbegin": 1, @@ -9929,7 +9298,7 @@ EditSession.$uid = 0; oop.implement(this, EventEmitter); this.setDocument = function(doc) { if (this.doc) - this.doc.removeListener("change", this.$onChange); + this.doc.off("change", this.$onChange); this.doc = doc; doc.on("change", this.$onChange); @@ -10356,7 +9725,8 @@ EditSession.$uid = 0; this.$modeId = mode.$id; if (this.$mode === mode) return; - + + var oldMode = this.$mode; this.$mode = mode; this.$stopWorker(); @@ -10366,15 +9736,15 @@ EditSession.$uid = 0; var tokenizer = mode.getTokenizer(); - if(tokenizer.addEventListener !== undefined) { + if(tokenizer.on !== undefined) { var onReloadTokenizer = this.onReloadTokenizer.bind(this); - tokenizer.addEventListener("update", onReloadTokenizer); + tokenizer.on("update", onReloadTokenizer); } if (!this.bgTokenizer) { this.bgTokenizer = new BackgroundTokenizer(tokenizer); var _self = this; - this.bgTokenizer.addEventListener("update", function(e) { + this.bgTokenizer.on("update", function(e) { _self._signal("tokenizerUpdate", e); }); } else { @@ -10393,7 +9763,7 @@ EditSession.$uid = 0; this.$options.wrapMethod.set.call(this, this.$wrapMethod); this.$setFolding(mode.foldingRules); this.bgTokenizer.start(0); - this._emit("changeMode"); + this._emit("changeMode", {oldMode: oldMode, mode: mode}); } }; @@ -10539,7 +9909,7 @@ EditSession.$uid = 0; for (var i = 0; i < deltas.length; i++) { var delta = deltas[i]; if (delta.action == "insert" || delta.action == "remove") { - this.doc.applyDelta(delta); + this.doc.$safeApplyDelta(delta); } } @@ -10561,7 +9931,6 @@ EditSession.$uid = 0; } var range, point; - var lastDeltaIsInsert; for (var i = 0; i < deltas.length; i++) { var delta = deltas[i]; @@ -10569,10 +9938,8 @@ EditSession.$uid = 0; if (!range) { if (isInsert(delta)) { range = Range.fromPoints(delta.start, delta.end); - lastDeltaIsInsert = true; } else { range = Range.fromPoints(delta.start, delta.start); - lastDeltaIsInsert = false; } continue; } @@ -10586,13 +9953,11 @@ EditSession.$uid = 0; if (range.compare(point.row, point.column) == 1) { range.setEnd(point); } - lastDeltaIsInsert = true; } else { point = delta.start; if (range.compare(point.row, point.column) == -1) { range = Range.fromPoints(delta.start, delta.start); } - lastDeltaIsInsert = false; } } return range; @@ -11458,6 +10823,11 @@ EditSession.$uid = 0; this.bgTokenizer = null; } this.$stopWorker(); + this.removeAllListeners(); + if (this.doc) { + this.doc.off("change", this.$onChange); + } + this.selection.detach(); }; this.isFullWidth = isFullWidth; @@ -11848,7 +11218,7 @@ var Search = function() { var len = re.length; var forEachInLine = function(row, offset, callback) { var startRow = backwards ? row - len + 1 : row; - if (startRow < 0) return; + if (startRow < 0 || startRow + len > session.getLength()) return; var line = session.getLine(startRow); var startIndex = line.search(re[0]); if (!backwards && startIndex < offset || startIndex === -1) return; @@ -12199,7 +11569,7 @@ oop.inherits(CommandManager, MultiHashHandler); editor && editor._emit("changeStatus"); if (this.recording) { this.macro.pop(); - this.removeEventListener("exec", this.$addCommandToMacro); + this.off("exec", this.$addCommandToMacro); if (!this.macro.length) this.macro = this.oldMacro; @@ -12266,6 +11636,7 @@ function bindKey(win, mac) { } exports.commands = [{ name: "showSettingsMenu", + description: "Show settings menu", bindKey: bindKey("Ctrl-,", "Command-,"), exec: function(editor) { config.loadModule("ace/ext/settings_menu", function(module) { @@ -12276,6 +11647,7 @@ exports.commands = [{ readOnly: true }, { name: "goToNextError", + description: "Go to next error", bindKey: bindKey("Alt-E", "F4"), exec: function(editor) { config.loadModule("./ext/error_marker", function(module) { @@ -12286,6 +11658,7 @@ exports.commands = [{ readOnly: true }, { name: "goToPreviousError", + description: "Go to previous error", bindKey: bindKey("Alt-Shift-E", "Shift-F4"), exec: function(editor) { config.loadModule("./ext/error_marker", function(module) { @@ -12332,6 +11705,7 @@ exports.commands = [{ readOnly: true }, { name: "toggleFoldWidget", + description: "Toggle fold widget", bindKey: bindKey("F2", "F2"), exec: function(editor) { editor.session.toggleFoldWidget(); }, multiSelectAction: "forEach", @@ -12339,6 +11713,7 @@ exports.commands = [{ readOnly: true }, { name: "toggleParentFoldWidget", + description: "Toggle parent fold widget", bindKey: bindKey("Alt-F2", "Alt-F2"), exec: function(editor) { editor.session.toggleFoldWidget(true); }, multiSelectAction: "forEach", @@ -12351,6 +11726,13 @@ exports.commands = [{ exec: function(editor) { editor.session.foldAll(); }, scrollIntoView: "center", readOnly: true +}, { + name: "foldAllComments", + description: "Fold all comments", + bindKey: bindKey(null, "Ctrl-Command-Option-0"), + exec: function(editor) { editor.session.foldAllComments(); }, + scrollIntoView: "center", + readOnly: true }, { name: "foldOther", description: "Fold other", @@ -12959,6 +12341,13 @@ exports.commands = [{ exec: function(editor) { editor.toLowerCase(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" +}, { + name: "autoindent", + description: "Auto Indent", + bindKey: bindKey(null, null), + exec: function(editor) { editor.autoIndent(); }, + multiSelectAction: "forEachLine", + scrollIntoView: "animate" }, { name: "expandtoline", description: "Expand to line", @@ -13051,6 +12440,7 @@ exports.commands = [{ scrollIntoView: "none" }, { name: "addLineAfter", + description: "Add new line after the current line", exec: function(editor) { editor.selection.clearSelection(); editor.navigateLineEnd(); @@ -13060,6 +12450,7 @@ exports.commands = [{ scrollIntoView: "cursor" }, { name: "addLineBefore", + description: "Add new line before the current line", exec: function(editor) { editor.selection.clearSelection(); var cursor = editor.getCursorPosition(); @@ -13087,6 +12478,17 @@ exports.commands = [{ readOnly: true }]; +for (var i = 1; i < 9; i++) { + exports.commands.push({ + name: "foldToLevel" + i, + description: "Fold To Level " + i, + level: i, + exec: function(editor) { editor.session.foldToLevel(this.level); }, + scrollIntoView: "center", + readOnly: true + }); +} + }); define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/clipboard"], function(require, exports, module) { @@ -13113,6 +12515,7 @@ var TokenIterator = require("./token_iterator").TokenIterator; var clipboard = require("./clipboard"); var Editor = function(renderer, session, options) { + this.$toDestroy = []; var container = renderer.getContainerElement(); this.container = container; this.renderer = renderer; @@ -13205,8 +12608,8 @@ Editor.$uid = 0; }; this.endOperation = function(e) { - if (this.curOp) { - if (e && e.returnValue === false) + if (this.curOp && this.session) { + if (e && e.returnValue === false || !this.session) return (this.curOp = null); if (e == true && this.curOp.command && this.curOp.command.name == "mouse") return; @@ -13517,25 +12920,33 @@ Editor.$uid = 0; return; } - if (token.type.indexOf("tag-open") != -1) { + if (token.type.indexOf("tag-open") !== -1) { token = iterator.stepForward(); if (!token) return; } var tag = token.value; + var currentTag = token.value; var depth = 0; var prevToken = iterator.stepBackward(); - if (prevToken.value == '<'){ + if (prevToken.value === '<'){ do { prevToken = token; token = iterator.stepForward(); - - if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) { - if (prevToken.value === '<'){ - depth++; - } else if (prevToken.value === '') { // self closing tag depth--; } } @@ -13545,12 +12956,32 @@ Editor.$uid = 0; do { token = prevToken; prevToken = iterator.stepBackward(); - - if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) { - if (prevToken.value === '<') { - depth++; - } else if (prevToken.value === '') { // self closing tag + var stepCount = 0; + var tmpToken = prevToken; + while (tmpToken) { + if (tmpToken.type.indexOf('tag-name') !== -1 && tmpToken.value === tag) { + depth--; + break; + } else if (tmpToken.value === '<') { + break; + } + tmpToken = iterator.stepBackward(); + stepCount++; + } + for (var i = 0; i < stepCount; i++) { + iterator.stepForward(); + } } } } while (prevToken && depth <= 0); @@ -13609,6 +13040,9 @@ Editor.$uid = 0; this.$cursorChange = function() { this.renderer.updateCursor(); + this.$highlightBrackets(); + this.$highlightTags(); + this.$updateHighlightActiveLine(); }; this.onDocumentChange = function(delta) { var wrap = this.session.$useWrapMode; @@ -13617,7 +13051,6 @@ Editor.$uid = 0; this._signal("change", delta); this.$cursorChange(); - this.$updateHighlightActiveLine(); }; this.onTokenizerUpdate = function(e) { @@ -13635,10 +13068,6 @@ Editor.$uid = 0; }; this.onCursorChange = function() { this.$cursorChange(); - - this.$highlightBrackets(); - this.$highlightTags(); - this.$updateHighlightActiveLine(); this._signal("changeSelection"); }; @@ -13777,7 +13206,7 @@ Editor.$uid = 0; } var e = {text: text}; this._signal("copy", e); - clipboard.lineMode = copyLine ? e.text : ""; + clipboard.lineMode = copyLine ? e.text : false; return e.text; }; this.onCopy = function() { @@ -13797,7 +13226,7 @@ Editor.$uid = 0; this._signal("paste", e); var text = e.text; - var lineMode = text == clipboard.lineMode; + var lineMode = text === clipboard.lineMode; var session = this.session; if (!this.inMultiSelectMode || this.inVirtualSelectionMode) { if (lineMode) @@ -13889,16 +13318,62 @@ Editor.$uid = 0; transform.selection[3])); } } + if (this.$enableAutoIndent) { + if (session.getDocument().isNewLine(text)) { + var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); - if (session.getDocument().isNewLine(text)) { - var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); - - session.insert({row: cursor.row+1, column: 0}, lineIndent); + session.insert({row: cursor.row+1, column: 0}, lineIndent); + } + if (shouldOutdent) + mode.autoOutdent(lineState, session, cursor.row); } - if (shouldOutdent) - mode.autoOutdent(lineState, session, cursor.row); }; + this.autoIndent = function () { + var session = this.session; + var mode = session.getMode(); + + var startRow, endRow; + if (this.selection.isEmpty()) { + startRow = 0; + endRow = session.doc.getLength() - 1; + } else { + var selectedRange = this.getSelectionRange(); + + startRow = selectedRange.start.row; + endRow = selectedRange.end.row; + } + + var prevLineState = ""; + var prevLine = ""; + var lineIndent = ""; + var line, currIndent, range; + var tab = session.getTabString(); + + for (var row = startRow; row <= endRow; row++) { + if (row > 0) { + prevLineState = session.getState(row - 1); + prevLine = session.getLine(row - 1); + lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab); + } + + line = session.getLine(row); + currIndent = mode.$getIndent(line); + if (lineIndent !== currIndent) { + if (currIndent.length > 0) { + range = new Range(row, 0, row, currIndent.length); + session.remove(range); + } + if (lineIndent.length > 0) { + session.insert({row: row, column: 0}, lineIndent); + } + } + + mode.autoOutdent(prevLineState, session, row); + } + }; + + this.onTextInput = function(text, composition) { if (!composition) return this.keyBinding.onTextInput(text); @@ -13917,6 +13392,10 @@ Editor.$uid = 0; var r = this.selection.getRange(); r.start.column -= composition.extendLeft; r.end.column += composition.extendRight; + if (r.start.column < 0) { + r.start.row--; + r.start.column += this.session.getLine(r.start.row).length + 1; + } this.selection.setRange(r); if (!text && !r.isEmpty()) this.remove(); @@ -14922,13 +14401,21 @@ Editor.$uid = 0; this.renderer.scrollCursorIntoView(null, 0.5); }; this.destroy = function() { + if (this.$toDestroy) { + this.$toDestroy.forEach(function(el) { + el.destroy(); + }); + this.$toDestroy = null; + } + if (this.$mouseHandler) + this.$mouseHandler.destroy(); this.renderer.destroy(); this._signal("destroy", this); if (this.session) this.session.destroy(); if (this._$emitInputEvent) this._$emitInputEvent.cancel(); - this.session = null; + this.removeAllListeners(); }; this.setAutoScrollEditorIntoView = function(enable) { if (!enable) @@ -15044,6 +14531,7 @@ config.defineOptions(Editor.prototype, "editor", { }, behavioursEnabled: {initialValue: true}, wrapBehavioursEnabled: {initialValue: true}, + enableAutoIndent: {initialValue: true}, autoScrollEditorIntoView: { set: function(val) {this.setAutoScrollEditorIntoView(val);} }, @@ -15088,7 +14576,7 @@ config.defineOptions(Editor.prototype, "editor", { set: function(message) { if (!this.$updatePlaceholder) { this.$updatePlaceholder = function() { - var value = this.renderer.$composition || this.getValue(); + var value = this.session && (this.renderer.$composition || this.getValue()); if (value && this.renderer.placeholderNode) { this.renderer.off("afterRender", this.$updatePlaceholder); dom.removeCssClass(this.container, "ace_hasPlaceholder"); @@ -15102,6 +14590,8 @@ config.defineOptions(Editor.prototype, "editor", { el.textContent = this.$placeholder || ""; this.renderer.placeholderNode = el; this.renderer.content.appendChild(this.renderer.placeholderNode); + } else if (!value && this.renderer.placeholderNode) { + this.renderer.placeholderNode.textContent = this.$placeholder || ""; } }.bind(this); this.on("input", this.$updatePlaceholder); @@ -15276,25 +14766,6 @@ var UndoManager = function() { if (to == null) to = this.$rev + 1; }; - - this.validateDeltaBoundaries = function(deltaSet, docLength, invertAction) { - if (!deltaSet) { - return false; - } - return deltaSet.every(function(delta) { - var action = delta.action; - if (invertAction && delta.action === "insert") action = "remove"; - if (invertAction && delta.action === "remove") action = "insert"; - switch(action) { - case "insert": - return delta.start.row <= docLength; - case "remove": - return delta.start.row < docLength && delta.end.row < docLength; - default: - return true; - } - }); - }; this.undo = function(session, dontSelect) { this.lastDeltas = null; var stack = this.$undoStack; @@ -15312,7 +14783,7 @@ var UndoManager = function() { var deltaSet = stack.pop(); var undoSelectionRange = null; - if (this.validateDeltaBoundaries(deltaSet, session.getLength(), true)) { + if (deltaSet) { undoSelectionRange = session.undoChanges(deltaSet, dontSelect); this.$redoStack.push(deltaSet); this.$syncRev(); @@ -15340,7 +14811,7 @@ var UndoManager = function() { var deltaSet = this.$redoStack.pop(); var redoSelectionRange = null; - if (this.validateDeltaBoundaries(deltaSet, session.getLength(), false)) { + if (deltaSet) { redoSelectionRange = session.redoChanges(deltaSet, dontSelect); this.$undoStack.push(deltaSet); this.$syncRev(); @@ -15840,7 +15311,7 @@ var Gutter = function(parentEl) { this.setSession = function(session) { if (this.session) - this.session.removeEventListener("change", this.$updateAnnotations); + this.session.off("change", this.$updateAnnotations); this.session = session; if (session) session.on("change", this.$updateAnnotations); @@ -16529,11 +16000,21 @@ var Text = function(parentEl) { }; this.showInvisibles = false; + this.showSpaces = false; + this.showTabs = false; + this.showEOL = false; this.setShowInvisibles = function(showInvisibles) { if (this.showInvisibles == showInvisibles) return false; this.showInvisibles = showInvisibles; + if (typeof showInvisibles == "string") { + this.showSpaces = /tab/i.test(showInvisibles); + this.showTabs = /space/i.test(showInvisibles); + this.showEOL = /eol/i.test(showInvisibles); + } else { + this.showSpaces = this.showTabs = this.showEOL = showInvisibles; + } this.$computeTabString(); return true; }; @@ -16555,7 +16036,7 @@ var Text = function(parentEl) { this.tabSize = tabSize; var tabStr = this.$tabStrings = [0]; for (var i = 1; i < tabSize + 1; i++) { - if (this.showInvisibles) { + if (this.showTabs) { var span = this.dom.createElement("span"); span.className = "ace_invisible ace_invisible_tab"; span.textContent = lang.stringRepeat(this.TAB_CHAR, i); @@ -16567,18 +16048,15 @@ var Text = function(parentEl) { if (this.displayIndentGuides) { this.$indentGuideRe = /\s\S| \t|\t |\s$/; var className = "ace_indent-guide"; - var spaceClass = ""; - var tabClass = ""; - if (this.showInvisibles) { - className += " ace_invisible"; - spaceClass = " ace_invisible_space"; - tabClass = " ace_invisible_tab"; - var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize); - var tabContent = lang.stringRepeat(this.TAB_CHAR, this.tabSize); - } else { - var spaceContent = lang.stringRepeat(" ", this.tabSize); - var tabContent = spaceContent; - } + var spaceClass = this.showSpaces ? " ace_invisible ace_invisible_space" : ""; + var spaceContent = this.showSpaces + ? lang.stringRepeat(this.SPACE_CHAR, this.tabSize) + : lang.stringRepeat(" ", this.tabSize); + + var tabClass = this.showTabs ? " ace_invisible ace_invisible_tab" : ""; + var tabContent = this.showTabs + ? lang.stringRepeat(this.TAB_CHAR, this.tabSize) + : spaceContent; var span = this.dom.createElement("span"); span.className = className + spaceClass; @@ -16771,7 +16249,7 @@ var Text = function(parentEl) { var cjkSpace = m[4]; var cjk = m[5]; - if (!self.showInvisibles && simpleSpace) + if (!self.showSpaces && simpleSpace) continue; var before = i != m.index ? value.slice(i, m.index) : ""; @@ -16787,7 +16265,7 @@ var Text = function(parentEl) { valueFragment.appendChild(self.$tabStrings[tabSize].cloneNode(true)); screenColumn += tabSize - 1; } else if (simpleSpace) { - if (self.showInvisibles) { + if (self.showSpaces) { var span = this.dom.createElement("span"); span.className = "ace_invisible ace_invisible_space"; span.textContent = lang.stringRepeat(self.SPACE_CHAR, simpleSpace.length); @@ -16805,8 +16283,8 @@ var Text = function(parentEl) { var span = this.dom.createElement("span"); span.style.width = (self.config.characterWidth * 2) + "px"; - span.className = self.showInvisibles ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk"; - span.textContent = self.showInvisibles ? self.SPACE_CHAR : cjkSpace; + span.className = self.showSpaces ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk"; + span.textContent = self.showSpaces ? self.SPACE_CHAR : cjkSpace; valueFragment.appendChild(span); } else if (cjk) { screenColumn += 1; @@ -16975,7 +16453,7 @@ var Text = function(parentEl) { parent.appendChild(lastLineEl); } - if (this.showInvisibles && lastLineEl) { + if (this.showEOL && lastLineEl) { if (foldLine) row = foldLine.end.row; @@ -17092,12 +16570,16 @@ var Cursor = function(parentEl) { for (var i = cursors.length; i--; ) cursors[i].style.animationDuration = this.blinkInterval + "ms"; + this.$isAnimating = true; setTimeout(function() { - dom.addCssClass(this.element, "ace_animate-blinking"); + if (this.$isAnimating) { + dom.addCssClass(this.element, "ace_animate-blinking"); + } }.bind(this)); }; this.$stopCssAnimation = function() { + this.$isAnimating = false; dom.removeCssClass(this.element, "ace_animate-blinking"); }; @@ -17168,6 +16650,7 @@ var Cursor = function(parentEl) { this.$stopCssAnimation(); if (this.smoothBlinking) { + this.$isSmoothBlinking = false; dom.removeCssClass(this.element, "ace_smooth-blinking"); } @@ -17179,8 +16662,11 @@ var Cursor = function(parentEl) { } if (this.smoothBlinking) { - setTimeout(function(){ - dom.addCssClass(this.element, "ace_smooth-blinking"); + this.$isSmoothBlinking = true; + setTimeout(function() { + if (this.$isSmoothBlinking) { + dom.addCssClass(this.element, "ace_smooth-blinking"); + } }.bind(this)); } @@ -17506,7 +16992,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) { this.el.appendChild(this.$measureNode); parentEl.appendChild(this.el); - this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT); + this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT); this.$characterSize = {width: 0, height: 0}; @@ -17555,11 +17041,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) { this.$addObserver = function() { var self = this; this.$observer = new window.ResizeObserver(function(e) { - var rect = e[0].contentRect; - self.checkForSizeChanges({ - height: rect.height, - width: rect.width / CHAR_COUNT - }); + self.checkForSizeChanges(); }); this.$observer.observe(this.$measureNode); }; @@ -17595,7 +17077,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) { }; this.$measureCharWidth = function(ch) { - this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT); + this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT); var rect = this.$main.getBoundingClientRect(); return rect.width / CHAR_COUNT; }; @@ -17618,7 +17100,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) { this.$getZoom = function getZoom(element) { - if (!element) return 1; + if (!element || !element.parentElement) return 1; return (window.getComputedStyle(element).zoom || 1) * getZoom(element.parentElement); }; this.$initTransformMeasureNodes = function() { @@ -17712,6 +17194,7 @@ var editorCss = "\ .ace_editor {\ position: relative;\ overflow: hidden;\ +padding: 0;\ font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\ direction: ltr;\ text-align: left;\ @@ -18184,7 +17667,7 @@ margin: 0 10px;\ var useragent = require("./lib/useragent"); var HIDE_TEXTAREA = useragent.isIE; -dom.importCssString(editorCss, "ace_editor.css"); +dom.importCssString(editorCss, "ace_editor.css", false); var VirtualRenderer = function(container, theme) { var _self = this; @@ -18195,6 +17678,8 @@ var VirtualRenderer = function(container, theme) { if (dom.HI_DPI) dom.addCssClass(this.container, "ace_hidpi"); this.setTheme(theme); + if (config.get("useStrictCSP") == null) + config.set("useStrictCSP", false); this.$gutter = dom.createElement("div"); this.$gutter.className = "ace_gutter"; @@ -18227,11 +17712,11 @@ var VirtualRenderer = function(container, theme) { this.scrollBar = this.scrollBarV = new VScrollBar(this.container, this); this.scrollBarH = new HScrollBar(this.container, this); - this.scrollBarV.addEventListener("scroll", function(e) { + this.scrollBarV.on("scroll", function(e) { if (!_self.$scrollAnimation) _self.session.setScrollTop(e.data - _self.scrollMargin.top); }); - this.scrollBarH.addEventListener("scroll", function(e) { + this.scrollBarH.on("scroll", function(e) { if (!_self.$scrollAnimation) _self.session.setScrollLeft(e.data - _self.scrollMargin.left); }); @@ -18246,7 +17731,7 @@ var VirtualRenderer = function(container, theme) { this.$fontMetrics = new FontMetrics(this.container); this.$textLayer.$setFontMetrics(this.$fontMetrics); - this.$textLayer.addEventListener("changeCharacterSize", function(e) { + this.$textLayer.on("changeCharacterSize", function(e) { _self.updateCharacterSize(); _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height); _self._signal("changeCharacterSize", e); @@ -18446,7 +17931,7 @@ var VirtualRenderer = function(container, theme) { if (this.resizing) this.resizing = 0; - this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null; + this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null; }; this.$updateCachedSize = function(force, gutterWidth, width, height) { @@ -19183,6 +18668,8 @@ var VirtualRenderer = function(container, theme) { _self.session.setScrollTop(steps.shift()); _self.session.$scrollTop = toValue; this.$timer = setInterval(function() { + if (!_self.session) + return clearInterval(_self.$timer); if (steps.length) { _self.session.setScrollTop(steps.shift()); _self.session.$scrollTop = toValue; @@ -19210,7 +18697,7 @@ var VirtualRenderer = function(container, theme) { }; this.scrollTo = function(x, y) { this.session.setScrollTop(y); - this.session.setScrollLeft(y); + this.session.setScrollLeft(x); }; this.scrollBy = function(deltaX, deltaY) { deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY); @@ -19293,7 +18780,8 @@ var VirtualRenderer = function(container, theme) { if (!composition.cssText) { composition.cssText = this.textarea.style.cssText; } - composition.useTextareaForIME = this.$useTextareaForIME; + if (composition.useTextareaForIME == undefined) + composition.useTextareaForIME = this.$useTextareaForIME; if (this.$useTextareaForIME) { dom.addCssClass(this.textarea, "ace_composition"); @@ -19319,6 +18807,8 @@ var VirtualRenderer = function(container, theme) { dom.removeCssClass(this.textarea, "ace_composition"); this.textarea.style.cssText = this.$composition.cssText; + var cursor = this.session.selection.cursor; + this.removeExtraToken(cursor.row, cursor.column); this.$composition = null; this.$cursorLayer.element.style.display = ""; }; @@ -19347,6 +18837,10 @@ var VirtualRenderer = function(container, theme) { } this.updateLines(row, row); }; + + this.removeExtraToken = function(row, column) { + this.updateLines(row, row); + }; this.setTheme = function(theme, cb) { var _self = this; this.$themeId = theme; @@ -19417,6 +18911,8 @@ var VirtualRenderer = function(container, theme) { this.freeze(); this.$fontMetrics.destroy(); this.$cursorLayer.destroy(); + this.removeAllListeners(); + this.container.textContent = ""; }; }).call(VirtualRenderer.prototype); @@ -19943,8 +19439,8 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) this.detach = function() { this.session.removeMarker(this.pos && this.pos.markerId); this.hideOtherMarkers(); - this.doc.removeEventListener("change", this.$onUpdate); - this.session.selection.removeEventListener("changeCursor", this.$onCursorChange); + this.doc.off("change", this.$onUpdate); + this.session.selection.off("changeCursor", this.$onCursorChange); this.session.setUndoSelect(true); this.session = null; }; @@ -20998,10 +20494,10 @@ function addAltCursorListeners(editor){ } else if (altCursor) { reset(); } - }); + }, editor); - event.addListener(el, "keyup", reset); - event.addListener(el, "blur", reset); + event.addListener(el, "keyup", reset, editor); + event.addListener(el, "blur", reset, editor); function reset(e) { if (altCursor) { editor.renderer.setMouseCursor(""); @@ -21259,7 +20755,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ exports.$id = "ace/theme/textmate"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); define("ace/line_widgets",["require","exports","module","ace/lib/dom"], function(require, exports, module) { @@ -21806,7 +21302,7 @@ dom.importCssString("\ border-left-color: transparent!important;\ top: -5px;\ }\ -", ""); +", "error_marker.css", false); }); diff --git a/htdocs/includes/ace/src/ext-beautify.js b/htdocs/includes/ace/src/ext-beautify.js index a39074326a2..674cf671131 100644 --- a/htdocs/includes/ace/src/ext-beautify.js +++ b/htdocs/includes/ace/src/ext-beautify.js @@ -40,16 +40,28 @@ exports.beautify = function(session) { var inBlock = false; var levels = {0: 0}; var parents = []; + var caseBody = false; var trimNext = function() { if (nextToken && nextToken.value && nextToken.type !== 'string.regexp') - nextToken.value = nextToken.value.trim(); + nextToken.value = nextToken.value.replace(/^\s*/, ""); }; - + var trimLine = function() { - code = code.replace(/ +$/, ""); - }; + var end = code.length - 1; + while (true) { + if (end == 0) + break; + if (code[end] !== " ") + break; + + end = end - 1; + } + + code = code.slice(0, end + 1); + }; + var trimCode = function() { code = code.trimRight(); breakBefore = false; @@ -201,8 +213,11 @@ exports.beautify = function(session) { trimLine(); if(value === "/>") spaceBefore = true; + } else if (token.type === "keyword" && value.match(/^(case|default)$/)) { + if (caseBody) + unindent = 1; } - if (breakBefore && !(token.type.match(/^(comment)$/) && !value.substr(0, 1).match(/^[/#]$/)) && !(token.type.match(/^(string)$/) && !value.substr(0, 1).match(/^['"]$/))) { + if (breakBefore && !(token.type.match(/^(comment)$/) && !value.substr(0, 1).match(/^[/#]$/)) && !(token.type.match(/^(string)$/) && !value.substr(0, 1).match(/^['"@]$/))) { indent = lastIndent; @@ -229,16 +244,16 @@ exports.beautify = function(session) { code += tabString; } - if (token.type === "keyword" && value.match(/^(case|default)$/)) { - parents[depth] = value; - depth++; - } - - - if (token.type === "keyword" && value.match(/^(break)$/)) { + if (caseBody === false) { + parents[depth] = value; + depth++; + caseBody = true; + } + } else if (token.type === "keyword" && value.match(/^(break)$/)) { if(parents[depth-1] && parents[depth-1].match(/^(case|default)$/)) { depth--; + caseBody = false; } } if (token.type === "paren.lparen") { @@ -264,6 +279,9 @@ exports.beautify = function(session) { } } } + + if (token.type == "text") + value = value.replace(/\s+$/, " "); if (spaceBefore && !breakBefore) { trimLine(); if (code.substr(-1) !== "\n") diff --git a/htdocs/includes/ace/src/ext-code_lens.js b/htdocs/includes/ace/src/ext-code_lens.js index 4b7e4340f22..ee4653d8595 100644 --- a/htdocs/includes/ace/src/ext-code_lens.js +++ b/htdocs/includes/ace/src/ext-code_lens.js @@ -1,6 +1,7 @@ -define("ace/ext/code_lens",["require","exports","module","ace/line_widgets","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"], function(require, exports, module) { +define("ace/ext/code_lens",["require","exports","module","ace/line_widgets","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"], function(require, exports, module) { "use strict"; var LineWidgets = require("../line_widgets").LineWidgets; +var event = require("../lib/event"); var lang = require("../lib/lang"); var dom = require("../lib/dom"); @@ -120,12 +121,14 @@ exports.setLenses = function(session, lenses) { function attachToEditor(editor) { editor.codeLensProviders = []; editor.renderer.on("afterRender", renderWidgets); - editor.$codeLensClickHandler = function(e) { - var command = e.target.lensCommand; - if (command) - editor.execCommand(command.id, command.arguments); - }; - editor.container.addEventListener("click", editor.$codeLensClickHandler); + if (!editor.$codeLensClickHandler) { + editor.$codeLensClickHandler = function(e) { + var command = e.target.lensCommand; + if (command) + editor.execCommand(command.id, command.arguments); + }; + event.addListener(editor.container, "click", editor.$codeLensClickHandler, editor); + } editor.$updateLenses = function() { var session = editor.session; if (!session) return; @@ -138,8 +141,9 @@ function attachToEditor(editor) { var providersToWaitNum = editor.codeLensProviders.length; var lenses = []; editor.codeLensProviders.forEach(function(provider) { - provider.provideCodeLenses(session, function(currentLenses) { - currentLenses.forEach(function(lens) { + provider.provideCodeLenses(session, function(err, payload) { + if (err) return; + payload.forEach(function(lens) { lenses.push(lens); }); providersToWaitNum--; @@ -222,7 +226,7 @@ dom.importCssString("\ .ace_dark > .ace_codeLens > a:hover {\ color: #4e94ce;\ }\ -", ""); +", "codelense.css", false); }); (function() { window.require(["ace/ext/code_lens"], function(m) { diff --git a/htdocs/includes/ace/src/ext-emmet.js b/htdocs/includes/ace/src/ext-emmet.js index 3cb3818d1b5..68fc0ff1367 100644 --- a/htdocs/includes/ace/src/ext-emmet.js +++ b/htdocs/includes/ace/src/ext-emmet.js @@ -1,5 +1,6 @@ -define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/lib/dom","ace/editor"], function(require, exports, module) { +define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module) { "use strict"; +var dom = require("./lib/dom"); var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var lang = require("./lib/lang"); @@ -144,7 +145,9 @@ var SnippetManager = function() { {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) { var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) { return operator.length == 2 ? operator[1] : "\x00"; - }).split("\x00"); + }).split("\x00").map(function(value){ + return {value: value}; + }); stack[0].choices = choices; return [choices[0]]; }, next: "start"}, @@ -615,6 +618,12 @@ var SnippetManager = function() { } snippetMap[scope].push(s); + if (s.prefix) + s.tabTrigger = s.prefix; + + if (!s.content && s.body) + s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body; + if (s.tabTrigger && !s.trigger) { if (!s.guard && /^\w/.test(s.tabTrigger)) s.guard = "\\b"; @@ -631,10 +640,13 @@ var SnippetManager = function() { s.endTriggerRe = new RegExp(s.endTrigger); } - if (snippets && snippets.content) - addSnippet(snippets); - else if (Array.isArray(snippets)) + if (Array.isArray(snippets)) { snippets.forEach(addSnippet); + } else { + Object.keys(snippets).forEach(function(key) { + addSnippet(snippets[key]); + }); + } this._signal("registerSnippets", {scope: scope}); }; @@ -684,7 +696,7 @@ var SnippetManager = function() { snippet.tabTrigger = val.match(/^\S*/)[0]; if (!snippet.name) snippet.name = val; - } else { + } else if (key) { snippet[key] = val; } } @@ -833,18 +845,17 @@ var TabstopManager = function(editor) { this.selectedTabstop = ts; var range = ts.firstNonLinked || ts; + if (ts.choices) range.cursor = range.start; if (!this.editor.inVirtualSelectionMode) { var sel = this.editor.multiSelect; - sel.toSingleRange(range.clone()); + sel.toSingleRange(range); for (var i = 0; i < ts.length; i++) { if (ts.hasLinkedRanges && ts[i].linked) continue; sel.addRange(ts[i].clone(), true); } - if (sel.ranges[0]) - sel.addRange(sel.ranges[0].clone()); } else { - this.editor.selection.setRange(range); + this.editor.selection.fromOrientedRange(range); } this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); @@ -971,14 +982,14 @@ var moveRelative = function(point, start) { }; -require("./lib/dom").importCssString("\ +dom.importCssString("\ .ace_snippet-marker {\ -moz-box-sizing: border-box;\ box-sizing: border-box;\ background: rgba(194, 193, 208, 0.09);\ border: 1px dotted rgba(211, 208, 235, 0.62);\ position: absolute;\ -}"); +}", "snippets.css", false); exports.snippetManager = new SnippetManager(); diff --git a/htdocs/includes/ace/src/ext-hardwrap.js b/htdocs/includes/ace/src/ext-hardwrap.js new file mode 100644 index 00000000000..a2037b9113e --- /dev/null +++ b/htdocs/includes/ace/src/ext-hardwrap.js @@ -0,0 +1,125 @@ +define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +function hardWrap(editor, options) { + var max = options.column || editor.getOption("printMarginColumn"); + var allowMerge = options.allowMerge != false; + + var row = Math.min(options.startRow, options.endRow); + var endRow = Math.max(options.startRow, options.endRow); + + var session = editor.session; + + while (row <= endRow) { + var line = session.getLine(row); + if (line.length > max) { + var space = findSpace(line, max, 5); + if (space) { + var indentation = /^\s*/.exec(line)[0]; + session.replace(new Range(row,space.start,row,space.end), "\n" + indentation); + } + endRow++; + } else if (allowMerge && /\S/.test(line) && row != endRow) { + var nextLine = session.getLine(row + 1); + if (nextLine && /\S/.test(nextLine)) { + var trimmedLine = line.replace(/\s+$/, ""); + var trimmedNextLine = nextLine.replace(/^\s+/, ""); + var mergedLine = trimmedLine + " " + trimmedNextLine; + + var space = findSpace(mergedLine, max, 5); + if (space && space.start > trimmedLine.length || mergedLine.length < max) { + var replaceRange = new Range(row,trimmedLine.length,row + 1,nextLine.length - trimmedNextLine.length); + session.replace(replaceRange, " "); + row--; + endRow--; + } else if (trimmedLine.length < line.length) { + session.remove(new Range(row, trimmedLine.length, row, line.length)); + } + } + } + row++; + } + + function findSpace(line, max, min) { + if (line.length < max) + return; + var before = line.slice(0, max); + var after = line.slice(max); + var spaceAfter = /^(?:(\s+)|(\S+)(\s+))/.exec(after); + var spaceBefore = /(?:(\s+)|(\s+)(\S+))$/.exec(before); + var start = 0; + var end = 0; + if (spaceBefore && !spaceBefore[2]) { + start = max - spaceBefore[1].length; + end = max; + } + if (spaceAfter && !spaceAfter[2]) { + if (!start) + start = max; + end = max + spaceAfter[1].length; + } + if (start) { + return { + start: start, + end: end + }; + } + if (spaceBefore && spaceBefore[2] && spaceBefore.index > min) { + return { + start: spaceBefore.index, + end: spaceBefore.index + spaceBefore[2].length + }; + } + if (spaceAfter && spaceAfter[2]) { + start = max + spaceAfter[2].length; + return { + start: start, + end: start + spaceAfter[3].length + }; + } + } + +} + +function wrapAfterInput(e) { + if (e.command.name == "insertstring" && /\S/.test(e.args)) { + var editor = e.editor; + var cursor = editor.selection.cursor; + if (cursor.column <= editor.renderer.$printMarginColumn) return; + var lastDelta = editor.session.$undoManager.$lastDelta; + + hardWrap(editor, { + startRow: cursor.row, endRow: cursor.row, + allowMerge: false + }); + if (lastDelta != editor.session.$undoManager.$lastDelta) + editor.session.markUndoGroup(); + } +} + +var Editor = require("../editor").Editor; +require("../config").defineOptions(Editor.prototype, "editor", { + hardWrap: { + set: function(val) { + if (val) { + this.commands.on("afterExec", wrapAfterInput); + } else { + this.commands.off("afterExec", wrapAfterInput); + } + }, + value: false + } +}); + +exports.hardWrap = hardWrap; + +}); (function() { + window.require(["ace/ext/hardwrap"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/ext-keybinding_menu.js b/htdocs/includes/ace/src/ext-keybinding_menu.js index 4f980686e68..b9ad46ee724 100644 --- a/htdocs/includes/ace/src/ext-keybinding_menu.js +++ b/htdocs/includes/ace/src/ext-keybinding_menu.js @@ -61,7 +61,7 @@ margin: 0px;\ .ace_optionsMenuEntry button:hover{\ background: #f0f0f0;\ }"; -dom.importCssString(cssText); +dom.importCssString(cssText, "settings_menu.css", false); module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); diff --git a/htdocs/includes/ace/src/ext-language_tools.js b/htdocs/includes/ace/src/ext-language_tools.js index 7e6967e0d7a..b561c3bc87d 100644 --- a/htdocs/includes/ace/src/ext-language_tools.js +++ b/htdocs/includes/ace/src/ext-language_tools.js @@ -1,5 +1,6 @@ -define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/lib/dom","ace/editor"], function(require, exports, module) { +define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module) { "use strict"; +var dom = require("./lib/dom"); var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var lang = require("./lib/lang"); @@ -144,7 +145,9 @@ var SnippetManager = function() { {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) { var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) { return operator.length == 2 ? operator[1] : "\x00"; - }).split("\x00"); + }).split("\x00").map(function(value){ + return {value: value}; + }); stack[0].choices = choices; return [choices[0]]; }, next: "start"}, @@ -615,6 +618,12 @@ var SnippetManager = function() { } snippetMap[scope].push(s); + if (s.prefix) + s.tabTrigger = s.prefix; + + if (!s.content && s.body) + s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body; + if (s.tabTrigger && !s.trigger) { if (!s.guard && /^\w/.test(s.tabTrigger)) s.guard = "\\b"; @@ -631,10 +640,13 @@ var SnippetManager = function() { s.endTriggerRe = new RegExp(s.endTrigger); } - if (snippets && snippets.content) - addSnippet(snippets); - else if (Array.isArray(snippets)) + if (Array.isArray(snippets)) { snippets.forEach(addSnippet); + } else { + Object.keys(snippets).forEach(function(key) { + addSnippet(snippets[key]); + }); + } this._signal("registerSnippets", {scope: scope}); }; @@ -684,7 +696,7 @@ var SnippetManager = function() { snippet.tabTrigger = val.match(/^\S*/)[0]; if (!snippet.name) snippet.name = val; - } else { + } else if (key) { snippet[key] = val; } } @@ -833,18 +845,17 @@ var TabstopManager = function(editor) { this.selectedTabstop = ts; var range = ts.firstNonLinked || ts; + if (ts.choices) range.cursor = range.start; if (!this.editor.inVirtualSelectionMode) { var sel = this.editor.multiSelect; - sel.toSingleRange(range.clone()); + sel.toSingleRange(range); for (var i = 0; i < ts.length; i++) { if (ts.hasLinkedRanges && ts[i].linked) continue; sel.addRange(ts[i].clone(), true); } - if (sel.ranges[0]) - sel.addRange(sel.ranges[0].clone()); } else { - this.editor.selection.setRange(range); + this.editor.selection.fromOrientedRange(range); } this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); @@ -971,14 +982,14 @@ var moveRelative = function(point, start) { }; -require("./lib/dom").importCssString("\ +dom.importCssString("\ .ace_snippet-marker {\ -moz-box-sizing: border-box;\ box-sizing: border-box;\ background: rgba(194, 193, 208, 0.09);\ border: 1px dotted rgba(211, 208, 235, 0.62);\ position: absolute;\ -}"); +}", "snippets.css", false); exports.snippetManager = new SnippetManager(); @@ -1330,7 +1341,7 @@ dom.importCssString("\ line-height: 1.4;\ background: #25282c;\ color: #c1c1c1;\ -}", "autocompletion.css"); +}", "autocompletion.css", false); exports.AcePopup = AcePopup; exports.$singleLineEditor = $singleLineEditor; @@ -1476,6 +1487,7 @@ var Autocomplete = function() { } else if (keepPopupPosition && !prefix) { this.detach(); } + this.changeTimer.cancel(); }; this.detach = function() { @@ -1538,13 +1550,15 @@ var Autocomplete = function() { if (!data) return false; + var completions = this.completions; + this.editor.startOperation({command: {name: "insertMatch"}}); if (data.completer && data.completer.insertMatch) { data.completer.insertMatch(this.editor, data); } else { - if (this.completions.filterText) { + if (completions.filterText) { var ranges = this.editor.selection.getAllRanges(); for (var i = 0, range; range = ranges[i]; i++) { - range.start.column -= this.completions.filterText.length; + range.start.column -= completions.filterText.length; this.editor.session.remove(range); } } @@ -1553,7 +1567,9 @@ var Autocomplete = function() { else this.editor.execCommand("insertstring", data.value || data); } - this.detach(); + if (this.completions == completions) + this.detach(); + this.editor.endOperation(); }; @@ -1649,19 +1665,14 @@ var Autocomplete = function() { return this.openPopup(this.editor, "", keepPopupPosition); } var _id = this.gatherCompletionsId; - this.gatherCompletions(this.editor, function(err, results) { - var detachIfFinished = function() { - if (!results.finished) return; - return this.detach(); - }.bind(this); + var detachIfFinished = function(results) { + if (!results.finished) return; + return this.detach(); + }.bind(this); + var processResults = function(results) { var prefix = results.prefix; - var matches = results && results.matches; - - if (!matches || !matches.length) - return detachIfFinished(); - if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) - return; + var matches = results.matches; this.completions = new FilteredList(matches); @@ -1671,14 +1682,39 @@ var Autocomplete = function() { this.completions.setFilter(prefix); var filtered = this.completions.filtered; if (!filtered.length) - return detachIfFinished(); + return detachIfFinished(results); if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet) - return detachIfFinished(); + return detachIfFinished(results); if (this.autoInsert && filtered.length == 1 && results.finished) return this.insertMatch(filtered[0]); this.openPopup(this.editor, prefix, keepPopupPosition); + }.bind(this); + + var isImmediate = true; + var immediateResults = null; + this.gatherCompletions(this.editor, function(err, results) { + var prefix = results.prefix; + var matches = results && results.matches; + + if (!matches || !matches.length) + return detachIfFinished(results); + if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) + return; + if (isImmediate) { + immediateResults = results; + return; + } + + processResults(results); }.bind(this)); + + isImmediate = false; + if (immediateResults) { + var results = immediateResults; + immediateResults = null; + processResults(results); + } }; this.cancelContextMenu = function() { @@ -2032,31 +2068,33 @@ var onChangeMode = function(e, editor) { }; var loadSnippetsForMode = function(mode) { - var id = mode.$id; + if (typeof mode == "string") + mode = config.$modes[mode]; + if (!mode) + return; if (!snippetManager.files) snippetManager.files = {}; - loadSnippetFile(id); + + loadSnippetFile(mode.$id, mode.snippetFileId); if (mode.modes) mode.modes.forEach(loadSnippetsForMode); }; -var loadSnippetFile = function(id) { - if (!id || snippetManager.files[id]) +var loadSnippetFile = function(id, snippetFilePath) { + if (!snippetFilePath || !id || snippetManager.files[id]) return; - var snippetFilePath = id.replace("mode", "snippets"); snippetManager.files[id] = {}; config.loadModule(snippetFilePath, function(m) { - if (m) { - snippetManager.files[id] = m; - if (!m.snippets && m.snippetText) - m.snippets = snippetManager.parseSnippetFile(m.snippetText); - snippetManager.register(m.snippets || [], m.scope); - if (m.includeScopes) { - snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes; - m.includeScopes.forEach(function(x) { - loadSnippetFile("ace/mode/" + x); - }); - } + if (!m) return; + snippetManager.files[id] = m; + if (!m.snippets && m.snippetText) + m.snippets = snippetManager.parseSnippetFile(m.snippetText); + snippetManager.register(m.snippets || [], m.scope); + if (m.includeScopes) { + snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes; + m.includeScopes.forEach(function(x) { + loadSnippetsForMode("ace/mode/" + x); + }); } }); }; diff --git a/htdocs/includes/ace/src/ext-modelist.js b/htdocs/includes/ace/src/ext-modelist.js index 8b771ffeb99..064e398db75 100644 --- a/htdocs/includes/ace/src/ext-modelist.js +++ b/htdocs/includes/ace/src/ext-modelist.js @@ -39,22 +39,23 @@ var supportedModes = { ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], + Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], - AsciiDoc: ["asciidoc|adoc"], - ASL: ["dsl|asl"], - Assembly_x86:["asm|a"], - AutoHotKey: ["ahk"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], + AsciiDoc: ["asciidoc|adoc"], + ASL: ["dsl|asl|asl.json"], + Assembly_x86:["asm|a"], + AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], - Crystal: ["cr"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], + Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], @@ -101,8 +102,8 @@ var supportedModes = { Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], - JSON5: ["json5"], JSON: ["json"], + JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], @@ -110,6 +111,7 @@ var supportedModes = { Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], + Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -124,32 +126,36 @@ var supportedModes = { Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], + MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], + MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nginx: ["nginx|conf"], - Nix: ["nix"], Nim: ["nim"], + Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], - Perl6: ["p6|pl6|pm6"], pgSQL: ["pgsql"], - PHP_Laravel_blade: ["blade.php"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], - Puppet: ["epp|pp"], + PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], + Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], + Puppet: ["epp|pp"], Python: ["py"], + QML: ["qml"], R: ["r"], + Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], @@ -161,11 +167,13 @@ var supportedModes = { SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], + Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], + Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], @@ -181,7 +189,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], - Twig: ["latte|twig|swig"], + Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], @@ -213,6 +221,7 @@ var nameOverrides = { Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; + var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; diff --git a/htdocs/includes/ace/src/ext-options.js b/htdocs/includes/ace/src/ext-options.js index d1d01cefa05..d200e821a3e 100644 --- a/htdocs/includes/ace/src/ext-options.js +++ b/htdocs/includes/ace/src/ext-options.js @@ -61,7 +61,7 @@ margin: 0px;\ .ace_optionsMenuEntry button:hover{\ background: #f0f0f0;\ }"; -dom.importCssString(cssText); +dom.importCssString(cssText, "settings_menu.css", false); module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); @@ -160,22 +160,23 @@ var supportedModes = { ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], + Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], - AsciiDoc: ["asciidoc|adoc"], - ASL: ["dsl|asl"], - Assembly_x86:["asm|a"], - AutoHotKey: ["ahk"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], + AsciiDoc: ["asciidoc|adoc"], + ASL: ["dsl|asl|asl.json"], + Assembly_x86:["asm|a"], + AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], - Crystal: ["cr"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], + Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], @@ -222,8 +223,8 @@ var supportedModes = { Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], - JSON5: ["json5"], JSON: ["json"], + JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], @@ -231,6 +232,7 @@ var supportedModes = { Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], + Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -245,32 +247,36 @@ var supportedModes = { Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], + MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], + MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nginx: ["nginx|conf"], - Nix: ["nix"], Nim: ["nim"], + Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], - Perl6: ["p6|pl6|pm6"], pgSQL: ["pgsql"], - PHP_Laravel_blade: ["blade.php"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], - Puppet: ["epp|pp"], + PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], + Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], + Puppet: ["epp|pp"], Python: ["py"], + QML: ["qml"], R: ["r"], + Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], @@ -282,11 +288,13 @@ var supportedModes = { SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], + Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], + Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], @@ -302,7 +310,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], - Twig: ["latte|twig|swig"], + Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], @@ -334,6 +342,7 @@ var nameOverrides = { Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; + var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; @@ -367,7 +376,7 @@ var themeData = [ ["Solarized Light"], ["TextMate" ], ["Tomorrow" ], - ["XCode" ], + ["Xcode" ], ["Kuroir"], ["KatzenMilch"], ["SQL Server" ,"sqlserver" , "light"], @@ -384,6 +393,8 @@ var themeData = [ ["Merbivore Soft" ,"merbivore_soft" , "dark"], ["Mono Industrial" ,"mono_industrial" , "dark"], ["Monokai" ,"monokai" , "dark"], + ["Nord Dark" ,"nord_dark" , "dark"], + ["One Dark" ,"one_dark" , "dark"], ["Pastel on dark" ,"pastel_on_dark" , "dark"], ["Solarized Dark" ,"solarized_dark" , "dark"], ["Terminal" ,"terminal" , "dark"], @@ -498,6 +509,7 @@ var optionGroups = { "Soft Tabs": [{ path: "useSoftTabs" }, { + ariaLabel: "Tab Size", path: "tabSize", type: "number", values: [2, 3, 4, 8, 16] @@ -519,6 +531,12 @@ var optionGroups = { "Enable Behaviours": { path: "behavioursEnabled" }, + "Wrap with quotes": { + path: "wrapBehavioursEnabled" + }, + "Enable Auto Indent": { + path: "enableAutoIndent" + }, "Full Line Selection": { type: "checkbox", values: "text|line", @@ -533,11 +551,12 @@ var optionGroups = { "Show Indent Guides": { path: "displayIndentGuides" }, - "Persistent Scrollbar": [{ + "Persistent HScrollbar": { path: "hScrollBarAlwaysVisible" - }, { + }, + "Persistent VScrollbar": { path: "vScrollBarAlwaysVisible" - }], + }, "Animate scrolling": { path: "animatedScroll" }, @@ -556,6 +575,7 @@ var optionGroups = { "Show Print Margin": [{ path: "showPrintMargin" }, { + ariaLabel: "Print Margin", type: "number", path: "printMarginColumn" }], @@ -618,10 +638,10 @@ var OptionPanel = function(editor, element) { this.render = function() { this.container.innerHTML = ""; - buildDom(["table", {id: "controls"}, + buildDom(["table", {role: "presentation", id: "controls"}, this.renderOptionGroup(optionGroups.Main), ["tr", null, ["td", {colspan: 2}, - ["table", {id: "more-controls"}, + ["table", {role: "presentation", id: "more-controls"}, this.renderOptionGroup(optionGroups.More) ] ]], @@ -664,17 +684,20 @@ var OptionPanel = function(editor, element) { } if (option.type == "buttonBar") { - control = ["div", option.items.map(function(item) { + control = ["div", {role: "group", "aria-labelledby": option.path + "-label"}, option.items.map(function(item) { return ["button", { value: item.value, ace_selected_button: value == item.value, + 'aria-pressed': value == item.value, onclick: function() { self.setOption(option, item.value); var nodes = this.parentNode.querySelectorAll("[ace_selected_button]"); for (var i = 0; i < nodes.length; i++) { nodes[i].removeAttribute("ace_selected_button"); + nodes[i].setAttribute("aria-pressed", false); } this.setAttribute("ace_selected_button", true); + this.setAttribute("aria-pressed", true); } }, item.desc || item.caption || item.name]; })]; @@ -682,6 +705,11 @@ var OptionPanel = function(editor, element) { control = ["input", {type: "number", value: value || option.defaultValue, style:"width:3em", oninput: function() { self.setOption(option, parseInt(this.value)); }}]; + if (option.ariaLabel) { + control[1]["aria-label"] = option.ariaLabel; + } else { + control[1].id = key; + } if (option.defaults) { control = [control, option.defaults.map(function(item) { return ["button", {onclick: function() { @@ -725,11 +753,13 @@ var OptionPanel = function(editor, element) { this.renderOption = function(key, option) { if (option.path && !option.onchange && !this.editor.$options[option.path]) return; - this.options[option.path] = option; - var safeKey = "-" + option.path; + var path = Array.isArray(option) ? option[0].path : option.path; + this.options[path] = option; + var safeKey = "-" + path; + var safeId = path + "-label"; var control = this.renderOptionControl(safeKey, option); return ["tr", {class: "ace_optionsMenuEntry"}, ["td", - ["label", {for: safeKey}, key] + ["label", {for: safeKey, id: safeId}, key] ], ["td", control]]; }; diff --git a/htdocs/includes/ace/src/ext-prompt.js b/htdocs/includes/ace/src/ext-prompt.js index bcc99f70806..34d7e36d513 100644 --- a/htdocs/includes/ace/src/ext-prompt.js +++ b/htdocs/includes/ace/src/ext-prompt.js @@ -364,7 +364,7 @@ dom.importCssString("\ line-height: 1.4;\ background: #25282c;\ color: #c1c1c1;\ -}", "autocompletion.css"); +}", "autocompletion.css", false); exports.AcePopup = AcePopup; exports.$singleLineEditor = $singleLineEditor; @@ -430,8 +430,9 @@ exports.getCompletionPrefix = function (editor) { }); -define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/lib/dom","ace/editor"], function(require, exports, module) { +define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module) { "use strict"; +var dom = require("./lib/dom"); var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var lang = require("./lib/lang"); @@ -576,7 +577,9 @@ var SnippetManager = function() { {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) { var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) { return operator.length == 2 ? operator[1] : "\x00"; - }).split("\x00"); + }).split("\x00").map(function(value){ + return {value: value}; + }); stack[0].choices = choices; return [choices[0]]; }, next: "start"}, @@ -1047,6 +1050,12 @@ var SnippetManager = function() { } snippetMap[scope].push(s); + if (s.prefix) + s.tabTrigger = s.prefix; + + if (!s.content && s.body) + s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body; + if (s.tabTrigger && !s.trigger) { if (!s.guard && /^\w/.test(s.tabTrigger)) s.guard = "\\b"; @@ -1063,10 +1072,13 @@ var SnippetManager = function() { s.endTriggerRe = new RegExp(s.endTrigger); } - if (snippets && snippets.content) - addSnippet(snippets); - else if (Array.isArray(snippets)) + if (Array.isArray(snippets)) { snippets.forEach(addSnippet); + } else { + Object.keys(snippets).forEach(function(key) { + addSnippet(snippets[key]); + }); + } this._signal("registerSnippets", {scope: scope}); }; @@ -1116,7 +1128,7 @@ var SnippetManager = function() { snippet.tabTrigger = val.match(/^\S*/)[0]; if (!snippet.name) snippet.name = val; - } else { + } else if (key) { snippet[key] = val; } } @@ -1265,18 +1277,17 @@ var TabstopManager = function(editor) { this.selectedTabstop = ts; var range = ts.firstNonLinked || ts; + if (ts.choices) range.cursor = range.start; if (!this.editor.inVirtualSelectionMode) { var sel = this.editor.multiSelect; - sel.toSingleRange(range.clone()); + sel.toSingleRange(range); for (var i = 0; i < ts.length; i++) { if (ts.hasLinkedRanges && ts[i].linked) continue; sel.addRange(ts[i].clone(), true); } - if (sel.ranges[0]) - sel.addRange(sel.ranges[0].clone()); } else { - this.editor.selection.setRange(range); + this.editor.selection.fromOrientedRange(range); } this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler); @@ -1403,14 +1414,14 @@ var moveRelative = function(point, start) { }; -require("./lib/dom").importCssString("\ +dom.importCssString("\ .ace_snippet-marker {\ -moz-box-sizing: border-box;\ box-sizing: border-box;\ background: rgba(194, 193, 208, 0.09);\ border: 1px dotted rgba(211, 208, 235, 0.62);\ position: absolute;\ -}"); +}", "snippets.css", false); exports.snippetManager = new SnippetManager(); @@ -1507,6 +1518,7 @@ var Autocomplete = function() { } else if (keepPopupPosition && !prefix) { this.detach(); } + this.changeTimer.cancel(); }; this.detach = function() { @@ -1569,13 +1581,15 @@ var Autocomplete = function() { if (!data) return false; + var completions = this.completions; + this.editor.startOperation({command: {name: "insertMatch"}}); if (data.completer && data.completer.insertMatch) { data.completer.insertMatch(this.editor, data); } else { - if (this.completions.filterText) { + if (completions.filterText) { var ranges = this.editor.selection.getAllRanges(); for (var i = 0, range; range = ranges[i]; i++) { - range.start.column -= this.completions.filterText.length; + range.start.column -= completions.filterText.length; this.editor.session.remove(range); } } @@ -1584,7 +1598,9 @@ var Autocomplete = function() { else this.editor.execCommand("insertstring", data.value || data); } - this.detach(); + if (this.completions == completions) + this.detach(); + this.editor.endOperation(); }; @@ -1680,19 +1696,14 @@ var Autocomplete = function() { return this.openPopup(this.editor, "", keepPopupPosition); } var _id = this.gatherCompletionsId; - this.gatherCompletions(this.editor, function(err, results) { - var detachIfFinished = function() { - if (!results.finished) return; - return this.detach(); - }.bind(this); + var detachIfFinished = function(results) { + if (!results.finished) return; + return this.detach(); + }.bind(this); + var processResults = function(results) { var prefix = results.prefix; - var matches = results && results.matches; - - if (!matches || !matches.length) - return detachIfFinished(); - if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) - return; + var matches = results.matches; this.completions = new FilteredList(matches); @@ -1702,14 +1713,39 @@ var Autocomplete = function() { this.completions.setFilter(prefix); var filtered = this.completions.filtered; if (!filtered.length) - return detachIfFinished(); + return detachIfFinished(results); if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet) - return detachIfFinished(); + return detachIfFinished(results); if (this.autoInsert && filtered.length == 1 && results.finished) return this.insertMatch(filtered[0]); this.openPopup(this.editor, prefix, keepPopupPosition); + }.bind(this); + + var isImmediate = true; + var immediateResults = null; + this.gatherCompletions(this.editor, function(err, results) { + var prefix = results.prefix; + var matches = results && results.matches; + + if (!matches || !matches.length) + return detachIfFinished(results); + if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) + return; + if (isImmediate) { + immediateResults = results; + return; + } + + processResults(results); }.bind(this)); + + isImmediate = false; + if (immediateResults) { + var results = immediateResults; + immediateResults = null; + processResults(results); + } }; this.cancelContextMenu = function() { @@ -1998,7 +2034,7 @@ margin: 0px;\ .ace_optionsMenuEntry button:hover{\ background: #f0f0f0;\ }"; -dom.importCssString(cssText); +dom.importCssString(cssText, "settings_menu.css", false); module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); @@ -2097,22 +2133,23 @@ var supportedModes = { ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], + Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], - AsciiDoc: ["asciidoc|adoc"], - ASL: ["dsl|asl"], - Assembly_x86:["asm|a"], - AutoHotKey: ["ahk"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], + AsciiDoc: ["asciidoc|adoc"], + ASL: ["dsl|asl|asl.json"], + Assembly_x86:["asm|a"], + AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], - Crystal: ["cr"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], + Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], @@ -2159,8 +2196,8 @@ var supportedModes = { Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], - JSON5: ["json5"], JSON: ["json"], + JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], @@ -2168,6 +2205,7 @@ var supportedModes = { Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], + Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -2182,32 +2220,36 @@ var supportedModes = { Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], + MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], + MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nginx: ["nginx|conf"], - Nix: ["nix"], Nim: ["nim"], + Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], - Perl6: ["p6|pl6|pm6"], pgSQL: ["pgsql"], - PHP_Laravel_blade: ["blade.php"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], - Puppet: ["epp|pp"], + PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], + Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], + Puppet: ["epp|pp"], Python: ["py"], + QML: ["qml"], R: ["r"], + Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], @@ -2219,11 +2261,13 @@ var supportedModes = { SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], + Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], + Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], @@ -2239,7 +2283,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], - Twig: ["latte|twig|swig"], + Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], @@ -2271,6 +2315,7 @@ var nameOverrides = { Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; + var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; @@ -2586,13 +2631,10 @@ prompt.commands = function(editor, callback) { var platform = handler.platform; var cbn = handler.byName; for (var i in cbn) { - var key; - if (cbn[i].bindKey && cbn[i].bindKey[platform] !== null) { - key = cbn[i].bindKey["win"]; - } else { - key = ""; + var key = cbn[i].bindKey; + if (typeof key !== "string") { + key = key && key[platform] || ""; } - var commands = cbn[i]; var description = commands.description || normalizeName(commands.name); if (!Array.isArray(commands)) @@ -2749,7 +2791,7 @@ dom.importCssString(".ace_prompt_container {\ background: white;\ border-radius: 2px;\ box-shadow: 0px 2px 3px 0px #555;\ -}"); +}", "promtp.css", false); exports.prompt = prompt; diff --git a/htdocs/includes/ace/src/ext-searchbox.js b/htdocs/includes/ace/src/ext-searchbox.js index 4fbe7933506..8be7e8c12e7 100644 --- a/htdocs/includes/ace/src/ext-searchbox.js +++ b/htdocs/includes/ace/src/ext-searchbox.js @@ -160,7 +160,7 @@ var keyUtil = require("../lib/keys"); var MAX_COUNT = 999; -dom.importCssString(searchboxCss, "ace_searchbox"); +dom.importCssString(searchboxCss, "ace_searchbox", false); var SearchBox = function(editor, range, showReplaceForm) { var div = dom.createElement("div"); diff --git a/htdocs/includes/ace/src/ext-settings_menu.js b/htdocs/includes/ace/src/ext-settings_menu.js index ebfa4108519..1d88965b63b 100644 --- a/htdocs/includes/ace/src/ext-settings_menu.js +++ b/htdocs/includes/ace/src/ext-settings_menu.js @@ -61,7 +61,7 @@ margin: 0px;\ .ace_optionsMenuEntry button:hover{\ background: #f0f0f0;\ }"; -dom.importCssString(cssText); +dom.importCssString(cssText, "settings_menu.css", false); module.exports.overlayPage = function overlayPage(editor, contentElement, callback) { var closer = document.createElement('div'); @@ -160,22 +160,23 @@ var supportedModes = { ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], + Alda: ["alda"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], - AsciiDoc: ["asciidoc|adoc"], - ASL: ["dsl|asl"], - Assembly_x86:["asm|a"], - AutoHotKey: ["ahk"], Apex: ["apex|cls|trigger|tgr"], AQL: ["aql"], + AsciiDoc: ["asciidoc|adoc"], + ASL: ["dsl|asl|asl.json"], + Assembly_x86:["asm|a"], + AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], - Crystal: ["cr"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], + Crystal: ["cr"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], @@ -222,8 +223,8 @@ var supportedModes = { Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], - JSON5: ["json5"], JSON: ["json"], + JSON5: ["json5"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], @@ -231,6 +232,7 @@ var supportedModes = { Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], + Latte: ["latte"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], @@ -245,32 +247,36 @@ var supportedModes = { Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], + MediaWiki: ["wiki|mediawiki"], MEL: ["mel"], + MIPS: ["s|asm"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nginx: ["nginx|conf"], - Nix: ["nix"], Nim: ["nim"], + Nix: ["nix"], NSIS: ["nsi|nsh"], Nunjucks: ["nunjucks|nunjs|nj|njk"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], - Perl6: ["p6|pl6|pm6"], pgSQL: ["pgsql"], - PHP_Laravel_blade: ["blade.php"], PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], - Puppet: ["epp|pp"], + PHP_Laravel_blade: ["blade.php"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], + Prisma: ["prisma"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], + Puppet: ["epp|pp"], Python: ["py"], + QML: ["qml"], R: ["r"], + Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], @@ -282,11 +288,13 @@ var supportedModes = { SCAD: ["scad"], Scala: ["scala|sbt"], Scheme: ["scm|sm|rkt|oak|scheme"], + Scrypt: ["scrypt"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Slim: ["slim|skim"], Smarty: ["smarty|tpl"], + Smithy: ["smithy"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], @@ -302,7 +310,7 @@ var supportedModes = { Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], - Twig: ["latte|twig|swig"], + Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], @@ -334,6 +342,7 @@ var nameOverrides = { Perl6: "Perl 6", AutoHotKey: "AutoHotkey / AutoIt" }; + var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; @@ -367,7 +376,7 @@ var themeData = [ ["Solarized Light"], ["TextMate" ], ["Tomorrow" ], - ["XCode" ], + ["Xcode" ], ["Kuroir"], ["KatzenMilch"], ["SQL Server" ,"sqlserver" , "light"], @@ -384,6 +393,8 @@ var themeData = [ ["Merbivore Soft" ,"merbivore_soft" , "dark"], ["Mono Industrial" ,"mono_industrial" , "dark"], ["Monokai" ,"monokai" , "dark"], + ["Nord Dark" ,"nord_dark" , "dark"], + ["One Dark" ,"one_dark" , "dark"], ["Pastel on dark" ,"pastel_on_dark" , "dark"], ["Solarized Dark" ,"solarized_dark" , "dark"], ["Terminal" ,"terminal" , "dark"], @@ -498,6 +509,7 @@ var optionGroups = { "Soft Tabs": [{ path: "useSoftTabs" }, { + ariaLabel: "Tab Size", path: "tabSize", type: "number", values: [2, 3, 4, 8, 16] @@ -519,6 +531,12 @@ var optionGroups = { "Enable Behaviours": { path: "behavioursEnabled" }, + "Wrap with quotes": { + path: "wrapBehavioursEnabled" + }, + "Enable Auto Indent": { + path: "enableAutoIndent" + }, "Full Line Selection": { type: "checkbox", values: "text|line", @@ -533,11 +551,12 @@ var optionGroups = { "Show Indent Guides": { path: "displayIndentGuides" }, - "Persistent Scrollbar": [{ + "Persistent HScrollbar": { path: "hScrollBarAlwaysVisible" - }, { + }, + "Persistent VScrollbar": { path: "vScrollBarAlwaysVisible" - }], + }, "Animate scrolling": { path: "animatedScroll" }, @@ -556,6 +575,7 @@ var optionGroups = { "Show Print Margin": [{ path: "showPrintMargin" }, { + ariaLabel: "Print Margin", type: "number", path: "printMarginColumn" }], @@ -618,10 +638,10 @@ var OptionPanel = function(editor, element) { this.render = function() { this.container.innerHTML = ""; - buildDom(["table", {id: "controls"}, + buildDom(["table", {role: "presentation", id: "controls"}, this.renderOptionGroup(optionGroups.Main), ["tr", null, ["td", {colspan: 2}, - ["table", {id: "more-controls"}, + ["table", {role: "presentation", id: "more-controls"}, this.renderOptionGroup(optionGroups.More) ] ]], @@ -664,17 +684,20 @@ var OptionPanel = function(editor, element) { } if (option.type == "buttonBar") { - control = ["div", option.items.map(function(item) { + control = ["div", {role: "group", "aria-labelledby": option.path + "-label"}, option.items.map(function(item) { return ["button", { value: item.value, ace_selected_button: value == item.value, + 'aria-pressed': value == item.value, onclick: function() { self.setOption(option, item.value); var nodes = this.parentNode.querySelectorAll("[ace_selected_button]"); for (var i = 0; i < nodes.length; i++) { nodes[i].removeAttribute("ace_selected_button"); + nodes[i].setAttribute("aria-pressed", false); } this.setAttribute("ace_selected_button", true); + this.setAttribute("aria-pressed", true); } }, item.desc || item.caption || item.name]; })]; @@ -682,6 +705,11 @@ var OptionPanel = function(editor, element) { control = ["input", {type: "number", value: value || option.defaultValue, style:"width:3em", oninput: function() { self.setOption(option, parseInt(this.value)); }}]; + if (option.ariaLabel) { + control[1]["aria-label"] = option.ariaLabel; + } else { + control[1].id = key; + } if (option.defaults) { control = [control, option.defaults.map(function(item) { return ["button", {onclick: function() { @@ -725,11 +753,13 @@ var OptionPanel = function(editor, element) { this.renderOption = function(key, option) { if (option.path && !option.onchange && !this.editor.$options[option.path]) return; - this.options[option.path] = option; - var safeKey = "-" + option.path; + var path = Array.isArray(option) ? option[0].path : option.path; + this.options[path] = option; + var safeKey = "-" + path; + var safeId = path + "-label"; var control = this.renderOptionControl(safeKey, option); return ["tr", {class: "ace_optionsMenuEntry"}, ["td", - ["label", {for: safeKey}, key] + ["label", {for: safeKey, id: safeId}, key] ], ["td", control]]; }; diff --git a/htdocs/includes/ace/src/ext-textarea.js b/htdocs/includes/ace/src/ext-textarea.js index b876bd3854e..c4bc96bdd1a 100644 --- a/htdocs/includes/ace/src/ext-textarea.js +++ b/htdocs/includes/ace/src/ext-textarea.js @@ -1,135 +1,4 @@ -define("ace/theme/textmate",["require","exports","module","ace/lib/dom"], function(require, exports, module) { -"use strict"; - -exports.isDark = false; -exports.cssClass = "ace-tm"; -exports.cssText = ".ace-tm .ace_gutter {\ -background: #f0f0f0;\ -color: #333;\ -}\ -.ace-tm .ace_print-margin {\ -width: 1px;\ -background: #e8e8e8;\ -}\ -.ace-tm .ace_fold {\ -background-color: #6B72E6;\ -}\ -.ace-tm {\ -background-color: #FFFFFF;\ -color: black;\ -}\ -.ace-tm .ace_cursor {\ -color: black;\ -}\ -.ace-tm .ace_invisible {\ -color: rgb(191, 191, 191);\ -}\ -.ace-tm .ace_storage,\ -.ace-tm .ace_keyword {\ -color: blue;\ -}\ -.ace-tm .ace_constant {\ -color: rgb(197, 6, 11);\ -}\ -.ace-tm .ace_constant.ace_buildin {\ -color: rgb(88, 72, 246);\ -}\ -.ace-tm .ace_constant.ace_language {\ -color: rgb(88, 92, 246);\ -}\ -.ace-tm .ace_constant.ace_library {\ -color: rgb(6, 150, 14);\ -}\ -.ace-tm .ace_invalid {\ -background-color: rgba(255, 0, 0, 0.1);\ -color: red;\ -}\ -.ace-tm .ace_support.ace_function {\ -color: rgb(60, 76, 114);\ -}\ -.ace-tm .ace_support.ace_constant {\ -color: rgb(6, 150, 14);\ -}\ -.ace-tm .ace_support.ace_type,\ -.ace-tm .ace_support.ace_class {\ -color: rgb(109, 121, 222);\ -}\ -.ace-tm .ace_keyword.ace_operator {\ -color: rgb(104, 118, 135);\ -}\ -.ace-tm .ace_string {\ -color: rgb(3, 106, 7);\ -}\ -.ace-tm .ace_comment {\ -color: rgb(76, 136, 107);\ -}\ -.ace-tm .ace_comment.ace_doc {\ -color: rgb(0, 102, 255);\ -}\ -.ace-tm .ace_comment.ace_doc.ace_tag {\ -color: rgb(128, 159, 191);\ -}\ -.ace-tm .ace_constant.ace_numeric {\ -color: rgb(0, 0, 205);\ -}\ -.ace-tm .ace_variable {\ -color: rgb(49, 132, 149);\ -}\ -.ace-tm .ace_xml-pe {\ -color: rgb(104, 104, 91);\ -}\ -.ace-tm .ace_entity.ace_name.ace_function {\ -color: #0000A2;\ -}\ -.ace-tm .ace_heading {\ -color: rgb(12, 7, 255);\ -}\ -.ace-tm .ace_list {\ -color:rgb(185, 6, 144);\ -}\ -.ace-tm .ace_meta.ace_tag {\ -color:rgb(0, 22, 142);\ -}\ -.ace-tm .ace_string.ace_regex {\ -color: rgb(255, 0, 0)\ -}\ -.ace-tm .ace_marker-layer .ace_selection {\ -background: rgb(181, 213, 255);\ -}\ -.ace-tm.ace_multiselect .ace_selection.ace_start {\ -box-shadow: 0 0 3px 0px white;\ -}\ -.ace-tm .ace_marker-layer .ace_step {\ -background: rgb(252, 255, 0);\ -}\ -.ace-tm .ace_marker-layer .ace_stack {\ -background: rgb(164, 229, 101);\ -}\ -.ace-tm .ace_marker-layer .ace_bracket {\ -margin: -1px 0 0 -1px;\ -border: 1px solid rgb(192, 192, 192);\ -}\ -.ace-tm .ace_marker-layer .ace_active-line {\ -background: rgba(0, 0, 0, 0.07);\ -}\ -.ace-tm .ace_gutter-active-line {\ -background-color : #dcdcdc;\ -}\ -.ace-tm .ace_marker-layer .ace_selected-word {\ -background: rgb(250, 250, 255);\ -border: 1px solid rgb(200, 200, 250);\ -}\ -.ace-tm .ace_indent-guide {\ -background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\ -}\ -"; -exports.$id = "ace/theme/textmate"; - -var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); -}); - -define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace","ace/theme/textmate"], function(require, exports, module) { +define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace"], function(require, exports, module) { "use strict"; var event = require("../lib/event"); @@ -137,8 +6,6 @@ var UA = require("../lib/useragent"); var net = require("../lib/net"); var ace = require("../ace"); -require("../theme/textmate"); - module.exports = exports = ace; var getCSSProperty = function(element, container, property) { var ret = element.style[property]; diff --git a/htdocs/includes/ace/src/ext-themelist.js b/htdocs/includes/ace/src/ext-themelist.js index 712700a64bd..e8a8ea8974a 100644 --- a/htdocs/includes/ace/src/ext-themelist.js +++ b/htdocs/includes/ace/src/ext-themelist.js @@ -13,7 +13,7 @@ var themeData = [ ["Solarized Light"], ["TextMate" ], ["Tomorrow" ], - ["XCode" ], + ["Xcode" ], ["Kuroir"], ["KatzenMilch"], ["SQL Server" ,"sqlserver" , "light"], @@ -30,6 +30,8 @@ var themeData = [ ["Merbivore Soft" ,"merbivore_soft" , "dark"], ["Mono Industrial" ,"mono_industrial" , "dark"], ["Monokai" ,"monokai" , "dark"], + ["Nord Dark" ,"nord_dark" , "dark"], + ["One Dark" ,"one_dark" , "dark"], ["Pastel on dark" ,"pastel_on_dark" , "dark"], ["Solarized Dark" ,"solarized_dark" , "dark"], ["Terminal" ,"terminal" , "dark"], diff --git a/htdocs/includes/ace/src/keybinding-emacs.js b/htdocs/includes/ace/src/keybinding-emacs.js index 58e79cd44fc..07ffa85cd9d 100644 --- a/htdocs/includes/ace/src/keybinding-emacs.js +++ b/htdocs/includes/ace/src/keybinding-emacs.js @@ -98,7 +98,7 @@ dom.importCssString(".ace_occur-highlight {\n\ .ace_dark .ace_occur-highlight {\n\ background-color: rgb(80, 140, 85);\n\ box-shadow: 0 0 4px rgb(60, 120, 70);\n\ -}\n", "incremental-occur-highlighting"); +}\n", "incremental-occur-highlighting", false); exports.Occur = Occur; @@ -325,7 +325,7 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); this.attach = function(editor) { var iSearch = this.$iSearch; HashHandler.call(this, exports.iSearchCommands, editor.commands.platform); - this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) { + this.$commandExecHandler = editor.commands.on('exec', function(e) { if (!e.command.isIncrementalSearchCommand) return iSearch.deactivate(); e.stopPropagation(); @@ -340,7 +340,7 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); this.detach = function(editor) { if (!this.$commandExecHandler) return; - editor.commands.removeEventListener('exec', this.$commandExecHandler); + editor.commands.off('exec', this.$commandExecHandler); delete this.$commandExecHandler; }; @@ -349,7 +349,7 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); if (((hashId === 1/*ctrl*/ || hashId === 8/*command*/) && key === 'v') || (hashId === 1/*ctrl*/ && key === 'y')) return null; var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); - if (cmd.command) { return cmd; } + if (cmd && cmd.command) { return cmd; } if (hashId == -1) { var extendCmd = this.commands.extendSearchTerm; if (extendCmd) { return {command: extendCmd, args: key}; } @@ -406,27 +406,28 @@ function objectToRegExp(obj) { (function() { - this.activate = function(ed, backwards) { - this.$editor = ed; - this.$startPos = this.$currentPos = ed.getCursorPosition(); + this.activate = function(editor, backwards) { + this.$editor = editor; + this.$startPos = this.$currentPos = editor.getCursorPosition(); this.$options.needle = ''; this.$options.backwards = backwards; - ed.keyBinding.addKeyboardHandler(this.$keyboardHandler); - this.$originalEditorOnPaste = ed.onPaste; ed.onPaste = this.onPaste.bind(this); - this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this)); - this.selectionFix(ed); + editor.keyBinding.addKeyboardHandler(this.$keyboardHandler); + this.$originalEditorOnPaste = editor.onPaste; + editor.onPaste = this.onPaste.bind(this); + this.$mousedownHandler = editor.on('mousedown', this.onMouseDown.bind(this)); + this.selectionFix(editor); this.statusMessage(true); }; this.deactivate = function(reset) { this.cancelSearch(reset); - var ed = this.$editor; - ed.keyBinding.removeKeyboardHandler(this.$keyboardHandler); + var editor = this.$editor; + editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler); if (this.$mousedownHandler) { - ed.removeEventListener('mousedown', this.$mousedownHandler); + editor.off('mousedown', this.$mousedownHandler); delete this.$mousedownHandler; } - ed.onPaste = this.$originalEditorOnPaste; + editor.onPaste = this.$originalEditorOnPaste; this.message(''); }; @@ -557,7 +558,7 @@ function objectToRegExp(obj) { exports.IncrementalSearch = IncrementalSearch; var dom = require('./lib/dom'); -dom.importCssString && dom.importCssString("\ +dom.importCssString("\ .ace_marker-layer .ace_isearch-result {\ position: absolute;\ z-index: 6;\ @@ -571,7 +572,7 @@ div.ace_isearch-result {\ .ace_dark div.ace_isearch-result {\ background-color: rgb(100, 110, 160);\ box-shadow: 0 0 4px rgb(80, 90, 140);\ -}", "incremental-search-highlighting"); +}", "incremental-search-highlighting", false); var commands = require("./commands/command_manager"); (function() { this.setupIncrementalSearch = function(editor, val) { @@ -700,20 +701,20 @@ exports.handler.attach = function(editor) { editor.commands.addCommands(commands); exports.handler.platform = editor.commands.platform; editor.$emacsModeHandler = this; - editor.addEventListener('copy', this.onCopy); - editor.addEventListener('paste', this.onPaste); + editor.on('copy', this.onCopy); + editor.on('paste', this.onPaste); }; exports.handler.detach = function(editor) { editor.renderer.$blockCursor = false; editor.session.$selectLongWords = $formerLongWords; editor.session.$useEmacsStyleLineStart = $formerLineStart; - editor.removeEventListener("click", $resetMarkMode); - editor.removeEventListener("changeSession", $kbSessionChange); + editor.off("click", $resetMarkMode); + editor.off("changeSession", $kbSessionChange); editor.unsetStyle("emacs-mode"); editor.commands.removeCommands(commands); - editor.removeEventListener('copy', this.onCopy); - editor.removeEventListener('paste', this.onPaste); + editor.off('copy', this.onCopy); + editor.off('paste', this.onPaste); editor.$emacsModeHandler = null; }; diff --git a/htdocs/includes/ace/src/keybinding-vim.js b/htdocs/includes/ace/src/keybinding-vim.js index 79761280e93..bfb7e0bafe5 100644 --- a/htdocs/includes/ace/src/keybinding-vim.js +++ b/htdocs/includes/ace/src/keybinding-vim.js @@ -1,4 +1,123 @@ -define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/multi_select"], function(require, exports, module) { +define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +function hardWrap(editor, options) { + var max = options.column || editor.getOption("printMarginColumn"); + var allowMerge = options.allowMerge != false; + + var row = Math.min(options.startRow, options.endRow); + var endRow = Math.max(options.startRow, options.endRow); + + var session = editor.session; + + while (row <= endRow) { + var line = session.getLine(row); + if (line.length > max) { + var space = findSpace(line, max, 5); + if (space) { + var indentation = /^\s*/.exec(line)[0]; + session.replace(new Range(row,space.start,row,space.end), "\n" + indentation); + } + endRow++; + } else if (allowMerge && /\S/.test(line) && row != endRow) { + var nextLine = session.getLine(row + 1); + if (nextLine && /\S/.test(nextLine)) { + var trimmedLine = line.replace(/\s+$/, ""); + var trimmedNextLine = nextLine.replace(/^\s+/, ""); + var mergedLine = trimmedLine + " " + trimmedNextLine; + + var space = findSpace(mergedLine, max, 5); + if (space && space.start > trimmedLine.length || mergedLine.length < max) { + var replaceRange = new Range(row,trimmedLine.length,row + 1,nextLine.length - trimmedNextLine.length); + session.replace(replaceRange, " "); + row--; + endRow--; + } else if (trimmedLine.length < line.length) { + session.remove(new Range(row, trimmedLine.length, row, line.length)); + } + } + } + row++; + } + + function findSpace(line, max, min) { + if (line.length < max) + return; + var before = line.slice(0, max); + var after = line.slice(max); + var spaceAfter = /^(?:(\s+)|(\S+)(\s+))/.exec(after); + var spaceBefore = /(?:(\s+)|(\s+)(\S+))$/.exec(before); + var start = 0; + var end = 0; + if (spaceBefore && !spaceBefore[2]) { + start = max - spaceBefore[1].length; + end = max; + } + if (spaceAfter && !spaceAfter[2]) { + if (!start) + start = max; + end = max + spaceAfter[1].length; + } + if (start) { + return { + start: start, + end: end + }; + } + if (spaceBefore && spaceBefore[2] && spaceBefore.index > min) { + return { + start: spaceBefore.index, + end: spaceBefore.index + spaceBefore[2].length + }; + } + if (spaceAfter && spaceAfter[2]) { + start = max + spaceAfter[2].length; + return { + start: start, + end: start + spaceAfter[3].length + }; + } + } + +} + +function wrapAfterInput(e) { + if (e.command.name == "insertstring" && /\S/.test(e.args)) { + var editor = e.editor; + var cursor = editor.selection.cursor; + if (cursor.column <= editor.renderer.$printMarginColumn) return; + var lastDelta = editor.session.$undoManager.$lastDelta; + + hardWrap(editor, { + startRow: cursor.row, endRow: cursor.row, + allowMerge: false + }); + if (lastDelta != editor.session.$undoManager.$lastDelta) + editor.session.markUndoGroup(); + } +} + +var Editor = require("../editor").Editor; +require("../config").defineOptions(Editor.prototype, "editor", { + hardWrap: { + set: function(val) { + if (val) { + this.commands.on("afterExec", wrapAfterInput); + } else { + this.commands.off("afterExec", wrapAfterInput); + } + }, + value: false + } +}); + +exports.hardWrap = hardWrap; + +}); + +define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/ext/hardwrap","ace/multi_select"], function(require, exports, module) { 'use strict'; function log() { @@ -36,12 +155,14 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve var SearchHighlight = require("../search_highlight").SearchHighlight; var multiSelectCommands = require("../commands/multi_select_commands"); var TextModeTokenRe = require("../mode/text").Mode.prototype.tokenRe; + var hardWrap = require("../ext/hardwrap").hardWrap; require("../multi_select"); var CodeMirror = function(ace) { this.ace = ace; this.state = {}; this.marks = {}; + this.options = {}; this.$uid = 0; this.onChange = this.onChange.bind(this); this.onSelectionChange = this.onSelectionChange.bind(this); @@ -58,7 +179,9 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve CodeMirror.commands = { redo: function(cm) { cm.ace.redo(); }, undo: function(cm) { cm.ace.undo(); }, - newlineAndIndent: function(cm) { cm.ace.insert("\n"); } + newlineAndIndent: function(cm) { cm.ace.insert("\n"); }, + goLineLeft: function(cm) { cm.ace.selection.moveCursorLineStart(); }, + goLineRight: function(cm) { cm.ace.selection.moveCursorLineEnd(); } }; CodeMirror.keyMap = {}; CodeMirror.addClass = CodeMirror.rmClass = function() {}; @@ -96,6 +219,11 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve } }; + + CodeMirror.findMatchingTag = function(cm, head) { + + }; + CodeMirror.signal = function(o, name, e) { return o._signal(name, e) }; CodeMirror.on = event.addListener; CodeMirror.off = event.removeListener; @@ -104,10 +232,10 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve TextModeTokenRe.lastIndex = 0; return TextModeTokenRe.test(ch); }; - + (function() { oop.implement(CodeMirror.prototype, EventEmitter); - + this.destroy = function() { this.ace.off('change', this.onChange); this.ace.off('changeSelection', this.onSelectionChange); @@ -194,10 +322,15 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve ch = line.ch; line = line.line; } + var shouldScroll = !this.curOp && !this.ace.inVirtualSelectionMode; if (!this.ace.inVirtualSelectionMode) this.ace.exitMultiSelectMode(); this.ace.session.unfold({row: line, column: ch}); this.ace.selection.moveTo(line, ch); + if (shouldScroll) { + this.ace.renderer.scrollCursorIntoView(); + this.ace.endOperation(); + } }; this.getCursor = function(p) { var sel = this.ace.selection; @@ -227,7 +360,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve r.cursor = Range.comparePoints(r.start, head) ? r.end : r.start; return r; }); - + if (this.ace.inVirtualSelectionMode) { this.ace.selection.fromOrientedRange(ranges[0]); return; @@ -259,6 +392,9 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve var pos = this.ace.session.$clipPositionToDocument(p.line, p.ch); return toCmPos(pos); }; + this.foldCode = function(pos) { + this.ace.session.$toggleFoldWidget(pos.line, {}); + }; this.markText = function(cursor) { return {clear: function() {}, find: function() {}}; }; @@ -269,7 +405,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve var rowShift = (end.row - start.row) * (isInsert ? 1 : -1); var colShift = (end.column - start.column) * (isInsert ? 1 : -1); if (isInsert) end = start; - + for (var i in this.marks) { var point = this.marks[i]; var cmp = Range.comparePoints(point, start); @@ -374,6 +510,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve query = query.source; isRegexp = true; } + if (query == "\\n") { query = "\n"; isRegexp = false; } var search = new Search(); if (pos.ch == undefined) pos.ch = Number.MAX_VALUE; var acePos = {row: pos.line, column: pos.ch}; @@ -392,14 +529,8 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve start: last || acePos }); var range = search.find(cm.ace.session); - if (range && range.isEmpty()) { - if (cm.getLine(range.start.row).length == range.start.column) { - search.$options.start = range; - range = search.find(cm.ace.session); - } - } last = range; - return last; + return last && [!last.isEmpty()]; }, from: function() { return last && toCmPos(last.start) }, to: function() { return last && toCmPos(last.end) }, @@ -433,9 +564,11 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve }; this.replaceRange = function(text, s, e) { if (!e) e = s; - return this.ace.session.replace(new Range(s.line, s.ch, e.line, e.ch), text); + var range = new Range(s.line, s.ch, e.line, e.ch); + this.ace.session.$clipRangeToDocument(range); + return this.ace.session.replace(range, text); }; - this.replaceSelection = + this.replaceSelection = this.replaceSelections = function(p) { var sel = this.ace.selection; if (this.ace.inVirtualSelectionMode) { @@ -487,7 +620,8 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve if (name) this.ace.setOption(name, val); }; - this.getOption = function(name, val) { + this.getOption = function(name) { + var val; var aceOpt = optMap[name]; if (aceOpt) val = this.ace.getOption(aceOpt); @@ -496,7 +630,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve name = optMap[name]; return !val; case 'keyMap': - return this.state.$keyMap; + return this.state.$keyMap || 'vim'; } return aceOpt ? val : this.state[name]; }; @@ -597,9 +731,17 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve this.getMode = function() { return { name : this.getOption("mode") }; }; - this.execCommand = function() { - + this.execCommand = function(name) { + if (CodeMirror.commands.hasOwnProperty(name)) return CodeMirror.commands[name](this); + if (name == "indentAuto") return this.ace.execCommand("autoindent"); + console.log(name + " is not implemented"); }; + this.getLineNumber = function(handle) { + return handle.row; + } + this.getLineHandle = function(row) { + return {text: this.ace.session.getLine(row), row: row}; + } }).call(CodeMirror.prototype); function toAcePos(cmPos) { return {row: cmPos.line, column: cmPos.ch}; @@ -710,7 +852,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ width: 20em;\ color: inherit;\ font-family: monospace;\ -}", "vimMode"); +}", "vimMode", false); (function() { function dialogDiv(cm, template, bottom) { var wrap = cm.ace.container; @@ -749,18 +891,26 @@ dom.importCssString(".normal-mode .ace_cursor{\ inp.value = newVal; } else { if (closed) return; - + if (newVal && newVal.type == "blur") { if (document.activeElement === inp) return; } - - me.state.dialog = null; + + if (me.state.dialog == dialog) { + me.state.dialog = null; + me.focus(); + } closed = true; - dialog.parentNode.removeChild(dialog); - me.focus(); + dialog.remove(); if (options.onClose) options.onClose(dialog); + var cm = me; + if (cm.state.vim) { + cm.state.vim.status = null; + cm.ace._signal("changeStatus"); + cm.ace.renderer.$loop.schedule(cm.ace.renderer.CHANGE_CURSOR); + } } } @@ -780,7 +930,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } if (e.keyCode == 13) callback(inp.value); if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { - inp.blur(); CodeMirror.e_stop(e); close(); } @@ -813,7 +962,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (closed) return; closed = true; clearTimeout(doneTimer); - dialog.parentNode.removeChild(dialog); + dialog.remove(); } CodeMirror.on(dialog, 'click', function(e) { @@ -828,12 +977,35 @@ dom.importCssString(".normal-mode .ace_cursor{\ }); })(); - + + var Pos = CodeMirror.Pos; + + function transformCursor(cm, range) { + var vim = cm.state.vim; + if (!vim || vim.insertMode) return range.head; + var head = vim.sel.head; + if (!head) return range.head; + + if (vim.visualBlock) { + if (range.head.line != head.line) { + return; + } + } + if (range.from() == range.anchor && !range.empty()) { + if (range.head.line == head.line && range.head.ch != head.ch) + return new Pos(range.head.line, range.head.ch - 1); + } + + return range.head; + } + var defaultKeymap = [ { keys: '', type: 'keyToKey', toKeys: 'h' }, { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'k' }, { keys: '', type: 'keyToKey', toKeys: 'j' }, + { keys: 'g', type: 'keyToKey', toKeys: 'gk' }, + { keys: 'g', type: 'keyToKey', toKeys: 'gj' }, { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'h', context: 'normal'}, { keys: '', type: 'keyToKey', toKeys: 'x', context: 'normal'}, @@ -858,6 +1030,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: 'j^', context: 'normal' }, + { keys: '', type: 'keyToKey', toKeys: 'i', context: 'normal'}, { keys: '', type: 'action', action: 'toggleOverwrite', context: 'insert' }, { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }}, { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }}, @@ -886,6 +1059,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }}, { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }}, { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }}, + {keys: "g$", type: "motion", motion: "moveToEndOfDisplayLine"}, + {keys: "g^", type: "motion", motion: "moveToStartOfDisplayLine"}, + {keys: "g0", type: "motion", motion: "moveToStartOfDisplayLine"}, { keys: '0', type: 'motion', motion: 'moveToStartOfLine' }, { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }}, @@ -923,6 +1099,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true }, { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }}, { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }}, + { keys: 'gn', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: true }}, + { keys: 'gN', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: false }}, { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }}, { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }}, { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, @@ -1002,7 +1180,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ { name: 'undo', shortName: 'u' }, { name: 'redo', shortName: 'red' }, { name: 'set', shortName: 'se' }, - { name: 'set', shortName: 'se' }, { name: 'setlocal', shortName: 'setl' }, { name: 'setglobal', shortName: 'setg' }, { name: 'sort', shortName: 'sor' }, @@ -1011,11 +1188,10 @@ dom.importCssString(".normal-mode .ace_cursor{\ { name: 'yank', shortName: 'y' }, { name: 'delmarks', shortName: 'delm' }, { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, + { name: 'vglobal', shortName: 'v' }, { name: 'global', shortName: 'g' } ]; - var Pos = CodeMirror.Pos; - var Vim = function() { return vimApi; } //{ function enterVimMode(cm) { cm.setOption('disableInput', true); @@ -1032,16 +1208,22 @@ dom.importCssString(".normal-mode .ace_cursor{\ CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); cm.state.vim = null; } + function detachVimMap(cm, next) { - if (this == CodeMirror.keyMap.vim) + if (this == CodeMirror.keyMap.vim) { + cm.options.$customCursor = null; CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); + } if (!next || next.attach != attachVimMap) leaveVimMode(cm); } function attachVimMap(cm, prev) { - if (this == CodeMirror.keyMap.vim) + if (this == CodeMirror.keyMap.vim) { + if (cm.curOp) cm.curOp.selectionChanged = true; + cm.options.$customCursor = transformCursor; CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); + } if (!prev || prev.attach != attachVimMap) enterVimMode(cm); @@ -1060,14 +1242,14 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!vimKey) { return false; } - var cmd = CodeMirror.Vim.findKey(cm, vimKey); + var cmd = vimApi.findKey(cm, vimKey); if (typeof cmd == 'function') { CodeMirror.signal(cm, 'vim-keypress', vimKey); } return cmd; } - var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'}; + var modifiers = {Shift:'S',Ctrl:'C',Alt:'A',Cmd:'D',Mod:'A',CapsLock:''}; var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del',Insert:'Ins'}; function cmKeyToVimKey(key) { if (key.charAt(0) == '\'') { @@ -1126,7 +1308,10 @@ dom.importCssString(".normal-mode .ace_cursor{\ var lowerCaseAlphabet = makeKeyRange(97, 26); var numbers = makeKeyRange(48, 10); var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']); - var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '/']); + var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '_', '/']); + var upperCaseChars; + try { upperCaseChars = new RegExp("^[\\p{Lu}]$", "u"); } + catch (_) { upperCaseChars = /^[A-Z]$/; } function isLine(cm, line) { return line >= cm.firstLine() && line <= cm.lastLine(); @@ -1141,7 +1326,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ return numberRegex.test(k); } function isUpperCase(k) { - return (/^[A-Z]$/).test(k); + return upperCaseChars.test(k); } function isWhiteSpaceString(k) { return (/^\s*$/).test(k); @@ -1352,7 +1537,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ this.latestRegister = registerName; if (cm.openDialog) { this.onRecordingDone = cm.openDialog( - '(recording)['+registerName+']', null, {bottom:true}); + document.createTextNode('(recording)['+registerName+']'), null, {bottom:true}); } this.isRecording = true; } @@ -1369,7 +1554,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ lastHSPos: -1, lastMotion: null, marks: {}, - fakeCursor: null, insertMode: false, insertModeRepeat: undefined, visualMode: false, @@ -1422,7 +1606,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ exCommandDispatcher.map(lhs, rhs, ctx); }, unmap: function(lhs, ctx) { - exCommandDispatcher.unmap(lhs, ctx); + return exCommandDispatcher.unmap(lhs, ctx); }, noremap: function(lhs, rhs, ctx) { function toCtxArray(ctx) { @@ -1530,7 +1714,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ match = (/<\w+-.+?>|<\w+>|./).exec(keys); key = match[0]; keys = keys.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'mapping'); + vimApi.handleKey(cm, key, 'mapping'); } } @@ -1576,9 +1760,14 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!keysMatcher) { clearInputState(cm); return false; } var context = vim.visualMode ? 'visual' : 'normal'; - var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); + var mainKey = keysMatcher[2] || keysMatcher[1]; + if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) { + mainKey = vim.inputState.operatorShortcut; + } + var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context); if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { return true; } + else if (match.type == 'clear') { clearInputState(cm); return true; } // ace_patch vim.inputState.keyBuffer = ''; var keysMatcher = /^(\d*)(.*)$/.exec(keys); @@ -1610,7 +1799,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } catch (e) { cm.state.vim = undefined; maybeInitVimState(cm); - if (!CodeMirror.Vim.suppressErrorLogging) { + if (!vimApi.suppressErrorLogging) { console['log'](e); } throw e; @@ -1727,6 +1916,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } RegisterController.prototype = { pushText: function(registerName, operator, text, linewise, blockwise) { + if (registerName === '_') return; if (linewise && text.charAt(text.length - 1) !== '\n'){ text += '\n'; } @@ -1830,7 +2020,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } if (bestMatch.keys.slice(-11) == '') { var character = lastChar(keys); - if (//.test(character) || !character) return {type: 'none'}; //ace_patch + if (!character || character.length > 1) return {type: 'clear'}; //ace_patch inputState.selectedCharacter = character; } return {type: 'full', command: bestMatch}; @@ -1880,6 +2070,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ } inputState.operator = command.operator; inputState.operatorArgs = copyArgs(command.operatorArgs); + if (command.keys.length > 1) { + inputState.operatorShortcut = command.keys; + } if (command.exitVisualBlock) { vim.visualBlock = false; updateCmSelection(cm); @@ -1955,7 +2148,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ }); } function onPromptClose(query) { - cm.scrollTo(originalScrollPos.left, originalScrollPos.top); handleQuery(query, true /** ignoreCase */, true /** smartCase */); var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isRecording) { @@ -2017,7 +2209,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ showPrompt(cm, { onClose: onPromptClose, prefix: promptPrefix, - desc: searchPromptDesc, + desc: '(JavaScript regexp)', onKeyUp: onPromptKeyUp, onKeyDown: onPromptKeyDown }); @@ -2131,7 +2323,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ motionArgs.repeat = repeat; clearInputState(cm); if (motion) { - var motionResult = motions[motion](cm, origHead, motionArgs, vim); + var motionResult = motions[motion](cm, origHead, motionArgs, vim, inputState); vim.lastMotion = motions[motion]; if (!motionResult) { return; @@ -2159,10 +2351,10 @@ dom.importCssString(".normal-mode .ace_cursor{\ } if (vim.visualMode) { if (!(vim.visualBlock && newHead.ch === Infinity)) { - newHead = clipCursorToContent(cm, newHead, vim.visualBlock); + newHead = clipCursorToContent(cm, newHead); } if (newAnchor) { - newAnchor = clipCursorToContent(cm, newAnchor, true); + newAnchor = clipCursorToContent(cm, newAnchor); } newAnchor = newAnchor || oldAnchor; sel.anchor = newAnchor; @@ -2186,13 +2378,13 @@ dom.importCssString(".normal-mode .ace_cursor{\ var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line); var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); if (lastSel.visualLine) { - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } else if (lastSel.visualBlock) { - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); } else if (lastSel.head.line == lastSel.anchor.line) { - newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset); + newHead = new Pos(oldAnchor.line, oldAnchor.ch + chOffset); } else { - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } vim.visualMode = true; vim.visualLine = lastSel.visualLine; @@ -2230,7 +2422,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ ranges[i].head.ch = lineLength(cm, ranges[i].head.line); } } else if (mode == 'line') { - ranges[0].head = Pos(ranges[0].head.line + 1, 0); + ranges[0].head = new Pos(ranges[0].head.line + 1, 0); } } } else { @@ -2282,20 +2474,20 @@ dom.importCssString(".normal-mode .ace_cursor{\ var motions = { moveToTopLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToMiddleLine: function(cm) { var range = getUserVisibleLines(cm); var line = Math.floor((range.top + range.bottom) * 0.5); - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToBottomLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, expandToLine: function(_cm, head, motionArgs) { var cur = head; - return Pos(cur.line + motionArgs.repeat - 1, Infinity); + return new Pos(cur.line + motionArgs.repeat - 1, Infinity); }, findNext: function(cm, _head, motionArgs) { var state = getSearchState(cm); @@ -2308,6 +2500,58 @@ dom.importCssString(".normal-mode .ace_cursor{\ highlightSearchMatches(cm, query); return findNext(cm, prev/** prev */, query, motionArgs.repeat); }, + findAndSelectNextInclusive: function(cm, _head, motionArgs, vim, prevInputState) { + var state = getSearchState(cm); + var query = state.getQuery(); + + if (!query) { + return; + } + + var prev = !motionArgs.forward; + prev = (state.isReversed()) ? !prev : prev; + var next = findNextFromAndToInclusive(cm, prev, query, motionArgs.repeat, vim); + if (!next) { + return; + } + if (prevInputState.operator) { + return next; + } + + var from = next[0]; + var to = new Pos(next[1].line, next[1].ch - 1); + + if (vim.visualMode) { + if (vim.visualLine || vim.visualBlock) { + vim.visualLine = false; + vim.visualBlock = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""}); + } + var anchor = vim.sel.anchor; + if (anchor) { + if (state.isReversed()) { + if (motionArgs.forward) { + return [anchor, from]; + } + + return [anchor, to]; + } else { + if (motionArgs.forward) { + return [anchor, to]; + } + + return [anchor, from]; + } + } + } else { + vim.visualMode = true; + vim.visualLine = false; + vim.visualBlock = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""}); + } + + return prev ? [to, from] : [from, to]; + }, goToMark: function(cm, _head, motionArgs, vim) { var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter); if (pos) { @@ -2319,8 +2563,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (vim.visualBlock && motionArgs.sameLine) { var sel = vim.sel; return [ - clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), - clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) + clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)), + clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch)) ]; } else { return ([vim.sel.head, vim.sel.anchor]); @@ -2357,7 +2601,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } if (motionArgs.linewise) { - best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); + best = new Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); } return best; }, @@ -2365,7 +2609,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ var cur = head; var repeat = motionArgs.repeat; var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat; - return Pos(cur.line, ch); + return new Pos(cur.line, ch); }, moveByLines: function(cm, head, motionArgs, vim) { var cur = head; @@ -2387,8 +2631,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ var last = cm.lastLine(); if (line < first && cur.line == first){ return this.moveToStartOfLine(cm, head, motionArgs, vim); - }else if (line > last && cur.line == last){ - return this.moveToEol(cm, head, motionArgs, vim, true); + } else if (line > last && cur.line == last){ + return moveToEol(cm, head, motionArgs, vim, true); } var fold = cm.ace.session.getFoldLine(line); if (fold) { @@ -2403,8 +2647,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); vim.lastHPos = endCh; } - vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; - return Pos(line, endCh); + vim.lastHSPos = cm.charCoords(new Pos(line, endCh),'div').left; + return new Pos(line, endCh); }, moveByDisplayLines: function(cm, head, motionArgs, vim) { var cur = head; @@ -2426,7 +2670,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; var res = cm.coordsChar(goalCoords, 'div'); } else { - var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); + var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div'); resCoords.left = vim.lastHSPos; res = cm.coordsChar(resCoords, 'div'); } @@ -2495,20 +2739,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.lastHSPos = cm.charCoords(head,'div').left; return moveToColumn(cm, repeat); }, - moveToEol: function(cm, head, motionArgs, vim, keepHPos) { - var cur = head; - var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity); - var end=cm.clipPos(retval); - end.ch--; - if (!keepHPos) { - vim.lastHPos = Infinity; - vim.lastHSPos = cm.charCoords(end,'div').left; - } - return retval; + moveToEol: function(cm, head, motionArgs, vim) { + return moveToEol(cm, head, motionArgs, vim, false); }, moveToFirstNonWhiteSpaceCharacter: function(cm, head) { var cursor = head; - return Pos(cursor.line, + return new Pos(cursor.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); }, moveToMatchedSymbol: function(cm, head) { @@ -2520,7 +2756,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ for (; ch < lineText.length; ch++) { symbol = lineText.charAt(ch); if (symbol && isMatchableSymbol(symbol)) { - var style = cm.getTokenTypeAt(Pos(line, ch + 1)); + var style = cm.getTokenTypeAt(new Pos(line, ch + 1)); if (style !== "string" && style !== "comment") { break; } @@ -2528,23 +2764,33 @@ dom.importCssString(".normal-mode .ace_cursor{\ } if (ch < lineText.length) { var re = /[<>]/.test(lineText[ch]) ? /[(){}[\]<>]/ : /[(){}[\]]/; //ace_patch? - var matched = cm.findMatchingBracket(Pos(line, ch+1), {bracketRegex: re}); + var matched = cm.findMatchingBracket(new Pos(line, ch+1), {bracketRegex: re}); return matched.to; } else { return cursor; } }, moveToStartOfLine: function(_cm, head) { - return Pos(head.line, 0); + return new Pos(head.line, 0); }, moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); if (motionArgs.repeatIsExplicit) { lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); } - return Pos(lineNum, + return new Pos(lineNum, findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); }, + moveToStartOfDisplayLine: function(cm) { + cm.execCommand("goLineLeft"); + return cm.getCursor(); + }, + moveToEndOfDisplayLine: function(cm) { + cm.execCommand("goLineRight"); + var head = cm.getCursor(); + if (head.sticky == "before") head.ch--; + return head; + }, textObjectManipulation: function(cm, head, motionArgs, vim) { var mirroredPairs = {'(': ')', ')': '(', '{': '}', '}': '{', @@ -2581,6 +2827,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (operatorArgs) { operatorArgs.linewise = true; } tmp.end.line--; } + } else if (character === 't') { + tmp = expandTagUnderCursor(cm, head, inclusive); } else { return null; } @@ -2682,7 +2930,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (anchor.line == cm.firstLine()) { anchor.ch = 0; } else { - anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); + anchor = new Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); } } text = cm.getRange(anchor, head); @@ -2695,13 +2943,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ text = cm.getSelection(); var replacement = fillArray('', ranges.length); cm.replaceSelections(replacement); - finalHead = ranges[0].anchor; + finalHead = cursorMin(ranges[0].head, ranges[0].anchor); } vimGlobalState.registerController.pushText( args.registerName, 'delete', text, args.linewise, vim.visualBlock); - var includeLineBreak = vim.insertMode - return clipCursorToContent(cm, finalHead, includeLineBreak); + return clipCursorToContent(cm, finalHead); }, indent: function(cm, args, ranges) { var vim = cm.state.vim; @@ -2721,6 +2968,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); }, indentAuto: function(cm, _args, ranges) { + if (ranges.length > 1) { // ace_patch + cm.setSelection(ranges[0].anchor, ranges[ranges.length - 1].head); + } cm.execCommand("indentAuto"); return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); }, @@ -2824,7 +3074,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ }, scrollToCursor: function(cm, actionArgs) { var lineNum = cm.getCursor().line; - var charCoords = cm.charCoords(Pos(lineNum, 0), 'local'); + var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local'); var height = cm.getScrollInfo().clientHeight; var y = charCoords.top; var lineHeight = charCoords.bottom - y; @@ -2876,9 +3126,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ var head = actionArgs.head || cm.getCursor('head'); var height = cm.listSelections().length; if (insertAt == 'eol') { - head = Pos(head.line, lineLength(cm, head.line)); + head = new Pos(head.line, lineLength(cm, head.line)); } else if (insertAt == 'bol') { - head = Pos(head.line, 0); + head = new Pos(head.line, 0); } else if (insertAt == 'charAfter') { head = offsetCursor(head, 0, 1); } else if (insertAt == 'firstNonBlank') { @@ -2890,10 +3140,10 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (sel.head.line < sel.anchor.line) { head = sel.head; } else { - head = Pos(sel.anchor.line, 0); + head = new Pos(sel.anchor.line, 0); } } else { - head = Pos( + head = new Pos( Math.min(sel.head.line, sel.anchor.line), Math.min(sel.head.ch, sel.anchor.ch)); height = Math.abs(sel.head.line - sel.anchor.line) + 1; @@ -2905,12 +3155,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (sel.head.line >= sel.anchor.line) { head = offsetCursor(sel.head, 0, 1); } else { - head = Pos(sel.anchor.line, 0); + head = new Pos(sel.anchor.line, 0); } } else { - head = Pos( + head = new Pos( Math.min(sel.head.line, sel.anchor.line), - Math.max(sel.head.ch + 1, sel.anchor.ch)); + Math.max(sel.head.ch, sel.anchor.ch) + 1); height = Math.abs(sel.head.line - sel.anchor.line) + 1; } } else if (insertAt == 'inplace') { @@ -2948,8 +3198,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.visualLine = !!actionArgs.linewise; vim.visualBlock = !!actionArgs.blockwise; head = clipCursorToContent( - cm, Pos(anchor.line, anchor.ch + repeat - 1), - true /** includeLineBreak */); + cm, new Pos(anchor.line, anchor.ch + repeat - 1)); vim.sel = { anchor: anchor, head: head @@ -3009,13 +3258,13 @@ dom.importCssString(".normal-mode .ace_cursor{\ } else { var repeat = Math.max(actionArgs.repeat, 2); curStart = cm.getCursor(); - curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, + curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1, Infinity)); } var finalCh = 0; for (var i = curStart.line; i < curEnd.line; i++) { finalCh = lineLength(cm, curStart.line); - var tmp = Pos(curStart.line + 1, + var tmp = new Pos(curStart.line + 1, lineLength(cm, curStart.line + 1)); var text = cm.getRange(curStart, tmp); text = actionArgs.keepSpaces @@ -3023,7 +3272,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ : text.replace(/\n\s*/g, ' '); cm.replaceRange(text, curStart, tmp); } - var curFinalPos = Pos(curStart.line, finalCh); + var curFinalPos = new Pos(curStart.line, finalCh); if (vim.visualMode) { exitVisualMode(cm, false); } @@ -3033,7 +3282,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.insertMode = true; var insertAt = copyCursor(cm.getCursor()); if (insertAt.line === cm.firstLine() && !actionArgs.after) { - cm.replaceRange('\n', Pos(cm.firstLine(), 0)); + cm.replaceRange('\n', new Pos(cm.firstLine(), 0)); cm.setCursor(cm.firstLine(), 0); } else { insertAt.line = (actionArgs.after) ? insertAt.line : @@ -3125,7 +3374,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ vimGlobalState.registerController.unnamedRegister.setText(selectedText); if (blockwise) { cm.replaceSelections(emptyStrings); - selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch); + selectionEnd = new Pos(selectionStart.line + text.length-1, selectionStart.ch); cm.setCursor(selectionStart); selectBlock(cm, selectionEnd); cm.replaceSelections(text); @@ -3151,7 +3400,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ for (var i = 0; i < text.length; i++) { var line = cur.line+i; if (line > cm.lastLine()) { - cm.replaceRange('\n', Pos(line, 0)); + cm.replaceRange('\n', new Pos(line, 0)); } var lastCh = lineLength(cm, line); if (lastCh < cur.ch) { @@ -3159,17 +3408,17 @@ dom.importCssString(".normal-mode .ace_cursor{\ } } cm.setCursor(cur); - selectBlock(cm, Pos(cur.line + text.length-1, cur.ch)); + selectBlock(cm, new Pos(cur.line + text.length-1, cur.ch)); cm.replaceSelections(text); curPosFinal = cur; } else { cm.replaceRange(text, cur); if (linewise && actionArgs.after) { - curPosFinal = Pos( + curPosFinal = new Pos( cur.line + 1, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); } else if (linewise && !actionArgs.after) { - curPosFinal = Pos( + curPosFinal = new Pos( cur.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); } else if (!linewise && actionArgs.after) { @@ -3217,7 +3466,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (replaceTo > line.length) { replaceTo=line.length; } - curEnd = Pos(curStart.line, replaceTo); + curEnd = new Pos(curStart.line, replaceTo); } if (replaceWith=='\n') { if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); @@ -3270,13 +3519,13 @@ dom.importCssString(".normal-mode .ace_cursor{\ } else { numberStr = baseStr + zeroPadding + numberStr; } - var from = Pos(cur.line, start); - var to = Pos(cur.line, end); + var from = new Pos(cur.line, start); + var to = new Pos(cur.line, end); cm.replaceRange(numberStr, from, to); } else { return; } - cm.setCursor(Pos(cur.line, start + numberStr.length - 1)); + cm.setCursor(new Pos(cur.line, start + numberStr.length - 1)); }, repeatLastEdit: function(cm, actionArgs, vim) { var lastEditInputState = vim.lastEditInputState; @@ -3298,12 +3547,13 @@ dom.importCssString(".normal-mode .ace_cursor{\ function defineAction(name, fn) { actions[name] = fn; } - function clipCursorToContent(cm, cur, includeLineBreak) { + function clipCursorToContent(cm, cur) { + var vim = cm.state.vim; + var includeLineBreak = vim.insertMode || vim.visualMode; var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); - var maxCh = lineLength(cm, line) - 1; - maxCh = (includeLineBreak) ? maxCh + 1 : maxCh; + var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak; var ch = Math.min(Math.max(0, cur.ch), maxCh); - return Pos(line, ch); + return new Pos(line, ch); } function copyArgs(args) { var ret = {}; @@ -3319,7 +3569,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ offsetCh = offsetLine.ch; offsetLine = offsetLine.line; } - return Pos(cur.line + offsetLine, cur.ch + offsetCh); + return new Pos(cur.line + offsetLine, cur.ch + offsetCh); } function commandMatches(keys, keyMap, context, inputState) { var match, partial = [], full = []; @@ -3375,7 +3625,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ }; } function copyCursor(cur) { - return Pos(cur.line, cur.ch); + return new Pos(cur.line, cur.ch); } function cursorEqual(cur1, cur2) { return cur1.ch == cur2.ch && cur1.line == cur2.line; @@ -3421,7 +3671,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ function extendLineToColumn(cm, lineNum, column) { var endCh = lineLength(cm, lineNum); var spaces = new Array(column-endCh+1).join(' '); - cm.setCursor(Pos(lineNum, endCh)); + cm.setCursor(new Pos(lineNum, endCh)); cm.replaceRange(spaces, cm.getCursor()); } function selectBlock(cm, selectionEnd) { @@ -3495,11 +3745,11 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (block) { var width = block.width; var height = block.height; - selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); + selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width); var selections = []; for (var i = selectionStart.line; i < selectionEnd.line; i++) { - var anchor = Pos(i, selectionStart.ch); - var head = Pos(i, selectionEnd.ch); + var anchor = new Pos(i, selectionStart.ch); + var head = new Pos(i, selectionEnd.ch); var range = {anchor: anchor, head: head}; selections.push(range); } @@ -3511,8 +3761,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ var ch = end.ch - start.ch; selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; if (lastSelection.visualLine) { - selectionStart = Pos(selectionStart.line, 0); - selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); + selectionStart = new Pos(selectionStart.line, 0); + selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); } cm.setSelection(selectionStart, selectionEnd); } @@ -3557,7 +3807,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ head = cursorMax(head, end); head = offsetCursor(head, 0, -1); if (head.ch == -1 && head.line != cm.firstLine()) { - head = Pos(head.line - 1, lineLength(cm, head.line - 1)); + head = new Pos(head.line - 1, lineLength(cm, head.line - 1)); } } return [anchor, head]; @@ -3569,7 +3819,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; var cmSel = makeCmSelection(cm, sel, mode); cm.setSelections(cmSel.ranges, cmSel.primary); - updateFakeCursor(cm); } function makeCmSelection(cm, sel, mode, exclusive) { var head = copyCursor(sel.head); @@ -3602,16 +3851,18 @@ dom.importCssString(".normal-mode .ace_cursor{\ }; } else if (mode == 'block') { var top = Math.min(anchor.line, head.line), - left = Math.min(anchor.ch, head.ch), + fromCh = anchor.ch, bottom = Math.max(anchor.line, head.line), - right = Math.max(anchor.ch, head.ch) + 1; + toCh = head.ch; + if (fromCh < toCh) { toCh += 1 } + else { fromCh += 1 }; var height = bottom - top + 1; var primary = head.line == top ? 0 : height - 1; var ranges = []; for (var i = 0; i < height; i++) { ranges.push({ - anchor: Pos(top + i, left), - head: Pos(top + i, right) + anchor: new Pos(top + i, fromCh), + head: new Pos(top + i, toCh) }); } return { @@ -3636,10 +3887,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ vim.visualMode = false; vim.visualLine = false; vim.visualBlock = false; - CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); - if (vim.fakeCursor) { - vim.fakeCursor.clear(); - } + if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); } function clipToLine(cm, curStart, curEnd) { var selection = cm.getRange(curStart, curEnd); @@ -3706,7 +3954,23 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!start) { start = wordStart; } } } - return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; + return { start: new Pos(cur.line, start), end: new Pos(cur.line, end) }; + } + function expandTagUnderCursor(cm, head, inclusive) { + var cur = head; + if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) { + return { start: cur, end: cur }; + } + + var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head); + if (!tags || !tags.open || !tags.close) { + return { start: cur, end: cur }; + } + + if (inclusive) { + return { start: tags.open.from, end: tags.close.to }; + } + return { start: tags.open.to, end: tags.close.from }; } function recordJumpPosition(cm, oldCur, newCur) { @@ -3772,7 +4036,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ }, isComplete: function(state) { if (state.nextCh === '#') { - var token = state.lineText.match(/#(\w+)/)[1]; + var token = state.lineText.match(/^#(\w+)/)[1]; if (token === 'endif') { if (state.forward && state.depth === 0) { return true; @@ -3834,7 +4098,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } } if (state.nextCh || state.curMoveThrough) { - return Pos(line, state.index); + return new Pos(line, state.index); } return cur; } @@ -3910,7 +4174,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ break; } words.push(word); - cur = Pos(word.line, forward ? (word.to - 1) : word.from); + cur = new Pos(word.line, forward ? (word.to - 1) : word.from); } var shortCircuit = words.length != repeat; var firstWord = words[0]; @@ -3919,19 +4183,31 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) { lastWord = words.pop(); } - return Pos(lastWord.line, lastWord.from); + return new Pos(lastWord.line, lastWord.from); } else if (forward && wordEnd) { - return Pos(lastWord.line, lastWord.to - 1); + return new Pos(lastWord.line, lastWord.to - 1); } else if (!forward && wordEnd) { if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { lastWord = words.pop(); } - return Pos(lastWord.line, lastWord.to); + return new Pos(lastWord.line, lastWord.to); } else { - return Pos(lastWord.line, lastWord.from); + return new Pos(lastWord.line, lastWord.from); } } + function moveToEol(cm, head, motionArgs, vim, keepHPos) { + var cur = head; + var retval= new Pos(cur.line + motionArgs.repeat - 1, Infinity); + var end=cm.clipPos(retval); + end.ch--; + if (!keepHPos) { + vim.lastHPos = Infinity; + vim.lastHSPos = cm.charCoords(end,'div').left; + } + return retval; + } + function moveToCharacter(cm, repeat, forward, character) { var cur = cm.getCursor(); var start = cur.ch; @@ -3944,12 +4220,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ } start = idx; } - return Pos(cm.getCursor().line, idx); + return new Pos(cm.getCursor().line, idx); } function moveToColumn(cm, repeat) { var line = cm.getCursor().line; - return clipCursorToContent(cm, Pos(line, repeat - 1)); + return clipCursorToContent(cm, new Pos(line, repeat - 1)); } function updateMark(cm, vim, markName, pos) { @@ -4167,7 +4443,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ repeat--; } - return Pos(curr_index.ln, curr_index.pos); + return new Pos(curr_index.ln, curr_index.pos); } function selectCompanionObject(cm, head, symb, inclusive) { var cur = head, start, end; @@ -4185,8 +4461,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ var curChar = cm.getLine(cur.line).charAt(cur.ch); var offset = curChar === openSym ? 1 : 0; - start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); - end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); + start = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); + end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); if (!start || !end) { return { start: cur, end: cur }; @@ -4247,8 +4523,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ } return { - start: Pos(cur.line, start), - end: Pos(cur.line, end) + start: new Pos(cur.line, start), + end: new Pos(cur.line, end) }; } defineOption('pcre', true, 'boolean'); @@ -4283,21 +4559,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ var vim = cm.state.vim; return vim.searchState_ || (vim.searchState_ = new SearchState()); } - function dialog(cm, template, shortText, onClose, options) { - if (cm.openDialog) { - cm.openDialog(template, onClose, { bottom: true, value: options.value, - onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, - selectValueOnOpen: false, onClose: function() { - if (cm.state.vim) { - cm.state.vim.status = ""; - cm.ace.renderer.$loop.schedule(cm.ace.renderer.CHANGE_CURSOR); - } - }}); - } - else { - onClose(prompt(shortText, '')); - } - } function splitBySlash(argString) { return splitBySeparator(argString, '/'); } @@ -4400,7 +4661,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } return out.join(''); } - var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'}; + var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\&':'&'}; function unescapeRegexReplace(str) { var stream = new CodeMirror.StringStream(str); var output = []; @@ -4446,30 +4707,58 @@ dom.importCssString(".normal-mode .ace_cursor{\ ignoreCase = (/^[^A-Z]*$/).test(regexPart); } var regexp = new RegExp(regexPart, - (ignoreCase || forceIgnoreCase) ? 'i' : undefined); + (ignoreCase || forceIgnoreCase) ? 'im' : 'm'); return regexp; } - function showConfirm(cm, text) { + function hdom(n) { + if (typeof n === 'string') n = document.createElement(n); + for (var a, i = 1; i < arguments.length; i++) { + if (!(a = arguments[i])) continue; + if (typeof a !== 'object') a = document.createTextNode(a); + if (a.nodeType) n.appendChild(a); + else for (var key in a) { + if (!Object.prototype.hasOwnProperty.call(a, key)) continue; + if (key[0] === '$') n.style[key.slice(1)] = a[key]; + else n.setAttribute(key, a[key]); + } + } + return n; + } + + function showConfirm(cm, template) { + var pre = hdom('span', {$color: 'red', $whiteSpace: 'pre', class: 'cm-vim-message'}, template); //ace_patch span instead of pre if (cm.openNotification) { - cm.openNotification('' + text + '', - {bottom: true, duration: 5000}); + cm.openNotification(pre, {bottom: true, duration: 5000}); } else { - alert(text); + alert(pre.innerText); } } + function makePrompt(prefix, desc) { - var raw = '' + - (prefix || "") + ''; - if (desc) - raw += ' ' + desc + ''; - return raw; + return hdom(document.createDocumentFragment(), + hdom('span', {$fontFamily: 'monospace', $whiteSpace: 'pre'}, + prefix, + hdom('input', {type: 'text', autocorrect: 'off', + autocapitalize: 'off', spellcheck: 'false'})), + desc && hdom('span', {$color: '#888'}, desc)); } - var searchPromptDesc = '(Javascript regexp)'; + function showPrompt(cm, options) { - var shortText = (options.prefix || '') + ' ' + (options.desc || ''); - var prompt = makePrompt(options.prefix, options.desc); - dialog(cm, prompt, shortText, options.onClose, options); + var template = makePrompt(options.prefix, options.desc); + if (cm.openDialog) { + cm.openDialog(template, options.onClose, { + onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, + bottom: true, selectValueOnOpen: false, value: options.value + }); + } + else { + var shortText = ''; + if (typeof options.prefix != "string" && options.prefix) shortText += options.prefix.textContent; + if (options.desc) shortText += " " + options.desc; + options.onClose(prompt(shortText, '')); + } } + function regexEqual(r1, r2) { if (r1 instanceof RegExp && r2 instanceof RegExp) { var props = ['global', 'multiline', 'ignoreCase', 'source']; @@ -4558,10 +4847,17 @@ dom.importCssString(".normal-mode .ace_cursor{\ var cursor = cm.getSearchCursor(query, pos); for (var i = 0; i < repeat; i++) { var found = cursor.find(prev); - if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); } + if (i == 0 && found && cursorEqual(cursor.from(), pos)) { + var lastEndPos = prev ? cursor.from() : cursor.to(); + found = cursor.find(prev); + if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) { + if (cm.getLine(lastEndPos.line).length == lastEndPos.ch) + found = cursor.find(prev); + } + } if (!found) { cursor = cm.getSearchCursor(query, - (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); + (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); if (!cursor.find(prev)) { return; } @@ -4570,6 +4866,29 @@ dom.importCssString(".normal-mode .ace_cursor{\ return cursor.from(); }); } + function findNextFromAndToInclusive(cm, prev, query, repeat, vim) { + if (repeat === undefined) { repeat = 1; } + return cm.operation(function() { + var pos = cm.getCursor(); + var cursor = cm.getSearchCursor(query, pos); + var found = cursor.find(!prev); + if (!vim.visualMode && found && cursorEqual(cursor.from(), pos)) { + cursor.find(!prev); + } + + for (var i = 0; i < repeat; i++) { + found = cursor.find(prev); + if (!found) { + cursor = cm.getSearchCursor(query, + (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); + if (!cursor.find(prev)) { + return; + } + } + } + return [cursor.from(), cursor.to()]; + }); + } function clearSearchHighlight(cm) { var state = getSearchState(cm); cm.removeOverlay(getSearchState(cm).getOverlay()); @@ -4586,7 +4905,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (start instanceof Array) { return inArray(pos, start); } else { - if (end) { + if (typeof end == 'number') { return (pos >= start && pos <= end); } else { return pos == start; @@ -4603,7 +4922,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ function getMarkPos(cm, vim, markName) { if (markName == '\'' || markName == '`') { - return vimGlobalState.jumpList.find(cm, -1) || Pos(0, 0); + return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0); } else if (markName == '.') { return getLastEditPos(cm); } @@ -4643,7 +4962,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ try { this.parseInput_(cm, inputStream, params); } catch(e) { - showConfirm(cm, e); + showConfirm(cm, e.toString()); throw e; } var command; @@ -4662,7 +4981,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ this.parseCommandArgs_(inputStream, params, command); if (command.type == 'exToKey') { for (var i = 0; i < command.toKeys.length; i++) { - CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); + vimApi.handleKey(cm, command.toKeys[i], 'mapping'); } return; } else if (command.type == 'exToEx') { @@ -4681,7 +5000,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ params.callback(); } } catch(e) { - showConfirm(cm, e); + showConfirm(cm, e.toString()); throw e; } }, @@ -4696,7 +5015,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ result.lineEnd = this.parseLineSpec_(cm, inputStream); } } - var commandMatch = inputStream.match(/^(\w+)/); + var commandMatch = inputStream.match(/^(\w+|!!|@@|[!#&*<=>@~])/); if (commandMatch) { result.commandName = commandMatch[1]; } else { @@ -4817,7 +5136,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ var commandName = lhs.substring(1); if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { delete this.commandMap_[commandName]; - return; + return true; } } else { var keys = lhs; @@ -4825,7 +5144,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (keys == defaultKeymap[i].keys && defaultKeymap[i].context === ctx) { defaultKeymap.splice(i, 1); - return; + return true; } } } @@ -4855,13 +5174,11 @@ dom.importCssString(".normal-mode .ace_cursor{\ vmap: function(cm, params) { this.map(cm, params, 'visual'); }, unmap: function(cm, params, ctx) { var mapArgs = params.args; - if (!mapArgs || mapArgs.length < 1) { + if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) { if (cm) { showConfirm(cm, 'No such mapping: ' + params.input); } - return; } - exCommandDispatcher.unmap(mapArgs[0], ctx); }, move: function(cm, params) { commandDispatcher.processCommand(cm, cm.state.vim, { @@ -4926,12 +5243,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ registers: function(cm, params) { var regArgs = params.args; var registers = vimGlobalState.registerController.registers; - var regInfo = '----------Registers----------

'; + var regInfo = '----------Registers----------\n\n'; if (!regArgs) { for (var registerName in registers) { var text = registers[registerName].toString(); if (text.length) { - regInfo += '"' + registerName + ' ' + text + '
'; + regInfo += '"' + registerName + ' ' + text + '\n' } } } else { @@ -4943,7 +5260,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ continue; } var register = registers[registerName] || new Register(); - regInfo += '"' + registerName + ' ' + register.toString() + '
'; + regInfo += '"' + registerName + ' ' + register.toString() + '\n' } } showConfirm(cm, regInfo); @@ -4980,8 +5297,8 @@ dom.importCssString(".normal-mode .ace_cursor{\ var lineStart = params.line || cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); if (lineStart == lineEnd) { return; } - var curStart = Pos(lineStart, 0); - var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); + var curStart = new Pos(lineStart, 0); + var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd)); var text = cm.getRange(curStart, curEnd).split('\n'); var numberRegex = pattern ? pattern : (number == 'decimal') ? /(-?)([\d]+)/ : @@ -5038,12 +5355,16 @@ dom.importCssString(".normal-mode .ace_cursor{\ } cm.replaceRange(text.join('\n'), curStart, curEnd); }, + vglobal: function(cm, params) { + this.global(cm, params); + }, global: function(cm, params) { var argString = params.argString; if (!argString) { showConfirm(cm, 'Regular Expression missing from global'); return; } + var inverted = params.commandName[0] === 'v'; var lineStart = (params.line !== undefined) ? params.line : cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); var tokens = splitBySlash(argString); @@ -5062,27 +5383,32 @@ dom.importCssString(".normal-mode .ace_cursor{\ } } var query = getSearchState(cm).getQuery(); - var matchedLines = [], content = ''; + var matchedLines = []; for (var i = lineStart; i <= lineEnd; i++) { - var matched = query.test(cm.getLine(i)); - if (matched) { - matchedLines.push(i+1); - content+= cm.getLine(i) + '
'; + var line = cm.getLineHandle(i); + var matched = query.test(line.text); + if (matched !== inverted) { + matchedLines.push(cmd ? line : line.text); } } if (!cmd) { - showConfirm(cm, content); + showConfirm(cm, matchedLines.join('\n')); return; } var index = 0; var nextCommand = function() { if (index < matchedLines.length) { - var command = matchedLines[index] + cmd; + var line = matchedLines[index++]; + var lineNum = cm.getLineNumber(line); + if (lineNum == null) { + nextCommand(); + return; + } + var command = (lineNum + 1) + cmd; exCommandDispatcher.processCommand(cm, command, { callback: nextCommand }); } - index++; }; nextCommand(); }, @@ -5102,10 +5428,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ regexPart = new RegExp(regexPart).source; //normalize not escaped characters } replacePart = tokens[1]; - if (regexPart && regexPart[regexPart.length - 1] === '$') { - regexPart = regexPart.slice(0, regexPart.length - 1) + '\\n'; - replacePart = replacePart ? replacePart + '\n' : '\n'; - } if (replacePart !== undefined) { if (getOption('pcre')) { replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&")); @@ -5128,11 +5450,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (flagsPart) { if (flagsPart.indexOf('c') != -1) { confirm = true; - flagsPart.replace('c', ''); } if (flagsPart.indexOf('g') != -1) { global = true; - flagsPart.replace('g', ''); } if (getOption('pcre')) { regexPart = regexPart + '/' + flagsPart; @@ -5166,7 +5486,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ lineStart = lineEnd; lineEnd = lineStart + count - 1; } - var startPos = clipCursorToContent(cm, Pos(lineStart, 0)); + var startPos = clipCursorToContent(cm, new Pos(lineStart, 0)); var cursor = cm.getSearchCursor(query, startPos); doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); }, @@ -5243,7 +5563,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ replaceWith, callback) { cm.state.vim.exMode = true; var done = false; - var lastPos = searchCursor.from(); + var lastPos, modifiedLineNumber, joined; function replaceAll() { cm.operation(function() { while (!done) { @@ -5256,12 +5576,24 @@ dom.importCssString(".normal-mode .ace_cursor{\ function replace() { var text = cm.getRange(searchCursor.from(), searchCursor.to()); var newText = text.replace(query, replaceWith); + var unmodifiedLineNumber = searchCursor.to().line; searchCursor.replace(newText); + modifiedLineNumber = searchCursor.to().line; + lineEnd += modifiedLineNumber - unmodifiedLineNumber; + joined = modifiedLineNumber < unmodifiedLineNumber; + } + function findNextValidMatch() { + var lastMatchTo = lastPos && copyCursor(searchCursor.to()); + var match = searchCursor.findNext(); + if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) { + match = searchCursor.findNext(); + } + return match; } function next() { - while(searchCursor.findNext() && + while(findNextValidMatch() && isInRange(searchCursor.from(), lineStart, lineEnd)) { - if (!global && lastPos && searchCursor.from().line == lastPos.line) { + if (!global && searchCursor.from().line == modifiedLineNumber && !joined) { continue; } cm.scrollIntoView(searchCursor.from(), 30); @@ -5320,7 +5652,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ return; } showPrompt(cm, { - prefix: 'replace with ' + replaceWith + ' (y/n/a/q/l)', + prefix: hdom('span', 'replace with ', hdom('strong', replaceWith), ' (y/n/a/q/l)'), onKeyDown: onPromptKeyDown }); } @@ -5408,7 +5740,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ match = (/<\w+-.+?>|<\w+>|./).exec(text); key = match[0]; text = text.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'macro'); + vimApi.handleKey(cm, key, 'macro'); if (vim.insertMode) { var changes = register.insertModeChanges[imc++].changes; vimGlobalState.macroModeState.lastInsertModeChanges.changes = @@ -5491,18 +5823,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ } else if (!cm.curOp.isVimOp) { handleExternalSelection(cm, vim); } - if (vim.visualMode) { - updateFakeCursor(cm); - } - } - function updateFakeCursor(cm) { - var vim = cm.state.vim; - var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); - var to = offsetCursor(from, 0, 1); - if (vim.fakeCursor) { - vim.fakeCursor.clear(); - } - vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'}); } function handleExternalSelection(cm, vim, keepHPos) { var anchor = cm.getCursor('anchor'); @@ -5612,12 +5932,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (change instanceof InsertModeKey) { CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); } else if (typeof change == "string") { - var cur = cm.getCursor(); - cm.replaceRange(change, cur, cur); + cm.replaceSelection(change); } else { var start = cm.getCursor(); var end = offsetCursor(start, 0, change[0].length); cm.replaceRange(change[0], start, end); + cm.setCursor(end); } } } @@ -5632,7 +5952,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ Vim = CodeMirror.Vim; var specialKey = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc', - left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space', + left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space',insert: 'Ins', home:'Home',end:'End',pageup:'PageUp',pagedown:'PageDown', enter: 'CR' }; function lookupKey(hashId, key, e) { @@ -5684,7 +6004,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ } else if (wasMultiselect && vim.visualBlock) { vim.wasInVisualBlock = true; } - + if (key == '' && !vim.insertMode && !vim.visualMode && wasMultiselect) { cm.ace.exitMultiSelectMode(); } else if (visualBlock || !wasMultiselect || cm.ace.inVirtualSelectionMode) { @@ -5703,7 +6023,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ anchor = offsetCursor(anchor, 0, anchorOffset); cm.state.vim.sel.head = head; cm.state.vim.sel.anchor = anchor; - + isHandled = handleKey(cm, key, origin); sel.$desiredColumn = cm.state.vim.lastHPos == -1 ? null : cm.state.vim.lastHPos; if (cm.virtualSelectionMode()) { @@ -5730,12 +6050,12 @@ dom.importCssString(".normal-mode .ace_cursor{\ var top = pixelPos.top; var left = pixelPos.left; if (!vim.insertMode) { - var isbackwards = !sel.cursor + var isbackwards = !sel.cursor ? session.selection.isBackwards() || session.selection.isEmpty() : Range.comparePoints(sel.cursor, sel.start) <= 0; if (!isbackwards && left > w) left -= w; - } + } if (!vim.insertMode && vim.status) { h = h / 2; top += h; @@ -5775,21 +6095,26 @@ dom.importCssString(".normal-mode .ace_cursor{\ data.inputChar = data.inputKey = null; } } + + if (cm.state.overwrite && vim.insertMode && key == "backspace" && hashId == 0) { + return {command: "gotoleft"} + } if (key == "c" && hashId == 1) { // key == "ctrl-c" if (!useragent.isMac && editor.getCopyText()) { editor.once("copy", function() { - editor.selection.clearSelection(); + if (vim.insertMode) editor.selection.clearSelection(); + else cm.operation(function() { exitVisualMode(cm); }); }); return {command: "null", passEvent: true}; } } - + if (key == "esc" && !vim.insertMode && !vim.visualMode && !cm.ace.inMultiSelectMode) { var searchState = getSearchState(cm); var overlay = searchState.getOverlay(); if (overlay) cm.removeOverlay(overlay); } - + if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) { var insertMode = vim.insertMode; var name = lookupKey(hashId, key, e || {}); @@ -5887,7 +6212,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: 'zA', type: 'action', action: 'fold', actionArgs: { toggle: true, all: true } }, { keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, - + { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAbove" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelow" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAboveSkipCurrent" } }, @@ -5897,6 +6222,34 @@ dom.importCssString(".normal-mode .ace_cursor{\ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextBefore" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextAfter" } } ); + + defaultKeymap.push({ + keys: 'gq', + type: 'operator', + operator: 'hardWrap' + }); + Vim.defineOperator("hardWrap", function(cm, operatorArgs, ranges, oldAnchor, newHead) { + var anchor = ranges[0].anchor.line; + var head = ranges[0].head.line; + if (operatorArgs.linewise) head--; + hardWrap(cm.ace, {startRow: anchor, endRow: head}); + return Pos(head, 0); + }); + defineOption('textwidth', undefined, 'number', ['tw'], function(width, cm) { + if (cm === undefined) { + return; + } + if (width === undefined) { + var value = cm.ace.getOption('printMarginColumn'); + return value; + } else { + var column = Math.round(width); + if (column > 1) { + cm.ace.setOption('printMarginColumn', column); + } + } + }); + actions.aceCommand = function(cm, actionArgs, vim) { cm.vimCmd = actionArgs; if (cm.ace.inVirtualSelectionMode) diff --git a/htdocs/includes/ace/src/keybinding-vscode.js b/htdocs/includes/ace/src/keybinding-vscode.js index 45ac5cf03ff..5ab34483c33 100644 --- a/htdocs/includes/ace/src/keybinding-vscode.js +++ b/htdocs/includes/ace/src/keybinding-vscode.js @@ -116,7 +116,7 @@ exports.handler.addCommands([{ [{ - bindKey: {mac: "Control-G", win: "Ctrl-G"}, + bindKey: {mac: "Ctrl-G", win: "Ctrl-G"}, name: "gotoline" }, { bindKey: {mac: "Command-Shift-L|Command-F2", win: "Ctrl-Shift-L|Ctrl-F2"}, @@ -158,10 +158,10 @@ exports.handler.addCommands([{ bindKey: {mac: "Command-[", win: "Ctrl-["}, name: "blockoutdent" }, { - bindKey: {mac: "Control-PageDown", win: "Alt-PageDown"}, + bindKey: {mac: "Ctrl-PageDown", win: "Alt-PageDown"}, name: "pagedown" }, { - bindKey: {mac: "Control-PageUp", win: "Alt-PageUp"}, + bindKey: {mac: "Ctrl-PageUp", win: "Alt-PageUp"}, name: "pageup" }, { bindKey: {mac: "Shift-Option-A", win: "Shift-Alt-A"}, diff --git a/htdocs/includes/ace/src/mode-abc.js b/htdocs/includes/ace/src/mode-abc.js index 94cb1605ec2..a1dd531b807 100644 --- a/htdocs/includes/ace/src/mode-abc.js +++ b/htdocs/includes/ace/src/mode-abc.js @@ -254,7 +254,10 @@ define("ace/mode/abc",["require","exports","module","ace/lib/oop","ace/mode/text oop.inherits(Mode, TextMode); (function () { + this.lineCommentStart = "%"; + this.$id = "ace/mode/abc"; + this.snippetFileId = "ace/snippets/abc"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-actionscript.js b/htdocs/includes/ace/src/mode-actionscript.js index f23c9d3ceb4..d9e6634b0d7 100644 --- a/htdocs/includes/ace/src/mode-actionscript.js +++ b/htdocs/includes/ace/src/mode-actionscript.js @@ -261,6 +261,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/actionscript"; + this.snippetFileId = "ace/snippets/actionscript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-alda.js b/htdocs/includes/ace/src/mode-alda.js new file mode 100644 index 00000000000..72470be79d0 --- /dev/null +++ b/htdocs/includes/ace/src/mode-alda.js @@ -0,0 +1,311 @@ +define("ace/mode/alda_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + + var AldaHighlightRules = function() { + + this.$rules = { + pitch: [{ + token: "variable.parameter.operator.pitch.alda", + regex: /(?:[+\-]+|\=)/ + }, { + token: "", + regex: "", + next: "timing" + }], + timing: [{ + token: "string.quoted.operator.timing.alda", + regex: /\d+(?:s|ms)?/ + }, { + token: "", + regex: "", + next: "start" + }], + start: [{ + token: [ + "constant.language.instrument.alda", + "constant.language.instrument.alda", + "meta.part.call.alda", + "storage.type.nickname.alda", + "meta.part.call.alda" + ], + regex: /^([a-zA-Z]{2}[\w\-+\'()]*)((?:\s*\/\s*[a-zA-Z]{2}[\w\-+\'()]*)*)(?:(\s*)(\"[a-zA-Z]{2}[\w\-+\'()]*\"))?(\s*:)/ + }, { + token: [ + "text", + "entity.other.inherited-class.voice.alda", + "text" + ], + regex: /^(\s*)(V\d+)(:)/ + }, { + token: "comment.line.number-sign.alda", + regex: /#.*$/ + }, { + token: "entity.name.function.pipe.measure.alda", + regex: /\|/ + }, { + token: "comment.block.inline.alda", + regex: /\(comment\b/, + push: [{ + token: "comment.block.inline.alda", + regex: /\)/, + next: "pop" + }, { + defaultToken: "comment.block.inline.alda" + }] + }, { + token: "entity.name.function.marker.alda", + regex: /%[a-zA-Z]{2}[\w\-+\'()]*/ + }, { + token: "entity.name.function.at-marker.alda", + regex: /@[a-zA-Z]{2}[\w\-+\'()]*/ + }, { + token: "keyword.operator.octave-change.alda", + regex: /\bo\d+\b/ + }, { + token: "keyword.operator.octave-shift.alda", + regex: /[><]/ + }, { + token: "keyword.operator.repeat.alda", + regex: /\*\s*\d+/ + }, { + token: "string.quoted.operator.timing.alda", + regex: /[.]|r\d*(?:s|ms)?/ + },{ + token: "text", + regex: /([cdefgab])/, + next: "pitch" + }, { + token: "string.quoted.operator.timing.alda", + regex: /~/, + next: "timing" + }, { + token: "punctuation.section.embedded.cram.alda", + regex: /\}/, + next: "timing" + }, { + token: "constant.numeric.subchord.alda", + regex: /\// + }, { + todo: { + token: "punctuation.section.embedded.cram.alda", + regex: /\{/, + push: [{ + token: "punctuation.section.embedded.cram.alda", + regex: /\}/, + next: "pop" + }, { + include: "$self" + }] + } + }, { + todo: { + token: "keyword.control.sequence.alda", + regex: /\[/, + push: [{ + token: "keyword.control.sequence.alda", + regex: /\]/, + next: "pop" + }, { + include: "$self" + }] + } + }, { + token: "meta.inline.clojure.alda", + regex: /\(/, + push: [{ + token: "meta.inline.clojure.alda", + regex: /\)/, + next: "pop" + }, { + include: "source.clojure" + }, { + defaultToken: "meta.inline.clojure.alda" + }] + }] + }; + + this.normalizeRules(); + }; + + AldaHighlightRules.metaData = { + scopeName: "source.alda", + fileTypes: ["alda"], + name: "Alda" + }; + + + oop.inherits(AldaHighlightRules, TextHighlightRules); + + exports.AldaHighlightRules = AldaHighlightRules; + }); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/alda",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/alda_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var AldaHighlightRules = require("./alda_highlight_rules").AldaHighlightRules; +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = AldaHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.$id = "ace/mode/alda"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/alda"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-asl.js b/htdocs/includes/ace/src/mode-asl.js index 58c82631449..955838a94b4 100644 --- a/htdocs/includes/ace/src/mode-asl.js +++ b/htdocs/includes/ace/src/mode-asl.js @@ -58,16 +58,7 @@ define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop var ASLHighlightRules = function() { var keywords = ( "Default|DefinitionBlock|Device|Method|Else|ElseIf|For|Function|If|Include|Method|Return|" + - "Scope|Switch|Case|While|Break|BreakPoint|Continue|NoOp|Wait" - ); - - var keywordOperators = ( - "Add|And|Decrement|Divide|Increment|Index|LAnd|LEqual|LGreater|LGreaterEqual|" + - "LLess|LLessEqual|LNot|LNotEqual|LOr|Mod|Multiply|NAnd|NOr|Not|Or|RefOf|Revision|" + - "ShiftLeft|ShiftRight|Subtract|XOr|DerefOf" - ); - - var buildinFunctions = ( + "Scope|Switch|Case|While|Break|BreakPoint|Continue|NoOp|Wait|True|False|" + "AccessAs|Acquire|Alias|BankField|Buffer|Concatenate|ConcatenateResTemplate|" + "CondRefOf|Connection|CopyObject|CreateBitField|CreateByteField|CreateDWordField|" + "CreateField|CreateQWordField|CreateWordField|DataTableRegion|Debug|" + @@ -83,6 +74,12 @@ define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop "WordSpace" ); + var keywordOperators = ( + "Add|And|Decrement|Divide|Increment|Index|LAnd|LEqual|LGreater|LGreaterEqual|" + + "LLess|LLessEqual|LNot|LNotEqual|LOr|Mod|Multiply|NAnd|NOr|Not|Or|RefOf|Revision|" + + "ShiftLeft|ShiftRight|Subtract|XOr|DerefOf" + ); + var flags = ( "AttribQuick|AttribSendReceive|AttribByte|AttribBytes|AttribRawBytes|" + "AttribRawProcessBytes|AttribWord|AttribBlock|AttribProcessCall|AttribBlockProcessCall|" + @@ -121,21 +118,25 @@ define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop "ThermalZoneObj|BuffFieldObj|DDBHandleObj" ); - var buildinConstants = ( + var builtinConstants = ( "__FILE__|__PATH__|__LINE__|__DATE__|__IASL__" ); + var strNumbers = ( + "One|Ones|Zero" + ); + var deprecated = ( "Memory24|Processor" ); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, + "constant.numeric": strNumbers, "keyword.operator": keywordOperators, - "function.buildin": buildinFunctions, - "constant.language": buildinConstants, + "constant.language": builtinConstants, "storage.type": storageTypes, - "constant.character": flags, + "constant.library": flags, "invalid.deprecated": deprecated }, "identifier"); @@ -174,13 +175,13 @@ define("ace/mode/asl_highlight_rules",["require","exports","module","ace/lib/oop regex : /0[xX][0-9a-fA-F]+\b/ }, { token : "constant.numeric", - regex : /(One(s)?|Zero|True|False|[0-9]+)\b/ + regex : /[0-9]+\b/ }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "/|!|\\$|%|&|\\||\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|\\^|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\|=" + regex : /[!\~\*\/%+-<>\^|=&]/ }, { token : "lparen", regex : "[[({]" diff --git a/htdocs/includes/ace/src/mode-bro.js b/htdocs/includes/ace/src/mode-bro.js deleted file mode 100644 index 86521764689..00000000000 --- a/htdocs/includes/ace/src/mode-bro.js +++ /dev/null @@ -1,334 +0,0 @@ -define("ace/mode/bro_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { -"use strict"; - -var oop = require("../lib/oop"); -var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - -var BroHighlightRules = function() { - - this.$rules = { - start: [{ - token: "punctuation.definition.comment.bro", - regex: /#/, - push: [{ - token: "comment.line.number-sign.bro", - regex: /$/, - next: "pop" - }, { - defaultToken: "comment.line.number-sign.bro" - }] - }, { - token: "keyword.control.bro", - regex: /\b(?:break|case|continue|else|for|if|return|switch|next|when|timeout|schedule)\b/ - }, { - token: [ - "meta.function.bro", - "meta.function.bro", - "storage.type.bro", - "meta.function.bro", - "entity.name.function.bro", - "meta.function.bro" - ], - regex: /^(\s*)(?:function|hook|event)(\s*)(.*)(\s*\()(.*)(\).*$)/ - }, { - token: "storage.type.bro", - regex: /\b(?:bool|enum|double|int|count|port|addr|subnet|any|file|interval|time|string|table|vector|set|record|pattern|hook)\b/ - }, { - token: "storage.modifier.bro", - regex: /\b(?:global|const|redef|local|&(?:optional|rotate_interval|rotate_size|add_func|del_func|expire_func|expire_create|expire_read|expire_write|persistent|synchronized|encrypt|mergeable|priority|group|type_column|log|error_handler))\b/ - }, { - token: "keyword.operator.bro", - regex: /\s*(?:\||&&|(?:>|<|!)=?|==)\s*|\b!?in\b/ - }, { - token: "constant.language.bro", - regex: /\b(?:T|F)\b/ - }, { - token: "constant.numeric.bro", - regex: /\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:(?:e|E)(?:\+|-)?[0-9]+)?)(?:\/(?:tcp|udp|icmp)|\s*(?:u?sec|min|hr|day)s?)?\b/ - }, { - token: "punctuation.definition.string.begin.bro", - regex: /"/, - push: [{ - token: "punctuation.definition.string.end.bro", - regex: /"/, - next: "pop" - }, { - include: "#string_escaped_char" - }, { - include: "#string_placeholder" - }, { - defaultToken: "string.quoted.double.bro" - }] - }, { - token: "punctuation.definition.string.begin.bro", - regex: /\//, - push: [{ - token: "punctuation.definition.string.end.bro", - regex: /\//, - next: "pop" - }, { - include: "#string_escaped_char" - }, { - include: "#string_placeholder" - }, { - defaultToken: "string.quoted.regex.bro" - }] - }, { - token: [ - "meta.preprocessor.bro.load", - "keyword.other.special-method.bro" - ], - regex: /^(\s*)(\@load(?:-sigs)?)\b/, - push: [{ - token: [], - regex: /(?=\#)|$/, - next: "pop" - }, { - defaultToken: "meta.preprocessor.bro.load" - }] - }, { - token: [ - "meta.preprocessor.bro.if", - "keyword.other.special-method.bro", - "meta.preprocessor.bro.if" - ], - regex: /^(\s*)(\@endif|\@if(?:n?def)?)(.*$)/, - push: [{ - token: [], - regex: /$/, - next: "pop" - }, { - defaultToken: "meta.preprocessor.bro.if" - }] - }], - "#disabled": [{ - token: "text", - regex: /^\s*\@if(?:n?def)?\b.*$/, - push: [{ - token: "text", - regex: /^\s*\@endif\b.*$/, - next: "pop" - }, { - include: "#disabled" - }, { - include: "#pragma-mark" - }], - comment: "eat nested preprocessor ifdefs" - }], - "#preprocessor-rule-other": [{ - token: [ - "text", - "meta.preprocessor.bro", - "meta.preprocessor.bro", - "text" - ], - regex: /^(\s*)(@if)((?:n?def)?)\b(.*?)(?:(?=)|$)/, - push: [{ - token: ["text", "meta.preprocessor.bro", "text"], - regex: /^(\s*)(@endif)\b(.*$)/, - next: "pop" - }, { - include: "$base" - }] - }], - "#string_escaped_char": [{ - token: "constant.character.escape.bro", - regex: /\\(?:\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2})/ - }, { - token: "invalid.illegal.unknown-escape.bro", - regex: /\\./ - }], - "#string_placeholder": [{ - token: "constant.other.placeholder.bro", - regex: /%(?:\d+\$)?[#0\- +']*[,;:_]?(?:-?\d+|\*(?:-?\d+\$)?)?(?:\.(?:-?\d+|\*(?:-?\d+\$)?)?)?(?:hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?[diouxXDOUeEfFgGaACcSspn%]/ - }, { - token: "invalid.illegal.placeholder.bro", - regex: /%/ - }] - }; - - this.normalizeRules(); -}; - -BroHighlightRules.metaData = { - fileTypes: ["bro"], - foldingStartMarker: "^(\\@if(n?def)?)", - foldingStopMarker: "^\\@endif", - keyEquivalent: "@B", - name: "Bro", - scopeName: "source.bro" -}; - - -oop.inherits(BroHighlightRules, TextHighlightRules); - -exports.BroHighlightRules = BroHighlightRules; -}); - -define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { -"use strict"; - -var oop = require("../../lib/oop"); -var Range = require("../../range").Range; -var BaseFoldMode = require("./fold_mode").FoldMode; - -var FoldMode = exports.FoldMode = function(commentRegex) { - if (commentRegex) { - this.foldingStartMarker = new RegExp( - this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) - ); - this.foldingStopMarker = new RegExp( - this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) - ); - } -}; -oop.inherits(FoldMode, BaseFoldMode); - -(function() { - - this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; - this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; - this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; - this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; - this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; - this._getFoldWidgetBase = this.getFoldWidget; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - - if (this.singleLineBlockCommentRe.test(line)) { - if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) - return ""; - } - - var fw = this._getFoldWidgetBase(session, foldStyle, row); - - if (!fw && this.startRegionRe.test(line)) - return "start"; // lineCommentRegionStart - - return fw; - }; - - this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { - var line = session.getLine(row); - - if (this.startRegionRe.test(line)) - return this.getCommentRegionBlock(session, line, row); - - var match = line.match(this.foldingStartMarker); - if (match) { - var i = match.index; - - if (match[1]) - return this.openingBracketBlock(session, match[1], row, i); - - var range = session.getCommentFoldRange(row, i + match[0].length, 1); - - if (range && !range.isMultiLine()) { - if (forceMultiline) { - range = this.getSectionRange(session, row); - } else if (foldStyle != "all") - range = null; - } - - return range; - } - - if (foldStyle === "markbegin") - return; - - var match = line.match(this.foldingStopMarker); - if (match) { - var i = match.index + match[0].length; - - if (match[1]) - return this.closingBracketBlock(session, match[1], row, i); - - return session.getCommentFoldRange(row, i, -1); - } - }; - - this.getSectionRange = function(session, row) { - var line = session.getLine(row); - var startIndent = line.search(/\S/); - var startRow = row; - var startColumn = line.length; - row = row + 1; - var endRow = row; - var maxRow = session.getLength(); - while (++row < maxRow) { - line = session.getLine(row); - var indent = line.search(/\S/); - if (indent === -1) - continue; - if (startIndent > indent) - break; - var subRange = this.getFoldWidgetRange(session, "all", row); - - if (subRange) { - if (subRange.start.row <= startRow) { - break; - } else if (subRange.isMultiLine()) { - row = subRange.end.row; - } else if (startIndent == indent) { - break; - } - } - endRow = row; - } - - return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); - }; - this.getCommentRegionBlock = function(session, line, row) { - var startColumn = line.search(/\s*$/); - var maxRow = session.getLength(); - var startRow = row; - - var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; - var depth = 1; - while (++row < maxRow) { - line = session.getLine(row); - var m = re.exec(line); - if (!m) continue; - if (m[1]) depth--; - else depth++; - - if (!depth) break; - } - - var endRow = row; - if (endRow > startRow) { - return new Range(startRow, startColumn, endRow, line.length); - } - }; - -}).call(FoldMode.prototype); - -}); - -define("ace/mode/bro",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/bro_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { -"use strict"; - -var oop = require("../lib/oop"); -var TextMode = require("./text").Mode; -var BroHighlightRules = require("./bro_highlight_rules").BroHighlightRules; -var FoldMode = require("./folding/cstyle").FoldMode; - -var Mode = function() { - this.HighlightRules = BroHighlightRules; - this.foldingRules = new FoldMode(); -}; -oop.inherits(Mode, TextMode); - -(function() { - this.$id = "ace/mode/bro"; -}).call(Mode.prototype); - -exports.Mode = Mode; -}); (function() { - window.require(["ace/mode/bro"], function(m) { - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = m; - } - }); - })(); - \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-c_cpp.js b/htdocs/includes/ace/src/mode-c_cpp.js index 4e653ebe028..da730717d6c 100644 --- a/htdocs/includes/ace/src/mode-c_cpp.js +++ b/htdocs/includes/ace/src/mode-c_cpp.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-clojure.js b/htdocs/includes/ace/src/mode-clojure.js index 1f7f41841a7..dd10ec76dd2 100644 --- a/htdocs/includes/ace/src/mode-clojure.js +++ b/htdocs/includes/ace/src/mode-clojure.js @@ -301,6 +301,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/clojure"; + this.snippetFileId = "ace/snippets/clojure"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-coffee.js b/htdocs/includes/ace/src/mode-coffee.js index 75d19d4d3ff..063883c9f58 100644 --- a/htdocs/includes/ace/src/mode-coffee.js +++ b/htdocs/includes/ace/src/mode-coffee.js @@ -385,6 +385,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/coffee"; + this.snippetFileId = "ace/snippets/coffee"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-coldfusion.js b/htdocs/includes/ace/src/mode-coldfusion.js index 8b85c12e940..fcb742db282 100644 --- a/htdocs/includes/ace/src/mode-coldfusion.js +++ b/htdocs/includes/ace/src/mode-coldfusion.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-csound_document.js b/htdocs/includes/ace/src/mode-csound_document.js index ae92fce17e1..de242e5c184 100644 --- a/htdocs/includes/ace/src/mode-csound_document.js +++ b/htdocs/includes/ace/src/mode-csound_document.js @@ -300,7 +300,7 @@ var CsoundScoreHighlightRules = function(embeddedRulePrefix) { start.push( { token : "keyword.control.csound-score", - regex : /[abCdefiqstvxy]/ + regex : /[aBbCdefiqstvxy]/ }, { token : "invalid.illegal.csound-score", regex : /w/ @@ -935,10 +935,10 @@ var PythonHighlightRules = function() { regex: "\\s+" }, { token: "string", - regex: "'(.)*'" + regex: "'[^']*'" }, { token: "string", - regex: '"(.)*"' + regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" @@ -1141,6 +1141,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "adsynt", "adsynt2", "aftouch", + "allpole", "alpass", "alwayson", "ampdb", @@ -1148,11 +1149,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ampmidi", "ampmidicurve", "ampmidid", + "apoleparams", + "arduinoRead", + "arduinoReadF", + "arduinoStart", + "arduinoStop", "areson", "aresonk", "atone", "atonek", "atonex", + "autocorr", "babo", "balance", "balance2", @@ -1160,8 +1167,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "barmodel", "bbcutm", "bbcuts", - "beadsynt", - "beosc", "betarand", "bexprnd", "bformdec1", @@ -1170,6 +1175,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "biquad", "biquada", "birnd", + "bob", "bpf", "bpfcos", "bqrez", @@ -1195,6 +1201,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ceps", "cepsinv", "chanctrl", + "changed", "changed2", "chani", "chano", @@ -1206,11 +1213,19 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "chnclear", "chnexport", "chnget", + "chngeta", + "chngeti", + "chngetk", "chngetks", + "chngets", "chnmix", "chnparams", "chnset", + "chnseta", + "chnseti", + "chnsetk", "chnsetks", + "chnsets", "chuap", "clear", "clfilt", @@ -1219,6 +1234,13 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "clockon", "cmp", "cmplxprod", + "cntCreate", + "cntCycles", + "cntDelete", + "cntDelete_i", + "cntRead", + "cntReset", + "cntState", "comb", "combinv", "compilecsd", @@ -1238,6 +1260,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "cosseg", "cossegb", "cossegr", + "count", + "count_i", "cps2pch", "cpsmidi", "cpsmidib", @@ -1263,6 +1287,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ctrl21", "ctrl7", "ctrlinit", + "ctrlpreset", + "ctrlprint", + "ctrlprintpresets", + "ctrlsave", + "ctrlselect", "cuserrnd", "dam", "date", @@ -1408,6 +1437,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ftchnls", "ftconv", "ftcps", + "ftexists", "ftfree", "ftgen", "ftgenonce", @@ -1424,7 +1454,9 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ftsamplebank", "ftsave", "ftsavek", + "ftset", "ftslice", + "ftslicei", "ftsr", "gain", "gainslider", @@ -1441,7 +1473,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "getcol", "getftargs", "getrow", - "getrowlin", "getseed", "gogobel", "grain", @@ -1689,8 +1720,12 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "la_k_upper_solve_mr", "la_k_vc_set", "la_k_vr_set", + "lag", + "lagud", + "lastcycle", "lenarray", "lfo", + "lfsr", "limit", "limit1", "lincos", @@ -1734,6 +1769,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "lowpass2", "lowres", "lowresx", + "lpcanal", + "lpcfilter", "lpf18", "lpform", "lpfreson", @@ -1749,14 +1786,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "lpshold", "lpsholdp", "lpslot", - "lua_exec", - "lua_iaopcall", - "lua_iaopcall_off", - "lua_ikopcall", - "lua_ikopcall_off", - "lua_iopcall", - "lua_iopcall_off", - "lua_opdef", + "lufs", "mac", "maca", "madsr", @@ -1779,6 +1809,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "median", "mediank", "metro", + "metro2", "mfb", "midglobal", "midiarp", @@ -1831,6 +1862,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "mp3sr", "mpulse", "mrtmsg", + "ms2st", "mtof", "mton", "multitap", @@ -1840,6 +1872,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "mvclpf2", "mvclpf3", "mvclpf4", + "mvmfilter", "mxadsr", "nchnls_hw", "nestedap", @@ -1883,6 +1916,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "oscilx", "out", "out32", + "outall", "outc", "outch", "outh", @@ -1983,12 +2017,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "printk2", "printks", "printks2", + "println", "prints", + "printsk", "product", "pset", - "ptable", - "ptable3", - "ptablei", "ptablew", "ptrack", "puts", @@ -2005,6 +2038,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvsarp", "pvsbandp", "pvsbandr", + "pvsbandwidth", "pvsbin", "pvsblur", "pvsbuffer", @@ -2013,6 +2047,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvscale", "pvscent", "pvsceps", + "pvscfs", "pvscross", "pvsdemix", "pvsdiskin", @@ -2032,6 +2067,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvsinfo", "pvsinit", "pvslock", + "pvslpc", "pvsmaska", "pvsmix", "pvsmooth", @@ -2133,6 +2169,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "qnan", "r2c", "rand", + "randc", "randh", "randi", "random", @@ -2156,6 +2193,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "repluck", "reshapearray", "reson", + "resonbnk", "resonk", "resonr", "resonx", @@ -2173,6 +2211,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "rms", "rnd", "rnd31", + "rndseed", "round", "rspline", "rtclock", @@ -2185,14 +2224,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sc_phasor", "sc_trig", "scale", + "scale2", "scalearray", "scanhammer", "scans", "scantable", "scanu", + "scanu2", "schedkwhen", "schedkwhennamed", "schedule", + "schedulek", "schedwhen", "scoreline", "scoreline_i", @@ -2238,6 +2280,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sinh", "sininv", "sinsyn", + "skf", "sleighbells", "slicearray", "slicearray_i", @@ -2273,13 +2316,16 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "spat3di", "spat3dt", "spdist", + "spf", "splitrig", "sprintf", "sprintfk", "spsend", "sqrt", "squinewave", + "st2ms", "statevar", + "sterrain", "stix", "strcat", "strcatk", @@ -2303,6 +2349,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "strrindex", "strrindexk", "strset", + "strstrip", "strsub", "strsubk", "strtod", @@ -2317,6 +2364,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sum", "sumarray", "svfilter", + "svn", "syncgrain", "syncloop", "syncphasor", @@ -2357,7 +2405,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "tabmorphi", "tabplay", "tabrec", - "tabrowlin", "tabsum", "tabw", "tabw_i", @@ -2389,7 +2436,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "trcross", "trfilter", "trhighest", + "trigExpseg", + "trigLinseg", "trigger", + "trighold", + "trigphasor", "trigseq", "trim", "trim_i", @@ -2401,6 +2452,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "trsplit", "turnoff", "turnoff2", + "turnoff2_i", + "turnoff3", "turnon", "tvconv", "unirand", @@ -2424,6 +2477,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "vbapz", "vbapzmove", "vcella", + "vclpf", "vco", "vco2", "vco2ft", @@ -2472,6 +2526,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "vpow_i", "vpowv", "vpowv_i", + "vps", "vpvoc", "vrandh", "vrandi", @@ -2511,6 +2566,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "wrap", "writescratch", "wterrain", + "wterrain2", "xadsr", "xin", "xout", @@ -2543,24 +2599,47 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "zkwm" ]; var deprecatedOpcodes = [ + "OSCsendA", "array", + "beadsynt", + "beosc", "bformdec", "bformenc", - "changed", + "buchla", "copy2ftab", "copy2ttab", + "getrowlin", "hrtfer", "ktableseg", "lentab", + "lua_exec", + "lua_iaopcall", + "lua_iaopcall_off", + "lua_ikopcall", + "lua_ikopcall_off", + "lua_iopcall", + "lua_iopcall_off", + "lua_opdef", "maxtab", "mintab", + "mp3scal_check", + "mp3scal_load", + "mp3scal_load2", + "mp3scal_play", + "mp3scal_play2", "pop", "pop_f", + "ptable", + "ptable3", + "ptablei", "ptableiw", "push", "push_f", + "pvsgendy", "scalet", + "signalflowgraph", "sndload", + "socksend_k", "soundout", "soundouts", "specaddm", @@ -2573,11 +2652,14 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "specsum", "spectrum", "stack", + "sumTableFilter", "sumtab", + "systime", "tabgen", "tableiw", "tabmap", "tabmap_i", + "tabrowlin", "tabslice", "tb0", "tb0_init", @@ -2612,6 +2694,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "tb9", "tb9_init", "vbap16", + "vbap1move", "vbap4", "vbap4move", "vbap8", @@ -4006,6 +4089,11 @@ var Mode = function() { }; oop.inherits(Mode, TextMode); +(function() { + this.$id = "ace/mode/csound_document"; + this.snippetFileId = "ace/snippets/csound_document"; +}).call(Mode.prototype); + exports.Mode = Mode; }); (function() { window.require(["ace/mode/csound_document"], function(m) { diff --git a/htdocs/includes/ace/src/mode-csound_orchestra.js b/htdocs/includes/ace/src/mode-csound_orchestra.js index 7cb3917c9f4..58f932eceee 100644 --- a/htdocs/includes/ace/src/mode-csound_orchestra.js +++ b/htdocs/includes/ace/src/mode-csound_orchestra.js @@ -300,7 +300,7 @@ var CsoundScoreHighlightRules = function(embeddedRulePrefix) { start.push( { token : "keyword.control.csound-score", - regex : /[abCdefiqstvxy]/ + regex : /[aBbCdefiqstvxy]/ }, { token : "invalid.illegal.csound-score", regex : /w/ @@ -935,10 +935,10 @@ var PythonHighlightRules = function() { regex: "\\s+" }, { token: "string", - regex: "'(.)*'" + regex: "'[^']*'" }, { token: "string", - regex: '"(.)*"' + regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" @@ -1141,6 +1141,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "adsynt", "adsynt2", "aftouch", + "allpole", "alpass", "alwayson", "ampdb", @@ -1148,11 +1149,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ampmidi", "ampmidicurve", "ampmidid", + "apoleparams", + "arduinoRead", + "arduinoReadF", + "arduinoStart", + "arduinoStop", "areson", "aresonk", "atone", "atonek", "atonex", + "autocorr", "babo", "balance", "balance2", @@ -1160,8 +1167,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "barmodel", "bbcutm", "bbcuts", - "beadsynt", - "beosc", "betarand", "bexprnd", "bformdec1", @@ -1170,6 +1175,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "biquad", "biquada", "birnd", + "bob", "bpf", "bpfcos", "bqrez", @@ -1195,6 +1201,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ceps", "cepsinv", "chanctrl", + "changed", "changed2", "chani", "chano", @@ -1206,11 +1213,19 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "chnclear", "chnexport", "chnget", + "chngeta", + "chngeti", + "chngetk", "chngetks", + "chngets", "chnmix", "chnparams", "chnset", + "chnseta", + "chnseti", + "chnsetk", "chnsetks", + "chnsets", "chuap", "clear", "clfilt", @@ -1219,6 +1234,13 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "clockon", "cmp", "cmplxprod", + "cntCreate", + "cntCycles", + "cntDelete", + "cntDelete_i", + "cntRead", + "cntReset", + "cntState", "comb", "combinv", "compilecsd", @@ -1238,6 +1260,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "cosseg", "cossegb", "cossegr", + "count", + "count_i", "cps2pch", "cpsmidi", "cpsmidib", @@ -1263,6 +1287,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ctrl21", "ctrl7", "ctrlinit", + "ctrlpreset", + "ctrlprint", + "ctrlprintpresets", + "ctrlsave", + "ctrlselect", "cuserrnd", "dam", "date", @@ -1408,6 +1437,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ftchnls", "ftconv", "ftcps", + "ftexists", "ftfree", "ftgen", "ftgenonce", @@ -1424,7 +1454,9 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "ftsamplebank", "ftsave", "ftsavek", + "ftset", "ftslice", + "ftslicei", "ftsr", "gain", "gainslider", @@ -1441,7 +1473,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "getcol", "getftargs", "getrow", - "getrowlin", "getseed", "gogobel", "grain", @@ -1689,8 +1720,12 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "la_k_upper_solve_mr", "la_k_vc_set", "la_k_vr_set", + "lag", + "lagud", + "lastcycle", "lenarray", "lfo", + "lfsr", "limit", "limit1", "lincos", @@ -1734,6 +1769,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "lowpass2", "lowres", "lowresx", + "lpcanal", + "lpcfilter", "lpf18", "lpform", "lpfreson", @@ -1749,14 +1786,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "lpshold", "lpsholdp", "lpslot", - "lua_exec", - "lua_iaopcall", - "lua_iaopcall_off", - "lua_ikopcall", - "lua_ikopcall_off", - "lua_iopcall", - "lua_iopcall_off", - "lua_opdef", + "lufs", "mac", "maca", "madsr", @@ -1779,6 +1809,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "median", "mediank", "metro", + "metro2", "mfb", "midglobal", "midiarp", @@ -1831,6 +1862,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "mp3sr", "mpulse", "mrtmsg", + "ms2st", "mtof", "mton", "multitap", @@ -1840,6 +1872,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "mvclpf2", "mvclpf3", "mvclpf4", + "mvmfilter", "mxadsr", "nchnls_hw", "nestedap", @@ -1883,6 +1916,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "oscilx", "out", "out32", + "outall", "outc", "outch", "outh", @@ -1983,12 +2017,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "printk2", "printks", "printks2", + "println", "prints", + "printsk", "product", "pset", - "ptable", - "ptable3", - "ptablei", "ptablew", "ptrack", "puts", @@ -2005,6 +2038,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvsarp", "pvsbandp", "pvsbandr", + "pvsbandwidth", "pvsbin", "pvsblur", "pvsbuffer", @@ -2013,6 +2047,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvscale", "pvscent", "pvsceps", + "pvscfs", "pvscross", "pvsdemix", "pvsdiskin", @@ -2032,6 +2067,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "pvsinfo", "pvsinit", "pvslock", + "pvslpc", "pvsmaska", "pvsmix", "pvsmooth", @@ -2133,6 +2169,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "qnan", "r2c", "rand", + "randc", "randh", "randi", "random", @@ -2156,6 +2193,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "repluck", "reshapearray", "reson", + "resonbnk", "resonk", "resonr", "resonx", @@ -2173,6 +2211,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "rms", "rnd", "rnd31", + "rndseed", "round", "rspline", "rtclock", @@ -2185,14 +2224,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sc_phasor", "sc_trig", "scale", + "scale2", "scalearray", "scanhammer", "scans", "scantable", "scanu", + "scanu2", "schedkwhen", "schedkwhennamed", "schedule", + "schedulek", "schedwhen", "scoreline", "scoreline_i", @@ -2238,6 +2280,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sinh", "sininv", "sinsyn", + "skf", "sleighbells", "slicearray", "slicearray_i", @@ -2273,13 +2316,16 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "spat3di", "spat3dt", "spdist", + "spf", "splitrig", "sprintf", "sprintfk", "spsend", "sqrt", "squinewave", + "st2ms", "statevar", + "sterrain", "stix", "strcat", "strcatk", @@ -2303,6 +2349,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "strrindex", "strrindexk", "strset", + "strstrip", "strsub", "strsubk", "strtod", @@ -2317,6 +2364,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "sum", "sumarray", "svfilter", + "svn", "syncgrain", "syncloop", "syncphasor", @@ -2357,7 +2405,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "tabmorphi", "tabplay", "tabrec", - "tabrowlin", "tabsum", "tabw", "tabw_i", @@ -2389,7 +2436,11 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "trcross", "trfilter", "trhighest", + "trigExpseg", + "trigLinseg", "trigger", + "trighold", + "trigphasor", "trigseq", "trim", "trim_i", @@ -2401,6 +2452,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "trsplit", "turnoff", "turnoff2", + "turnoff2_i", + "turnoff3", "turnon", "tvconv", "unirand", @@ -2424,6 +2477,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "vbapz", "vbapzmove", "vcella", + "vclpf", "vco", "vco2", "vco2ft", @@ -2472,6 +2526,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "vpow_i", "vpowv", "vpowv_i", + "vps", "vpvoc", "vrandh", "vrandi", @@ -2511,6 +2566,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "wrap", "writescratch", "wterrain", + "wterrain2", "xadsr", "xin", "xout", @@ -2543,24 +2599,47 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "zkwm" ]; var deprecatedOpcodes = [ + "OSCsendA", "array", + "beadsynt", + "beosc", "bformdec", "bformenc", - "changed", + "buchla", "copy2ftab", "copy2ttab", + "getrowlin", "hrtfer", "ktableseg", "lentab", + "lua_exec", + "lua_iaopcall", + "lua_iaopcall_off", + "lua_ikopcall", + "lua_ikopcall_off", + "lua_iopcall", + "lua_iopcall_off", + "lua_opdef", "maxtab", "mintab", + "mp3scal_check", + "mp3scal_load", + "mp3scal_load2", + "mp3scal_play", + "mp3scal_play2", "pop", "pop_f", + "ptable", + "ptable3", + "ptablei", "ptableiw", "push", "push_f", + "pvsgendy", "scalet", + "signalflowgraph", "sndload", + "socksend_k", "soundout", "soundouts", "specaddm", @@ -2573,11 +2652,14 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "specsum", "spectrum", "stack", + "sumTableFilter", "sumtab", + "systime", "tabgen", "tableiw", "tabmap", "tabmap_i", + "tabrowlin", "tabslice", "tb0", "tb0_init", @@ -2612,6 +2694,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) { "tb9", "tb9_init", "vbap16", + "vbap1move", "vbap4", "vbap4move", "vbap8", @@ -2937,6 +3020,8 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = ";"; this.blockComment = {start: "/*", end: "*/"}; + this.$id = "ace/mode/csound_orchestra"; + this.snippetFileId = "ace/snippets/csound_orchestra"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-csound_score.js b/htdocs/includes/ace/src/mode-csound_score.js index e7168662e1a..3155ca1ab67 100644 --- a/htdocs/includes/ace/src/mode-csound_score.js +++ b/htdocs/includes/ace/src/mode-csound_score.js @@ -300,7 +300,7 @@ var CsoundScoreHighlightRules = function(embeddedRulePrefix) { start.push( { token : "keyword.control.csound-score", - regex : /[abCdefiqstvxy]/ + regex : /[aBbCdefiqstvxy]/ }, { token : "invalid.illegal.csound-score", regex : /w/ @@ -448,6 +448,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = ";"; this.blockComment = {start: "/*", end: "*/"}; + this.$id = "ace/mode/csound_score"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-css.js b/htdocs/includes/ace/src/mode-css.js index 5ccc1ae304c..04560163b76 100644 --- a/htdocs/includes/ace/src/mode-css.js +++ b/htdocs/includes/ace/src/mode-css.js @@ -705,6 +705,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-curly.js b/htdocs/includes/ace/src/mode-curly.js index c408fed95ed..a3a7e712980 100644 --- a/htdocs/includes/ace/src/mode-curly.js +++ b/htdocs/includes/ace/src/mode-curly.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-d.js b/htdocs/includes/ace/src/mode-d.js index 8615c468b48..15379fb9992 100644 --- a/htdocs/includes/ace/src/mode-d.js +++ b/htdocs/includes/ace/src/mode-d.js @@ -308,7 +308,7 @@ var DHighlightRules = function() { regex: '[a-zA-Z]+' }, { token: 'string', - regex: '".*"' + regex: '"[^"]*"' }, { token: 'comment', regex: '//.*$' diff --git a/htdocs/includes/ace/src/mode-dart.js b/htdocs/includes/ace/src/mode-dart.js index 4a228361e6e..9abd9ecc054 100644 --- a/htdocs/includes/ace/src/mode-dart.js +++ b/htdocs/includes/ace/src/mode-dart.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; @@ -700,6 +701,7 @@ oop.inherits(Mode, CMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/dart"; + this.snippetFileId = "ace/snippets/dart"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-diff.js b/htdocs/includes/ace/src/mode-diff.js index b8237149bef..8a0ec7e722a 100644 --- a/htdocs/includes/ace/src/mode-diff.js +++ b/htdocs/includes/ace/src/mode-diff.js @@ -132,6 +132,7 @@ oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/diff"; + this.snippetFileId = "ace/snippets/diff"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-django.js b/htdocs/includes/ace/src/mode-django.js index 81ce28dc73f..3a5d519bda7 100644 --- a/htdocs/includes/ace/src/mode-django.js +++ b/htdocs/includes/ace/src/mode-django.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2578,6 +2581,7 @@ oop.inherits(Mode, HtmlMode); (function() { this.$id = "ace/mode/django"; + this.snippetFileId = "ace/snippets/django"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-dockerfile.js b/htdocs/includes/ace/src/mode-dockerfile.js index 6b4e85c871b..26d64de860b 100644 --- a/htdocs/includes/ace/src/mode-dockerfile.js +++ b/htdocs/includes/ace/src/mode-dockerfile.js @@ -435,6 +435,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/sh"; + this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-drools.js b/htdocs/includes/ace/src/mode-drools.js index d208011c997..adcc08f45f7 100644 --- a/htdocs/includes/ace/src/mode-drools.js +++ b/htdocs/includes/ace/src/mode-drools.js @@ -168,7 +168,7 @@ var JavaHighlightRules = function() { regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + regex : "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "lparen", regex : "[[({]" @@ -483,6 +483,7 @@ oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/drools"; + this.snippetFileId = "ace/snippets/drools"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-edifact.js b/htdocs/includes/ace/src/mode-edifact.js index cffe68e2532..3fc865aee9a 100644 --- a/htdocs/includes/ace/src/mode-edifact.js +++ b/htdocs/includes/ace/src/mode-edifact.js @@ -152,6 +152,7 @@ oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/edifact"; + this.snippetFileId = "ace/snippets/edifact"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-ejs.js b/htdocs/includes/ace/src/mode-ejs.js index 95323019651..5825e8385ca 100644 --- a/htdocs/includes/ace/src/mode-ejs.js +++ b/htdocs/includes/ace/src/mode-ejs.js @@ -1264,6 +1264,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1601,6 +1602,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2508,17 +2511,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -2528,9 +2531,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -2570,18 +2598,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -2597,126 +2626,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -2733,7 +2827,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -2748,38 +2842,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -2792,94 +3109,271 @@ oop.inherits(RubyHighlightRules, TextHighlightRules); exports.RubyHighlightRules = RubyHighlightRules; }); -define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { +define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function () { +}; -var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } +(function () { + this.indentKeywords = { + "class": 1, + "def": 1, + "module": 1, + "do": 1, + "unless": 1, + "if": 1, + "while": 1, + "for": 1, + "until": 1, + "begin": 1, + "else": 0, + "elsif": 0, + "rescue": 0, + "ensure": 0, + "when": 0, + "end": -1, + "case": 1, + "=begin": 1, + "=end": -1 }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; + this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; + this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; + + this.getFoldWidget = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + + if (isStart && !isEnd) { + var match = line.match(this.foldingStartMarker); + if (match[1]) { + if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { + if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { + return; + } + if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { + return; + } + } + + if (match[1] == "when") { + if (/\sthen\s/.test(line) === true) { + return; + } + } + if (session.getTokenAt(row, match.index + 2).type === "keyword") + return "start"; + } else if (match[3]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "start"; + } else { return "start"; } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; + } + if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) + return ""; + + var match = line.match(this.foldingStopMarker); + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return "end"; + } else if (match[1]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "end"; + } else + return "end"; + }; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.doc.getLine(row); + var match = this.foldingStartMarker.exec(line); + if (match) { + if (match[1] || match[3]) + return this.rubyBlock(session, row, match.index + 2); + + return this.openingBracketBlock(session, "{", row, match.index); + } + + var match = this.foldingStopMarker.exec(line); + if (match) { + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return this.rubyBlock(session, row, match.index + 1); + } + + if (match[1] === "=end") { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return this.rubyBlock(session, row, match.index + 1); + } + + return this.closingBracketBlock(session, "}", row, match.index + match[0].length); + } + }; + + this.rubyBlock = function (session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword" && token.type != "comment.multiline")) + return; + + var val = token.value; + var line = session.getLine(row); + switch (token.value) { + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + return; + } + var dir = this.indentKeywords[val]; + break; + case "when": + if (/\sthen\s/.test(line)) { + return; + } + case "elsif": + case "rescue": + case "ensure": + var dir = 1; + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line)) { + return; + } + var dir = 1; + break; + default: + var dir = this.indentKeywords[val]; + break; + } + + var stack = [val]; + if (!dir) + return; + + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(stream.getCurrentTokenRange()); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + if (token.type == "comment.multiline") { + while (token = stream.step()) { + if (token.type !== "comment.multiline") + continue; + if (dir == 1) { + startColumn = 6; + if (token.value == "=end") { + break; + } + } else { + if (token.value == "=begin") { + break; + } + } + } + } else { + while (token = stream.step()) { + var ignore = false; + if (token.type !== "keyword") + continue; + var level = dir * this.indentKeywords[token.value]; + line = session.getLine(stream.getCurrentTokenRow()); + switch (token.value) { + case "do": + for (var i = stream.$tokenIndex - 1; i >= 0; i--) { + var prevToken = stream.$rowTokens[i]; + if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { + level = 0; + break; + } + } + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "when": + if (/\sthen\s/.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(token.value); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + if ((val == "while" || val == "until" || val == "for") && token.value != "do") { + break; + } + if (token.value == "do" && dir == -1 && level != 0) + break; + if (token.value != "do") + break; + } + + if (level === 0) { + stack.unshift(token.value); + } + } } } - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; + if (!token) + return null; - if (indent < nextIndent) - return "start"; - else - return ""; + if (tokenRange) { + ranges.push(stream.getCurrentTokenRange()); + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + if (token.type === "comment.multiline") { + var endColumn = 6; + } else { + var endColumn = session.getLine(row).length; + } + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); }; }).call(FoldMode.prototype); }); -define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) { +define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); @@ -2888,13 +3382,14 @@ 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 FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new FoldMode(); + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); @@ -2909,7 +3404,7 @@ oop.inherits(Mode, TextMode); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; - if (tokens.length && tokens[tokens.length-1].type == "comment") { + if (tokens.length && tokens[tokens.length - 1].type == "comment") { return indent; } @@ -2917,7 +3412,7 @@ oop.inherits(Mode, TextMode); var match = line.match(/^.*[\{\(\[]\s*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else|when)\s*/); + var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } @@ -2927,7 +3422,7 @@ oop.inherits(Mode, TextMode); }; this.checkOutdent = function(state, line, input) { - return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); + return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { @@ -2940,11 +3435,24 @@ oop.inherits(Mode, TextMode); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) - session.remove(new Range(row, indent.length-tab.length, row, indent.length)); + session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; + this.getMatching = function(session, row, column) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + + var startToken = session.getTokenAt(row, column); + if (startToken && startToken.value in this.indentKeywords) + return this.foldingRules.rubyBlock(session, row, column, true); + }; + this.$id = "ace/mode/ruby"; + this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-erlang.js b/htdocs/includes/ace/src/mode-erlang.js index 3f91c0098c8..fd1143d9e87 100644 --- a/htdocs/includes/ace/src/mode-erlang.js +++ b/htdocs/includes/ace/src/mode-erlang.js @@ -996,6 +996,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "%"; this.blockComment = null; this.$id = "ace/mode/erlang"; + this.snippetFileId = "ace/snippets/erlang"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-fsl.js b/htdocs/includes/ace/src/mode-fsl.js index 9bfde7ebaba..9bd21d96c15 100644 --- a/htdocs/includes/ace/src/mode-fsl.js +++ b/htdocs/includes/ace/src/mode-fsl.js @@ -245,6 +245,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/fsl"; + this.snippetFileId = "ace/snippets/fsl"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-glsl.js b/htdocs/includes/ace/src/mode-glsl.js index b5bc6e699e1..f5d0c815c94 100644 --- a/htdocs/includes/ace/src/mode-glsl.js +++ b/htdocs/includes/ace/src/mode-glsl.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-gobstones.js b/htdocs/includes/ace/src/mode-gobstones.js index 1ab66a8b898..cd2fc3aaf82 100644 --- a/htdocs/includes/ace/src/mode-gobstones.js +++ b/htdocs/includes/ace/src/mode-gobstones.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1075,6 +1076,7 @@ oop.inherits(Mode, JavaScriptMode); }; this.$id = "ace/mode/gobstones"; + this.snippetFileId = "ace/snippets/gobstones"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-graphqlschema.js b/htdocs/includes/ace/src/mode-graphqlschema.js index e252b70c78c..cf0931e3c8a 100644 --- a/htdocs/includes/ace/src/mode-graphqlschema.js +++ b/htdocs/includes/ace/src/mode-graphqlschema.js @@ -200,6 +200,7 @@ oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$id = "ace/mode/graphqlschema"; + this.snippetFileId = "ace/snippets/graphqlschema"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-groovy.js b/htdocs/includes/ace/src/mode-groovy.js index 4c48df1f925..8395de92087 100644 --- a/htdocs/includes/ace/src/mode-groovy.js +++ b/htdocs/includes/ace/src/mode-groovy.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-haml.js b/htdocs/includes/ace/src/mode-haml.js index e6821c8a45e..db8e69343ca 100644 --- a/htdocs/includes/ace/src/mode-haml.js +++ b/htdocs/includes/ace/src/mode-haml.js @@ -1012,17 +1012,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -1032,9 +1032,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -1074,18 +1099,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -1101,126 +1127,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -1237,7 +1328,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -1252,38 +1343,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -1545,6 +1859,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.$id = "ace/mode/haml"; + this.snippetFileId = "ace/snippets/haml"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-handlebars.js b/htdocs/includes/ace/src/mode-handlebars.js index 620074baff2..ba8f7e015fc 100644 --- a/htdocs/includes/ace/src/mode-handlebars.js +++ b/htdocs/includes/ace/src/mode-handlebars.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-haskell.js b/htdocs/includes/ace/src/mode-haskell.js index af5eff5693a..bf5f1d6edb3 100644 --- a/htdocs/includes/ace/src/mode-haskell.js +++ b/htdocs/includes/ace/src/mode-haskell.js @@ -366,6 +366,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "--"; this.blockComment = null; this.$id = "ace/mode/haskell"; + this.snippetFileId = "ace/snippets/haskell"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-html.js b/htdocs/includes/ace/src/mode-html.js index 2d7ddabbdaa..f8466c2ddb7 100644 --- a/htdocs/includes/ace/src/mode-html.js +++ b/htdocs/includes/ace/src/mode-html.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-html_elixir.js b/htdocs/includes/ace/src/mode-html_elixir.js index 5d80fcbbcef..53fa828bdde 100644 --- a/htdocs/includes/ace/src/mode-html_elixir.js +++ b/htdocs/includes/ace/src/mode-html_elixir.js @@ -1704,6 +1704,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2041,6 +2042,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2933,6 +2935,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-html_ruby.js b/htdocs/includes/ace/src/mode-html_ruby.js index ec77543f358..e3eb0f7761a 100644 --- a/htdocs/includes/ace/src/mode-html_ruby.js +++ b/htdocs/includes/ace/src/mode-html_ruby.js @@ -1012,17 +1012,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -1032,9 +1032,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -1074,18 +1099,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -1101,126 +1127,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -1237,7 +1328,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -1252,38 +1343,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -1613,6 +1927,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1950,6 +2265,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2842,99 +3158,277 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; }); -define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { +define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function () { +}; -var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } +(function () { + this.indentKeywords = { + "class": 1, + "def": 1, + "module": 1, + "do": 1, + "unless": 1, + "if": 1, + "while": 1, + "for": 1, + "until": 1, + "begin": 1, + "else": 0, + "elsif": 0, + "rescue": 0, + "ensure": 0, + "when": 0, + "end": -1, + "case": 1, + "=begin": 1, + "=end": -1 }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; + this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; + this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; + + this.getFoldWidget = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + + if (isStart && !isEnd) { + var match = line.match(this.foldingStartMarker); + if (match[1]) { + if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { + if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { + return; + } + if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { + return; + } + } + + if (match[1] == "when") { + if (/\sthen\s/.test(line) === true) { + return; + } + } + if (session.getTokenAt(row, match.index + 2).type === "keyword") + return "start"; + } else if (match[3]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "start"; + } else { return "start"; } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; + } + if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) + return ""; + + var match = line.match(this.foldingStopMarker); + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return "end"; + } else if (match[1]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "end"; + } else + return "end"; + }; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.doc.getLine(row); + var match = this.foldingStartMarker.exec(line); + if (match) { + if (match[1] || match[3]) + return this.rubyBlock(session, row, match.index + 2); + + return this.openingBracketBlock(session, "{", row, match.index); + } + + var match = this.foldingStopMarker.exec(line); + if (match) { + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return this.rubyBlock(session, row, match.index + 1); + } + + if (match[1] === "=end") { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return this.rubyBlock(session, row, match.index + 1); + } + + return this.closingBracketBlock(session, "}", row, match.index + match[0].length); + } + }; + + this.rubyBlock = function (session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword" && token.type != "comment.multiline")) + return; + + var val = token.value; + var line = session.getLine(row); + switch (token.value) { + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + return; + } + var dir = this.indentKeywords[val]; + break; + case "when": + if (/\sthen\s/.test(line)) { + return; + } + case "elsif": + case "rescue": + case "ensure": + var dir = 1; + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line)) { + return; + } + var dir = 1; + break; + default: + var dir = this.indentKeywords[val]; + break; + } + + var stack = [val]; + if (!dir) + return; + + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(stream.getCurrentTokenRange()); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + if (token.type == "comment.multiline") { + while (token = stream.step()) { + if (token.type !== "comment.multiline") + continue; + if (dir == 1) { + startColumn = 6; + if (token.value == "=end") { + break; + } + } else { + if (token.value == "=begin") { + break; + } + } + } + } else { + while (token = stream.step()) { + var ignore = false; + if (token.type !== "keyword") + continue; + var level = dir * this.indentKeywords[token.value]; + line = session.getLine(stream.getCurrentTokenRow()); + switch (token.value) { + case "do": + for (var i = stream.$tokenIndex - 1; i >= 0; i--) { + var prevToken = stream.$rowTokens[i]; + if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { + level = 0; + break; + } + } + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "when": + if (/\sthen\s/.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(token.value); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + if ((val == "while" || val == "until" || val == "for") && token.value != "do") { + break; + } + if (token.value == "do" && dir == -1 && level != 0) + break; + if (token.value != "do") + break; + } + + if (level === 0) { + stack.unshift(token.value); + } + } } } - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; + if (!token) + return null; - if (indent < nextIndent) - return "start"; - else - return ""; + if (tokenRange) { + ranges.push(stream.getCurrentTokenRange()); + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + if (token.type === "comment.multiline") { + var endColumn = 6; + } else { + var endColumn = session.getLine(row).length; + } + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); }; }).call(FoldMode.prototype); }); -define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) { +define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); @@ -2943,13 +3437,14 @@ 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 FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new FoldMode(); + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); @@ -2964,7 +3459,7 @@ oop.inherits(Mode, TextMode); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; - if (tokens.length && tokens[tokens.length-1].type == "comment") { + if (tokens.length && tokens[tokens.length - 1].type == "comment") { return indent; } @@ -2972,7 +3467,7 @@ oop.inherits(Mode, TextMode); var match = line.match(/^.*[\{\(\[]\s*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else|when)\s*/); + var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } @@ -2982,7 +3477,7 @@ oop.inherits(Mode, TextMode); }; this.checkOutdent = function(state, line, input) { - return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); + return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { @@ -2995,11 +3490,24 @@ oop.inherits(Mode, TextMode); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) - session.remove(new Range(row, indent.length-tab.length, row, indent.length)); + session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; + this.getMatching = function(session, row, column) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + + var startToken = session.getTokenAt(row, column); + if (startToken && startToken.value in this.indentKeywords) + return this.foldingRules.rubyBlock(session, row, column, true); + }; + this.$id = "ace/mode/ruby"; + this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-io.js b/htdocs/includes/ace/src/mode-io.js index aba935b2011..452a803f8d7 100644 --- a/htdocs/includes/ace/src/mode-io.js +++ b/htdocs/includes/ace/src/mode-io.js @@ -234,6 +234,7 @@ oop.inherits(Mode, TextMode); this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/io"; + this.snippetFileId = "ace/snippets/io"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-java.js b/htdocs/includes/ace/src/mode-java.js index ed9cbe351ba..b61e2a90a78 100644 --- a/htdocs/includes/ace/src/mode-java.js +++ b/htdocs/includes/ace/src/mode-java.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -909,7 +910,7 @@ var JavaHighlightRules = function() { regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + regex : "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "lparen", regex : "[[({]" @@ -1023,6 +1024,7 @@ oop.inherits(Mode, JavaScriptMode); }; this.$id = "ace/mode/java"; + this.snippetFileId = "ace/snippets/java"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-javascript.js b/htdocs/includes/ace/src/mode-javascript.js index f9640e85d95..be3d822c23d 100644 --- a/htdocs/includes/ace/src/mode-javascript.js +++ b/htdocs/includes/ace/src/mode-javascript.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-json.js b/htdocs/includes/ace/src/mode-json.js index 5ade1857f98..2446e39c6a1 100644 --- a/htdocs/includes/ace/src/mode-json.js +++ b/htdocs/includes/ace/src/mode-json.js @@ -275,6 +275,9 @@ oop.inherits(Mode, TextMode); (function() { + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); diff --git a/htdocs/includes/ace/src/mode-jsoniq.js b/htdocs/includes/ace/src/mode-jsoniq.js index 2d717609bd9..323317aa4ae 100644 --- a/htdocs/includes/ace/src/mode-jsoniq.js +++ b/htdocs/includes/ace/src/mode-jsoniq.js @@ -2618,6 +2618,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/jsoniq"; + this.snippetFileId = "ace/snippets/jsoniq"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-jsp.js b/htdocs/includes/ace/src/mode-jsp.js index 42cc5f54321..b6c4233441a 100644 --- a/htdocs/includes/ace/src/mode-jsp.js +++ b/htdocs/includes/ace/src/mode-jsp.js @@ -1122,7 +1122,7 @@ var JavaHighlightRules = function() { regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + regex : "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "lparen", regex : "[[({]" @@ -1419,6 +1419,7 @@ oop.inherits(Mode, TextMode); (function() { this.$id = "ace/mode/jsp"; + this.snippetFileId = "ace/snippets/jsp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-kotlin.js b/htdocs/includes/ace/src/mode-kotlin.js index 11021b5890a..394271de33c 100644 --- a/htdocs/includes/ace/src/mode-kotlin.js +++ b/htdocs/includes/ace/src/mode-kotlin.js @@ -781,6 +781,8 @@ var Mode = function() { oop.inherits(Mode, TextMode); (function() { + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/kotlin"; }).call(Mode.prototype); diff --git a/htdocs/includes/ace/src/mode-latte.js b/htdocs/includes/ace/src/mode-latte.js new file mode 100644 index 00000000000..0377c843865 --- /dev/null +++ b/htdocs/includes/ace/src/mode-latte.js @@ -0,0 +1,2708 @@ +define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var DocCommentHighlightRules = function() { + this.$rules = { + "start" : [ { + token : "comment.doc.tag", + regex : "@[\\w\\d_]+" // TODO: fix email addresses + }, + DocCommentHighlightRules.getTagRule(), + { + defaultToken : "comment.doc", + caseInsensitive: true + }] + }; +}; + +oop.inherits(DocCommentHighlightRules, TextHighlightRules); + +DocCommentHighlightRules.getTagRule = function(start) { + return { + token : "comment.doc.tag.storage.type", + regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" + }; +}; + +DocCommentHighlightRules.getStartRule = function(start) { + return { + token : "comment.doc", // doc comment + regex : "\\/\\*(?=\\*)", + next : start + }; +}; + +DocCommentHighlightRules.getEndRule = function (start) { + return { + token : "comment.doc", // closing comment + regex : "\\*\\/", + next : start + }; +}; + + +exports.DocCommentHighlightRules = DocCommentHighlightRules; + +}); + +define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; +var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; + +var JavaScriptHighlightRules = function(options) { + var keywordMapper = this.createKeywordMapper({ + "variable.language": + "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors + "Namespace|QName|XML|XMLList|" + // E4X + "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors + "SyntaxError|TypeError|URIError|" + + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions + "isNaN|parseFloat|parseInt|" + + "JSON|Math|" + // Other + "this|arguments|prototype|window|document" , // Pseudo + "keyword": + "const|yield|import|get|set|async|await|" + + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + + "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + + "__parent__|__count__|escape|unescape|with|__proto__|" + + "class|enum|extends|super|export|implements|private|public|interface|package|protected|static", + "storage.type": + "const|let|var|function", + "constant.language": + "null|Infinity|NaN|undefined", + "support.function": + "alert", + "constant.language.boolean": "true|false" + }, "identifier"); + var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; + + var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex + "u[0-9a-fA-F]{4}|" + // unicode + "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode + "[0-2][0-7]{0,2}|" + // oct + "3[0-7][0-7]?|" + // oct + "[4-7][0-7]?|" + //oct + ".)"; + + this.$rules = { + "no_regex" : [ + DocCommentHighlightRules.getStartRule("doc-start"), + comments("no_regex"), + { + token : "string", + regex : "'(?=.)", + next : "qstring" + }, { + token : "string", + regex : '"(?=.)', + next : "qqstring" + }, { + token : "constant.numeric", // hexadecimal, octal and binary + regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ + }, { + token : "constant.numeric", // decimal integers and floats + regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ + }, { + token : [ + "storage.type", "punctuation.operator", "support.function", + "punctuation.operator", "entity.name.function", "text","keyword.operator" + ], + regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", + next: "function_arguments" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", "storage.type", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "entity.name.function", "text", "keyword.operator", "text", "storage.type", + "text", "paren.lparen" + ], + regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "entity.name.function", "text", "punctuation.operator", + "text", "storage.type", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : [ + "text", "text", "storage.type", "text", "paren.lparen" + ], + regex : "(:)(\\s*)(function)(\\s*)(\\()", + next: "function_arguments" + }, { + token : "keyword", + regex : "from(?=\\s*('|\"))" + }, { + token : "keyword", + regex : "(?:" + kwBeforeRe + ")\\b", + next : "start" + }, { + token : ["support.constant"], + regex : /that\b/ + }, { + token : ["storage.type", "punctuation.operator", "support.function.firebug"], + regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/ + }, { + token : keywordMapper, + regex : identifierRe + }, { + token : "punctuation.operator", + regex : /[.](?![.])/, + next : "property" + }, { + token : "storage.type", + regex : /=>/, + next : "start" + }, { + token : "keyword.operator", + regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, + next : "start" + }, { + token : "punctuation.operator", + regex : /[?:,;.]/, + next : "start" + }, { + token : "paren.lparen", + regex : /[\[({]/, + next : "start" + }, { + token : "paren.rparen", + regex : /[\])}]/ + }, { + token: "comment", + regex: /^#!.*$/ + } + ], + property: [{ + token : "text", + regex : "\\s+" + }, { + token : [ + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", + "storage.type", "text", "entity.name.function", "text", "paren.lparen" + ], + regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()", + next: "function_arguments" + }, { + token : "punctuation.operator", + regex : /[.](?![.])/ + }, { + token : "support.function", + regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ + }, { + token : "support.function.dom", + regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/ + }, { + token : "support.constant", + regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/ + }, { + token : "identifier", + regex : identifierRe + }, { + regex: "", + token: "empty", + next: "no_regex" + } + ], + "start": [ + DocCommentHighlightRules.getStartRule("doc-start"), + comments("start"), + { + token: "string.regexp", + regex: "\\/", + next: "regex" + }, { + token : "text", + regex : "\\s+|^$", + next : "start" + }, { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "regex": [ + { + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "string.regexp", + regex: "/[sxngimy]*", + next: "no_regex" + }, { + token : "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, { + token : "constant.language.escape", + regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token : "constant.language.delimiter", + regex: /\|/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + next: "regex_character_class" + }, { + token: "empty", + regex: "$", + next: "no_regex" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: "]", + next: "regex" + }, { + token: "constant.language.escape", + regex: "-" + }, { + token: "empty", + regex: "$", + next: "no_regex" + }, { + defaultToken: "string.regexp.charachterclass" + } + ], + "function_arguments": [ + { + token: "variable.parameter", + regex: identifierRe + }, { + token: "punctuation.operator", + regex: "[, ]+" + }, { + token: "punctuation.operator", + regex: "$" + }, { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "qqstring" : [ + { + token : "constant.language.escape", + regex : escapedRe + }, { + token : "string", + regex : "\\\\$", + consumeLineEnd : true + }, { + token : "string", + regex : '"|$', + next : "no_regex" + }, { + defaultToken: "string" + } + ], + "qstring" : [ + { + token : "constant.language.escape", + regex : escapedRe + }, { + token : "string", + regex : "\\\\$", + consumeLineEnd : true + }, { + token : "string", + regex : "'|$", + next : "no_regex" + }, { + defaultToken: "string" + } + ] + }; + + + 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); + } + else if (val == "}" && stack.length) { + stack.shift(); + this.next = stack.shift(); + if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -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" + }] + }); + + if (!options || options.jsx != false) + JSX.call(this); + } + + this.embedRules(DocCommentHighlightRules, "doc-", + [ DocCommentHighlightRules.getEndRule("no_regex") ]); + + this.normalizeRules(); +}; + +oop.inherits(JavaScriptHighlightRules, TextHighlightRules); + +function JSX() { + var tagRegex = identifierRe.replace("\\d", "\\d\\-"); + var jsxTag = { + onMatch : function(val, state, stack) { + var offset = val.charAt(1) == "/" ? 2 : 1; + if (offset == 1) { + if (state != this.nextState) + stack.unshift(this.next, this.nextState, 0); + else + stack.unshift(this.next); + stack[2]++; + } else if (offset == 2) { + if (state == this.nextState) { + stack[1]--; + if (!stack[1] || stack[1] < 0) { + stack.shift(); + stack.shift(); + } + } + } + return [{ + type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", + value: val.slice(0, offset) + }, { + type: "meta.tag.tag-name.xml", + value: val.substr(offset) + }]; + }, + regex : "", + onMatch : function(value, currentState, stack) { + if (currentState == stack[0]) + stack.shift(); + if (value.length == 2) { + if (stack[0] == this.nextState) + stack[1]--; + if (!stack[1] || stack[1] < 0) { + stack.splice(0, 2); + } + } + this.next = stack[0] || "start"; + return [{type: this.token, value: value}]; + }, + nextState: "jsx" + }, + jsxJsRule, + comments("jsxAttributes"), + { + token : "entity.other.attribute-name.xml", + regex : tagRegex + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=" + }, { + token : "text.tag-whitespace.xml", + regex : "\\s+" + }, { + token : "string.attribute-value.xml", + regex : "'", + stateName : "jsx_attr_q", + push : [ + {token : "string.attribute-value.xml", regex: "'", next: "pop"}, + {include : "reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }, { + token : "string.attribute-value.xml", + regex : '"', + stateName : "jsx_attr_qq", + push : [ + {token : "string.attribute-value.xml", regex: '"', next: "pop"}, + {include : "reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }, + jsxTag + ]; + this.$rules.reference = [{ + token : "constant.language.escape.reference.xml", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + }]; +} + +function comments(next) { + return [ + { + token : "comment", // multi line comment + regex : /\/\*/, + next: [ + DocCommentHighlightRules.getTagRule(), + {token : "comment", regex : "\\*\\/", next : next || "pop"}, + {defaultToken : "comment", caseInsensitive: true} + ] + }, { + token : "comment", + regex : "\\/\\/", + next: [ + DocCommentHighlightRules.getTagRule(), + {token : "comment", regex : "$|^", next : next || "pop"}, + {defaultToken : "comment", caseInsensitive: true} + ] + } + ]; +} +exports.JavaScriptHighlightRules = JavaScriptHighlightRules; +}); + +define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + return line.match(/^\s*/)[0]; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var WorkerClient = require("../worker/worker_client").WorkerClient; +var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; +var CStyleFoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = JavaScriptHighlightRules; + + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CstyleBehaviour(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + this.$quotes = {'"': '"', "'": "'", "`": "`"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); + var tokens = tokenizedLine.tokens; + var endState = tokenizedLine.state; + + if (tokens.length && tokens[tokens.length-1].type == "comment") { + return indent; + } + + if (state == "start" || state == "no_regex") { + var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); + if (match) { + indent += tab; + } + } else if (state == "doc-start") { + if (endState == "start" || endState == "no_regex") { + return ""; + } + var match = line.match(/^\s*(\/?)\*/); + if (match) { + if (match[1]) { + indent += " "; + } + indent += "* "; + } + } + + 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.createWorker = function(session) { + var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); + worker.attachToDocument(session.getDocument()); + + worker.on("annotate", function(results) { + session.setAnnotations(results.data); + }); + + worker.on("terminate", function() { + session.clearAnnotations(); + }); + + return worker; + }; + + this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); + +define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var lang = require("../lib/lang"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; +var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index"; +var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; +var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom"; +var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen"; +var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"; + +var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))"; +var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; +var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b"; + +var CssHighlightRules = function() { + + var keywordMapper = this.createKeywordMapper({ + "support.function": supportFunction, + "support.constant": supportConstant, + "support.type": supportType, + "support.constant.color": supportConstantColor, + "support.constant.fonts": supportConstantFonts + }, "text", true); + + this.$rules = { + "start" : [{ + include : ["strings", "url", "comments"] + }, { + token: "paren.lparen", + regex: "\\{", + next: "ruleset" + }, { + token: "paren.rparen", + regex: "\\}" + }, { + token: "string", + regex: "@(?!viewport)", + next: "media" + }, { + token: "keyword", + regex: "#[a-z0-9-_]+" + }, { + token: "keyword", + regex: "%" + }, { + token: "variable", + regex: "\\.[a-z0-9-_]+" + }, { + token: "string", + regex: ":[a-z0-9-_]+" + }, { + token : "constant.numeric", + regex : numRe + }, { + token: "constant", + regex: "[a-z0-9-_]+" + }, { + caseInsensitive: true + }], + + "media": [{ + include : ["strings", "url", "comments"] + }, { + token: "paren.lparen", + regex: "\\{", + next: "start" + }, { + token: "paren.rparen", + regex: "\\}", + next: "start" + }, { + token: "string", + regex: ";", + next: "start" + }, { + token: "keyword", + regex: "(?:media|supports|document|charset|import|namespace|media|supports|document" + + "|page|font|keyframes|viewport|counter-style|font-feature-values" + + "|swash|ornaments|annotation|stylistic|styleset|character-variant)" + }], + + "comments" : [{ + token: "comment", // multi line comment + regex: "\\/\\*", + push: [{ + token : "comment", + regex : "\\*\\/", + next : "pop" + }, { + defaultToken : "comment" + }] + }], + + "ruleset" : [{ + regex : "-(webkit|ms|moz|o)-", + token : "text" + }, { + token : "punctuation.operator", + regex : "[:;]" + }, { + token : "paren.rparen", + regex : "\\}", + next : "start" + }, { + include : ["strings", "url", "comments"] + }, { + token : ["constant.numeric", "keyword"], + regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)" + }, { + token : "constant.numeric", + regex : numRe + }, { + token : "constant.numeric", // hex6 color + regex : "#[a-f0-9]{6}" + }, { + token : "constant.numeric", // hex3 color + regex : "#[a-f0-9]{3}" + }, { + token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"], + regex : pseudoElements + }, { + token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"], + regex : pseudoClasses + }, { + include: "url" + }, { + token : keywordMapper, + regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" + }, { + caseInsensitive: true + }], + + url: [{ + token : "support.function", + regex : "(?:url(:?-prefix)?|domain|regexp)\\(", + push: [{ + token : "support.function", + regex : "\\)", + next : "pop" + }, { + defaultToken: "string" + }] + }], + + strings: [{ + token : "string.start", + regex : "'", + push : [{ + token : "string.end", + regex : "'|$", + next: "pop" + }, { + include : "escapes" + }, { + token : "constant.language.escape", + regex : /\\$/, + consumeLineEnd: true + }, { + defaultToken: "string" + }] + }, { + token : "string.start", + regex : '"', + push : [{ + token : "string.end", + regex : '"|$', + next: "pop" + }, { + include : "escapes" + }, { + token : "constant.language.escape", + regex : /\\$/, + consumeLineEnd: true + }, { + defaultToken: "string" + }] + }], + escapes: [{ + token : "constant.language.escape", + regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/ + }] + + }; + + this.normalizeRules(); +}; + +oop.inherits(CssHighlightRules, TextHighlightRules); + +exports.CssHighlightRules = CssHighlightRules; + +}); + +define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) { +"use strict"; + +var propertyMap = { + "background": {"#$0": 1}, + "background-color": {"#$0": 1, "transparent": 1, "fixed": 1}, + "background-image": {"url('/$0')": 1}, + "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1}, + "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2}, + "background-attachment": {"scroll": 1, "fixed": 1}, + "background-size": {"cover": 1, "contain": 1}, + "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1}, + "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1}, + "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1}, + "border-color": {"#$0": 1}, + "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2}, + "border-collapse": {"collapse": 1, "separate": 1}, + "bottom": {"px": 1, "em": 1, "%": 1}, + "clear": {"left": 1, "right": 1, "both": 1, "none": 1}, + "color": {"#$0": 1, "rgb(#$00,0,0)": 1}, + "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1}, + "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1}, + "empty-cells": {"show": 1, "hide": 1}, + "float": {"left": 1, "right": 1, "none": 1}, + "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1}, + "font-size": {"px": 1, "em": 1, "%": 1}, + "font-weight": {"bold": 1, "normal": 1}, + "font-style": {"italic": 1, "normal": 1}, + "font-variant": {"normal": 1, "small-caps": 1}, + "height": {"px": 1, "em": 1, "%": 1}, + "left": {"px": 1, "em": 1, "%": 1}, + "letter-spacing": {"normal": 1}, + "line-height": {"normal": 1}, + "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1}, + "margin": {"px": 1, "em": 1, "%": 1}, + "margin-right": {"px": 1, "em": 1, "%": 1}, + "margin-left": {"px": 1, "em": 1, "%": 1}, + "margin-top": {"px": 1, "em": 1, "%": 1}, + "margin-bottom": {"px": 1, "em": 1, "%": 1}, + "max-height": {"px": 1, "em": 1, "%": 1}, + "max-width": {"px": 1, "em": 1, "%": 1}, + "min-height": {"px": 1, "em": 1, "%": 1}, + "min-width": {"px": 1, "em": 1, "%": 1}, + "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, + "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, + "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, + "padding": {"px": 1, "em": 1, "%": 1}, + "padding-top": {"px": 1, "em": 1, "%": 1}, + "padding-right": {"px": 1, "em": 1, "%": 1}, + "padding-bottom": {"px": 1, "em": 1, "%": 1}, + "padding-left": {"px": 1, "em": 1, "%": 1}, + "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1}, + "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1}, + "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1}, + "right": {"px": 1, "em": 1, "%": 1}, + "table-layout": {"fixed": 1, "auto": 1}, + "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1}, + "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1}, + "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1}, + "top": {"px": 1, "em": 1, "%": 1}, + "vertical-align": {"top": 1, "bottom": 1}, + "visibility": {"hidden": 1, "visible": 1}, + "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1}, + "width": {"px": 1, "em": 1, "%": 1}, + "word-spacing": {"normal": 1}, + "filter": {"alpha(opacity=$0100)": 1}, + + "text-shadow": {"$02px 2px 2px #777": 1}, + "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1}, + "-moz-border-radius": 1, + "-moz-border-radius-topright": 1, + "-moz-border-radius-bottomright": 1, + "-moz-border-radius-topleft": 1, + "-moz-border-radius-bottomleft": 1, + "-webkit-border-radius": 1, + "-webkit-border-top-right-radius": 1, + "-webkit-border-top-left-radius": 1, + "-webkit-border-bottom-right-radius": 1, + "-webkit-border-bottom-left-radius": 1, + "-moz-box-shadow": 1, + "-webkit-box-shadow": 1, + "transform": {"rotate($00deg)": 1, "skew($00deg)": 1}, + "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1}, + "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 } +}; + +var CssCompletions = function() { + +}; + +(function() { + + this.completionsDefined = false; + + this.defineCompletions = function() { + if (document) { + var style = document.createElement('c').style; + + for (var i in style) { + if (typeof style[i] !== 'string') + continue; + + var name = i.replace(/[A-Z]/g, function(x) { + return '-' + x.toLowerCase(); + }); + + if (!propertyMap.hasOwnProperty(name)) + propertyMap[name] = 1; + } + } + + this.completionsDefined = true; + }; + + this.getCompletions = function(state, session, pos, prefix) { + if (!this.completionsDefined) { + this.defineCompletions(); + } + + if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") { + var line = session.getLine(pos.row).substr(0, pos.column); + if (/:[^;]+$/.test(line)) { + /([\w\-]+):[^:]*$/.test(line); + + return this.getPropertyValueCompletions(state, session, pos, prefix); + } else { + return this.getPropertyCompletions(state, session, pos, prefix); + } + } + + return []; + }; + + this.getPropertyCompletions = function(state, session, pos, prefix) { + var properties = Object.keys(propertyMap); + return properties.map(function(property){ + return { + caption: property, + snippet: property + ': $0;', + meta: "property", + score: 1000000 + }; + }); + }; + + this.getPropertyValueCompletions = function(state, session, pos, prefix) { + var line = session.getLine(pos.row).substr(0, pos.column); + var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1]; + + if (!property) + return []; + var values = []; + if (property in propertyMap && typeof propertyMap[property] === "object") { + values = Object.keys(propertyMap[property]); + } + return values.map(function(value){ + return { + caption: value, + snippet: value, + meta: "property value", + score: 1000000 + }; + }); + }; + +}).call(CssCompletions.prototype); + +exports.CssCompletions = CssCompletions; +}); + +define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Behaviour = require("../behaviour").Behaviour; +var CstyleBehaviour = require("./cstyle").CstyleBehaviour; +var TokenIterator = require("../../token_iterator").TokenIterator; + +var CssBehaviour = function () { + + this.inherit(CstyleBehaviour); + + this.add("colon", "insertion", function (state, action, editor, session, text) { + if (text === ':' && editor.selection.isEmpty()) { + var cursor = editor.getCursorPosition(); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + if (token && token.value.match(/\s+/)) { + token = iterator.stepBackward(); + } + if (token && token.type === 'support.type') { + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar === ':') { + return { + text: '', + selection: [1, 1] + }; + } + if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) { + return { + text: ':;', + selection: [1, 1] + }; + } + } + } + }); + + this.add("colon", "deletion", function (state, action, editor, session, range) { + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && selected === ':') { + var cursor = editor.getCursorPosition(); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + if (token && token.value.match(/\s+/)) { + token = iterator.stepBackward(); + } + if (token && token.type === 'support.type') { + var line = session.doc.getLine(range.start.row); + var rightChar = line.substring(range.end.column, range.end.column + 1); + if (rightChar === ';') { + range.end.column ++; + return range; + } + } + } + }); + + this.add("semicolon", "insertion", function (state, action, editor, session, text) { + if (text === ';' && editor.selection.isEmpty()) { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar === ';') { + return { + text: '', + selection: [1, 1] + }; + } + } + }); + + this.add("!important", "insertion", function (state, action, editor, session, text) { + if (text === '!' && editor.selection.isEmpty()) { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + + if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) { + return { + text: '!important', + selection: [10, 10] + }; + } + } + }); + +}; +oop.inherits(CssBehaviour, CstyleBehaviour); + +exports.CssBehaviour = CssBehaviour; +}); + +define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var WorkerClient = require("../worker/worker_client").WorkerClient; +var CssCompletions = require("./css_completions").CssCompletions; +var CssBehaviour = require("./behaviour/css").CssBehaviour; +var CStyleFoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = CssHighlightRules; + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CssBehaviour(); + this.$completer = new CssCompletions(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.foldingRules = "cStyle"; + this.blockComment = {start: "/*", end: "*/"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + var tokens = this.getTokenizer().getLineTokens(line, state).tokens; + if (tokens.length && tokens[tokens.length-1].type == "comment") { + return indent; + } + + 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.getCompletions = function(state, session, pos, prefix) { + return this.$completer.getCompletions(state, session, pos, prefix); + }; + + this.createWorker = function(session) { + var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); + worker.attachToDocument(session.getDocument()); + + worker.on("annotate", function(e) { + session.setAnnotations(e.data); + }); + + worker.on("terminate", function() { + session.clearAnnotations(); + }); + + return worker; + }; + + this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; +}).call(Mode.prototype); + +exports.Mode = Mode; + +}); + +define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var XmlHighlightRules = function(normalize) { + var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*"; + + this.$rules = { + start : [ + {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"}, + { + token : ["punctuation.instruction.xml", "keyword.instruction.xml"], + regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction" + }, + {token : "comment.start.xml", regex : "<\\!--", next : "comment"}, + { + token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"], + regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true + }, + {include : "tag"}, + {token : "text.end-tag-open.xml", regex: "", + next : "start" + }], + + doctype : [ + {include : "whitespace"}, + {include : "string"}, + {token : "xml-pe.doctype.xml", regex : ">", next : "start"}, + {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"}, + {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"} + ], + + int_subset : [{ + token : "text.xml", + regex : "\\s+" + }, { + token: "punctuation.int-subset.xml", + regex: "]", + next: "pop" + }, { + token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"], + regex : "(<\\!)(" + tagRegex + ")", + push : [{ + token : "text", + regex : "\\s+" + }, + { + token : "punctuation.markup-decl.xml", + regex : ">", + next : "pop" + }, + {include : "string"}] + }], + + cdata : [ + {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"}, + {token : "text.xml", regex : "\\s+"}, + {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"} + ], + + comment : [ + {token : "comment.end.xml", regex : "-->", next : "start"}, + {defaultToken : "comment.xml"} + ], + + reference : [{ + token : "constant.language.escape.reference.xml", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + }], + + attr_reference : [{ + token : "constant.language.escape.reference.attribute-value.xml", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + }], + + tag : [{ + token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"], + regex : "(?:(<)|(", next : "start"} + ] + }], + + tag_whitespace : [ + {token : "text.tag-whitespace.xml", regex : "\\s+"} + ], + whitespace : [ + {token : "text.whitespace.xml", regex : "\\s+"} + ], + string: [{ + token : "string.xml", + regex : "'", + push : [ + {token : "string.xml", regex: "'", next: "pop"}, + {defaultToken : "string.xml"} + ] + }, { + token : "string.xml", + regex : '"', + push : [ + {token : "string.xml", regex: '"', next: "pop"}, + {defaultToken : "string.xml"} + ] + }], + + attributes: [{ + token : "entity.other.attribute-name.xml", + regex : tagRegex + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=" + }, { + include: "tag_whitespace" + }, { + include: "attribute_value" + }], + + attribute_value: [{ + token : "string.attribute-value.xml", + regex : "'", + push : [ + {token : "string.attribute-value.xml", regex: "'", next: "pop"}, + {include : "attr_reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }, { + token : "string.attribute-value.xml", + regex : '"', + push : [ + {token : "string.attribute-value.xml", regex: '"', next: "pop"}, + {include : "attr_reference"}, + {defaultToken : "string.attribute-value.xml"} + ] + }] + }; + + if (this.constructor === XmlHighlightRules) + this.normalizeRules(); +}; + + +(function() { + + this.embedTagRules = function(HighlightRules, prefix, tag){ + this.$rules.tag.unshift({ + token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], + regex : "(<)(" + tag + "(?=\\s|>|$))", + next: [ + {include : "attributes"}, + {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"} + ] + }); + + this.$rules[tag + "-end"] = [ + {include : "attributes"}, + {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start", + onMatch : function(value, currentState, stack) { + stack.splice(0); + return this.token; + }} + ]; + + this.embedRules(HighlightRules, prefix, [{ + token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], + regex : "(|$))", + next: tag + "-end" + }, { + token: "string.cdata.xml", + regex : "<\\!\\[CDATA\\[" + }, { + token: "string.cdata.xml", + regex : "\\]\\]>" + }]); + }; + +}).call(TextHighlightRules.prototype); + +oop.inherits(XmlHighlightRules, TextHighlightRules); + +exports.XmlHighlightRules = XmlHighlightRules; +}); + +define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var lang = require("../lib/lang"); +var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; +var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; +var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; + +var tagMap = lang.createMap({ + a : 'anchor', + button : 'form', + form : 'form', + img : 'image', + input : 'form', + label : 'form', + option : 'form', + script : 'script', + select : 'form', + textarea : 'form', + style : 'style', + table : 'table', + tbody : 'table', + td : 'table', + tfoot : 'table', + th : 'table', + tr : 'table' +}); + +var HtmlHighlightRules = function() { + XmlHighlightRules.call(this); + + this.addRules({ + attributes: [{ + include : "tag_whitespace" + }, { + token : "entity.other.attribute-name.xml", + regex : "[-_a-zA-Z0-9:.]+" + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=", + push : [{ + include: "tag_whitespace" + }, { + token : "string.unquoted.attribute-value.html", + regex : "[^<>='\"`\\s]+", + next : "pop" + }, { + token : "empty", + regex : "", + next : "pop" + }] + }, { + include : "attribute_value" + }], + tag: [{ + token : function(start, tag) { + var group = tagMap[tag]; + return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml", + "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"]; + }, + regex : "(", next : "start"} + ] + }); + + this.embedTagRules(CssHighlightRules, "css-", "style"); + this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script"); + + if (this.constructor === HtmlHighlightRules) + this.normalizeRules(); +}; + +oop.inherits(HtmlHighlightRules, XmlHighlightRules); + +exports.HtmlHighlightRules = HtmlHighlightRules; +}); + +define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Behaviour = require("../behaviour").Behaviour; +var TokenIterator = require("../../token_iterator").TokenIterator; +var lang = require("../../lib/lang"); + +function is(token, type) { + return token && token.type.lastIndexOf(type + ".xml") > -1; +} + +var XmlBehaviour = function () { + + this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { + if (text == '"' || text == "'") { + var quote = text; + var selected = session.doc.getTextRange(editor.getSelectionRange()); + if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { + return { + text: quote + selected + quote, + selection: false + }; + } + + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + + if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) { + return { + text: "", + selection: [1, 1] + }; + } + + if (!token) + token = iterator.stepBackward(); + + if (!token) + return; + + while (is(token, "tag-whitespace") || is(token, "whitespace")) { + token = iterator.stepBackward(); + } + var rightSpace = !rightChar || rightChar.match(/\s/); + if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) { + return { + text: quote + quote, + selection: [1, 1] + }; + } + } + }); + + this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && (selected == '"' || selected == "'")) { + var line = session.doc.getLine(range.start.row); + var rightChar = line.substring(range.start.column + 1, range.start.column + 2); + if (rightChar == selected) { + range.end.column++; + return range; + } + } + }); + + this.add("autoclosing", "insertion", function (state, action, editor, session, text) { + if (text == '>') { + var position = editor.getSelectionRange().start; + var iterator = new TokenIterator(session, position.row, position.column); + var token = iterator.getCurrentToken() || iterator.stepBackward(); + if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value"))) + return; + if (is(token, "reference.attribute-value")) + return; + if (is(token, "attribute-value")) { + var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length; + if (position.column < tokenEndColumn) + return; + if (position.column == tokenEndColumn) { + var nextToken = iterator.stepForward(); + if (nextToken && is(nextToken, "attribute-value")) + return; + iterator.stepBackward(); + } + } + + if (/^\s*>/.test(session.getLine(position.row).slice(position.column))) + return; + while (!is(token, "tag-name")) { + token = iterator.stepBackward(); + if (token.value == "<") { + token = iterator.stepForward(); + break; + } + } + + var tokenRow = iterator.getCurrentTokenRow(); + var tokenColumn = iterator.getCurrentTokenColumn(); + if (is(iterator.stepBackward(), "end-tag-open")) + return; + + var element = token.value; + if (tokenRow == position.row) + element = element.substring(0, position.column - tokenColumn); + + if (this.voidElements.hasOwnProperty(element.toLowerCase())) + return; + + return { + text: ">" + "", + selection: [1, 1] + }; + } + }); + + this.add("autoindent", "insertion", function (state, action, editor, session, text) { + if (text == "\n") { + var cursor = editor.getCursorPosition(); + var line = session.getLine(cursor.row); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + + if (token && token.type.indexOf("tag-close") !== -1) { + if (token.value == "/>") + return; + while (token && token.type.indexOf("tag-name") === -1) { + token = iterator.stepBackward(); + } + + if (!token) { + return; + } + + var tag = token.value; + var row = iterator.getCurrentTokenRow(); + token = iterator.stepBackward(); + if (!token || token.type.indexOf("end-tag") !== -1) { + return; + } + + if (this.voidElements && !this.voidElements[tag]) { + var nextToken = session.getTokenAt(cursor.row, cursor.column+1); + var line = session.getLine(row); + var nextIndent = this.$getIndent(line); + var indent = nextIndent + session.getTabString(); + + if (nextToken && nextToken.value === " -1; +} + +(function() { + + this.getFoldWidget = function(session, foldStyle, row) { + var tag = this._getFirstTagInLine(session, row); + + if (!tag) + return this.getCommentFoldWidget(session, row); + + if (tag.closing || (!tag.tagName && tag.selfClosing)) + return foldStyle == "markbeginend" ? "end" : ""; + + if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase())) + return ""; + + if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column)) + return ""; + + return "start"; + }; + + this.getCommentFoldWidget = function(session, row) { + if (/comment/.test(session.getState(row)) && /'; + break; + } + } + return tag; + } else if (is(token, "tag-close")) { + tag.selfClosing = token.value == '/>'; + return tag; + } + tag.start.column += token.value.length; + } + + return null; + }; + + this._findEndTagInLine = function(session, row, tagName, startColumn) { + var tokens = session.getTokens(row); + var column = 0; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + column += token.value.length; + if (column < startColumn) + continue; + if (is(token, "end-tag-open")) { + token = tokens[i + 1]; + if (token && token.value == tagName) + return true; + } + } + return false; + }; + this._readTagForward = function(iterator) { + var token = iterator.getCurrentToken(); + if (!token) + return null; + + var tag = new Tag(); + do { + if (is(token, "tag-open")) { + tag.closing = is(token, "end-tag-open"); + tag.start.row = iterator.getCurrentTokenRow(); + tag.start.column = iterator.getCurrentTokenColumn(); + } else if (is(token, "tag-name")) { + tag.tagName = token.value; + } else if (is(token, "tag-close")) { + tag.selfClosing = token.value == "/>"; + tag.end.row = iterator.getCurrentTokenRow(); + tag.end.column = iterator.getCurrentTokenColumn() + token.value.length; + iterator.stepForward(); + return tag; + } + } while(token = iterator.stepForward()); + + return null; + }; + + this._readTagBackward = function(iterator) { + var token = iterator.getCurrentToken(); + if (!token) + return null; + + var tag = new Tag(); + do { + if (is(token, "tag-open")) { + tag.closing = is(token, "end-tag-open"); + tag.start.row = iterator.getCurrentTokenRow(); + tag.start.column = iterator.getCurrentTokenColumn(); + iterator.stepBackward(); + return tag; + } else if (is(token, "tag-name")) { + tag.tagName = token.value; + } else if (is(token, "tag-close")) { + tag.selfClosing = token.value == "/>"; + tag.end.row = iterator.getCurrentTokenRow(); + tag.end.column = iterator.getCurrentTokenColumn() + token.value.length; + } + } while(token = iterator.stepBackward()); + + return null; + }; + + this._pop = function(stack, tag) { + while (stack.length) { + + var top = stack[stack.length-1]; + if (!tag || top.tagName == tag.tagName) { + return stack.pop(); + } + else if (this.optionalEndTags.hasOwnProperty(top.tagName)) { + stack.pop(); + continue; + } else { + return null; + } + } + }; + + this.getFoldWidgetRange = function(session, foldStyle, row) { + var firstTag = this._getFirstTagInLine(session, row); + + if (!firstTag) { + return this.getCommentFoldWidget(session, row) + && session.getCommentFoldRange(row, session.getLine(row).length); + } + + var isBackward = firstTag.closing || firstTag.selfClosing; + var stack = []; + var tag; + + if (!isBackward) { + var iterator = new TokenIterator(session, row, firstTag.start.column); + var start = { + row: row, + column: firstTag.start.column + firstTag.tagName.length + 2 + }; + if (firstTag.start.row == firstTag.end.row) + start.column = firstTag.end.column; + while (tag = this._readTagForward(iterator)) { + if (tag.selfClosing) { + if (!stack.length) { + tag.start.column += tag.tagName.length + 2; + tag.end.column -= 2; + return Range.fromPoints(tag.start, tag.end); + } else + continue; + } + + if (tag.closing) { + this._pop(stack, tag); + if (stack.length == 0) + return Range.fromPoints(start, tag.start); + } + else { + stack.push(tag); + } + } + } + else { + var iterator = new TokenIterator(session, row, firstTag.end.column); + var end = { + row: row, + column: firstTag.start.column + }; + + while (tag = this._readTagBackward(iterator)) { + if (tag.selfClosing) { + if (!stack.length) { + tag.start.column += tag.tagName.length + 2; + tag.end.column -= 2; + return Range.fromPoints(tag.start, tag.end); + } else + continue; + } + + if (!tag.closing) { + this._pop(stack, tag); + if (stack.length == 0) { + tag.start.column += tag.tagName.length + 2; + if (tag.start.row == tag.end.row && tag.start.column < tag.end.column) + tag.start.column = tag.end.column; + return Range.fromPoints(tag.start, end); + } + } + else { + stack.push(tag); + } + } + } + + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var MixedFoldMode = require("./mixed").FoldMode; +var XmlFoldMode = require("./xml").FoldMode; +var CStyleFoldMode = require("./cstyle").FoldMode; + +var FoldMode = exports.FoldMode = function(voidElements, optionalTags) { + MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), { + "js-": new CStyleFoldMode(), + "css-": new CStyleFoldMode() + }); +}; + +oop.inherits(FoldMode, MixedFoldMode); + +}); + +define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) { +"use strict"; + +var TokenIterator = require("../token_iterator").TokenIterator; + +var commonAttributes = [ + "accesskey", + "class", + "contenteditable", + "contextmenu", + "dir", + "draggable", + "dropzone", + "hidden", + "id", + "inert", + "itemid", + "itemprop", + "itemref", + "itemscope", + "itemtype", + "lang", + "spellcheck", + "style", + "tabindex", + "title", + "translate" +]; + +var eventAttributes = [ + "onabort", + "onblur", + "oncancel", + "oncanplay", + "oncanplaythrough", + "onchange", + "onclick", + "onclose", + "oncontextmenu", + "oncuechange", + "ondblclick", + "ondrag", + "ondragend", + "ondragenter", + "ondragleave", + "ondragover", + "ondragstart", + "ondrop", + "ondurationchange", + "onemptied", + "onended", + "onerror", + "onfocus", + "oninput", + "oninvalid", + "onkeydown", + "onkeypress", + "onkeyup", + "onload", + "onloadeddata", + "onloadedmetadata", + "onloadstart", + "onmousedown", + "onmousemove", + "onmouseout", + "onmouseover", + "onmouseup", + "onmousewheel", + "onpause", + "onplay", + "onplaying", + "onprogress", + "onratechange", + "onreset", + "onscroll", + "onseeked", + "onseeking", + "onselect", + "onshow", + "onstalled", + "onsubmit", + "onsuspend", + "ontimeupdate", + "onvolumechange", + "onwaiting" +]; + +var globalAttributes = commonAttributes.concat(eventAttributes); + +var attributeMap = { + "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1}, + "abbr": {}, + "address": {}, + "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1}, + "article": {"pubdate": 1}, + "aside": {}, + "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }}, + "b": {}, + "base": {"href": 1, "target": 1}, + "bdi": {}, + "bdo": {}, + "blockquote": {"cite": 1}, + "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1}, + "br": {}, + "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}}, + "canvas": {"width": 1, "height": 1}, + "caption": {}, + "cite": {}, + "code": {}, + "col": {"span": 1}, + "colgroup": {"span": 1}, + "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1}, + "data": {}, + "datalist": {}, + "dd": {}, + "del": {"cite": 1, "datetime": 1}, + "details": {"open": 1}, + "dfn": {}, + "dialog": {"open": 1}, + "div": {}, + "dl": {}, + "dt": {}, + "em": {}, + "embed": {"src": 1, "height": 1, "width": 1, "type": 1}, + "fieldset": {"disabled": 1, "form": 1, "name": 1}, + "figcaption": {}, + "figure": {}, + "footer": {}, + "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}}, + "h1": {}, + "h2": {}, + "h3": {}, + "h4": {}, + "h5": {}, + "h6": {}, + "head": {}, + "header": {}, + "hr": {}, + "html": {"manifest": 1}, + "i": {}, + "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}}, + "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1}, + "input": { + "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1}, + "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1}, + "ins": {"cite": 1, "datetime": 1}, + "kbd": {}, + "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1}, + "label": {"form": 1, "for": 1}, + "legend": {}, + "li": {"value": 1}, + "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1}, + "main": {}, + "map": {"name": 1}, + "mark": {}, + "math": {}, + "menu": {"type": 1, "label": 1}, + "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1}, + "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1}, + "nav": {}, + "noscript": {"href": 1}, + "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1}, + "ol": {"start": 1, "reversed": 1}, + "optgroup": {"disabled": 1, "label": 1}, + "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1}, + "output": {"for": 1, "form": 1, "name": 1}, + "p": {}, + "param": {"name": 1, "value": 1}, + "pre": {}, + "progress": {"value": 1, "max": 1}, + "q": {"cite": 1}, + "rp": {}, + "rt": {}, + "ruby": {}, + "s": {}, + "samp": {}, + "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1}, + "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}}, + "small": {}, + "source": {"src": 1, "type": 1, "media": 1}, + "span": {}, + "strong": {}, + "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1}, + "sub": {}, + "sup": {}, + "svg": {}, + "table": {"summary": 1}, + "tbody": {}, + "td": {"headers": 1, "rowspan": 1, "colspan": 1}, + "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}}, + "tfoot": {}, + "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1}, + "thead": {}, + "time": {"datetime": 1}, + "title": {}, + "tr": {}, + "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1}, + "section": {}, + "summary": {}, + "u": {}, + "ul": {}, + "var": {}, + "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}}, + "wbr": {} +}; + +var elements = Object.keys(attributeMap); + +function is(token, type) { + return token.type.lastIndexOf(type + ".xml") > -1; +} + +function findTagName(session, pos) { + var iterator = new TokenIterator(session, pos.row, pos.column); + var token = iterator.getCurrentToken(); + while (token && !is(token, "tag-name")){ + token = iterator.stepBackward(); + } + if (token) + return token.value; +} + +function findAttributeName(session, pos) { + var iterator = new TokenIterator(session, pos.row, pos.column); + var token = iterator.getCurrentToken(); + while (token && !is(token, "attribute-name")){ + token = iterator.stepBackward(); + } + if (token) + return token.value; +} + +var HtmlCompletions = function() { + +}; + +(function() { + + this.getCompletions = function(state, session, pos, prefix) { + var token = session.getTokenAt(pos.row, pos.column); + + if (!token) + return []; + if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open")) + return this.getTagCompletions(state, session, pos, prefix); + if (is(token, "tag-whitespace") || is(token, "attribute-name")) + return this.getAttributeCompletions(state, session, pos, prefix); + if (is(token, "attribute-value")) + return this.getAttributeValueCompletions(state, session, pos, prefix); + var line = session.getLine(pos.row).substr(0, pos.column); + if (/&[a-z]*$/i.test(line)) + return this.getHTMLEntityCompletions(state, session, pos, prefix); + + return []; + }; + + this.getTagCompletions = function(state, session, pos, prefix) { + return elements.map(function(element){ + return { + value: element, + meta: "tag", + score: 1000000 + }; + }); + }; + + this.getAttributeCompletions = function(state, session, pos, prefix) { + var tagName = findTagName(session, pos); + if (!tagName) + return []; + var attributes = globalAttributes; + if (tagName in attributeMap) { + attributes = attributes.concat(Object.keys(attributeMap[tagName])); + } + return attributes.map(function(attribute){ + return { + caption: attribute, + snippet: attribute + '="$0"', + meta: "attribute", + score: 1000000 + }; + }); + }; + + this.getAttributeValueCompletions = function(state, session, pos, prefix) { + var tagName = findTagName(session, pos); + var attributeName = findAttributeName(session, pos); + + if (!tagName) + return []; + var values = []; + if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") { + values = Object.keys(attributeMap[tagName][attributeName]); + } + return values.map(function(value){ + return { + caption: value, + snippet: value, + meta: "attribute value", + score: 1000000 + }; + }); + }; + + this.getHTMLEntityCompletions = function(state, session, pos, prefix) { + var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;']; + + return values.map(function(value){ + return { + caption: value, + snippet: value, + meta: "html entity", + score: 1000000 + }; + }); + }; + +}).call(HtmlCompletions.prototype); + +exports.HtmlCompletions = HtmlCompletions; +}); + +define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var lang = require("../lib/lang"); +var TextMode = require("./text").Mode; +var JavaScriptMode = require("./javascript").Mode; +var CssMode = require("./css").Mode; +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; +var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; +var HtmlFoldMode = require("./folding/html").FoldMode; +var HtmlCompletions = require("./html_completions").HtmlCompletions; +var WorkerClient = require("../worker/worker_client").WorkerClient; +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) { + this.fragmentContext = options && options.fragmentContext; + this.HighlightRules = HtmlHighlightRules; + this.$behaviour = new XmlBehaviour(); + this.$completer = new HtmlCompletions(); + + this.createModeDelegates({ + "js-": JavaScriptMode, + "css-": CssMode + }); + + this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags)); +}; +oop.inherits(Mode, TextMode); + +(function() { + + this.blockComment = {start: ""}; + + this.voidElements = lang.arrayToMap(voidElements); + + this.getNextLineIndent = function(state, line, tab) { + return this.$getIndent(line); + }; + + this.checkOutdent = function(state, line, input) { + return false; + }; + + this.getCompletions = function(state, session, pos, prefix) { + return this.$completer.getCompletions(state, session, pos, prefix); + }; + + this.createWorker = function(session) { + if (this.constructor != Mode) + return; + var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker"); + worker.attachToDocument(session.getDocument()); + + if (this.fragmentContext) + worker.call("setOptions", [{context: this.fragmentContext}]); + + worker.on("error", function(e) { + session.setAnnotations(e.data); + }); + + worker.on("terminate", function() { + session.clearAnnotations(); + }); + + return worker; + }; + + this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); + +define("ace/mode/latte_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var LatteHighlightRules = function() { + HtmlHighlightRules.call(this); + for (var rule in this.$rules) { + this.$rules[rule].unshift( + { + token : "comment.start.latte", + regex : "\\{\\*", + push : [{ + token : "comment.end.latte", + regex : ".*\\*\\}", + next : "pop" + }, { + defaultToken : "comment" + }] + }, { + token : "meta.tag.punctuation.tag-open.latte", + regex : "\\{(?![\\s'\"{}]|$)/?", + push : [{ + token : "meta.tag.latte", + regex : "(?:_|=|[a-z]\\w*(?:[.:-]\\w+)*)?", + next: [{ + token : "meta.tag.punctuation.tag-close.latte", + regex : "\\}", + next : "pop" + }, { + include: "latte-content" + }] + }] + }); + } + this.$rules['tag_stuff'].unshift({ + token : "meta.attribute.latte", + regex : "n:[\\w-]+", + next : [{ + include: "tag_whitespace" + }, { + token : "keyword.operator.attribute-equals.xml", + regex : "=", + next : [{ + token : "string.attribute-value.xml", + regex : "'", + next : [ + {token : "string.attribute-value.xml", regex: "'", next: "tag_stuff"}, + {include : "latte-content"} + ] + }, { + token : "string.attribute-value.xml", + regex : '"', + next : [ + {token : "string.attribute-value.xml", regex: '"', next: "tag_stuff"}, + {include : "latte-content"} + ] + }, { + token : "text.tag-whitespace.xml", + regex : "\\s", + next: "tag_stuff" + }, { + token : "meta.tag.punctuation.tag-close.xml", + regex : "/?>", + next: "tag_stuff" + }, { + include : "latte-content" + }] + }, { + token : "empty", + regex : "", + next : "tag_stuff" + }] + }); + this.$rules["latte-content"] = [ + { + token : "comment.start.latte", // multi line comment + regex : "\\/\\*", + push : [ + { + token : "comment.end.latte", + regex : "\\*\\/", + next : "pop" + }, { + defaultToken : "comment" + } + ] + }, { + token : "string.start", // " string start + regex : '"', + push : [ + { + token : "constant.language.escape", + regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})' + }, { + token : "variable", + regex : /\$[\w]+(?:\[[\w\]+]|[=\-]>\w+)?/ + }, { + token : "variable", + regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now + }, + {token : "string.end", regex : '"', next : "pop"}, + {defaultToken : "string"} + ] + }, { + token : "string.start", // ' string start + regex : "'", + push : [ + {token : "constant.language.escape", regex : /\\['\\]/}, + {token : "string.end", regex : "'", next : "pop"}, + {defaultToken : "string"} + ] + }, { + token : "keyword.control", + regex : "\\b(?:INF|NAN|and|or|xor|AND|OR|XOR|clone|new|instanceof|return|continue|break|as)\\b" + }, { + token : "constant.language", + regex : "\\b(?:true|false|null|TRUE|FALSE|NULL)\\b" + }, { + token : "variable", + regex : /\$\w+/ + }, { + token : "constant.numeric", + regex : "[+-]?[0-9]+(?:\\.[0-9]+)?(?:e[0-9]+)?" + }, { + token : ["support.class", "keyword.operator"], + regex : "\\b(\\w+)(::)" + }, { + token : "constant.language", // constants + regex : "\\b(?:[A-Z0-9_]+)\\b" + }, { + token : "string.unquoted", + regex : "\\w+(?:-+\\w+)*" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "keyword.operator", + regex : "::|=>|->|\\?->|\\?\\?->|\\+\\+|--|<<|>>|<=>|<=|>=|===|!==|==|!=|<>|&&|\\|\\||\\?\\?|\\?>|\\*\\*|\\.\\.\\.|[^'\"]" // =>, any char except quotes + } + ]; + + this.normalizeRules(); +}; + +oop.inherits(LatteHighlightRules, TextHighlightRules); + +exports.LatteHighlightRules = LatteHighlightRules; +}); + +define("ace/mode/latte",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/latte_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var HtmlMode = require("./html").Mode; +var LatteHighlightRules = require("./latte_highlight_rules").LatteHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + +var Mode = function() { + HtmlMode.call(this); + this.HighlightRules = LatteHighlightRules; + this.$outdent = new MatchingBraceOutdent(); +}; +oop.inherits(Mode, HtmlMode); + +(function() { + this.blockComment = {start: "{*", end: "*}"}; + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + + if (state == "start") { + var match = line.match(/^.*\{(?:if|else|elseif|ifset|elseifset|ifchanged|switch|case|foreach|iterateWhile|for|while|first|last|sep|try|capture|spaceless|snippet|block|define|embed|snippetArea)\b[^{]*$/); + if (match) { + indent += tab; + } + } + + return indent; + }; + + this.checkOutdent = function(state, line, input) { + return /^\s+\{\/$/.test(line + input); + }; + + this.autoOutdent = function(state, doc, row) { + }; + + this.$id = "ace/mode/latte"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/latte"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-liquid.js b/htdocs/includes/ace/src/mode-liquid.js index 6bbf7d1e9d6..f22cfa98a4a 100644 --- a/htdocs/includes/ace/src/mode-liquid.js +++ b/htdocs/includes/ace/src/mode-liquid.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2725,6 +2728,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/liquid"; + this.snippetFileId = "ace/snippets/liquid"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-lsl.js b/htdocs/includes/ace/src/mode-lsl.js index f6d7a7497f5..a08ff25f31b 100644 --- a/htdocs/includes/ace/src/mode-lsl.js +++ b/htdocs/includes/ace/src/mode-lsl.js @@ -329,6 +329,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/lsl"; + this.snippetFileId = "ace/snippets/lsl"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-lua.js b/htdocs/includes/ace/src/mode-lua.js index e96b6c37a9b..a87f127a893 100644 --- a/htdocs/includes/ace/src/mode-lua.js +++ b/htdocs/includes/ace/src/mode-lua.js @@ -438,6 +438,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/lua"; + this.snippetFileId = "ace/snippets/lua"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-luapage.js b/htdocs/includes/ace/src/mode-luapage.js index 5f5ecce9079..49bbde3f148 100644 --- a/htdocs/includes/ace/src/mode-luapage.js +++ b/htdocs/includes/ace/src/mode-luapage.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2938,6 +2941,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/lua"; + this.snippetFileId = "ace/snippets/lua"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-makefile.js b/htdocs/includes/ace/src/mode-makefile.js index 0314c6a216b..f8d853bd52c 100644 --- a/htdocs/includes/ace/src/mode-makefile.js +++ b/htdocs/includes/ace/src/mode-makefile.js @@ -398,6 +398,7 @@ oop.inherits(Mode, TextMode); this.$indentWithTabs = true; this.$id = "ace/mode/makefile"; + this.snippetFileId = "ace/snippets/makefile"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-markdown.js b/htdocs/includes/ace/src/mode-markdown.js index ac4072175ec..42fa514fdf5 100644 --- a/htdocs/includes/ace/src/mode-markdown.js +++ b/htdocs/includes/ace/src/mode-markdown.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1986,6 +1987,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2539,6 +2541,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3124,6 +3127,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/sh"; + this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3176,6 +3180,7 @@ oop.inherits(Mode, TextMode); } }; this.$id = "ace/mode/markdown"; + this.snippetFileId = "ace/snippets/markdown"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-maze.js b/htdocs/includes/ace/src/mode-maze.js index faa82968572..75e1da782da 100644 --- a/htdocs/includes/ace/src/mode-maze.js +++ b/htdocs/includes/ace/src/mode-maze.js @@ -278,6 +278,7 @@ oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.$id = "ace/mode/maze"; + this.snippetFileId = "ace/snippets/maze"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-mediawiki.js b/htdocs/includes/ace/src/mode-mediawiki.js new file mode 100644 index 00000000000..199e90b9101 --- /dev/null +++ b/htdocs/includes/ace/src/mode-mediawiki.js @@ -0,0 +1,592 @@ +define("ace/mode/mediawiki_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var MediaWikiHighlightRules = function() { + this.$rules = { + start: [{ + include: "#switch" + }, { + include: "#redirect" + }, { + include: "#variable" + }, { + include: "#comment" + }, { + include: "#entity" + }, { + include: "#emphasis" + }, { + include: "#tag" + }, { + include: "#table" + }, { + include: "#hr" + }, { + include: "#heading" + }, { + include: "#link" + }, { + include: "#list" + }, { + include: "#template" + }], + "#hr": [{ + token: "markup.bold", + regex: /^[-]{4,}/ + }], + "#switch": [{ + token: "constant.language", + regex: /(__NOTOC__|__FORCETOC__|__TOC__|__NOEDITSECTION__|__NEWSECTIONLINK__|__NONEWSECTIONLINK__|__NOWYSIWYG__|__NOGALLERY__|__HIDDENCAT__|__EXPECTUNUSEDCATEGORY__|__NOCONTENTCONVERT__|__NOCC__|__NOTITLECONVERT__|__NOTC__|__START__|__END__|__INDEX__|__NOINDEX__|__STATICREDIRECT__|__NOGLOBAL__|__DISAMBIG__)/ + }], + "#redirect": [{ + token: [ + "keyword.control.redirect", + "meta.keyword.control" + ], + regex: /(^#REDIRECT|^#redirect|^#Redirect)(\s+)/ + }], + "#variable": [{ + token: "storage.type.variable", + regex: /{{{/, + push: [{ + token: "storage.type.variable", + regex: /}}}/, + next: "pop" + }, { + token: [ + "text", + "variable.other", + "text", + "keyword.operator" + ], + regex: /(\s*)(\w+)(\s*)((?:\|)?)/ + }, { + defaultToken: "storage.type.variable" + }] + }], + "#entity": [{ + token: "constant.character.entity", + regex: /&\w+;/ + }], + "#list": [{ + token: "markup.bold", + regex: /^[#*;:]+/, + push: [{ + token: "markup.list", + regex: /$/, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "markup.list" + }] + }], + "#template": [{ + token: [ + "storage.type.function", + "meta.template", + "entity.name.function", + "meta.template" + ], + regex: /({{)(\s*)([#\w: ]+)(\s*)/, + push: [{ + token: "storage.type.function", + regex: /}}/, + next: "pop" + }, { + token: [ + "storage", + "meta.structure.dictionary", + "support.type.property-name", + "meta.structure.dictionary", + "punctuation.separator.dictionary.key-value", + "meta.structure.dictionary", + "meta.structure.dictionary.value" + ], + regex: /(\|)(\s*)([a-zA-Z-]*)(\s*)(=)(\s*)([^|}]*)/, + push: [{ + token: "meta.structure.dictionary", + regex: /(?=}}|[|])/, + next: "pop" + }, { + defaultToken: "meta.structure.dictionary" + }] + }, { + token: ["storage", "meta.template.value"], + regex: /(\|)(.*?)/, + push: [{ + token: [], + regex: /(?=}}|[|])/, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "meta.template.value" + }] + }, { + defaultToken: "meta.template" + }] + }], + "#link": [{ + token: [ + "punctuation.definition.tag.begin", + "meta.tag.link.internal", + "entity.name.tag", + "meta.tag.link.internal", + "string.other.link.title", + "meta.tag.link.internal", + "punctuation.definition.tag" + ], + regex: /(\[\[)(\s*)((?:Category|Wikipedia)?)(:?)([^\]\]\|]+)(\s*)((?:\|)*)/, + push: [{ + token: "punctuation.definition.tag.end", + regex: /\]\]/, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "meta.tag.link.internal" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "meta.tag.link.external", + "meta.tag.link.external", + "string.unquoted", + "punctuation.definition.tag.end" + ], + regex: /(\[)(.*?)([\s]+)(.*?)(\])/ + }], + "#comment": [{ + token: "punctuation.definition.comment.html", + regex: //, + next: "pop" + }, { + defaultToken: "comment.block.html" + }] + }], + "#emphasis": [{ + token: [ + "punctuation.definition.tag.begin", + "markup.italic.bold", + "punctuation.definition.tag.end" + ], + regex: /(''''')(?!')(.*?)('''''|$)/ + }, { + token: [ + "punctuation.definition.tag.begin", + "markup.bold", + "punctuation.definition.tag.end" + ], + regex: /(''')(?!')(.*?)('''|$)/ + }, { + token: [ + "punctuation.definition.tag.begin", + "markup.italic", + "punctuation.definition.tag.end" + ], + regex: /('')(?!')(.*?)(''|$)/ + }], + "#heading": [{ + token: [ + "punctuation.definition.heading", + "entity.name.section", + "punctuation.definition.heading" + ], + regex: /(={1,6})(.+?)(\1)(?!=)/ + }], + "#tag": [{ + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag", + "meta.tag.block.ref", + "punctuation.definition.tag.end" + ], + regex: /(<)(ref)((?:\s+.*?)?)(>)/, + caseInsensitive: true, + push: [{ + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag", + "meta.tag.block.ref", + "punctuation.definition.tag.end" + ], + regex: /(<\/)(ref)(\s*)(>)/, + caseInsensitive: true, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "meta.tag.block.ref" + }] + }, + { + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag", + "meta.tag.block.nowiki", + "punctuation.definition.tag.end" + ], + regex: /(<)(nowiki)((?:\s+.*?)?)(>)/, + caseInsensitive: true, + push: [{ + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag", + "meta.tag.block.nowiki", + "punctuation.definition.tag.end" + ], + regex: /(<\/)(nowiki)(\s*)(>)/, + caseInsensitive: true, + next: "pop" + }, { + defaultToken: "meta.tag.block.nowiki" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag" + ], + regex: /(<\/?)(noinclude|includeonly|onlyinclude)(?=\W)/, + caseInsensitive: true, + push: [{ + token: [ + "invalid.illegal", + "punctuation.definition.tag.end" + ], + regex: /((?:\/)?)(>)/, + next: "pop" + }, { + include: "#attribute" + }, { + defaultToken: "meta.tag.block.any" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag" + ], + regex: /(<)(br|wbr|hr|meta|link)(?=\W)/, + caseInsensitive: true, + push: [{ + token: "punctuation.definition.tag.end", + regex: /\/?>/, + next: "pop" + }, { + include: "#attribute" + }, { + defaultToken: "meta.tag.other" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "entity.name.tag" + ], + regex: /(<\/?)(div|center|span|h1|h2|h3|h4|h5|h6|bdo|em|strong|cite|dfn|code|samp|kbd|var|abbr|blockquote|q|sub|sup|p|pre|ins|del|ul|ol|li|dl|dd|dt|table|caption|thead|tfoot|tbody|colgroup|col|tr|td|th|a|img|video|source|track|tt|b|i|big|small|strike|s|u|font|ruby|rb|rp|rt|rtc|math|figure|figcaption|bdi|data|time|mark|html)(?=\W)/, + caseInsensitive: true, + push: [{ + token: [ + "invalid.illegal", + "punctuation.definition.tag.end" + ], + regex: /((?:\/)?)(>)/, + next: "pop" + }, { + include: "#attribute" + }, { + defaultToken: "meta.tag.block" + }] + }, { + token: [ + "punctuation.definition.tag.begin", + "invalid.illegal" + ], + regex: /(<\/)(br|wbr|hr|meta|link)(?=\W)/, + caseInsensitive: true, + push: [{ + token: "punctuation.definition.tag.end", + regex: /\/?>/, + next: "pop" + }, { + include: "#attribute" + }, { + defaultToken: "meta.tag.other" + }] + }], + "#caption": [{ + token: [ + "meta.tag.block.table-caption", + "punctuation.definition.tag.begin" + ], + regex: /^(\s*)(\|\+)/, + push: [{ + token: "meta.tag.block.table-caption", + regex: /$/, + next: "pop" + }, { + defaultToken: "meta.tag.block.table-caption" + }] + }], + "#tr": [{ + token: [ + "meta.tag.block.tr", + "punctuation.definition.tag.begin", + "meta.tag.block.tr", + "invalid.illegal" + ], + regex: /^(\s*)(\|\-)([\s]*)(.*)/ + }], + "#th": [{ + token: [ + "meta.tag.block.th.heading", + "punctuation.definition.tag.begin", + "meta.tag.block.th.heading", + "punctuation.definition.tag", + "markup.bold" + ], + regex: /^(\s*)(!)(?:(.*?)(\|))?(.*?)(?=!!|$)/, + push: [{ + token: "meta.tag.block.th.heading", + regex: /$/, + next: "pop" + }, { + token: [ + "punctuation.definition.tag.begin", + "meta.tag.block.th.inline", + "punctuation.definition.tag", + "markup.bold" + ], + regex: /(!!)(?:(.*?)(\|))?(.*?)(?=!!|$)/ + }, { + include: "$self" + }, { + defaultToken: "meta.tag.block.th.heading" + }] + }], + "#td": [{ + token: [ + "meta.tag.block.td", + "punctuation.definition.tag.begin" + ], + regex: /^(\s*)(\|)/, + push: [{ + token: "meta.tag.block.td", + regex: /$/, + next: "pop" + }, { + include: "$self" + }, { + defaultToken: "meta.tag.block.td" + }] + }], + "#table": [{ + patterns: [{ + name: "meta.tag.block.table", + begin: "^\\s*({\\|)(.*?)$", + end: "^\\s*\\|}", + beginCaptures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 2: { + patterns: [{ + include: "#attribute" + }] + }, + 3: { + name: "invalid.illegal" + } + }, + endCaptures: { + 0: { + name: "punctuation.definition.tag.end" + } + }, + patterns: [{ + include: "#comment" + }, { + include: "#template" + }, { + include: "#caption" + }, { + include: "#tr" + }, { + include: "#th" + }, { + include: "#td" + }] + }], + repository: { + caption: { + name: "meta.tag.block.table-caption", + begin: "^\\s*(\\|\\+)", + end: "$", + beginCaptures: { + 1: { + name: "punctuation.definition.tag.begin" + } + } + }, + tr: { + name: "meta.tag.block.tr", + match: "^\\s*(\\|\\-)[\\s]*(.*)", + captures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 2: { + name: "invalid.illegal" + } + } + }, + th: { + name: "meta.tag.block.th.heading", + begin: "^\\s*(!)((.*?)(\\|))?(.*?)(?=(!!)|$)", + end: "$", + beginCaptures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 3: { + patterns: [{ + include: "#attribute" + }] + }, + 4: { + name: "punctuation.definition.tag" + }, + 5: { + name: "markup.bold" + } + }, + patterns: [{ + name: "meta.tag.block.th.inline", + match: "(!!)((.*?)(\\|))?(.*?)(?=(!!)|$)", + captures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 3: { + patterns: [{ + include: "#attribute" + }] + }, + 4: { + name: "punctuation.definition.tag" + }, + 5: { + name: "markup.bold" + } + } + }, { + include: "$self" + }] + }, + td: { + name: "meta.tag.block.td", + begin: "^\\s*(\\|)", + end: "$", + beginCaptures: { + 1: { + name: "punctuation.definition.tag.begin" + }, + 2: { + patterns: [{ + include: "#attribute" + }] + }, + 3: { + name: "punctuation.definition.tag" + } + }, + patterns: [{ + include: "$self" + }] + } + } + }], + "#attribute": [{ + include: "#string" + }, { + token: "entity.other.attribute-name", + regex: /\w+/ + }], + "#string": [{ + token: "string.quoted.double", + regex: /\"/, + push: [{ + token: "string.quoted.double", + regex: /\"/, + next: "pop" + }, { + defaultToken: "string.quoted.double" + }] + }, { + token: "string.quoted.single", + regex: /\'/, + push: [{ + token: "string.quoted.single", + regex: /\'/, + next: "pop" + }, { + defaultToken: "string.quoted.single" + }] + }], + "#url": [{ + token: "markup.underline.link", + regex: /(?:http(?:s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:\/?#\[\]@!\$&'\(\)\*\+,;=.]+/ + }, { + token: "invalid.illegal", + regex: /.*/ + }] + }; + + + this.normalizeRules(); +}; + +MediaWikiHighlightRules.metaData = { + name: "MediaWiki", + scopeName: "text.html.mediawiki", + fileTypes: ["mediawiki", "wiki"] +}; + + +oop.inherits(MediaWikiHighlightRules, TextHighlightRules); + +exports.MediaWikiHighlightRules = MediaWikiHighlightRules; +}); + +define("ace/mode/mediawiki",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mediawiki_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var MediaWikiHighlightRules = require("./mediawiki_highlight_rules").MediaWikiHighlightRules; + +var Mode = function() { + this.HighlightRules = MediaWikiHighlightRules; +}; +oop.inherits(Mode, TextMode); + +(function() { + this.type = "text"; + this.blockComment = {start: ""}; + this.$id = "ace/mode/mediawiki"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/mediawiki"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-mips.js b/htdocs/includes/ace/src/mode-mips.js new file mode 100644 index 00000000000..4d28b88d676 --- /dev/null +++ b/htdocs/includes/ace/src/mode-mips.js @@ -0,0 +1,264 @@ +define("ace/mode/mips_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var MIPSHighlightRules = function() { + + var escapeRe = /\\(?:['"?\\abfnrtv]|[0-7]{1,3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}U[a-fA-F\d]{8}|.)/.source; + + this.$rules = { + start: [{ + token: "storage.modifier.mips", + regex: /\.\b(?:align|ascii|asciiz|byte|double|extern|float|globl|space|word)\b/, + comment: "Assembler directives for data storage" + }, { + token: "entity.name.section.mips", + regex: /\.\b(?:data|text|kdata|ktext|)\b/, + comment: "Segements: .data .text" + }, { + token: "variable.parameter.mips", + regex: /\$(?:(?:3[01]|[12]?[0-9]|[0-9])|zero|at|v[01]|a[0-3]|s[0-7]|t[0-9]|k[01]|gp|sp|fp|ra)/, + comment: "Registers by id $1, $2, ..." + }, { + token: "variable.parameter.mips", + regex: /\$f(?:[0-9]|[1-2][0-9]|3[0-1])/, + comment: "Floating point registers" + }, { + token: "support.function.source.mips", + regex: /\b(?:(?:add|sub|div|l|mov|mult|neg|s|c\.eq|c\.le|c\.lt)\.[ds]|cvt\.s\.[dw]|cvt\.d\.[sw]|cvt\.w\.[ds]|bc1[tf])\b/, + comment: "The MIPS floating-point instruction set" + }, { + token: "support.function.source.mips", + regex: /\b(?:add|addu|addi|addiu|sub|subu|and|andi|or|not|ori|nor|xor|xori|slt|sltu|slti|sltiu|sll|sllv|rol|srl|sra|srlv|ror|j|jr|jal|beq|bne|lw|sw|lb|sb|lui|move|mfhi|mflo|mthi|mtlo)\b/, + comment: "Just the hardcoded instructions provided by the MIPS assembly language" + }, { + token: "support.function.other.mips", + regex: /\b(?:abs|b|beqz|bge|bgt|bgtu|ble|bleu|blt|bltu|bnez|div|divu|la|li|move|mul|neg|not|rem|remu|seq|sge|sgt|sle|sne)\b/, + comment: "Pseudo instructions" + }, { + token: "entity.name.function.mips", + regex: /\bsyscall\b/, + comment: "Other" + }, { + token : "string", // character + regex : "(?:'\")(?:" + escapeRe + "|.)?(?:'\")" + }, { + token : "string.start", + regex : '\'', + stateName: "qstring", + next: [ + { token: "string", regex: /\\\s*$/, next: "qqstring" }, + { token: "constant.language.escape", regex: escapeRe }, + { token: "string.end", regex: '\'|$', next: "start" }, + { defaultToken: "string"} + ] + }, { + token : "string.start", + regex : '"', + stateName: "qqstring", + next: [ + { token: "string", regex: /\\\s*$/, next: "qqstring" }, + { token: "constant.language.escape", regex: escapeRe }, + { token: "string.end", regex: '"|$', next: "start" }, + { defaultToken: "string"} + ] + }, { + token: "constant.numeric.mips", + regex: /\b(?:\d+|0(?:x|X)[a-fA-F0-9]+)\b/, + comment: "Numbers like +12, -3, 55, 0x3F" + }, { + token: "entity.name.tag.mips", + regex: /\b[\w]+\b:/, + comment: "Labels at line start: begin_repeat: add ..." + }, { + token: "comment.assembly", + regex: /#.*$/, + comment: "Single line comments" + }] + }; + + this.normalizeRules(); +}; + +MIPSHighlightRules.metaData = { + fileTypes: ["s", "asm"], + name: "MIPS", + scopeName: "source.mips" +}; + + +oop.inherits(MIPSHighlightRules, TextHighlightRules); + +exports.MIPSHighlightRules = MIPSHighlightRules; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/mips",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mips_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var MIPSHighlightRules = require("./mips_highlight_rules").MIPSHighlightRules; +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = MIPSHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = ["#"]; + this.$id = "ace/mode/mips"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/mips"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-nix.js b/htdocs/includes/ace/src/mode-nix.js index b1a426fb9b3..d5698eb141b 100644 --- a/htdocs/includes/ace/src/mode-nix.js +++ b/htdocs/includes/ace/src/mode-nix.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-nsis.js b/htdocs/includes/ace/src/mode-nsis.js index 67c2abec063..10816422adf 100644 --- a/htdocs/includes/ace/src/mode-nsis.js +++ b/htdocs/includes/ace/src/mode-nsis.js @@ -13,7 +13,7 @@ var NSISHighlightRules = function() { caseInsensitive: true }, { token: "keyword.command.nsis", - regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, + regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, caseInsensitive: true }, { token: "keyword.control.nsis", diff --git a/htdocs/includes/ace/src/mode-nunjucks.js b/htdocs/includes/ace/src/mode-nunjucks.js index 57f1e9f32bb..c59a814e67d 100644 --- a/htdocs/includes/ace/src/mode-nunjucks.js +++ b/htdocs/includes/ace/src/mode-nunjucks.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-objectivec.js b/htdocs/includes/ace/src/mode-objectivec.js index 28a56917f03..0a2dbd08fba 100644 --- a/htdocs/includes/ace/src/mode-objectivec.js +++ b/htdocs/includes/ace/src/mode-objectivec.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); diff --git a/htdocs/includes/ace/src/mode-perl.js b/htdocs/includes/ace/src/mode-perl.js index 978979b1e47..bc8d178c968 100644 --- a/htdocs/includes/ace/src/mode-perl.js +++ b/htdocs/includes/ace/src/mode-perl.js @@ -367,6 +367,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/perl"; + this.snippetFileId = "ace/snippets/perl"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-pgsql.js b/htdocs/includes/ace/src/mode-pgsql.js index 952319ef862..069b750eab6 100644 --- a/htdocs/includes/ace/src/mode-pgsql.js +++ b/htdocs/includes/ace/src/mode-pgsql.js @@ -526,10 +526,10 @@ var PythonHighlightRules = function() { regex: "\\s+" }, { token: "string", - regex: "'(.)*'" + regex: "'[^']*'" }, { token: "string", - regex: '"(.)*"' + regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" diff --git a/htdocs/includes/ace/src/mode-php.js b/htdocs/includes/ace/src/mode-php.js index b9acd2c8073..7db8bf2c7bd 100644 --- a/htdocs/includes/ace/src/mode-php.js +++ b/htdocs/includes/ace/src/mode-php.js @@ -2138,15 +2138,15 @@ var functionMap = { "Escapes single quote, double quotes and backslash characters in a string with backslashes" ], "apache_child_terminate": [ - "bool apache_child_terminate(void)", + "bool apache_child_terminate()", "Terminate apache process after this request" ], "apache_get_modules": [ - "array apache_get_modules(void)", + "array apache_get_modules()", "Get a list of loaded Apache modules" ], "apache_get_version": [ - "string apache_get_version(void)", + "string apache_get_version()", "Fetch Apache version" ], "apache_getenv": [ @@ -2178,7 +2178,7 @@ var functionMap = { "* fetch all headers that go out in case of an error or a subrequest" ], "apache_request_headers": [ - "array apache_request_headers(void)", + "array apache_request_headers()", "Fetch all HTTP request headers" ], "apache_request_headers_in": [ @@ -2194,7 +2194,7 @@ var functionMap = { "" ], "apache_request_log_error": [ - "boolean apache_request_log_error(string message, [long facility])", + "bool apache_request_log_error(string message, [long facility])", "" ], "apache_request_meets_conditions": [ @@ -2246,11 +2246,11 @@ var functionMap = { "" ], "apache_reset_timeout": [ - "bool apache_reset_timeout(void)", + "bool apache_reset_timeout()", "Reset the Apache write timer" ], "apache_response_headers": [ - "array apache_response_headers(void)", + "array apache_response_headers()", "Fetch all HTTP response headers" ], "apache_setenv": [ @@ -2337,6 +2337,14 @@ var functionMap = { "array array_keys(array input [, mixed search_value[, bool strict]])", "Return just the keys from the input array, optionally only for the specified search_value" ], + "array_key_first": [ + "mixed array_key_first(array arr)", + "Returns the first key of arr if the array is not empty; NULL otherwise" + ], + "array_key_last": [ + "mixed array_key_last(array arr)", + "Returns the last key of arr if the array is not empty; NULL otherwise" + ], "array_map": [ "array array_map(mixed callback, array input1 [, array input2 ,...])", "Applies the callback to the elements in given arrays." @@ -2694,7 +2702,7 @@ var functionMap = { "Change file mode" ], "chown": [ - "bool chown (string filename, mixed user)", + "bool chown(string filename, mixed user)", "Change file owner" ], "chr": [ @@ -2722,7 +2730,7 @@ var functionMap = { "Return all classes and interfaces implemented by SPL" ], "class_parents": [ - "array class_parents(object instance [, boolean autoload = true])", + "array class_parents(object instance [, bool autoload = true])", "Return an array containing the names of all parent classes" ], "clearstatcache": [ @@ -2734,7 +2742,7 @@ var functionMap = { "Close directory connection identified by the dir_handle" ], "closelog": [ - "bool closelog(void)", + "bool closelog()", "Close connection to system logger" ], "collator_asort": [ @@ -2826,11 +2834,11 @@ var functionMap = { "Return a string to confirm that the module is compiled in" ], "connection_aborted": [ - "int connection_aborted(void)", + "int connection_aborted()", "Returns true if client disconnected" ], "connection_status": [ - "int connection_status(void)", + "int connection_status()", "Returns the connection status bitfield" ], "constant": [ @@ -2875,7 +2883,7 @@ var functionMap = { ], "create_function": [ "string create_function(string args, string code)", - "Creates an anonymous function, and returns its name (funny, eh?)" + "Creates an anonymous function, and returns its name" ], "crypt": [ "string crypt(string str [, string salt])", @@ -2974,7 +2982,7 @@ var functionMap = { "Get information about the current transfers" ], "curl_multi_init": [ - "resource curl_multi_init(void)", + "resource curl_multi_init()", "Returns a new cURL multi handle" ], "curl_multi_remove_handle": [ @@ -3170,7 +3178,7 @@ var functionMap = { "* Set formatter pattern." ], "datefmt_set_timezone_id": [ - "boolean datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", + "bool datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", "* Set formatter timezone_id." ], "dba_close": [ @@ -3238,7 +3246,7 @@ var functionMap = { "Return the translation of msgid for domain_name and category, or msgid unaltered if a translation does not exist" ], "dcngettext": [ - "string dcngettext (string domain, string msgid1, string msgid2, int n, int category)", + "string dcngettext(string domain, string msgid1, string msgid2, int n, int category)", "Plural version of dcgettext()" ], "debug_backtrace": [ @@ -3246,44 +3254,231 @@ var functionMap = { "Return backtrace as array" ], "debug_print_backtrace": [ - "void debug_print_backtrace(void) */", - "ZEND_FUNCTION(debug_print_backtrace) { zend_execute_data *ptr, *skip; int lineno; char *function_name; char *filename; char *class_name = NULL; char *call_type; char *include_filename = NULL; zval *arg_array = NULL; int indent = 0; if (zend_parse_parameters_none() == FAILURE) { return; } ptr = EG(current_execute_data);", + "void debug_print_backtrace()", + "Prints a PHP backtrace" + ], + "debug_zval_dump": [ + "void debug_zval_dump(mixed var)", + "Dumps a string representation of an internal Zend value to output" + ], + "decbin": [ + "string decbin(int decimal_number)", + "Returns a string containing a binary representation of the number" + ], + "dechex": [ + "string dechex(int decimal_number)", + "Returns a string containing a hexadecimal representation of the given number" + ], + "decoct": [ + "string decoct(int decimal_number)", + "Returns a string containing an octal representation of the given number" + ], + "define": [ + "bool define(string constant_name, mixed value, bool case_insensitive=false)", + "Define a new constant" + ], + "define_syslog_variables": [ + "void define_syslog_variables()", + "Initializes all syslog-related variables" + ], + "defined": [ + "bool defined(string constant_name)", + "Check whether a constant exists" + ], + "deg2rad": [ + "float deg2rad(float number)", + "Converts the number in degrees to the radian equivalent" + ], + "dgettext": [ + "string dgettext(string domain_name, string msgid)", + "Return the translation of msgid for domain_name, or msgid unaltered if a translation does not exist" + ], + "die": [ + "void die([mixed status])", + "Output a message and terminate the current script" + ], + "dir": [ + "object dir(string directory[, resource context])", + "Directory class with properties, handle and class and methods read, rewind and close" + ], + "dirname": [ + "string dirname(string path)", + "Returns the directory name component of the path" + ], + "disk_free_space": [ + "float disk_free_space(string path)", + "Get free disk space for filesystem that path is on" + ], + "disk_total_space": [ + "float disk_total_space(string path)", + "Get total disk space for filesystem that path is on" + ], + "display_disabled_function": [ + "void display_disabled_function()", + "Dummy function which displays an error when a disabled function is called." + ], + "dl": [ + "int dl(string extension_filename)", + "Load a PHP extension at runtime" + ], + "dngettext": [ + "string dngettext(string domain, string msgid1, string msgid2, int count)", + "Plural version of dgettext()" + ], + "dns_check_record": [ + "bool dns_check_record(string host [, string type])", + "Check DNS records corresponding to a given Internet host name or IP address" + ], + "dns_get_mx": [ + "bool dns_get_mx(string hostname, array mxhosts [, array weight])", + "Get MX records corresponding to a given Internet host name" + ], + "dns_get_record": [ + "array|false dns_get_record(string hostname [, int type[, array authns, array addtl]])", + "Get any Resource Record corresponding to a given Internet host name" + ], + "dom_attr_is_id": [ + "bool dom_attr_is_id()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId Since: DOM Level 3" + ], + "dom_characterdata_append_data": [ + "void dom_characterdata_append_data(string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-32791A2F Since:" + ], + "dom_characterdata_delete_data": [ + "void dom_characterdata_delete_data(int offset, int count)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7C603781 Since:" + ], + "dom_characterdata_insert_data": [ + "void dom_characterdata_insert_data(int offset, string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3EDB695F Since:" + ], + "dom_characterdata_replace_data": [ + "void dom_characterdata_replace_data(int offset, int count, string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-E5CBA7FB Since:" + ], + "dom_characterdata_substring_data": [ + "string dom_characterdata_substring_data(int offset, int count)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6531BCCF Since:" + ], + "dom_document_adopt_node": [ + "DOMNode dom_document_adopt_node(DOMNode source)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode Since: DOM Level 3" + ], + "dom_document_create_attribute": [ + "DOMAttr dom_document_create_attribute(string name)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198 Since:" + ], + "dom_document_create_attribute_ns": [ + "DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS Since: DOM Level 2" + ], + "dom_document_create_cdatasection": [ + "DOMCdataSection dom_document_create_cdatasection(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8 Since:" + ], + "dom_document_create_comment": [ + "DOMComment dom_document_create_comment(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328 Since:" + ], + "dom_document_create_document_fragment": [ + "DOMDocumentFragment dom_document_create_document_fragment()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5 Since:" + ], + "dom_document_create_element": [ + "DOMElement dom_document_create_element(string tagName [, string value])", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547 Since:" + ], + "dom_document_create_element_ns": [ + "DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value])", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS Since: DOM Level 2" + ], + "dom_document_create_entity_reference": [ + "DOMEntityReference dom_document_create_entity_reference(string name)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE Since:" + ], + "dom_document_create_processing_instruction": [ + "DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439 Since:" + ], + "dom_document_create_text_node": [ + "DOMText dom_document_create_text_node(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127 Since:" + ], + "dom_document_get_element_by_id": [ + "DOMElement dom_document_get_element_by_id(string elementId)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId Since: DOM Level 2" + ], + "dom_document_get_elements_by_tag_name": [ + "DOMNodeList dom_document_get_elements_by_tag_name(string tagname)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094 Since:" + ], + "dom_document_get_elements_by_tag_name_ns": [ + "DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS Since: DOM Level 2" + ], + "dom_document_import_node": [ + "DOMNode dom_document_import_node(DOMNode importedNode, bool deep)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode Since: DOM Level 2" + ], + "dom_document_load": [ + "DOMNode dom_document_load(string source [, int options])", + "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load Since: DOM Level 3" + ], + "dom_document_load_html": [ + "DOMNode dom_document_load_html(string source)", + "Since: DOM extended" + ], + "dom_document_load_html_file": [ + "DOMNode dom_document_load_html_file(string source)", + "Since: DOM extended" + ], + "dom_document_loadxml": [ + "DOMNode dom_document_loadxml(string source [, int options])", + "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-loadXML Since: DOM Level 3" + ], + "dom_document_normalize_document": [ + "void dom_document_normalize_document()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument Since: DOM Level 3" + ], + "dom_document_relaxNG_validate_file": [ + "bool dom_document_relaxNG_validate_file(string filename); */", "PHP_FUNCTION(dom_document_relaxNG_validate_file) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_relaxNG_validate_file" ], "dom_document_relaxNG_validate_xml": [ - "boolean dom_document_relaxNG_validate_xml(string source); */", + "bool dom_document_relaxNG_validate_xml(string source); */", "PHP_FUNCTION(dom_document_relaxNG_validate_xml) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_relaxNG_validate_xml" ], "dom_document_rename_node": [ - "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName);", + "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode Since: DOM Level 3" ], "dom_document_save": [ - "int dom_document_save(string file);", + "int dom_document_save(string file)", "Convenience method to save to file" ], "dom_document_save_html": [ - "string dom_document_save_html();", + "string dom_document_save_html()", "Convenience method to output as html" ], "dom_document_save_html_file": [ - "int dom_document_save_html_file(string file);", + "int dom_document_save_html_file(string file)", "Convenience method to save to file as html" ], "dom_document_savexml": [ - "string dom_document_savexml([node n]);", + "string dom_document_savexml([node n])", "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-saveXML Since: DOM Level 3" ], "dom_document_schema_validate": [ - "boolean dom_document_schema_validate(string source); */", + "bool dom_document_schema_validate(string source); */", "PHP_FUNCTION(dom_document_schema_validate_xml) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_schema_validate" ], "dom_document_schema_validate_file": [ - "boolean dom_document_schema_validate_file(string filename); */", + "bool dom_document_schema_validate_file(string filename); */", "PHP_FUNCTION(dom_document_schema_validate_file) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_schema_validate_file" ], "dom_document_validate": [ - "boolean dom_document_validate();", + "bool dom_document_validate()", "Since: DOM extended" ], "dom_document_xinclude": [ @@ -3291,123 +3486,123 @@ var functionMap = { "Substitutues xincludes in a DomDocument" ], "dom_domconfiguration_can_set_parameter": [ - "boolean dom_domconfiguration_can_set_parameter(string name, domuserdata value);", + "bool dom_domconfiguration_can_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-canSetParameter Since:" ], "dom_domconfiguration_get_parameter": [ - "domdomuserdata dom_domconfiguration_get_parameter(string name);", + "domdomuserdata dom_domconfiguration_get_parameter(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-getParameter Since:" ], "dom_domconfiguration_set_parameter": [ - "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value);", + "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-property Since:" ], "dom_domerrorhandler_handle_error": [ - "dom_boolean dom_domerrorhandler_handle_error(domerror error);", + "dom_bool dom_domerrorhandler_handle_error(domerror error)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-ERRORS-DOMErrorHandler-handleError Since:" ], "dom_domimplementation_create_document": [ - "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype);", + "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocument Since: DOM Level 2" ], "dom_domimplementation_create_document_type": [ - "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId);", + "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocType Since: DOM Level 2" ], "dom_domimplementation_get_feature": [ - "DOMNode dom_domimplementation_get_feature(string feature, string version);", + "DOMNode dom_domimplementation_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementation3-getFeature Since: DOM Level 3" ], "dom_domimplementation_has_feature": [ - "boolean dom_domimplementation_has_feature(string feature, string version);", + "bool dom_domimplementation_has_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-5CED94D7 Since:" ], "dom_domimplementationlist_item": [ - "domdomimplementation dom_domimplementationlist_item(int index);", + "domdomimplementation dom_domimplementationlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item Since:" ], "dom_domimplementationsource_get_domimplementation": [ - "domdomimplementation dom_domimplementationsource_get_domimplementation(string features);", + "domdomimplementation dom_domimplementationsource_get_domimplementation(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpl Since:" ], "dom_domimplementationsource_get_domimplementations": [ - "domimplementationlist dom_domimplementationsource_get_domimplementations(string features);", + "domimplementationlist dom_domimplementationsource_get_domimplementations(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpls Since:" ], "dom_domstringlist_item": [ - "domstring dom_domstringlist_item(int index);", + "domstring dom_domstringlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item Since:" ], "dom_element_get_attribute": [ - "string dom_element_get_attribute(string name);", + "string dom_element_get_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-666EE0F9 Since:" ], "dom_element_get_attribute_node": [ - "DOMAttr dom_element_get_attribute_node(string name);", + "DOMAttr dom_element_get_attribute_node(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-217A91B8 Since:" ], "dom_element_get_attribute_node_ns": [ - "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName);", + "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAtNodeNS Since: DOM Level 2" ], "dom_element_get_attribute_ns": [ - "string dom_element_get_attribute_ns(string namespaceURI, string localName);", + "string dom_element_get_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAttrNS Since: DOM Level 2" ], "dom_element_get_elements_by_tag_name": [ - "DOMNodeList dom_element_get_elements_by_tag_name(string name);", + "DOMNodeList dom_element_get_elements_by_tag_name(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1938918D Since:" ], "dom_element_get_elements_by_tag_name_ns": [ - "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName);", + "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C90942 Since: DOM Level 2" ], "dom_element_has_attribute": [ - "boolean dom_element_has_attribute(string name);", + "bool dom_element_has_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttr Since: DOM Level 2" ], "dom_element_has_attribute_ns": [ - "boolean dom_element_has_attribute_ns(string namespaceURI, string localName);", + "bool dom_element_has_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttrNS Since: DOM Level 2" ], "dom_element_remove_attribute": [ - "void dom_element_remove_attribute(string name);", + "void dom_element_remove_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6D6AC0F9 Since:" ], "dom_element_remove_attribute_node": [ - "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr);", + "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D589198 Since:" ], "dom_element_remove_attribute_ns": [ - "void dom_element_remove_attribute_ns(string namespaceURI, string localName);", + "void dom_element_remove_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElRemAtNS Since: DOM Level 2" ], "dom_element_set_attribute": [ - "void dom_element_set_attribute(string name, string value);", + "void dom_element_set_attribute(string name, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68F082 Since:" ], "dom_element_set_attribute_node": [ - "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr);", + "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-887236154 Since:" ], "dom_element_set_attribute_node_ns": [ - "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr);", + "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAtNodeNS Since: DOM Level 2" ], "dom_element_set_attribute_ns": [ - "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value);", + "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAttrNS Since: DOM Level 2" ], "dom_element_set_id_attribute": [ - "void dom_element_set_id_attribute(string name, boolean isId);", + "void dom_element_set_id_attribute(string name, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttr Since: DOM Level 3" ], "dom_element_set_id_attribute_node": [ - "void dom_element_set_id_attribute_node(attr idAttr, boolean isId);", + "void dom_element_set_id_attribute_node(attr idAttr, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNode Since: DOM Level 3" ], "dom_element_set_id_attribute_ns": [ - "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, boolean isId);", + "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNS Since: DOM Level 3" ], "dom_import_simplexml": [ @@ -3415,156 +3610,156 @@ var functionMap = { "Get a simplexml_element object from dom to allow for processing" ], "dom_namednodemap_get_named_item": [ - "DOMNode dom_namednodemap_get_named_item(string name);", + "DOMNode dom_namednodemap_get_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1074577549 Since:" ], "dom_namednodemap_get_named_item_ns": [ - "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName);", + "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_item": [ - "DOMNode dom_namednodemap_item(int index);", + "DOMNode dom_namednodemap_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-349467F9 Since:" ], "dom_namednodemap_remove_named_item": [ - "DOMNode dom_namednodemap_remove_named_item(string name);", + "DOMNode dom_namednodemap_remove_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D58B193 Since:" ], "dom_namednodemap_remove_named_item_ns": [ - "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName);", + "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-removeNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_set_named_item": [ - "DOMNode dom_namednodemap_set_named_item(DOMNode arg);", + "DOMNode dom_namednodemap_set_named_item(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1025163788 Since:" ], "dom_namednodemap_set_named_item_ns": [ - "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg);", + "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-setNamedItemNS Since: DOM Level 2" ], "dom_namelist_get_name": [ - "string dom_namelist_get_name(int index);", + "string dom_namelist_get_name(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getName Since:" ], "dom_namelist_get_namespace_uri": [ - "string dom_namelist_get_namespace_uri(int index);", + "string dom_namelist_get_namespace_uri(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getNamespaceURI Since:" ], "dom_node_append_child": [ - "DomNode dom_node_append_child(DomNode newChild);", + "DomNode dom_node_append_child(DomNode newChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-184E7107 Since:" ], "dom_node_clone_node": [ - "DomNode dom_node_clone_node(boolean deep);", + "DomNode dom_node_clone_node(bool deep)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3A0ED0A4 Since:" ], "dom_node_compare_document_position": [ - "short dom_node_compare_document_position(DomNode other);", + "short dom_node_compare_document_position(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-compareDocumentPosition Since: DOM Level 3" ], "dom_node_get_feature": [ - "DomNode dom_node_get_feature(string feature, string version);", + "DomNode dom_node_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getFeature Since: DOM Level 3" ], "dom_node_get_user_data": [ - "mixed dom_node_get_user_data(string key);", + "mixed dom_node_get_user_data(string key)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getUserData Since: DOM Level 3" ], "dom_node_has_attributes": [ - "boolean dom_node_has_attributes();", + "bool dom_node_has_attributes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeHasAttrs Since: DOM Level 2" ], "dom_node_has_child_nodes": [ - "boolean dom_node_has_child_nodes();", + "bool dom_node_has_child_nodes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-810594187 Since:" ], "dom_node_insert_before": [ - "domnode dom_node_insert_before(DomNode newChild, DomNode refChild);", + "domnode dom_node_insert_before(DomNode newChild, DomNode refChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-952280727 Since:" ], "dom_node_is_default_namespace": [ - "boolean dom_node_is_default_namespace(string namespaceURI);", + "bool dom_node_is_default_namespace(string namespaceURI)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace Since: DOM Level 3" ], "dom_node_is_equal_node": [ - "boolean dom_node_is_equal_node(DomNode arg);", + "bool dom_node_is_equal_node(DomNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isEqualNode Since: DOM Level 3" ], "dom_node_is_same_node": [ - "boolean dom_node_is_same_node(DomNode other);", + "bool dom_node_is_same_node(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isSameNode Since: DOM Level 3" ], "dom_node_is_supported": [ - "boolean dom_node_is_supported(string feature, string version);", + "bool dom_node_is_supported(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Level-2-Core-Node-supports Since: DOM Level 2" ], "dom_node_lookup_namespace_uri": [ - "string dom_node_lookup_namespace_uri(string prefix);", + "string dom_node_lookup_namespace_uri(string prefix)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI Since: DOM Level 3" ], "dom_node_lookup_prefix": [ - "string dom_node_lookup_prefix(string namespaceURI);", + "string dom_node_lookup_prefix(string namespaceURI)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-lookupNamespacePrefix Since: DOM Level 3" ], "dom_node_normalize": [ - "void dom_node_normalize();", + "void dom_node_normalize()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-normalize Since:" ], "dom_node_remove_child": [ - "DomNode dom_node_remove_child(DomNode oldChild);", + "DomNode dom_node_remove_child(DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1734834066 Since:" ], "dom_node_replace_child": [ - "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild);", + "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-785887307 Since:" ], "dom_node_set_user_data": [ - "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler);", + "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-setUserData Since: DOM Level 3" ], "dom_nodelist_item": [ - "DOMNode dom_nodelist_item(int index);", + "DOMNode dom_nodelist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-844377136 Since:" ], "dom_string_extend_find_offset16": [ - "int dom_string_extend_find_offset16(int offset32);", + "int dom_string_extend_find_offset16(int offset32)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset16 Since:" ], "dom_string_extend_find_offset32": [ - "int dom_string_extend_find_offset32(int offset16);", + "int dom_string_extend_find_offset32(int offset16)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset32 Since:" ], "dom_text_is_whitespace_in_element_content": [ - "boolean dom_text_is_whitespace_in_element_content();", + "bool dom_text_is_whitespace_in_element_content()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent Since: DOM Level 3" ], "dom_text_replace_whole_text": [ - "DOMText dom_text_replace_whole_text(string content);", + "DOMText dom_text_replace_whole_text(string content)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText Since: DOM Level 3" ], "dom_text_split_text": [ - "DOMText dom_text_split_text(int offset);", + "DOMText dom_text_split_text(int offset)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D Since:" ], "dom_userdatahandler_handle": [ - "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst);", + "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent Since:" ], "dom_xpath_evaluate": [ - "mixed dom_xpath_evaluate(string expr [,DOMNode context]); */", - "PHP_FUNCTION(dom_xpath_evaluate) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_EVALUATE); } /* }}} end dom_xpath_evaluate" + "mixed dom_xpath_evaluate(string expr [,DOMNode context])", + "" ], "dom_xpath_query": [ - "DOMNodeList dom_xpath_query(string expr [,DOMNode context]); */", - "PHP_FUNCTION(dom_xpath_query) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_QUERY); } /* }}} end dom_xpath_query" + "DOMNodeList dom_xpath_query(string expr [,DOMNode context])", + "" ], "dom_xpath_register_ns": [ - "boolean dom_xpath_register_ns(string prefix, string uri); */", - "PHP_FUNCTION(dom_xpath_register_ns) { zval *id; xmlXPathContextPtr ctxp; int prefix_len, ns_uri_len; dom_xpath_object *intern; unsigned char *prefix, *ns_uri; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"Oss\", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { return; } intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); ctxp = (xmlXPathContextPtr) intern->ptr; if (ctxp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid XPath Context\"); RETURN_FALSE; } if (xmlXPathRegisterNs(ctxp, prefix, ns_uri) != 0) { RETURN_FALSE } RETURN_TRUE; } /* }}}" + "bool dom_xpath_register_ns(string prefix, string uri)", + "" ], "dom_xpath_register_php_functions": [ - "void dom_xpath_register_php_functions() */", - "PHP_FUNCTION(dom_xpath_register_php_functions) { zval *id; dom_xpath_object *intern; zval *array_value, **entry, *new_string; int name_len = 0; char *name; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"a\", &array_value) == SUCCESS) { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) { SEPARATE_ZVAL(entry); convert_to_string_ex(entry); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &new_string, sizeof(zval*), NULL); zend_hash_move_forward(Z_ARRVAL_P(array_value)); } intern->registerPhpFunctions = 2; RETURN_TRUE; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &name, &name_len) == SUCCESS) { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, name, name_len + 1, &new_string, sizeof(zval*), NULL); intern->registerPhpFunctions = 2; } else { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); intern->registerPhpFunctions = 1; } } /* }}} end dom_xpath_register_php_functions" + "void dom_xpath_register_php_functions()", + "" ], "each": [ "array each(array arr)", @@ -3583,7 +3778,7 @@ var functionMap = { "Output one or more strings" ], "empty": [ - "bool empty( mixed var )", + "bool empty(mixed var)", "Determine whether a variable is empty" ], "enchant_broker_describe": [ @@ -3595,7 +3790,7 @@ var functionMap = { "Whether a dictionary exists or not. Using non-empty tag" ], "enchant_broker_free": [ - "boolean enchant_broker_free(resource broker)", + "bool enchant_broker_free(resource broker)", "Destroys the broker object and its dictionnaries" ], "enchant_broker_free_dict": [ @@ -3891,7 +4086,7 @@ var functionMap = { "Returns the next lowest integer value from the number" ], "flush": [ - "void flush(void)", + "void flush()", "Flush the output buffer" ], "fmod": [ @@ -4099,7 +4294,7 @@ var functionMap = { "Get an array of the arguments that were passed to the function" ], "func_num_args": [ - "int func_num_args(void)", + "int func_num_args()", "Get the number of arguments that were passed to the function" ], "function ": ["", ""], @@ -4113,19 +4308,19 @@ var functionMap = { "Binary-safe file write" ], "gc_collect_cycles": [ - "int gc_collect_cycles(void)", + "int gc_collect_cycles()", "Forces collection of any existing garbage cycles. Returns number of freed zvals" ], "gc_disable": [ - "void gc_disable(void)", + "void gc_disable()", "Deactivates the circular reference collector" ], "gc_enable": [ - "void gc_enable(void)", + "void gc_enable()", "Activates the circular reference collector" ], "gc_enabled": [ - "void gc_enabled(void)", + "void gc_enabled()", "Returns status of the circular reference collector" ], "gd_info": [ @@ -4134,7 +4329,7 @@ var functionMap = { ], "getKeywords": [ "static array getKeywords(string $locale) {", - "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!) * }}}" + "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array * }}}" ], "get_browser": [ "mixed get_browser([string browser_name [, bool return_array]])", @@ -4161,7 +4356,7 @@ var functionMap = { "Returns an array of default properties of the class." ], "get_current_user": [ - "string get_current_user(void)", + "string get_current_user()", "Get the name of the owner of the current PHP script" ], "get_declared_classes": [ @@ -4177,11 +4372,11 @@ var functionMap = { "Return an array containing the names and values of all defined constants" ], "get_defined_functions": [ - "array get_defined_functions(void)", + "array get_defined_functions()", "Returns an array of all defined functions" ], "get_defined_vars": [ - "array get_defined_vars(void)", + "array get_defined_vars()", "Returns an associative array of names and values of all currently defined variable names (variables in the current scope)" ], "get_display_language": [ @@ -4217,7 +4412,7 @@ var functionMap = { "Get the current include_path configuration option" ], "get_included_files": [ - "array get_included_files(void)", + "array get_included_files()", "Returns an array with the file names that were include_once()'d" ], "get_loaded_extensions": [ @@ -4225,11 +4420,11 @@ var functionMap = { "Return an array containing names of loaded extensions" ], "get_magic_quotes_gpc": [ - "int get_magic_quotes_gpc(void)", + "int get_magic_quotes_gpc()", "Get the current active configuration setting of magic_quotes_gpc" ], "get_magic_quotes_runtime": [ - "int get_magic_quotes_runtime(void)", + "int get_magic_quotes_runtime()", "Get the current active configuration setting of magic_quotes_runtime" ], "get_meta_tags": [ @@ -4249,11 +4444,11 @@ var functionMap = { "Get the resource type name for a given resource" ], "getallheaders": [ - "array getallheaders(void)", + "array getallheaders()", "" ], "getcwd": [ - "mixed getcwd(void)", + "mixed getcwd()", "Gets the current directory" ], "getdate": [ @@ -4285,23 +4480,23 @@ var functionMap = { "Get the size of an image as 4-element array" ], "getlastmod": [ - "int getlastmod(void)", + "int getlastmod()", "Get time of last page modification" ], "getmygid": [ - "int getmygid(void)", + "int getmygid()", "Get PHP script owner's GID" ], "getmyinode": [ - "int getmyinode(void)", + "int getmyinode()", "Get the inode of the current script being parsed" ], "getmypid": [ - "int getmypid(void)", + "int getmypid()", "Get current process ID" ], "getmyuid": [ - "int getmyuid(void)", + "int getmyuid()", "Get PHP script owner's UID" ], "getopt": [ @@ -4317,7 +4512,7 @@ var functionMap = { "Returns protocol name associated with protocol number proto" ], "getrandmax": [ - "int getrandmax(void)", + "int getrandmax()", "Returns the maximum value a random number can have" ], "getrusage": [ @@ -4593,7 +4788,7 @@ var functionMap = { "Generate a hash of a given input string Returns lowercase hexits by default" ], "hash_algos": [ - "array hash_algos(void)", + "array hash_algos()", "Return a list of registered hashing algorithms" ], "hash_copy": [ @@ -4641,7 +4836,7 @@ var functionMap = { "Removes an HTTP header previously set using header()" ], "headers_list": [ - "array headers_list(void)", + "array headers_list()", "Return list of headers to be sent / already sent" ], "headers_sent": [ @@ -4769,11 +4964,11 @@ var functionMap = { "Drop an InterBase database" ], "ibase_errcode": [ - "int ibase_errcode(void)", + "int ibase_errcode()", "Return error code" ], "ibase_errmsg": [ - "string ibase_errmsg(void)", + "string ibase_errmsg()", "Return error message" ], "ibase_execute": [ @@ -5242,7 +5437,7 @@ var functionMap = { ], "imagepsextendfont": [ "bool imagepsextendfont(resource font_index, float extend)", - "Extend or or condense (if extend < 1) a font" + "Extend or or condense if (extend < 1) a font" ], "imagepsfreefont": [ "bool imagepsfreefont(resource font_index)", @@ -5321,7 +5516,7 @@ var functionMap = { "Write text to the image using a TrueType font" ], "imagetypes": [ - "int imagetypes(void)", + "int imagetypes()", "Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM" ], "imagewbmp": [ @@ -5337,7 +5532,7 @@ var functionMap = { "Convert an 8-bit string to a quoted-printable string" ], "imap_alerts": [ - "array imap_alerts(void)", + "array imap_alerts()", "Returns an array of all IMAP alerts that have been generated since the last page load or since the last imap_alerts() call, whichever came last. The alert stack is cleared after imap_alerts() is called." ], "imap_append": [ @@ -5385,7 +5580,7 @@ var functionMap = { "Delete a mailbox" ], "imap_errors": [ - "array imap_errors(void)", + "array imap_errors()", "Returns an array of all IMAP errors generated since the last page load, or since the last imap_errors() call, whichever came last. The error stack is cleared after imap_errors() is called." ], "imap_expunge": [ @@ -5441,7 +5636,7 @@ var functionMap = { "Returns headers for all messages in a mailbox" ], "imap_last_error": [ - "string imap_last_error(void)", + "string imap_last_error()", "Returns the last error that was generated by an IMAP function. The error stack is NOT cleared after this call." ], "imap_list": [ @@ -5692,6 +5887,10 @@ var functionMap = { "bool is_callable(mixed var [, bool syntax_only [, string callable_name]])", "Returns true if var is callable." ], + "is_countable": [ + "bool is_countable(mixed var)", + "Returns true if var is countable, false otherwise" + ], "is_dir": [ "bool is_dir(string filename)", "Returns true if file is directory" @@ -5773,15 +5972,15 @@ var functionMap = { "Determine whether a variable is set" ], "iterator_apply": [ - "int iterator_apply(Traversable it, mixed function [, mixed params])", + "int iterator_apply(Traversable iterator, callable function [, array args = null)", "Calls a function for every element in an iterator" ], "iterator_count": [ - "int iterator_count(Traversable it)", + "int iterator_count(Traversable iterator)", "Count the elements in an iterator" ], "iterator_to_array": [ - "array iterator_to_array(Traversable it [, bool use_keys = true])", + "array iterator_to_array(Traversable iterator [, bool use_keys = true])", "Copy the iterator into an array" ], "jddayofweek": [ @@ -5817,11 +6016,11 @@ var functionMap = { "Converts a jewish calendar date to a julian day count" ], "join": [ - "string join(array src, string glue)", - "An alias for implode" + "string join([string glue,] array pieces)", + "Returns a string containing a string representation of all the arrayelements in the same order, with the glue string between each element" ], "jpeg2wbmp": [ - "bool jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)", + "bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert JPEG image to WBMP image" ], "json_decode": [ @@ -5989,7 +6188,7 @@ var functionMap = { "Read an entry" ], "ldap_rename": [ - "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn);", + "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn)", "Modify the name of an entry" ], "ldap_sasl_bind": [ @@ -6037,7 +6236,7 @@ var functionMap = { "Clear last error from libxml" ], "libxml_disable_entity_loader": [ - "bool libxml_disable_entity_loader([boolean disable])", + "bool libxml_disable_entity_loader([bool disable])", "Disable/Enable ability to load external entities" ], "libxml_get_errors": [ @@ -6053,7 +6252,7 @@ var functionMap = { "Set the streams context for the next libxml document load or write" ], "libxml_use_internal_errors": [ - "bool libxml_use_internal_errors([boolean use_errors])", + "bool libxml_use_internal_errors([bool use_errors])", "Disable libxml errors and allow user to fetch error information as needed" ], "link": [ @@ -6065,11 +6264,11 @@ var functionMap = { "Returns the st_dev field of the UNIX C stat structure describing the link" ], "litespeed_request_headers": [ - "array litespeed_request_headers(void)", + "array litespeed_request_headers()", "Fetch all HTTP request headers" ], "litespeed_response_headers": [ - "array litespeed_response_headers(void)", + "array litespeed_response_headers()", "Fetch all HTTP response headers" ], "locale_accept_from_http": [ @@ -6081,7 +6280,7 @@ var functionMap = { "* @param string $locale The locale string to canonicalize" ], "locale_filter_matches": [ - "boolean locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", + "bool locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", "* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm" ], "locale_get_all_variants": [ @@ -6094,7 +6293,7 @@ var functionMap = { ], "locale_get_keywords": [ "static array locale_get_keywords(string $locale) {", - "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!)" + "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array" ], "locale_get_primary_language": [ "static string locale_get_primary_language($locale)", @@ -6117,7 +6316,7 @@ var functionMap = { "Set default locale" ], "localeconv": [ - "array localeconv(void)", + "array localeconv()", "Returns numeric formatting information based on the current locale" ], "localtime": [ @@ -6221,11 +6420,11 @@ var functionMap = { "Regular expression search for multibyte string" ], "mb_ereg_search_getpos": [ - "int mb_ereg_search_getpos(void)", + "int mb_ereg_search_getpos()", "Get search start position" ], "mb_ereg_search_getregs": [ - "array mb_ereg_search_getregs(void)", + "array mb_ereg_search_getregs()", "Get matched substring of the last time" ], "mb_ereg_search_init": [ @@ -6545,7 +6744,7 @@ var functionMap = { "Hash data with hash" ], "mhash_count": [ - "int mhash_count(void)", + "int mhash_count()", "Gets the number of available hashes" ], "mhash_get_block_size": [ @@ -6721,7 +6920,7 @@ var functionMap = { "Free a MS-SQL statement index" ], "mssql_get_last_message": [ - "string mssql_get_last_message(void)", + "string mssql_get_last_message()", "Gets the last message from the MS-SQL server" ], "mssql_guid_string": [ @@ -6773,7 +6972,7 @@ var functionMap = { "Select a MS-SQL database" ], "mt_getrandmax": [ - "int mt_getrandmax(void)", + "int mt_getrandmax()", "Returns the maximum value a random number from Mersenne Twister can have" ], "mt_rand": [ @@ -6881,7 +7080,7 @@ var functionMap = { "Free result memory" ], "mysql_get_client_info": [ - "string mysql_get_client_info(void)", + "string mysql_get_client_info()", "Returns a string that represents the client library version" ], "mysql_get_host_info": [ @@ -6977,7 +7176,7 @@ var functionMap = { "Turn auto commit on or of" ], "mysqli_cache_stats": [ - "array mysqli_cache_stats(void)", + "array mysqli_cache_stats()", "Returns statistics about the zval cache" ], "mysqli_change_user": [ @@ -7001,11 +7200,11 @@ var functionMap = { "Open a connection to a mysql server" ], "mysqli_connect_errno": [ - "int mysqli_connect_errno(void)", + "int mysqli_connect_errno()", "Returns the numerical value of the error message from last connect command" ], "mysqli_connect_error": [ - "string mysqli_connect_error(void)", + "string mysqli_connect_error()", "Returns the text of the error message from previous MySQL operation" ], "mysqli_data_seek": [ @@ -7021,7 +7220,7 @@ var functionMap = { "" ], "mysqli_embedded_server_end": [ - "void mysqli_embedded_server_end(void)", + "void mysqli_embedded_server_end()", "" ], "mysqli_embedded_server_start": [ @@ -7037,39 +7236,39 @@ var functionMap = { "Returns the text of the error message from previous MySQL operation" ], "mysqli_fetch_all": [ - "mixed mysqli_fetch_all (object result [,int resulttype])", + "mixed mysqli_fetch_all(object result [,int resulttype])", "Fetches all result rows as an associative array, a numeric array, or both" ], "mysqli_fetch_array": [ - "mixed mysqli_fetch_array (object result [,int resulttype])", + "mixed mysqli_fetch_array(object result [,int resulttype])", "Fetch a result row as an associative array, a numeric array, or both" ], "mysqli_fetch_assoc": [ - "mixed mysqli_fetch_assoc (object result)", + "mixed mysqli_fetch_assoc(object result)", "Fetch a result row as an associative array" ], "mysqli_fetch_field": [ - "mixed mysqli_fetch_field (object result)", + "mixed mysqli_fetch_field(object result)", "Get column information from a result and return as an object" ], "mysqli_fetch_field_direct": [ - "mixed mysqli_fetch_field_direct (object result, int offset)", + "mixed mysqli_fetch_field_direct(object result, int offset)", "Fetch meta-data for a single field" ], "mysqli_fetch_fields": [ - "mixed mysqli_fetch_fields (object result)", + "mixed mysqli_fetch_fields(object result)", "Return array of objects containing field meta-data" ], "mysqli_fetch_lengths": [ - "mixed mysqli_fetch_lengths (object result)", + "mixed mysqli_fetch_lengths(object result)", "Get the length of each output in a result" ], "mysqli_fetch_object": [ - "mixed mysqli_fetch_object (object result [, string class_name [, NULL|array ctor_params]])", + "mixed mysqli_fetch_object(object result [, string class_name [, NULL|array ctor_params]])", "Fetch a result row as an object" ], "mysqli_fetch_row": [ - "array mysqli_fetch_row (object result)", + "array mysqli_fetch_row(object result)", "Get a result row as an enumerated array" ], "mysqli_field_count": [ @@ -7093,23 +7292,23 @@ var functionMap = { "returns a character set object" ], "mysqli_get_client_info": [ - "string mysqli_get_client_info(void)", + "string mysqli_get_client_info()", "Get MySQL client info" ], "mysqli_get_client_stats": [ - "array mysqli_get_client_stats(void)", + "array mysqli_get_client_stats()", "Returns statistics about the zval cache" ], "mysqli_get_client_version": [ - "int mysqli_get_client_version(void)", + "int mysqli_get_client_version()", "Get MySQL client info" ], "mysqli_get_connection_stats": [ - "array mysqli_get_connection_stats(void)", + "array mysqli_get_connection_stats()", "Returns statistics about the zval cache" ], "mysqli_get_host_info": [ - "string mysqli_get_host_info (object link)", + "string mysqli_get_host_info(object link)", "Get MySQL host info" ], "mysqli_get_proto_info": [ @@ -7125,15 +7324,15 @@ var functionMap = { "Return the MySQL version for the server referenced by the given link" ], "mysqli_get_warnings": [ - "object mysqli_get_warnings(object link) */", - "PHP_FUNCTION(mysqli_get_warnings) { MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; MYSQLI_WARNING *w; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"O\", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, \"mysqli_link\", MYSQLI_STATUS_VALID); if (mysql_warning_count(mysql->mysql)) { w = php_get_warnings(mysql->mysql TSRMLS_CC); } else { RETURN_FALSE; } mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = mysqli_resource->info = (void *)w; mysqli_resource->status = MYSQLI_STATUS_VALID; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry); } /* }}}" + "object mysqli_get_warnings(object link)", + "" ], "mysqli_info": [ "string mysqli_info(object link)", "Get information about the most recent query" ], "mysqli_init": [ - "resource mysqli_init(void)", + "resource mysqli_init()", "Initialize mysqli and return a resource for use with mysql_real_connect" ], "mysqli_insert_id": [ @@ -7185,8 +7384,8 @@ var functionMap = { "Prepare a SQL statement for execution" ], "mysqli_query": [ - "mixed mysqli_query(object link, string query [,int resultmode]) */", - "PHP_FUNCTION(mysqli_query) { MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; MYSQL_RES *result; char *query = NULL; unsigned int query_len; unsigned long resultmode = MYSQLI_STORE_RESULT; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"Os|l\", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { return; } if (!query_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Empty query\"); RETURN_FALSE; } if ((resultmode & ~MYSQLI_ASYNC) != MYSQLI_USE_RESULT && (resultmode & ~MYSQLI_ASYNC) != MYSQLI_STORE_RESULT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid value for resultmode\"); RETURN_FALSE; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, \"mysqli_link\", MYSQLI_STATUS_VALID); MYSQLI_DISABLE_MQ; #ifdef MYSQLI_USE_MYSQLND if (resultmode & MYSQLI_ASYNC) { if (mysqli_async_query(mysql->mysql, query, query_len)) { MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } mysql->async_result_fetch_type = resultmode & ~MYSQLI_ASYNC; RETURN_TRUE; } #endif if (mysql_real_query(mysql->mysql, query, query_len)) { MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } if (!mysql_field_count(mysql->mysql)) { /* no result set - not a SELECT" + "mixed mysqli_query(object link, string query [,int resultmode])", + "" ], "mysqli_real_connect": [ "bool mysqli_real_connect(object link [,string hostname [,string username [,string passwd [,string dbname [,int port [,string socket [,int flags]]]]]]])", @@ -7301,8 +7500,8 @@ var functionMap = { "Buffer result set on client" ], "mysqli_stmt_get_warnings": [ - "object mysqli_stmt_get_warnings(object link) */", - "PHP_FUNCTION(mysqli_stmt_get_warnings) { MY_STMT *stmt; zval *stmt_link; MYSQLI_RESOURCE *mysqli_resource; MYSQLI_WARNING *w; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"O\", &stmt_link, mysqli_stmt_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(stmt, MY_STMT*, &stmt_link, \"mysqli_stmt\", MYSQLI_STATUS_VALID); if (mysqli_stmt_warning_count(stmt->stmt)) { w = php_get_warnings(mysqli_stmt_get_connection(stmt->stmt) TSRMLS_CC); } else { RETURN_FALSE; } mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = mysqli_resource->info = (void *)w; mysqli_resource->status = MYSQLI_STATUS_VALID; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry); } /* }}}" + "object mysqli_stmt_get_warnings(object link)", + "" ], "mysqli_stmt_init": [ "mixed mysqli_stmt_init(object link)", @@ -7357,7 +7556,7 @@ var functionMap = { "Return the current thread ID" ], "mysqli_thread_safe": [ - "bool mysqli_thread_safe(void)", + "bool mysqli_thread_safe()", "Return whether thread safety is given or not" ], "mysqli_use_result": [ @@ -7365,7 +7564,7 @@ var functionMap = { "Directly retrieve query results - do not buffer results on client side" ], "mysqli_warning_count": [ - "int mysqli_warning_count (object link)", + "int mysqli_warning_count(object link)", "Return number of warnings from the last query for the given link" ], "natcasesort": [ @@ -7401,11 +7600,11 @@ var functionMap = { "* Normalize a string." ], "nsapi_request_headers": [ - "array nsapi_request_headers(void)", + "array nsapi_request_headers()", "Get all headers from the request" ], "nsapi_response_headers": [ - "array nsapi_response_headers(void)", + "array nsapi_response_headers()", "Get all headers from the response" ], "nsapi_virtual": [ @@ -7485,39 +7684,39 @@ var functionMap = { "* Get formatter attribute value." ], "ob_clean": [ - "bool ob_clean(void)", + "bool ob_clean()", "Clean (delete) the current output buffer" ], "ob_end_clean": [ - "bool ob_end_clean(void)", + "bool ob_end_clean()", "Clean the output buffer, and delete current output buffer" ], "ob_end_flush": [ - "bool ob_end_flush(void)", + "bool ob_end_flush()", "Flush (send) the output buffer, and delete current output buffer" ], "ob_flush": [ - "bool ob_flush(void)", + "bool ob_flush()", "Flush (send) contents of the output buffer. The last buffer content is sent to next buffer" ], "ob_get_clean": [ - "bool ob_get_clean(void)", + "bool ob_get_clean()", "Get current buffer contents and delete current output buffer" ], "ob_get_contents": [ - "string ob_get_contents(void)", + "string ob_get_contents()", "Return the contents of the output buffer" ], "ob_get_flush": [ - "bool ob_get_flush(void)", + "bool ob_get_flush()", "Get current buffer contents, flush (send) the output buffer, and delete current output buffer" ], "ob_get_length": [ - "int ob_get_length(void)", + "int ob_get_length()", "Return the length of the output buffer" ], "ob_get_level": [ - "int ob_get_level(void)", + "int ob_get_level()", "Return the nesting level of the output buffer" ], "ob_get_status": [ @@ -7837,7 +8036,7 @@ var functionMap = { "Returns current state of buffering for a LOB" ], "ocisetbufferinglob": [ - "bool ocisetbufferinglob( boolean flag )", + "bool ocisetbufferinglob( bool flag )", "Enables/disables buffering for a LOB" ], "octdec": [ @@ -7857,7 +8056,7 @@ var functionMap = { "Close an ODBC connection" ], "odbc_close_all": [ - "void odbc_close_all(void)", + "void odbc_close_all()", "Close all ODBC connections" ], "odbc_columnprivileges": [ @@ -8065,7 +8264,7 @@ var functionMap = { "Encrypts given data with given method and key, returns raw or base64 encoded string" ], "openssl_error_string": [ - "mixed openssl_error_string(void)", + "mixed openssl_error_string()", "Returns a description of the last error, and alters the index of the error messages. Returns false when the are no more messages" ], "openssl_get_cipher_methods": [ @@ -8205,7 +8404,7 @@ var functionMap = { "Add URL rewriter values" ], "output_reset_rewrite_vars": [ - "bool output_reset_rewrite_vars(void)", + "bool output_reset_rewrite_vars()", "Reset(clear) URL rewriter values" ], "pack": [ @@ -8257,7 +8456,7 @@ var functionMap = { "Executes specified program in current process space as defined by exec(2)" ], "pcntl_fork": [ - "int pcntl_fork(void)", + "int pcntl_fork()", "Forks the currently running process following the same behavior as the UNIX fork() system call" ], "pcntl_getpriority": [ @@ -8374,7 +8573,7 @@ var functionMap = { ], "pg_delete": [ "mixed pg_delete(resource db, string table, array ids[, int options])", - "Delete records has ids (id=>value)" + "Delete records has ids (id => value)" ], "pg_end_copy": [ "bool pg_end_copy([resource connection])", @@ -8474,7 +8673,7 @@ var functionMap = { ], "pg_insert": [ "mixed pg_insert(resource db, string table, array values[, int options])", - "Insert values (filed=>value) to table" + "Insert values (filed => value) to table" ], "pg_last_error": [ "string pg_last_error([resource connection])", @@ -8598,7 +8797,7 @@ var functionMap = { ], "pg_select": [ "mixed pg_select(resource db, string table, array ids[, int options])", - "Select records that has ids (id=>value)" + "Select records that has ids (id => value)" ], "pg_send_execute": [ "bool pg_send_execute(resource connection, string stmtname, array params)", @@ -8646,34 +8845,34 @@ var functionMap = { ], "pg_update": [ "mixed pg_update(resource db, string table, array fields, array ids[, int options])", - "Update table using values (field=>value) and ids (id=>value)" + "Update table using values (field => value) and ids (id => value)" ], "pg_version": [ "array pg_version([resource connection])", "Returns an array with client, protocol and server version (when available)" ], "php_egg_logo_guid": [ - "string php_egg_logo_guid(void)", + "string php_egg_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_ini_loaded_file": [ - "string php_ini_loaded_file(void)", + "string php_ini_loaded_file()", "Return the actual loaded ini filename" ], "php_ini_scanned_files": [ - "string php_ini_scanned_files(void)", + "string php_ini_scanned_files()", "Return comma-separated string of .ini files parsed from the additional ini dir" ], "php_logo_guid": [ - "string php_logo_guid(void)", + "string php_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_real_logo_guid": [ - "string php_real_logo_guid(void)", + "string php_real_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_sapi_name": [ - "string php_sapi_name(void)", + "string php_sapi_name()", "Return the current SAPI module name" ], "php_snmpv3": [ @@ -8685,7 +8884,7 @@ var functionMap = { "Return source with stripped comments and whitespace" ], "php_uname": [ - "string php_uname(void)", + "string php_uname()", "Return information about the system PHP was built on" ], "phpcredits": [ @@ -8701,11 +8900,11 @@ var functionMap = { "Return the current PHP version" ], "pi": [ - "float pi(void)", + "float pi()", "Returns an approximation of pi" ], "png2wbmp": [ - "bool png2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)", + "bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert PNG image to WBMP image" ], "popen": [ @@ -8717,27 +8916,27 @@ var functionMap = { "Determine accessibility of a file (POSIX.1 5.6.3)" ], "posix_ctermid": [ - "string posix_ctermid(void)", + "string posix_ctermid()", "Generate terminal path name (POSIX.1, 4.7.1)" ], "posix_get_last_error": [ - "int posix_get_last_error(void)", + "int posix_get_last_error()", "Retrieve the error number set by the last posix function which failed." ], "posix_getcwd": [ - "string posix_getcwd(void)", + "string posix_getcwd()", "Get working directory pathname (POSIX.1, 5.2.2)" ], "posix_getegid": [ - "int posix_getegid(void)", + "int posix_getegid()", "Get the current effective group id (POSIX.1, 4.2.1)" ], "posix_geteuid": [ - "int posix_geteuid(void)", + "int posix_geteuid()", "Get the current effective user id (POSIX.1, 4.2.1)" ], "posix_getgid": [ - "int posix_getgid(void)", + "int posix_getgid()", "Get the current group id (POSIX.1, 4.2.1)" ], "posix_getgrgid": [ @@ -8749,27 +8948,27 @@ var functionMap = { "Group database access (POSIX.1, 9.2.1)" ], "posix_getgroups": [ - "array posix_getgroups(void)", + "array posix_getgroups()", "Get supplementary group id's (POSIX.1, 4.2.3)" ], "posix_getlogin": [ - "string posix_getlogin(void)", + "string posix_getlogin()", "Get user name (POSIX.1, 4.2.4)" ], "posix_getpgid": [ - "int posix_getpgid(void)", + "int posix_getpgid()", "Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)" ], "posix_getpgrp": [ - "int posix_getpgrp(void)", + "int posix_getpgrp()", "Get current process group id (POSIX.1, 4.3.1)" ], "posix_getpid": [ - "int posix_getpid(void)", + "int posix_getpid()", "Get the current process id (POSIX.1, 4.1.1)" ], "posix_getppid": [ - "int posix_getppid(void)", + "int posix_getppid()", "Get the parent process id (POSIX.1, 4.1.1)" ], "posix_getpwnam": [ @@ -8781,15 +8980,15 @@ var functionMap = { "User database access (POSIX.1, 9.2.2)" ], "posix_getrlimit": [ - "array posix_getrlimit(void)", + "array posix_getrlimit()", "Get system resource consumption limits (This is not a POSIX function, but a BSDism and a SVR4ism. We compile conditionally)" ], "posix_getsid": [ - "int posix_getsid(void)", + "int posix_getsid()", "Get process group id of session leader (This is not a POSIX function, but a SVR4ism, so be compile conditionally)" ], "posix_getuid": [ - "int posix_getuid(void)", + "int posix_getuid()", "Get the current user id (POSIX.1, 4.2.1)" ], "posix_initgroups": [ @@ -8829,7 +9028,7 @@ var functionMap = { "Set process group id for job control (POSIX.1, 4.3.3)" ], "posix_setsid": [ - "int posix_setsid(void)", + "int posix_setsid()", "Create session and set process group id (POSIX.1, 4.3.2)" ], "posix_setuid": [ @@ -8841,7 +9040,7 @@ var functionMap = { "Retrieve the system error message associated with the given errno." ], "posix_times": [ - "array posix_times(void)", + "array posix_times()", "Get process times (POSIX.1, 4.5.2)" ], "posix_ttyname": [ @@ -8849,7 +9048,7 @@ var functionMap = { "Determine terminal device name (POSIX.1, 4.7.2)" ], "posix_uname": [ - "array posix_uname(void)", + "array posix_uname()", "Get system name (POSIX.1, 4.4.1)" ], "pow": [ @@ -9017,8 +9216,8 @@ var functionMap = { "Convert a quoted-printable string to an 8 bit string" ], "quoted_printable_encode": [ - "string quoted_printable_encode(string str) */", - "PHP_FUNCTION(quoted_printable_encode) { char *str, *new_str; int str_len; size_t new_str_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &str, &str_len) != SUCCESS) { return; } if (!str_len) { RETURN_EMPTY_STRING(); } new_str = (char *)php_quot_print_encode((unsigned char *)str, (size_t)str_len, &new_str_len); RETURN_STRINGL(new_str, new_str_len, 0); } /* }}}" + "string quoted_printable_encode(string str)", + "" ], "quotemeta": [ "string quotemeta(string str)", @@ -9077,7 +9276,7 @@ var functionMap = { "Informs the readline callback interface that a character is ready for input" ], "readline_clear_history": [ - "bool readline_clear_history(void)", + "bool readline_clear_history()", "Clears the history" ], "readline_completion_function": [ @@ -9089,11 +9288,11 @@ var functionMap = { "Gets/sets various internal readline variables." ], "readline_list_history": [ - "array readline_list_history(void)", + "array readline_list_history()", "Lists the history" ], "readline_on_new_line": [ - "void readline_on_new_line(void)", + "void readline_on_new_line()", "Inform readline that the cursor has moved to a new line" ], "readline_read_history": [ @@ -9101,7 +9300,7 @@ var functionMap = { "Reads the history" ], "readline_redisplay": [ - "void readline_redisplay(void)", + "void readline_redisplay()", "Ask readline to redraw the display" ], "readline_write_history": [ @@ -9157,11 +9356,11 @@ var functionMap = { "Set array argument's internal pointer to the first element and return it" ], "restore_error_handler": [ - "void restore_error_handler(void)", + "void restore_error_handler()", "Restores the previously defined error handler function" ], "restore_exception_handler": [ - "void restore_exception_handler(void)", + "void restore_exception_handler()", "Restores the previously defined exception handler function" ], "restore_include_path": [ @@ -9229,15 +9428,15 @@ var functionMap = { "Deserializes data and reinitializes the variables" ], "session_destroy": [ - "bool session_destroy(void)", + "bool session_destroy()", "Destroy the current session and all data associated with it" ], "session_encode": [ - "string session_encode(void)", + "string session_encode()", "Serializes the current setup and returns the serialized representation" ], "session_get_cookie_params": [ - "array session_get_cookie_params(void)", + "array session_get_cookie_params()", "Return the session cookie parameters" ], "session_id": [ @@ -9277,7 +9476,7 @@ var functionMap = { "Sets user-level functions" ], "session_start": [ - "bool session_start(void)", + "bool session_start()", "Begin session - reinitializes freezed variables, registers browsers etc" ], "session_unregister": [ @@ -9285,11 +9484,11 @@ var functionMap = { "Removes varname from the list of variables which are freezed at the session end" ], "session_unset": [ - "void session_unset(void)", + "void session_unset()", "Unset all registered variables" ], "session_write_close": [ - "void session_write_close(void)", + "void session_write_close()", "Write session data and end session" ], "set_error_handler": [ @@ -9369,27 +9568,27 @@ var functionMap = { "Removes variable from shared memory" ], "shmop_close": [ - "void shmop_close (int shmid)", + "void shmop_close(int shmid)", "closes a shared memory segment" ], "shmop_delete": [ - "bool shmop_delete (int shmid)", + "bool shmop_delete(int shmid)", "mark segment for deletion" ], "shmop_open": [ - "int shmop_open (int key, string flags, int mode, int size)", + "int shmop_open(int key, string flags, int mode, int size)", "gets and attaches a shared memory segment" ], "shmop_read": [ - "string shmop_read (int shmid, int start, int count)", + "string shmop_read(int shmid, int start, int count)", "reads from a shm segment" ], "shmop_size": [ - "int shmop_size (int shmid)", + "int shmop_size(int shmid)", "returns the shm size" ], "shmop_write": [ - "int shmop_write (int shmid, string data, int offset)", + "int shmop_write(int shmid, string data, int offset)", "writes to a shared memory segment" ], "shuffle": [ @@ -9501,7 +9700,7 @@ var functionMap = { "Fetch the value of a SNMP object" ], "snmp_get_quick_print": [ - "bool snmp_get_quick_print(void)", + "bool snmp_get_quick_print()", "Return the current status of quick_print" ], "snmp_get_valueretrieval": [ @@ -9749,7 +9948,7 @@ var functionMap = { "Escapes a string for use as a query parameter." ], "sqlite_exec": [ - "boolean sqlite_exec(string query, resource db[, string &error_message])", + "bool sqlite_exec(string query, resource db[, string &error_message])", "Executes a result-less query against a given database" ], "sqlite_factory": [ @@ -10001,7 +10200,7 @@ var functionMap = { "Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string." ], "stream_get_filters": [ - "array stream_get_filters(void)", + "array stream_get_filters()", "Returns a list of registered filters" ], "stream_get_line": [ @@ -10265,7 +10464,7 @@ var functionMap = { "Free result memory" ], "sybase_get_last_message": [ - "string sybase_get_last_message(void)", + "string sybase_get_last_message()", "Returns the last message from server (over min_message_severity)" ], "sybase_min_client_severity": [ @@ -10349,7 +10548,7 @@ var functionMap = { "Returns the Number of Tidy accessibility warnings encountered for specified document." ], "tidy_clean_repair": [ - "boolean tidy_clean_repair()", + "bool tidy_clean_repair()", "Execute configured cleanup and repair operations on parsed markup" ], "tidy_config_count": [ @@ -10357,7 +10556,7 @@ var functionMap = { "Returns the Number of Tidy configuration errors encountered for specified document." ], "tidy_diagnose": [ - "boolean tidy_diagnose()", + "bool tidy_diagnose()", "Run configured diagnostics on parsed and repaired markup." ], "tidy_error_count": [ @@ -10373,7 +10572,7 @@ var functionMap = { "Get current Tidy configuarion" ], "tidy_get_error_buffer": [ - "string tidy_get_error_buffer([boolean detailed])", + "string tidy_get_error_buffer([bool detailed])", "Return warnings and errors which occured parsing the specified document" ], "tidy_get_head": [ @@ -10413,15 +10612,15 @@ var functionMap = { "Returns the value of the specified configuration option for the tidy document." ], "tidy_is_xhtml": [ - "boolean tidy_is_xhtml()", + "bool tidy_is_xhtml()", "Indicates if the document is a XHTML document." ], "tidy_is_xml": [ - "boolean tidy_is_xml()", + "bool tidy_is_xml()", "Indicates if the document is a generic (non HTML/XHTML) XML document." ], "tidy_parse_file": [ - "boolean tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", + "bool tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", "Parse markup in file or URI" ], "tidy_parse_string": [ @@ -10429,11 +10628,11 @@ var functionMap = { "Parse a document stored in a string" ], "tidy_repair_file": [ - "boolean tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", + "bool tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", "Repair a file using an optionally provided configuration file" ], "tidy_repair_string": [ - "boolean tidy_repair_string(string data [, mixed config_file [, string encoding]])", + "bool tidy_repair_string(string data [, mixed config_file [, string encoding]])", "Repair a string using an optionally provided configuration file" ], "tidy_warning_count": [ @@ -10441,7 +10640,7 @@ var functionMap = { "Returns the Number of Tidy warnings encountered for specified document." ], "time": [ - "int time(void)", + "int time()", "Return current UNIX timestamp" ], "time_nanosleep": [ @@ -10489,7 +10688,7 @@ var functionMap = { "Returns the Olson database version number." ], "tmpfile": [ - "resource tmpfile(void)", + "resource tmpfile()", "Create a temporary file that will be deleted automatically after use" ], "token_get_all": [ @@ -10557,7 +10756,7 @@ var functionMap = { "Takes a string representation of variable and recreates it" ], "unset": [ - "void unset (mixed var [, mixed var])", + "void unset(mixed var [, mixed var])", "Unset a given variable" ], "urldecode": [ @@ -10589,7 +10788,7 @@ var functionMap = { "Dumps a string representation of variable to output" ], "var_export": [ - "mixed var_export(mixed var [, bool return])", + "string var_export(mixed var [, bool return])", "Outputs or returns a string representation of a variable" ], "variant_abs": [ @@ -10717,7 +10916,7 @@ var functionMap = { "Return a formatted string" ], "wddx_add_vars": [ - "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", + "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", "Serializes given variables and adds them to packet given by packet_id" ], "wddx_deserialize": [ @@ -10741,7 +10940,7 @@ var functionMap = { "Creates a new packet and serializes given variables into a struct" ], "wordwrap": [ - "string wordwrap(string str [, int width [, string break [, boolean cut]]])", + "string wordwrap(string str [, int width [, string break [, bool cut]]])", "Wraps buffer to selected number of characters using string break char" ], "xml_error_string": [ @@ -10869,7 +11068,7 @@ var functionMap = { "Parses XML requests and call methods" ], "xmlrpc_server_create": [ - "resource xmlrpc_server_create(void)", + "resource xmlrpc_server_create()", "Creates an xmlrpc server" ], "xmlrpc_server_destroy": [ @@ -11057,51 +11256,51 @@ var functionMap = { "Write text - returns FALSE on error" ], "xsl_xsltprocessor_get_parameter": [ - "string xsl_xsltprocessor_get_parameter(string namespace, string name);", + "string xsl_xsltprocessor_get_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_has_exslt_support": [ - "bool xsl_xsltprocessor_has_exslt_support();", + "bool xsl_xsltprocessor_has_exslt_support()", "" ], "xsl_xsltprocessor_import_stylesheet": [ - "void xsl_xsltprocessor_import_stylesheet(domdocument doc);", - "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since:" + "void xsl_xsltprocessor_import_stylesheet(domdocument doc)", + "" ], "xsl_xsltprocessor_register_php_functions": [ - "void xsl_xsltprocessor_register_php_functions([mixed $restrict]);", + "void xsl_xsltprocessor_register_php_functions([mixed $restrict])", "" ], "xsl_xsltprocessor_remove_parameter": [ - "bool xsl_xsltprocessor_remove_parameter(string namespace, string name);", + "bool xsl_xsltprocessor_remove_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_set_parameter": [ - "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value]);", + "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value])", "" ], "xsl_xsltprocessor_set_profiling": [ - "bool xsl_xsltprocessor_set_profiling(string filename) */", - "PHP_FUNCTION(xsl_xsltprocessor_set_profiling) { zval *id; xsl_object *intern; char *filename = NULL; int filename_len; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"s!\", &filename, &filename_len) == SUCCESS) { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); if (intern->profiling) { efree(intern->profiling); } if (filename != NULL) { intern->profiling = estrndup(filename,filename_len); } else { intern->profiling = NULL; } RETURN_TRUE; } else { WRONG_PARAM_COUNT; } } /* }}} end xsl_xsltprocessor_set_profiling" + "bool xsl_xsltprocessor_set_profiling(string filename)", + "" ], "xsl_xsltprocessor_transform_to_doc": [ - "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc);", - "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since:" + "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc)", + "" ], "xsl_xsltprocessor_transform_to_uri": [ - "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri);", + "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri)", "" ], "xsl_xsltprocessor_transform_to_xml": [ - "string xsl_xsltprocessor_transform_to_xml(domdocument doc);", + "string xsl_xsltprocessor_transform_to_xml(domdocument doc)", "" ], "zend_logo_guid": [ - "string zend_logo_guid(void)", + "string zend_logo_guid()", "Return the special ID used to request the Zend logo in phpinfo screens" ], "zend_version": [ - "string zend_version(void)", + "string zend_version()", "Get the version of the Zend Engine" ], "zip_close": [ @@ -11145,7 +11344,7 @@ var functionMap = { "Returns the next file in the archive" ], "zlib_get_coding_type": [ - "string zlib_get_coding_type(void)", + "string zlib_get_coding_type()", "Returns the coding type used for output compression" ] }; @@ -11196,7 +11395,9 @@ var variableMap = { "SERVER_PORT": 1, "SERVER_PROTOCOL": 1, "SERVER_SIGNATURE": 1, - "SERVER_SOFTWARE": 1 + "SERVER_SOFTWARE": 1, + "argv": 1, + "argc": 1 } }, "$_SESSION": { @@ -11204,6 +11405,12 @@ var variableMap = { }, "$GLOBALS": { type: "array" + }, + '$argv': { + type: "array" + }, + '$argc': { + type: "int" } }; @@ -11531,6 +11738,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -11868,6 +12076,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -12760,6 +12969,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -12886,6 +13096,7 @@ oop.inherits(Mode, HtmlMode); }; this.$id = "ace/mode/php"; + this.snippetFileId = "ace/snippets/php"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-php_laravel_blade.js b/htdocs/includes/ace/src/mode-php_laravel_blade.js index cd09a1f11fa..b9393a8a281 100644 --- a/htdocs/includes/ace/src/mode-php_laravel_blade.js +++ b/htdocs/includes/ace/src/mode-php_laravel_blade.js @@ -2309,15 +2309,15 @@ var functionMap = { "Escapes single quote, double quotes and backslash characters in a string with backslashes" ], "apache_child_terminate": [ - "bool apache_child_terminate(void)", + "bool apache_child_terminate()", "Terminate apache process after this request" ], "apache_get_modules": [ - "array apache_get_modules(void)", + "array apache_get_modules()", "Get a list of loaded Apache modules" ], "apache_get_version": [ - "string apache_get_version(void)", + "string apache_get_version()", "Fetch Apache version" ], "apache_getenv": [ @@ -2349,7 +2349,7 @@ var functionMap = { "* fetch all headers that go out in case of an error or a subrequest" ], "apache_request_headers": [ - "array apache_request_headers(void)", + "array apache_request_headers()", "Fetch all HTTP request headers" ], "apache_request_headers_in": [ @@ -2365,7 +2365,7 @@ var functionMap = { "" ], "apache_request_log_error": [ - "boolean apache_request_log_error(string message, [long facility])", + "bool apache_request_log_error(string message, [long facility])", "" ], "apache_request_meets_conditions": [ @@ -2417,11 +2417,11 @@ var functionMap = { "" ], "apache_reset_timeout": [ - "bool apache_reset_timeout(void)", + "bool apache_reset_timeout()", "Reset the Apache write timer" ], "apache_response_headers": [ - "array apache_response_headers(void)", + "array apache_response_headers()", "Fetch all HTTP response headers" ], "apache_setenv": [ @@ -2508,6 +2508,14 @@ var functionMap = { "array array_keys(array input [, mixed search_value[, bool strict]])", "Return just the keys from the input array, optionally only for the specified search_value" ], + "array_key_first": [ + "mixed array_key_first(array arr)", + "Returns the first key of arr if the array is not empty; NULL otherwise" + ], + "array_key_last": [ + "mixed array_key_last(array arr)", + "Returns the last key of arr if the array is not empty; NULL otherwise" + ], "array_map": [ "array array_map(mixed callback, array input1 [, array input2 ,...])", "Applies the callback to the elements in given arrays." @@ -2865,7 +2873,7 @@ var functionMap = { "Change file mode" ], "chown": [ - "bool chown (string filename, mixed user)", + "bool chown(string filename, mixed user)", "Change file owner" ], "chr": [ @@ -2893,7 +2901,7 @@ var functionMap = { "Return all classes and interfaces implemented by SPL" ], "class_parents": [ - "array class_parents(object instance [, boolean autoload = true])", + "array class_parents(object instance [, bool autoload = true])", "Return an array containing the names of all parent classes" ], "clearstatcache": [ @@ -2905,7 +2913,7 @@ var functionMap = { "Close directory connection identified by the dir_handle" ], "closelog": [ - "bool closelog(void)", + "bool closelog()", "Close connection to system logger" ], "collator_asort": [ @@ -2997,11 +3005,11 @@ var functionMap = { "Return a string to confirm that the module is compiled in" ], "connection_aborted": [ - "int connection_aborted(void)", + "int connection_aborted()", "Returns true if client disconnected" ], "connection_status": [ - "int connection_status(void)", + "int connection_status()", "Returns the connection status bitfield" ], "constant": [ @@ -3046,7 +3054,7 @@ var functionMap = { ], "create_function": [ "string create_function(string args, string code)", - "Creates an anonymous function, and returns its name (funny, eh?)" + "Creates an anonymous function, and returns its name" ], "crypt": [ "string crypt(string str [, string salt])", @@ -3145,7 +3153,7 @@ var functionMap = { "Get information about the current transfers" ], "curl_multi_init": [ - "resource curl_multi_init(void)", + "resource curl_multi_init()", "Returns a new cURL multi handle" ], "curl_multi_remove_handle": [ @@ -3341,7 +3349,7 @@ var functionMap = { "* Set formatter pattern." ], "datefmt_set_timezone_id": [ - "boolean datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", + "bool datefmt_set_timezone_id( IntlDateFormatter $mf,$timezone_id)", "* Set formatter timezone_id." ], "dba_close": [ @@ -3409,7 +3417,7 @@ var functionMap = { "Return the translation of msgid for domain_name and category, or msgid unaltered if a translation does not exist" ], "dcngettext": [ - "string dcngettext (string domain, string msgid1, string msgid2, int n, int category)", + "string dcngettext(string domain, string msgid1, string msgid2, int n, int category)", "Plural version of dcgettext()" ], "debug_backtrace": [ @@ -3417,44 +3425,231 @@ var functionMap = { "Return backtrace as array" ], "debug_print_backtrace": [ - "void debug_print_backtrace(void) */", - "ZEND_FUNCTION(debug_print_backtrace) { zend_execute_data *ptr, *skip; int lineno; char *function_name; char *filename; char *class_name = NULL; char *call_type; char *include_filename = NULL; zval *arg_array = NULL; int indent = 0; if (zend_parse_parameters_none() == FAILURE) { return; } ptr = EG(current_execute_data);", + "void debug_print_backtrace()", + "Prints a PHP backtrace" + ], + "debug_zval_dump": [ + "void debug_zval_dump(mixed var)", + "Dumps a string representation of an internal Zend value to output" + ], + "decbin": [ + "string decbin(int decimal_number)", + "Returns a string containing a binary representation of the number" + ], + "dechex": [ + "string dechex(int decimal_number)", + "Returns a string containing a hexadecimal representation of the given number" + ], + "decoct": [ + "string decoct(int decimal_number)", + "Returns a string containing an octal representation of the given number" + ], + "define": [ + "bool define(string constant_name, mixed value, bool case_insensitive=false)", + "Define a new constant" + ], + "define_syslog_variables": [ + "void define_syslog_variables()", + "Initializes all syslog-related variables" + ], + "defined": [ + "bool defined(string constant_name)", + "Check whether a constant exists" + ], + "deg2rad": [ + "float deg2rad(float number)", + "Converts the number in degrees to the radian equivalent" + ], + "dgettext": [ + "string dgettext(string domain_name, string msgid)", + "Return the translation of msgid for domain_name, or msgid unaltered if a translation does not exist" + ], + "die": [ + "void die([mixed status])", + "Output a message and terminate the current script" + ], + "dir": [ + "object dir(string directory[, resource context])", + "Directory class with properties, handle and class and methods read, rewind and close" + ], + "dirname": [ + "string dirname(string path)", + "Returns the directory name component of the path" + ], + "disk_free_space": [ + "float disk_free_space(string path)", + "Get free disk space for filesystem that path is on" + ], + "disk_total_space": [ + "float disk_total_space(string path)", + "Get total disk space for filesystem that path is on" + ], + "display_disabled_function": [ + "void display_disabled_function()", + "Dummy function which displays an error when a disabled function is called." + ], + "dl": [ + "int dl(string extension_filename)", + "Load a PHP extension at runtime" + ], + "dngettext": [ + "string dngettext(string domain, string msgid1, string msgid2, int count)", + "Plural version of dgettext()" + ], + "dns_check_record": [ + "bool dns_check_record(string host [, string type])", + "Check DNS records corresponding to a given Internet host name or IP address" + ], + "dns_get_mx": [ + "bool dns_get_mx(string hostname, array mxhosts [, array weight])", + "Get MX records corresponding to a given Internet host name" + ], + "dns_get_record": [ + "array|false dns_get_record(string hostname [, int type[, array authns, array addtl]])", + "Get any Resource Record corresponding to a given Internet host name" + ], + "dom_attr_is_id": [ + "bool dom_attr_is_id()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId Since: DOM Level 3" + ], + "dom_characterdata_append_data": [ + "void dom_characterdata_append_data(string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-32791A2F Since:" + ], + "dom_characterdata_delete_data": [ + "void dom_characterdata_delete_data(int offset, int count)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7C603781 Since:" + ], + "dom_characterdata_insert_data": [ + "void dom_characterdata_insert_data(int offset, string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3EDB695F Since:" + ], + "dom_characterdata_replace_data": [ + "void dom_characterdata_replace_data(int offset, int count, string arg)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-E5CBA7FB Since:" + ], + "dom_characterdata_substring_data": [ + "string dom_characterdata_substring_data(int offset, int count)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6531BCCF Since:" + ], + "dom_document_adopt_node": [ + "DOMNode dom_document_adopt_node(DOMNode source)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode Since: DOM Level 3" + ], + "dom_document_create_attribute": [ + "DOMAttr dom_document_create_attribute(string name)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198 Since:" + ], + "dom_document_create_attribute_ns": [ + "DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS Since: DOM Level 2" + ], + "dom_document_create_cdatasection": [ + "DOMCdataSection dom_document_create_cdatasection(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8 Since:" + ], + "dom_document_create_comment": [ + "DOMComment dom_document_create_comment(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328 Since:" + ], + "dom_document_create_document_fragment": [ + "DOMDocumentFragment dom_document_create_document_fragment()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5 Since:" + ], + "dom_document_create_element": [ + "DOMElement dom_document_create_element(string tagName [, string value])", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547 Since:" + ], + "dom_document_create_element_ns": [ + "DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value])", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS Since: DOM Level 2" + ], + "dom_document_create_entity_reference": [ + "DOMEntityReference dom_document_create_entity_reference(string name)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE Since:" + ], + "dom_document_create_processing_instruction": [ + "DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439 Since:" + ], + "dom_document_create_text_node": [ + "DOMText dom_document_create_text_node(string data)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127 Since:" + ], + "dom_document_get_element_by_id": [ + "DOMElement dom_document_get_element_by_id(string elementId)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId Since: DOM Level 2" + ], + "dom_document_get_elements_by_tag_name": [ + "DOMNodeList dom_document_get_elements_by_tag_name(string tagname)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094 Since:" + ], + "dom_document_get_elements_by_tag_name_ns": [ + "DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS Since: DOM Level 2" + ], + "dom_document_import_node": [ + "DOMNode dom_document_import_node(DOMNode importedNode, bool deep)", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode Since: DOM Level 2" + ], + "dom_document_load": [ + "DOMNode dom_document_load(string source [, int options])", + "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load Since: DOM Level 3" + ], + "dom_document_load_html": [ + "DOMNode dom_document_load_html(string source)", + "Since: DOM extended" + ], + "dom_document_load_html_file": [ + "DOMNode dom_document_load_html_file(string source)", + "Since: DOM extended" + ], + "dom_document_loadxml": [ + "DOMNode dom_document_loadxml(string source [, int options])", + "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-loadXML Since: DOM Level 3" + ], + "dom_document_normalize_document": [ + "void dom_document_normalize_document()", + "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument Since: DOM Level 3" + ], + "dom_document_relaxNG_validate_file": [ + "bool dom_document_relaxNG_validate_file(string filename); */", "PHP_FUNCTION(dom_document_relaxNG_validate_file) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_relaxNG_validate_file" ], "dom_document_relaxNG_validate_xml": [ - "boolean dom_document_relaxNG_validate_xml(string source); */", + "bool dom_document_relaxNG_validate_xml(string source); */", "PHP_FUNCTION(dom_document_relaxNG_validate_xml) { _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_relaxNG_validate_xml" ], "dom_document_rename_node": [ - "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName);", + "DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode Since: DOM Level 3" ], "dom_document_save": [ - "int dom_document_save(string file);", + "int dom_document_save(string file)", "Convenience method to save to file" ], "dom_document_save_html": [ - "string dom_document_save_html();", + "string dom_document_save_html()", "Convenience method to output as html" ], "dom_document_save_html_file": [ - "int dom_document_save_html_file(string file);", + "int dom_document_save_html_file(string file)", "Convenience method to save to file as html" ], "dom_document_savexml": [ - "string dom_document_savexml([node n]);", + "string dom_document_savexml([node n])", "URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-saveXML Since: DOM Level 3" ], "dom_document_schema_validate": [ - "boolean dom_document_schema_validate(string source); */", + "bool dom_document_schema_validate(string source); */", "PHP_FUNCTION(dom_document_schema_validate_xml) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); } /* }}} end dom_document_schema_validate" ], "dom_document_schema_validate_file": [ - "boolean dom_document_schema_validate_file(string filename); */", + "bool dom_document_schema_validate_file(string filename); */", "PHP_FUNCTION(dom_document_schema_validate_file) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_schema_validate_file" ], "dom_document_validate": [ - "boolean dom_document_validate();", + "bool dom_document_validate()", "Since: DOM extended" ], "dom_document_xinclude": [ @@ -3462,123 +3657,123 @@ var functionMap = { "Substitutues xincludes in a DomDocument" ], "dom_domconfiguration_can_set_parameter": [ - "boolean dom_domconfiguration_can_set_parameter(string name, domuserdata value);", + "bool dom_domconfiguration_can_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-canSetParameter Since:" ], "dom_domconfiguration_get_parameter": [ - "domdomuserdata dom_domconfiguration_get_parameter(string name);", + "domdomuserdata dom_domconfiguration_get_parameter(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-getParameter Since:" ], "dom_domconfiguration_set_parameter": [ - "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value);", + "dom_void dom_domconfiguration_set_parameter(string name, domuserdata value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-property Since:" ], "dom_domerrorhandler_handle_error": [ - "dom_boolean dom_domerrorhandler_handle_error(domerror error);", + "dom_bool dom_domerrorhandler_handle_error(domerror error)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-ERRORS-DOMErrorHandler-handleError Since:" ], "dom_domimplementation_create_document": [ - "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype);", + "DOMDocument dom_domimplementation_create_document(string namespaceURI, string qualifiedName, DOMDocumentType doctype)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocument Since: DOM Level 2" ], "dom_domimplementation_create_document_type": [ - "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId);", + "DOMDocumentType dom_domimplementation_create_document_type(string qualifiedName, string publicId, string systemId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Level-2-Core-DOM-createDocType Since: DOM Level 2" ], "dom_domimplementation_get_feature": [ - "DOMNode dom_domimplementation_get_feature(string feature, string version);", + "DOMNode dom_domimplementation_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementation3-getFeature Since: DOM Level 3" ], "dom_domimplementation_has_feature": [ - "boolean dom_domimplementation_has_feature(string feature, string version);", + "bool dom_domimplementation_has_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-5CED94D7 Since:" ], "dom_domimplementationlist_item": [ - "domdomimplementation dom_domimplementationlist_item(int index);", + "domdomimplementation dom_domimplementationlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item Since:" ], "dom_domimplementationsource_get_domimplementation": [ - "domdomimplementation dom_domimplementationsource_get_domimplementation(string features);", + "domdomimplementation dom_domimplementationsource_get_domimplementation(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpl Since:" ], "dom_domimplementationsource_get_domimplementations": [ - "domimplementationlist dom_domimplementationsource_get_domimplementations(string features);", + "domimplementationlist dom_domimplementationsource_get_domimplementations(string features)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpls Since:" ], "dom_domstringlist_item": [ - "domstring dom_domstringlist_item(int index);", + "domstring dom_domstringlist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item Since:" ], "dom_element_get_attribute": [ - "string dom_element_get_attribute(string name);", + "string dom_element_get_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-666EE0F9 Since:" ], "dom_element_get_attribute_node": [ - "DOMAttr dom_element_get_attribute_node(string name);", + "DOMAttr dom_element_get_attribute_node(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-217A91B8 Since:" ], "dom_element_get_attribute_node_ns": [ - "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName);", + "DOMAttr dom_element_get_attribute_node_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAtNodeNS Since: DOM Level 2" ], "dom_element_get_attribute_ns": [ - "string dom_element_get_attribute_ns(string namespaceURI, string localName);", + "string dom_element_get_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAttrNS Since: DOM Level 2" ], "dom_element_get_elements_by_tag_name": [ - "DOMNodeList dom_element_get_elements_by_tag_name(string name);", + "DOMNodeList dom_element_get_elements_by_tag_name(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1938918D Since:" ], "dom_element_get_elements_by_tag_name_ns": [ - "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName);", + "DOMNodeList dom_element_get_elements_by_tag_name_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C90942 Since: DOM Level 2" ], "dom_element_has_attribute": [ - "boolean dom_element_has_attribute(string name);", + "bool dom_element_has_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttr Since: DOM Level 2" ], "dom_element_has_attribute_ns": [ - "boolean dom_element_has_attribute_ns(string namespaceURI, string localName);", + "bool dom_element_has_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttrNS Since: DOM Level 2" ], "dom_element_remove_attribute": [ - "void dom_element_remove_attribute(string name);", + "void dom_element_remove_attribute(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6D6AC0F9 Since:" ], "dom_element_remove_attribute_node": [ - "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr);", + "DOMAttr dom_element_remove_attribute_node(DOMAttr oldAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D589198 Since:" ], "dom_element_remove_attribute_ns": [ - "void dom_element_remove_attribute_ns(string namespaceURI, string localName);", + "void dom_element_remove_attribute_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElRemAtNS Since: DOM Level 2" ], "dom_element_set_attribute": [ - "void dom_element_set_attribute(string name, string value);", + "void dom_element_set_attribute(string name, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68F082 Since:" ], "dom_element_set_attribute_node": [ - "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr);", + "DOMAttr dom_element_set_attribute_node(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-887236154 Since:" ], "dom_element_set_attribute_node_ns": [ - "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr);", + "DOMAttr dom_element_set_attribute_node_ns(DOMAttr newAttr)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAtNodeNS Since: DOM Level 2" ], "dom_element_set_attribute_ns": [ - "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value);", + "void dom_element_set_attribute_ns(string namespaceURI, string qualifiedName, string value)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAttrNS Since: DOM Level 2" ], "dom_element_set_id_attribute": [ - "void dom_element_set_id_attribute(string name, boolean isId);", + "void dom_element_set_id_attribute(string name, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttr Since: DOM Level 3" ], "dom_element_set_id_attribute_node": [ - "void dom_element_set_id_attribute_node(attr idAttr, boolean isId);", + "void dom_element_set_id_attribute_node(attr idAttr, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNode Since: DOM Level 3" ], "dom_element_set_id_attribute_ns": [ - "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, boolean isId);", + "void dom_element_set_id_attribute_ns(string namespaceURI, string localName, bool isId)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNS Since: DOM Level 3" ], "dom_import_simplexml": [ @@ -3586,156 +3781,156 @@ var functionMap = { "Get a simplexml_element object from dom to allow for processing" ], "dom_namednodemap_get_named_item": [ - "DOMNode dom_namednodemap_get_named_item(string name);", + "DOMNode dom_namednodemap_get_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1074577549 Since:" ], "dom_namednodemap_get_named_item_ns": [ - "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName);", + "DOMNode dom_namednodemap_get_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_item": [ - "DOMNode dom_namednodemap_item(int index);", + "DOMNode dom_namednodemap_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-349467F9 Since:" ], "dom_namednodemap_remove_named_item": [ - "DOMNode dom_namednodemap_remove_named_item(string name);", + "DOMNode dom_namednodemap_remove_named_item(string name)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D58B193 Since:" ], "dom_namednodemap_remove_named_item_ns": [ - "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName);", + "DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-removeNamedItemNS Since: DOM Level 2" ], "dom_namednodemap_set_named_item": [ - "DOMNode dom_namednodemap_set_named_item(DOMNode arg);", + "DOMNode dom_namednodemap_set_named_item(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1025163788 Since:" ], "dom_namednodemap_set_named_item_ns": [ - "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg);", + "DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-setNamedItemNS Since: DOM Level 2" ], "dom_namelist_get_name": [ - "string dom_namelist_get_name(int index);", + "string dom_namelist_get_name(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getName Since:" ], "dom_namelist_get_namespace_uri": [ - "string dom_namelist_get_namespace_uri(int index);", + "string dom_namelist_get_namespace_uri(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getNamespaceURI Since:" ], "dom_node_append_child": [ - "DomNode dom_node_append_child(DomNode newChild);", + "DomNode dom_node_append_child(DomNode newChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-184E7107 Since:" ], "dom_node_clone_node": [ - "DomNode dom_node_clone_node(boolean deep);", + "DomNode dom_node_clone_node(bool deep)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3A0ED0A4 Since:" ], "dom_node_compare_document_position": [ - "short dom_node_compare_document_position(DomNode other);", + "short dom_node_compare_document_position(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-compareDocumentPosition Since: DOM Level 3" ], "dom_node_get_feature": [ - "DomNode dom_node_get_feature(string feature, string version);", + "DomNode dom_node_get_feature(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getFeature Since: DOM Level 3" ], "dom_node_get_user_data": [ - "mixed dom_node_get_user_data(string key);", + "mixed dom_node_get_user_data(string key)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getUserData Since: DOM Level 3" ], "dom_node_has_attributes": [ - "boolean dom_node_has_attributes();", + "bool dom_node_has_attributes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeHasAttrs Since: DOM Level 2" ], "dom_node_has_child_nodes": [ - "boolean dom_node_has_child_nodes();", + "bool dom_node_has_child_nodes()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-810594187 Since:" ], "dom_node_insert_before": [ - "domnode dom_node_insert_before(DomNode newChild, DomNode refChild);", + "domnode dom_node_insert_before(DomNode newChild, DomNode refChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-952280727 Since:" ], "dom_node_is_default_namespace": [ - "boolean dom_node_is_default_namespace(string namespaceURI);", + "bool dom_node_is_default_namespace(string namespaceURI)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace Since: DOM Level 3" ], "dom_node_is_equal_node": [ - "boolean dom_node_is_equal_node(DomNode arg);", + "bool dom_node_is_equal_node(DomNode arg)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isEqualNode Since: DOM Level 3" ], "dom_node_is_same_node": [ - "boolean dom_node_is_same_node(DomNode other);", + "bool dom_node_is_same_node(DomNode other)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isSameNode Since: DOM Level 3" ], "dom_node_is_supported": [ - "boolean dom_node_is_supported(string feature, string version);", + "bool dom_node_is_supported(string feature, string version)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Level-2-Core-Node-supports Since: DOM Level 2" ], "dom_node_lookup_namespace_uri": [ - "string dom_node_lookup_namespace_uri(string prefix);", + "string dom_node_lookup_namespace_uri(string prefix)", "URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI Since: DOM Level 3" ], "dom_node_lookup_prefix": [ - "string dom_node_lookup_prefix(string namespaceURI);", + "string dom_node_lookup_prefix(string namespaceURI)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-lookupNamespacePrefix Since: DOM Level 3" ], "dom_node_normalize": [ - "void dom_node_normalize();", + "void dom_node_normalize()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-normalize Since:" ], "dom_node_remove_child": [ - "DomNode dom_node_remove_child(DomNode oldChild);", + "DomNode dom_node_remove_child(DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1734834066 Since:" ], "dom_node_replace_child": [ - "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild);", + "DomNode dom_node_replace_child(DomNode newChild, DomNode oldChild)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-785887307 Since:" ], "dom_node_set_user_data": [ - "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler);", + "mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-setUserData Since: DOM Level 3" ], "dom_nodelist_item": [ - "DOMNode dom_nodelist_item(int index);", + "DOMNode dom_nodelist_item(int index)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-844377136 Since:" ], "dom_string_extend_find_offset16": [ - "int dom_string_extend_find_offset16(int offset32);", + "int dom_string_extend_find_offset16(int offset32)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset16 Since:" ], "dom_string_extend_find_offset32": [ - "int dom_string_extend_find_offset32(int offset16);", + "int dom_string_extend_find_offset32(int offset16)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset32 Since:" ], "dom_text_is_whitespace_in_element_content": [ - "boolean dom_text_is_whitespace_in_element_content();", + "bool dom_text_is_whitespace_in_element_content()", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent Since: DOM Level 3" ], "dom_text_replace_whole_text": [ - "DOMText dom_text_replace_whole_text(string content);", + "DOMText dom_text_replace_whole_text(string content)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText Since: DOM Level 3" ], "dom_text_split_text": [ - "DOMText dom_text_split_text(int offset);", + "DOMText dom_text_split_text(int offset)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D Since:" ], "dom_userdatahandler_handle": [ - "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst);", + "dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst)", "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent Since:" ], "dom_xpath_evaluate": [ - "mixed dom_xpath_evaluate(string expr [,DOMNode context]); */", - "PHP_FUNCTION(dom_xpath_evaluate) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_EVALUATE); } /* }}} end dom_xpath_evaluate" + "mixed dom_xpath_evaluate(string expr [,DOMNode context])", + "" ], "dom_xpath_query": [ - "DOMNodeList dom_xpath_query(string expr [,DOMNode context]); */", - "PHP_FUNCTION(dom_xpath_query) { php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_QUERY); } /* }}} end dom_xpath_query" + "DOMNodeList dom_xpath_query(string expr [,DOMNode context])", + "" ], "dom_xpath_register_ns": [ - "boolean dom_xpath_register_ns(string prefix, string uri); */", - "PHP_FUNCTION(dom_xpath_register_ns) { zval *id; xmlXPathContextPtr ctxp; int prefix_len, ns_uri_len; dom_xpath_object *intern; unsigned char *prefix, *ns_uri; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"Oss\", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { return; } intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); ctxp = (xmlXPathContextPtr) intern->ptr; if (ctxp == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid XPath Context\"); RETURN_FALSE; } if (xmlXPathRegisterNs(ctxp, prefix, ns_uri) != 0) { RETURN_FALSE } RETURN_TRUE; } /* }}}" + "bool dom_xpath_register_ns(string prefix, string uri)", + "" ], "dom_xpath_register_php_functions": [ - "void dom_xpath_register_php_functions() */", - "PHP_FUNCTION(dom_xpath_register_php_functions) { zval *id; dom_xpath_object *intern; zval *array_value, **entry, *new_string; int name_len = 0; char *name; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"a\", &array_value) == SUCCESS) { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) { SEPARATE_ZVAL(entry); convert_to_string_ex(entry); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &new_string, sizeof(zval*), NULL); zend_hash_move_forward(Z_ARRVAL_P(array_value)); } intern->registerPhpFunctions = 2; RETURN_TRUE; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &name, &name_len) == SUCCESS) { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, name, name_len + 1, &new_string, sizeof(zval*), NULL); intern->registerPhpFunctions = 2; } else { intern = (dom_xpath_object *)zend_object_store_get_object(id TSRMLS_CC); intern->registerPhpFunctions = 1; } } /* }}} end dom_xpath_register_php_functions" + "void dom_xpath_register_php_functions()", + "" ], "each": [ "array each(array arr)", @@ -3754,7 +3949,7 @@ var functionMap = { "Output one or more strings" ], "empty": [ - "bool empty( mixed var )", + "bool empty(mixed var)", "Determine whether a variable is empty" ], "enchant_broker_describe": [ @@ -3766,7 +3961,7 @@ var functionMap = { "Whether a dictionary exists or not. Using non-empty tag" ], "enchant_broker_free": [ - "boolean enchant_broker_free(resource broker)", + "bool enchant_broker_free(resource broker)", "Destroys the broker object and its dictionnaries" ], "enchant_broker_free_dict": [ @@ -4062,7 +4257,7 @@ var functionMap = { "Returns the next lowest integer value from the number" ], "flush": [ - "void flush(void)", + "void flush()", "Flush the output buffer" ], "fmod": [ @@ -4270,7 +4465,7 @@ var functionMap = { "Get an array of the arguments that were passed to the function" ], "func_num_args": [ - "int func_num_args(void)", + "int func_num_args()", "Get the number of arguments that were passed to the function" ], "function ": ["", ""], @@ -4284,19 +4479,19 @@ var functionMap = { "Binary-safe file write" ], "gc_collect_cycles": [ - "int gc_collect_cycles(void)", + "int gc_collect_cycles()", "Forces collection of any existing garbage cycles. Returns number of freed zvals" ], "gc_disable": [ - "void gc_disable(void)", + "void gc_disable()", "Deactivates the circular reference collector" ], "gc_enable": [ - "void gc_enable(void)", + "void gc_enable()", "Activates the circular reference collector" ], "gc_enabled": [ - "void gc_enabled(void)", + "void gc_enabled()", "Returns status of the circular reference collector" ], "gd_info": [ @@ -4305,7 +4500,7 @@ var functionMap = { ], "getKeywords": [ "static array getKeywords(string $locale) {", - "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!) * }}}" + "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array * }}}" ], "get_browser": [ "mixed get_browser([string browser_name [, bool return_array]])", @@ -4332,7 +4527,7 @@ var functionMap = { "Returns an array of default properties of the class." ], "get_current_user": [ - "string get_current_user(void)", + "string get_current_user()", "Get the name of the owner of the current PHP script" ], "get_declared_classes": [ @@ -4348,11 +4543,11 @@ var functionMap = { "Return an array containing the names and values of all defined constants" ], "get_defined_functions": [ - "array get_defined_functions(void)", + "array get_defined_functions()", "Returns an array of all defined functions" ], "get_defined_vars": [ - "array get_defined_vars(void)", + "array get_defined_vars()", "Returns an associative array of names and values of all currently defined variable names (variables in the current scope)" ], "get_display_language": [ @@ -4388,7 +4583,7 @@ var functionMap = { "Get the current include_path configuration option" ], "get_included_files": [ - "array get_included_files(void)", + "array get_included_files()", "Returns an array with the file names that were include_once()'d" ], "get_loaded_extensions": [ @@ -4396,11 +4591,11 @@ var functionMap = { "Return an array containing names of loaded extensions" ], "get_magic_quotes_gpc": [ - "int get_magic_quotes_gpc(void)", + "int get_magic_quotes_gpc()", "Get the current active configuration setting of magic_quotes_gpc" ], "get_magic_quotes_runtime": [ - "int get_magic_quotes_runtime(void)", + "int get_magic_quotes_runtime()", "Get the current active configuration setting of magic_quotes_runtime" ], "get_meta_tags": [ @@ -4420,11 +4615,11 @@ var functionMap = { "Get the resource type name for a given resource" ], "getallheaders": [ - "array getallheaders(void)", + "array getallheaders()", "" ], "getcwd": [ - "mixed getcwd(void)", + "mixed getcwd()", "Gets the current directory" ], "getdate": [ @@ -4456,23 +4651,23 @@ var functionMap = { "Get the size of an image as 4-element array" ], "getlastmod": [ - "int getlastmod(void)", + "int getlastmod()", "Get time of last page modification" ], "getmygid": [ - "int getmygid(void)", + "int getmygid()", "Get PHP script owner's GID" ], "getmyinode": [ - "int getmyinode(void)", + "int getmyinode()", "Get the inode of the current script being parsed" ], "getmypid": [ - "int getmypid(void)", + "int getmypid()", "Get current process ID" ], "getmyuid": [ - "int getmyuid(void)", + "int getmyuid()", "Get PHP script owner's UID" ], "getopt": [ @@ -4488,7 +4683,7 @@ var functionMap = { "Returns protocol name associated with protocol number proto" ], "getrandmax": [ - "int getrandmax(void)", + "int getrandmax()", "Returns the maximum value a random number can have" ], "getrusage": [ @@ -4764,7 +4959,7 @@ var functionMap = { "Generate a hash of a given input string Returns lowercase hexits by default" ], "hash_algos": [ - "array hash_algos(void)", + "array hash_algos()", "Return a list of registered hashing algorithms" ], "hash_copy": [ @@ -4812,7 +5007,7 @@ var functionMap = { "Removes an HTTP header previously set using header()" ], "headers_list": [ - "array headers_list(void)", + "array headers_list()", "Return list of headers to be sent / already sent" ], "headers_sent": [ @@ -4940,11 +5135,11 @@ var functionMap = { "Drop an InterBase database" ], "ibase_errcode": [ - "int ibase_errcode(void)", + "int ibase_errcode()", "Return error code" ], "ibase_errmsg": [ - "string ibase_errmsg(void)", + "string ibase_errmsg()", "Return error message" ], "ibase_execute": [ @@ -5413,7 +5608,7 @@ var functionMap = { ], "imagepsextendfont": [ "bool imagepsextendfont(resource font_index, float extend)", - "Extend or or condense (if extend < 1) a font" + "Extend or or condense if (extend < 1) a font" ], "imagepsfreefont": [ "bool imagepsfreefont(resource font_index)", @@ -5492,7 +5687,7 @@ var functionMap = { "Write text to the image using a TrueType font" ], "imagetypes": [ - "int imagetypes(void)", + "int imagetypes()", "Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM" ], "imagewbmp": [ @@ -5508,7 +5703,7 @@ var functionMap = { "Convert an 8-bit string to a quoted-printable string" ], "imap_alerts": [ - "array imap_alerts(void)", + "array imap_alerts()", "Returns an array of all IMAP alerts that have been generated since the last page load or since the last imap_alerts() call, whichever came last. The alert stack is cleared after imap_alerts() is called." ], "imap_append": [ @@ -5556,7 +5751,7 @@ var functionMap = { "Delete a mailbox" ], "imap_errors": [ - "array imap_errors(void)", + "array imap_errors()", "Returns an array of all IMAP errors generated since the last page load, or since the last imap_errors() call, whichever came last. The error stack is cleared after imap_errors() is called." ], "imap_expunge": [ @@ -5612,7 +5807,7 @@ var functionMap = { "Returns headers for all messages in a mailbox" ], "imap_last_error": [ - "string imap_last_error(void)", + "string imap_last_error()", "Returns the last error that was generated by an IMAP function. The error stack is NOT cleared after this call." ], "imap_list": [ @@ -5863,6 +6058,10 @@ var functionMap = { "bool is_callable(mixed var [, bool syntax_only [, string callable_name]])", "Returns true if var is callable." ], + "is_countable": [ + "bool is_countable(mixed var)", + "Returns true if var is countable, false otherwise" + ], "is_dir": [ "bool is_dir(string filename)", "Returns true if file is directory" @@ -5944,15 +6143,15 @@ var functionMap = { "Determine whether a variable is set" ], "iterator_apply": [ - "int iterator_apply(Traversable it, mixed function [, mixed params])", + "int iterator_apply(Traversable iterator, callable function [, array args = null)", "Calls a function for every element in an iterator" ], "iterator_count": [ - "int iterator_count(Traversable it)", + "int iterator_count(Traversable iterator)", "Count the elements in an iterator" ], "iterator_to_array": [ - "array iterator_to_array(Traversable it [, bool use_keys = true])", + "array iterator_to_array(Traversable iterator [, bool use_keys = true])", "Copy the iterator into an array" ], "jddayofweek": [ @@ -5988,11 +6187,11 @@ var functionMap = { "Converts a jewish calendar date to a julian day count" ], "join": [ - "string join(array src, string glue)", - "An alias for implode" + "string join([string glue,] array pieces)", + "Returns a string containing a string representation of all the arrayelements in the same order, with the glue string between each element" ], "jpeg2wbmp": [ - "bool jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)", + "bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert JPEG image to WBMP image" ], "json_decode": [ @@ -6160,7 +6359,7 @@ var functionMap = { "Read an entry" ], "ldap_rename": [ - "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn);", + "bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn)", "Modify the name of an entry" ], "ldap_sasl_bind": [ @@ -6208,7 +6407,7 @@ var functionMap = { "Clear last error from libxml" ], "libxml_disable_entity_loader": [ - "bool libxml_disable_entity_loader([boolean disable])", + "bool libxml_disable_entity_loader([bool disable])", "Disable/Enable ability to load external entities" ], "libxml_get_errors": [ @@ -6224,7 +6423,7 @@ var functionMap = { "Set the streams context for the next libxml document load or write" ], "libxml_use_internal_errors": [ - "bool libxml_use_internal_errors([boolean use_errors])", + "bool libxml_use_internal_errors([bool use_errors])", "Disable libxml errors and allow user to fetch error information as needed" ], "link": [ @@ -6236,11 +6435,11 @@ var functionMap = { "Returns the st_dev field of the UNIX C stat structure describing the link" ], "litespeed_request_headers": [ - "array litespeed_request_headers(void)", + "array litespeed_request_headers()", "Fetch all HTTP request headers" ], "litespeed_response_headers": [ - "array litespeed_response_headers(void)", + "array litespeed_response_headers()", "Fetch all HTTP response headers" ], "locale_accept_from_http": [ @@ -6252,7 +6451,7 @@ var functionMap = { "* @param string $locale The locale string to canonicalize" ], "locale_filter_matches": [ - "boolean locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", + "bool locale_filter_matches(string $langtag, string $locale[, bool $canonicalize])", "* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm" ], "locale_get_all_variants": [ @@ -6265,7 +6464,7 @@ var functionMap = { ], "locale_get_keywords": [ "static array locale_get_keywords(string $locale) {", - "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!)" + "* return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array" ], "locale_get_primary_language": [ "static string locale_get_primary_language($locale)", @@ -6288,7 +6487,7 @@ var functionMap = { "Set default locale" ], "localeconv": [ - "array localeconv(void)", + "array localeconv()", "Returns numeric formatting information based on the current locale" ], "localtime": [ @@ -6392,11 +6591,11 @@ var functionMap = { "Regular expression search for multibyte string" ], "mb_ereg_search_getpos": [ - "int mb_ereg_search_getpos(void)", + "int mb_ereg_search_getpos()", "Get search start position" ], "mb_ereg_search_getregs": [ - "array mb_ereg_search_getregs(void)", + "array mb_ereg_search_getregs()", "Get matched substring of the last time" ], "mb_ereg_search_init": [ @@ -6716,7 +6915,7 @@ var functionMap = { "Hash data with hash" ], "mhash_count": [ - "int mhash_count(void)", + "int mhash_count()", "Gets the number of available hashes" ], "mhash_get_block_size": [ @@ -6892,7 +7091,7 @@ var functionMap = { "Free a MS-SQL statement index" ], "mssql_get_last_message": [ - "string mssql_get_last_message(void)", + "string mssql_get_last_message()", "Gets the last message from the MS-SQL server" ], "mssql_guid_string": [ @@ -6944,7 +7143,7 @@ var functionMap = { "Select a MS-SQL database" ], "mt_getrandmax": [ - "int mt_getrandmax(void)", + "int mt_getrandmax()", "Returns the maximum value a random number from Mersenne Twister can have" ], "mt_rand": [ @@ -7052,7 +7251,7 @@ var functionMap = { "Free result memory" ], "mysql_get_client_info": [ - "string mysql_get_client_info(void)", + "string mysql_get_client_info()", "Returns a string that represents the client library version" ], "mysql_get_host_info": [ @@ -7148,7 +7347,7 @@ var functionMap = { "Turn auto commit on or of" ], "mysqli_cache_stats": [ - "array mysqli_cache_stats(void)", + "array mysqli_cache_stats()", "Returns statistics about the zval cache" ], "mysqli_change_user": [ @@ -7172,11 +7371,11 @@ var functionMap = { "Open a connection to a mysql server" ], "mysqli_connect_errno": [ - "int mysqli_connect_errno(void)", + "int mysqli_connect_errno()", "Returns the numerical value of the error message from last connect command" ], "mysqli_connect_error": [ - "string mysqli_connect_error(void)", + "string mysqli_connect_error()", "Returns the text of the error message from previous MySQL operation" ], "mysqli_data_seek": [ @@ -7192,7 +7391,7 @@ var functionMap = { "" ], "mysqli_embedded_server_end": [ - "void mysqli_embedded_server_end(void)", + "void mysqli_embedded_server_end()", "" ], "mysqli_embedded_server_start": [ @@ -7208,39 +7407,39 @@ var functionMap = { "Returns the text of the error message from previous MySQL operation" ], "mysqli_fetch_all": [ - "mixed mysqli_fetch_all (object result [,int resulttype])", + "mixed mysqli_fetch_all(object result [,int resulttype])", "Fetches all result rows as an associative array, a numeric array, or both" ], "mysqli_fetch_array": [ - "mixed mysqli_fetch_array (object result [,int resulttype])", + "mixed mysqli_fetch_array(object result [,int resulttype])", "Fetch a result row as an associative array, a numeric array, or both" ], "mysqli_fetch_assoc": [ - "mixed mysqli_fetch_assoc (object result)", + "mixed mysqli_fetch_assoc(object result)", "Fetch a result row as an associative array" ], "mysqli_fetch_field": [ - "mixed mysqli_fetch_field (object result)", + "mixed mysqli_fetch_field(object result)", "Get column information from a result and return as an object" ], "mysqli_fetch_field_direct": [ - "mixed mysqli_fetch_field_direct (object result, int offset)", + "mixed mysqli_fetch_field_direct(object result, int offset)", "Fetch meta-data for a single field" ], "mysqli_fetch_fields": [ - "mixed mysqli_fetch_fields (object result)", + "mixed mysqli_fetch_fields(object result)", "Return array of objects containing field meta-data" ], "mysqli_fetch_lengths": [ - "mixed mysqli_fetch_lengths (object result)", + "mixed mysqli_fetch_lengths(object result)", "Get the length of each output in a result" ], "mysqli_fetch_object": [ - "mixed mysqli_fetch_object (object result [, string class_name [, NULL|array ctor_params]])", + "mixed mysqli_fetch_object(object result [, string class_name [, NULL|array ctor_params]])", "Fetch a result row as an object" ], "mysqli_fetch_row": [ - "array mysqli_fetch_row (object result)", + "array mysqli_fetch_row(object result)", "Get a result row as an enumerated array" ], "mysqli_field_count": [ @@ -7264,23 +7463,23 @@ var functionMap = { "returns a character set object" ], "mysqli_get_client_info": [ - "string mysqli_get_client_info(void)", + "string mysqli_get_client_info()", "Get MySQL client info" ], "mysqli_get_client_stats": [ - "array mysqli_get_client_stats(void)", + "array mysqli_get_client_stats()", "Returns statistics about the zval cache" ], "mysqli_get_client_version": [ - "int mysqli_get_client_version(void)", + "int mysqli_get_client_version()", "Get MySQL client info" ], "mysqli_get_connection_stats": [ - "array mysqli_get_connection_stats(void)", + "array mysqli_get_connection_stats()", "Returns statistics about the zval cache" ], "mysqli_get_host_info": [ - "string mysqli_get_host_info (object link)", + "string mysqli_get_host_info(object link)", "Get MySQL host info" ], "mysqli_get_proto_info": [ @@ -7296,15 +7495,15 @@ var functionMap = { "Return the MySQL version for the server referenced by the given link" ], "mysqli_get_warnings": [ - "object mysqli_get_warnings(object link) */", - "PHP_FUNCTION(mysqli_get_warnings) { MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; MYSQLI_WARNING *w; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"O\", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, \"mysqli_link\", MYSQLI_STATUS_VALID); if (mysql_warning_count(mysql->mysql)) { w = php_get_warnings(mysql->mysql TSRMLS_CC); } else { RETURN_FALSE; } mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = mysqli_resource->info = (void *)w; mysqli_resource->status = MYSQLI_STATUS_VALID; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry); } /* }}}" + "object mysqli_get_warnings(object link)", + "" ], "mysqli_info": [ "string mysqli_info(object link)", "Get information about the most recent query" ], "mysqli_init": [ - "resource mysqli_init(void)", + "resource mysqli_init()", "Initialize mysqli and return a resource for use with mysql_real_connect" ], "mysqli_insert_id": [ @@ -7356,8 +7555,8 @@ var functionMap = { "Prepare a SQL statement for execution" ], "mysqli_query": [ - "mixed mysqli_query(object link, string query [,int resultmode]) */", - "PHP_FUNCTION(mysqli_query) { MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; MYSQL_RES *result; char *query = NULL; unsigned int query_len; unsigned long resultmode = MYSQLI_STORE_RESULT; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"Os|l\", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { return; } if (!query_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Empty query\"); RETURN_FALSE; } if ((resultmode & ~MYSQLI_ASYNC) != MYSQLI_USE_RESULT && (resultmode & ~MYSQLI_ASYNC) != MYSQLI_STORE_RESULT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid value for resultmode\"); RETURN_FALSE; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, \"mysqli_link\", MYSQLI_STATUS_VALID); MYSQLI_DISABLE_MQ; #ifdef MYSQLI_USE_MYSQLND if (resultmode & MYSQLI_ASYNC) { if (mysqli_async_query(mysql->mysql, query, query_len)) { MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } mysql->async_result_fetch_type = resultmode & ~MYSQLI_ASYNC; RETURN_TRUE; } #endif if (mysql_real_query(mysql->mysql, query, query_len)) { MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); RETURN_FALSE; } if (!mysql_field_count(mysql->mysql)) { /* no result set - not a SELECT" + "mixed mysqli_query(object link, string query [,int resultmode])", + "" ], "mysqli_real_connect": [ "bool mysqli_real_connect(object link [,string hostname [,string username [,string passwd [,string dbname [,int port [,string socket [,int flags]]]]]]])", @@ -7472,8 +7671,8 @@ var functionMap = { "Buffer result set on client" ], "mysqli_stmt_get_warnings": [ - "object mysqli_stmt_get_warnings(object link) */", - "PHP_FUNCTION(mysqli_stmt_get_warnings) { MY_STMT *stmt; zval *stmt_link; MYSQLI_RESOURCE *mysqli_resource; MYSQLI_WARNING *w; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), \"O\", &stmt_link, mysqli_stmt_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(stmt, MY_STMT*, &stmt_link, \"mysqli_stmt\", MYSQLI_STATUS_VALID); if (mysqli_stmt_warning_count(stmt->stmt)) { w = php_get_warnings(mysqli_stmt_get_connection(stmt->stmt) TSRMLS_CC); } else { RETURN_FALSE; } mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = mysqli_resource->info = (void *)w; mysqli_resource->status = MYSQLI_STATUS_VALID; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_warning_class_entry); } /* }}}" + "object mysqli_stmt_get_warnings(object link)", + "" ], "mysqli_stmt_init": [ "mixed mysqli_stmt_init(object link)", @@ -7528,7 +7727,7 @@ var functionMap = { "Return the current thread ID" ], "mysqli_thread_safe": [ - "bool mysqli_thread_safe(void)", + "bool mysqli_thread_safe()", "Return whether thread safety is given or not" ], "mysqli_use_result": [ @@ -7536,7 +7735,7 @@ var functionMap = { "Directly retrieve query results - do not buffer results on client side" ], "mysqli_warning_count": [ - "int mysqli_warning_count (object link)", + "int mysqli_warning_count(object link)", "Return number of warnings from the last query for the given link" ], "natcasesort": [ @@ -7572,11 +7771,11 @@ var functionMap = { "* Normalize a string." ], "nsapi_request_headers": [ - "array nsapi_request_headers(void)", + "array nsapi_request_headers()", "Get all headers from the request" ], "nsapi_response_headers": [ - "array nsapi_response_headers(void)", + "array nsapi_response_headers()", "Get all headers from the response" ], "nsapi_virtual": [ @@ -7656,39 +7855,39 @@ var functionMap = { "* Get formatter attribute value." ], "ob_clean": [ - "bool ob_clean(void)", + "bool ob_clean()", "Clean (delete) the current output buffer" ], "ob_end_clean": [ - "bool ob_end_clean(void)", + "bool ob_end_clean()", "Clean the output buffer, and delete current output buffer" ], "ob_end_flush": [ - "bool ob_end_flush(void)", + "bool ob_end_flush()", "Flush (send) the output buffer, and delete current output buffer" ], "ob_flush": [ - "bool ob_flush(void)", + "bool ob_flush()", "Flush (send) contents of the output buffer. The last buffer content is sent to next buffer" ], "ob_get_clean": [ - "bool ob_get_clean(void)", + "bool ob_get_clean()", "Get current buffer contents and delete current output buffer" ], "ob_get_contents": [ - "string ob_get_contents(void)", + "string ob_get_contents()", "Return the contents of the output buffer" ], "ob_get_flush": [ - "bool ob_get_flush(void)", + "bool ob_get_flush()", "Get current buffer contents, flush (send) the output buffer, and delete current output buffer" ], "ob_get_length": [ - "int ob_get_length(void)", + "int ob_get_length()", "Return the length of the output buffer" ], "ob_get_level": [ - "int ob_get_level(void)", + "int ob_get_level()", "Return the nesting level of the output buffer" ], "ob_get_status": [ @@ -8008,7 +8207,7 @@ var functionMap = { "Returns current state of buffering for a LOB" ], "ocisetbufferinglob": [ - "bool ocisetbufferinglob( boolean flag )", + "bool ocisetbufferinglob( bool flag )", "Enables/disables buffering for a LOB" ], "octdec": [ @@ -8028,7 +8227,7 @@ var functionMap = { "Close an ODBC connection" ], "odbc_close_all": [ - "void odbc_close_all(void)", + "void odbc_close_all()", "Close all ODBC connections" ], "odbc_columnprivileges": [ @@ -8236,7 +8435,7 @@ var functionMap = { "Encrypts given data with given method and key, returns raw or base64 encoded string" ], "openssl_error_string": [ - "mixed openssl_error_string(void)", + "mixed openssl_error_string()", "Returns a description of the last error, and alters the index of the error messages. Returns false when the are no more messages" ], "openssl_get_cipher_methods": [ @@ -8376,7 +8575,7 @@ var functionMap = { "Add URL rewriter values" ], "output_reset_rewrite_vars": [ - "bool output_reset_rewrite_vars(void)", + "bool output_reset_rewrite_vars()", "Reset(clear) URL rewriter values" ], "pack": [ @@ -8428,7 +8627,7 @@ var functionMap = { "Executes specified program in current process space as defined by exec(2)" ], "pcntl_fork": [ - "int pcntl_fork(void)", + "int pcntl_fork()", "Forks the currently running process following the same behavior as the UNIX fork() system call" ], "pcntl_getpriority": [ @@ -8545,7 +8744,7 @@ var functionMap = { ], "pg_delete": [ "mixed pg_delete(resource db, string table, array ids[, int options])", - "Delete records has ids (id=>value)" + "Delete records has ids (id => value)" ], "pg_end_copy": [ "bool pg_end_copy([resource connection])", @@ -8645,7 +8844,7 @@ var functionMap = { ], "pg_insert": [ "mixed pg_insert(resource db, string table, array values[, int options])", - "Insert values (filed=>value) to table" + "Insert values (filed => value) to table" ], "pg_last_error": [ "string pg_last_error([resource connection])", @@ -8769,7 +8968,7 @@ var functionMap = { ], "pg_select": [ "mixed pg_select(resource db, string table, array ids[, int options])", - "Select records that has ids (id=>value)" + "Select records that has ids (id => value)" ], "pg_send_execute": [ "bool pg_send_execute(resource connection, string stmtname, array params)", @@ -8817,34 +9016,34 @@ var functionMap = { ], "pg_update": [ "mixed pg_update(resource db, string table, array fields, array ids[, int options])", - "Update table using values (field=>value) and ids (id=>value)" + "Update table using values (field => value) and ids (id => value)" ], "pg_version": [ "array pg_version([resource connection])", "Returns an array with client, protocol and server version (when available)" ], "php_egg_logo_guid": [ - "string php_egg_logo_guid(void)", + "string php_egg_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_ini_loaded_file": [ - "string php_ini_loaded_file(void)", + "string php_ini_loaded_file()", "Return the actual loaded ini filename" ], "php_ini_scanned_files": [ - "string php_ini_scanned_files(void)", + "string php_ini_scanned_files()", "Return comma-separated string of .ini files parsed from the additional ini dir" ], "php_logo_guid": [ - "string php_logo_guid(void)", + "string php_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_real_logo_guid": [ - "string php_real_logo_guid(void)", + "string php_real_logo_guid()", "Return the special ID used to request the PHP logo in phpinfo screens" ], "php_sapi_name": [ - "string php_sapi_name(void)", + "string php_sapi_name()", "Return the current SAPI module name" ], "php_snmpv3": [ @@ -8856,7 +9055,7 @@ var functionMap = { "Return source with stripped comments and whitespace" ], "php_uname": [ - "string php_uname(void)", + "string php_uname()", "Return information about the system PHP was built on" ], "phpcredits": [ @@ -8872,11 +9071,11 @@ var functionMap = { "Return the current PHP version" ], "pi": [ - "float pi(void)", + "float pi()", "Returns an approximation of pi" ], "png2wbmp": [ - "bool png2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold)", + "bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)", "Convert PNG image to WBMP image" ], "popen": [ @@ -8888,27 +9087,27 @@ var functionMap = { "Determine accessibility of a file (POSIX.1 5.6.3)" ], "posix_ctermid": [ - "string posix_ctermid(void)", + "string posix_ctermid()", "Generate terminal path name (POSIX.1, 4.7.1)" ], "posix_get_last_error": [ - "int posix_get_last_error(void)", + "int posix_get_last_error()", "Retrieve the error number set by the last posix function which failed." ], "posix_getcwd": [ - "string posix_getcwd(void)", + "string posix_getcwd()", "Get working directory pathname (POSIX.1, 5.2.2)" ], "posix_getegid": [ - "int posix_getegid(void)", + "int posix_getegid()", "Get the current effective group id (POSIX.1, 4.2.1)" ], "posix_geteuid": [ - "int posix_geteuid(void)", + "int posix_geteuid()", "Get the current effective user id (POSIX.1, 4.2.1)" ], "posix_getgid": [ - "int posix_getgid(void)", + "int posix_getgid()", "Get the current group id (POSIX.1, 4.2.1)" ], "posix_getgrgid": [ @@ -8920,27 +9119,27 @@ var functionMap = { "Group database access (POSIX.1, 9.2.1)" ], "posix_getgroups": [ - "array posix_getgroups(void)", + "array posix_getgroups()", "Get supplementary group id's (POSIX.1, 4.2.3)" ], "posix_getlogin": [ - "string posix_getlogin(void)", + "string posix_getlogin()", "Get user name (POSIX.1, 4.2.4)" ], "posix_getpgid": [ - "int posix_getpgid(void)", + "int posix_getpgid()", "Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)" ], "posix_getpgrp": [ - "int posix_getpgrp(void)", + "int posix_getpgrp()", "Get current process group id (POSIX.1, 4.3.1)" ], "posix_getpid": [ - "int posix_getpid(void)", + "int posix_getpid()", "Get the current process id (POSIX.1, 4.1.1)" ], "posix_getppid": [ - "int posix_getppid(void)", + "int posix_getppid()", "Get the parent process id (POSIX.1, 4.1.1)" ], "posix_getpwnam": [ @@ -8952,15 +9151,15 @@ var functionMap = { "User database access (POSIX.1, 9.2.2)" ], "posix_getrlimit": [ - "array posix_getrlimit(void)", + "array posix_getrlimit()", "Get system resource consumption limits (This is not a POSIX function, but a BSDism and a SVR4ism. We compile conditionally)" ], "posix_getsid": [ - "int posix_getsid(void)", + "int posix_getsid()", "Get process group id of session leader (This is not a POSIX function, but a SVR4ism, so be compile conditionally)" ], "posix_getuid": [ - "int posix_getuid(void)", + "int posix_getuid()", "Get the current user id (POSIX.1, 4.2.1)" ], "posix_initgroups": [ @@ -9000,7 +9199,7 @@ var functionMap = { "Set process group id for job control (POSIX.1, 4.3.3)" ], "posix_setsid": [ - "int posix_setsid(void)", + "int posix_setsid()", "Create session and set process group id (POSIX.1, 4.3.2)" ], "posix_setuid": [ @@ -9012,7 +9211,7 @@ var functionMap = { "Retrieve the system error message associated with the given errno." ], "posix_times": [ - "array posix_times(void)", + "array posix_times()", "Get process times (POSIX.1, 4.5.2)" ], "posix_ttyname": [ @@ -9020,7 +9219,7 @@ var functionMap = { "Determine terminal device name (POSIX.1, 4.7.2)" ], "posix_uname": [ - "array posix_uname(void)", + "array posix_uname()", "Get system name (POSIX.1, 4.4.1)" ], "pow": [ @@ -9188,8 +9387,8 @@ var functionMap = { "Convert a quoted-printable string to an 8 bit string" ], "quoted_printable_encode": [ - "string quoted_printable_encode(string str) */", - "PHP_FUNCTION(quoted_printable_encode) { char *str, *new_str; int str_len; size_t new_str_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &str, &str_len) != SUCCESS) { return; } if (!str_len) { RETURN_EMPTY_STRING(); } new_str = (char *)php_quot_print_encode((unsigned char *)str, (size_t)str_len, &new_str_len); RETURN_STRINGL(new_str, new_str_len, 0); } /* }}}" + "string quoted_printable_encode(string str)", + "" ], "quotemeta": [ "string quotemeta(string str)", @@ -9248,7 +9447,7 @@ var functionMap = { "Informs the readline callback interface that a character is ready for input" ], "readline_clear_history": [ - "bool readline_clear_history(void)", + "bool readline_clear_history()", "Clears the history" ], "readline_completion_function": [ @@ -9260,11 +9459,11 @@ var functionMap = { "Gets/sets various internal readline variables." ], "readline_list_history": [ - "array readline_list_history(void)", + "array readline_list_history()", "Lists the history" ], "readline_on_new_line": [ - "void readline_on_new_line(void)", + "void readline_on_new_line()", "Inform readline that the cursor has moved to a new line" ], "readline_read_history": [ @@ -9272,7 +9471,7 @@ var functionMap = { "Reads the history" ], "readline_redisplay": [ - "void readline_redisplay(void)", + "void readline_redisplay()", "Ask readline to redraw the display" ], "readline_write_history": [ @@ -9328,11 +9527,11 @@ var functionMap = { "Set array argument's internal pointer to the first element and return it" ], "restore_error_handler": [ - "void restore_error_handler(void)", + "void restore_error_handler()", "Restores the previously defined error handler function" ], "restore_exception_handler": [ - "void restore_exception_handler(void)", + "void restore_exception_handler()", "Restores the previously defined exception handler function" ], "restore_include_path": [ @@ -9400,15 +9599,15 @@ var functionMap = { "Deserializes data and reinitializes the variables" ], "session_destroy": [ - "bool session_destroy(void)", + "bool session_destroy()", "Destroy the current session and all data associated with it" ], "session_encode": [ - "string session_encode(void)", + "string session_encode()", "Serializes the current setup and returns the serialized representation" ], "session_get_cookie_params": [ - "array session_get_cookie_params(void)", + "array session_get_cookie_params()", "Return the session cookie parameters" ], "session_id": [ @@ -9448,7 +9647,7 @@ var functionMap = { "Sets user-level functions" ], "session_start": [ - "bool session_start(void)", + "bool session_start()", "Begin session - reinitializes freezed variables, registers browsers etc" ], "session_unregister": [ @@ -9456,11 +9655,11 @@ var functionMap = { "Removes varname from the list of variables which are freezed at the session end" ], "session_unset": [ - "void session_unset(void)", + "void session_unset()", "Unset all registered variables" ], "session_write_close": [ - "void session_write_close(void)", + "void session_write_close()", "Write session data and end session" ], "set_error_handler": [ @@ -9540,27 +9739,27 @@ var functionMap = { "Removes variable from shared memory" ], "shmop_close": [ - "void shmop_close (int shmid)", + "void shmop_close(int shmid)", "closes a shared memory segment" ], "shmop_delete": [ - "bool shmop_delete (int shmid)", + "bool shmop_delete(int shmid)", "mark segment for deletion" ], "shmop_open": [ - "int shmop_open (int key, string flags, int mode, int size)", + "int shmop_open(int key, string flags, int mode, int size)", "gets and attaches a shared memory segment" ], "shmop_read": [ - "string shmop_read (int shmid, int start, int count)", + "string shmop_read(int shmid, int start, int count)", "reads from a shm segment" ], "shmop_size": [ - "int shmop_size (int shmid)", + "int shmop_size(int shmid)", "returns the shm size" ], "shmop_write": [ - "int shmop_write (int shmid, string data, int offset)", + "int shmop_write(int shmid, string data, int offset)", "writes to a shared memory segment" ], "shuffle": [ @@ -9672,7 +9871,7 @@ var functionMap = { "Fetch the value of a SNMP object" ], "snmp_get_quick_print": [ - "bool snmp_get_quick_print(void)", + "bool snmp_get_quick_print()", "Return the current status of quick_print" ], "snmp_get_valueretrieval": [ @@ -9920,7 +10119,7 @@ var functionMap = { "Escapes a string for use as a query parameter." ], "sqlite_exec": [ - "boolean sqlite_exec(string query, resource db[, string &error_message])", + "bool sqlite_exec(string query, resource db[, string &error_message])", "Executes a result-less query against a given database" ], "sqlite_factory": [ @@ -10172,7 +10371,7 @@ var functionMap = { "Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string." ], "stream_get_filters": [ - "array stream_get_filters(void)", + "array stream_get_filters()", "Returns a list of registered filters" ], "stream_get_line": [ @@ -10436,7 +10635,7 @@ var functionMap = { "Free result memory" ], "sybase_get_last_message": [ - "string sybase_get_last_message(void)", + "string sybase_get_last_message()", "Returns the last message from server (over min_message_severity)" ], "sybase_min_client_severity": [ @@ -10520,7 +10719,7 @@ var functionMap = { "Returns the Number of Tidy accessibility warnings encountered for specified document." ], "tidy_clean_repair": [ - "boolean tidy_clean_repair()", + "bool tidy_clean_repair()", "Execute configured cleanup and repair operations on parsed markup" ], "tidy_config_count": [ @@ -10528,7 +10727,7 @@ var functionMap = { "Returns the Number of Tidy configuration errors encountered for specified document." ], "tidy_diagnose": [ - "boolean tidy_diagnose()", + "bool tidy_diagnose()", "Run configured diagnostics on parsed and repaired markup." ], "tidy_error_count": [ @@ -10544,7 +10743,7 @@ var functionMap = { "Get current Tidy configuarion" ], "tidy_get_error_buffer": [ - "string tidy_get_error_buffer([boolean detailed])", + "string tidy_get_error_buffer([bool detailed])", "Return warnings and errors which occured parsing the specified document" ], "tidy_get_head": [ @@ -10584,15 +10783,15 @@ var functionMap = { "Returns the value of the specified configuration option for the tidy document." ], "tidy_is_xhtml": [ - "boolean tidy_is_xhtml()", + "bool tidy_is_xhtml()", "Indicates if the document is a XHTML document." ], "tidy_is_xml": [ - "boolean tidy_is_xml()", + "bool tidy_is_xml()", "Indicates if the document is a generic (non HTML/XHTML) XML document." ], "tidy_parse_file": [ - "boolean tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", + "bool tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])", "Parse markup in file or URI" ], "tidy_parse_string": [ @@ -10600,11 +10799,11 @@ var functionMap = { "Parse a document stored in a string" ], "tidy_repair_file": [ - "boolean tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", + "bool tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])", "Repair a file using an optionally provided configuration file" ], "tidy_repair_string": [ - "boolean tidy_repair_string(string data [, mixed config_file [, string encoding]])", + "bool tidy_repair_string(string data [, mixed config_file [, string encoding]])", "Repair a string using an optionally provided configuration file" ], "tidy_warning_count": [ @@ -10612,7 +10811,7 @@ var functionMap = { "Returns the Number of Tidy warnings encountered for specified document." ], "time": [ - "int time(void)", + "int time()", "Return current UNIX timestamp" ], "time_nanosleep": [ @@ -10660,7 +10859,7 @@ var functionMap = { "Returns the Olson database version number." ], "tmpfile": [ - "resource tmpfile(void)", + "resource tmpfile()", "Create a temporary file that will be deleted automatically after use" ], "token_get_all": [ @@ -10728,7 +10927,7 @@ var functionMap = { "Takes a string representation of variable and recreates it" ], "unset": [ - "void unset (mixed var [, mixed var])", + "void unset(mixed var [, mixed var])", "Unset a given variable" ], "urldecode": [ @@ -10760,7 +10959,7 @@ var functionMap = { "Dumps a string representation of variable to output" ], "var_export": [ - "mixed var_export(mixed var [, bool return])", + "string var_export(mixed var [, bool return])", "Outputs or returns a string representation of a variable" ], "variant_abs": [ @@ -10888,7 +11087,7 @@ var functionMap = { "Return a formatted string" ], "wddx_add_vars": [ - "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", + "int wddx_add_vars(resource packet_id, mixed var_names [, mixed ...])", "Serializes given variables and adds them to packet given by packet_id" ], "wddx_deserialize": [ @@ -10912,7 +11111,7 @@ var functionMap = { "Creates a new packet and serializes given variables into a struct" ], "wordwrap": [ - "string wordwrap(string str [, int width [, string break [, boolean cut]]])", + "string wordwrap(string str [, int width [, string break [, bool cut]]])", "Wraps buffer to selected number of characters using string break char" ], "xml_error_string": [ @@ -11040,7 +11239,7 @@ var functionMap = { "Parses XML requests and call methods" ], "xmlrpc_server_create": [ - "resource xmlrpc_server_create(void)", + "resource xmlrpc_server_create()", "Creates an xmlrpc server" ], "xmlrpc_server_destroy": [ @@ -11228,51 +11427,51 @@ var functionMap = { "Write text - returns FALSE on error" ], "xsl_xsltprocessor_get_parameter": [ - "string xsl_xsltprocessor_get_parameter(string namespace, string name);", + "string xsl_xsltprocessor_get_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_has_exslt_support": [ - "bool xsl_xsltprocessor_has_exslt_support();", + "bool xsl_xsltprocessor_has_exslt_support()", "" ], "xsl_xsltprocessor_import_stylesheet": [ - "void xsl_xsltprocessor_import_stylesheet(domdocument doc);", - "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since:" + "void xsl_xsltprocessor_import_stylesheet(domdocument doc)", + "" ], "xsl_xsltprocessor_register_php_functions": [ - "void xsl_xsltprocessor_register_php_functions([mixed $restrict]);", + "void xsl_xsltprocessor_register_php_functions([mixed $restrict])", "" ], "xsl_xsltprocessor_remove_parameter": [ - "bool xsl_xsltprocessor_remove_parameter(string namespace, string name);", + "bool xsl_xsltprocessor_remove_parameter(string namespace, string name)", "" ], "xsl_xsltprocessor_set_parameter": [ - "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value]);", + "bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value])", "" ], "xsl_xsltprocessor_set_profiling": [ - "bool xsl_xsltprocessor_set_profiling(string filename) */", - "PHP_FUNCTION(xsl_xsltprocessor_set_profiling) { zval *id; xsl_object *intern; char *filename = NULL; int filename_len; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, \"s!\", &filename, &filename_len) == SUCCESS) { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); if (intern->profiling) { efree(intern->profiling); } if (filename != NULL) { intern->profiling = estrndup(filename,filename_len); } else { intern->profiling = NULL; } RETURN_TRUE; } else { WRONG_PARAM_COUNT; } } /* }}} end xsl_xsltprocessor_set_profiling" + "bool xsl_xsltprocessor_set_profiling(string filename)", + "" ], "xsl_xsltprocessor_transform_to_doc": [ - "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc);", - "URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html# Since:" + "domdocument xsl_xsltprocessor_transform_to_doc(domnode doc)", + "" ], "xsl_xsltprocessor_transform_to_uri": [ - "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri);", + "int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri)", "" ], "xsl_xsltprocessor_transform_to_xml": [ - "string xsl_xsltprocessor_transform_to_xml(domdocument doc);", + "string xsl_xsltprocessor_transform_to_xml(domdocument doc)", "" ], "zend_logo_guid": [ - "string zend_logo_guid(void)", + "string zend_logo_guid()", "Return the special ID used to request the Zend logo in phpinfo screens" ], "zend_version": [ - "string zend_version(void)", + "string zend_version()", "Get the version of the Zend Engine" ], "zip_close": [ @@ -11316,7 +11515,7 @@ var functionMap = { "Returns the next file in the archive" ], "zlib_get_coding_type": [ - "string zlib_get_coding_type(void)", + "string zlib_get_coding_type()", "Returns the coding type used for output compression" ] }; @@ -11367,7 +11566,9 @@ var variableMap = { "SERVER_PORT": 1, "SERVER_PROTOCOL": 1, "SERVER_SIGNATURE": 1, - "SERVER_SOFTWARE": 1 + "SERVER_SOFTWARE": 1, + "argv": 1, + "argc": 1 } }, "$_SESSION": { @@ -11375,6 +11576,12 @@ var variableMap = { }, "$GLOBALS": { type: "array" + }, + '$argv': { + type: "array" + }, + '$argc': { + type: "int" } }; @@ -11702,6 +11909,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -12039,6 +12247,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -12931,6 +13140,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -13057,6 +13267,7 @@ oop.inherits(Mode, HtmlMode); }; this.$id = "ace/mode/php"; + this.snippetFileId = "ace/snippets/php"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-prisma.js b/htdocs/includes/ace/src/mode-prisma.js new file mode 100644 index 00000000000..fc7048378e3 --- /dev/null +++ b/htdocs/includes/ace/src/mode-prisma.js @@ -0,0 +1,489 @@ +define("ace/mode/prisma_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var PrismaHighlightRules = function() { + + this.$rules = { + start: [{ + include: "#triple_comment" + }, { + include: "#double_comment" + }, { + include: "#model_block_definition" + }, { + include: "#config_block_definition" + }, { + include: "#enum_block_definition" + }, { + include: "#type_definition" + }], + "#model_block_definition": [{ + token: [ + "source.prisma.embedded.source", + "storage.type.model.prisma", + "source.prisma.embedded.source", + "entity.name.type.model.prisma", + "source.prisma.embedded.source", + "punctuation.definition.tag.prisma" + ], + regex: /^(\s*)(model|type)(\s+)([A-Za-z][\w]*)(\s+)({)/, + push: [{ + token: "punctuation.definition.tag.prisma", + regex: /\s*\}/, + next: "pop" + }, { + include: "#triple_comment" + }, { + include: "#double_comment" + }, { + include: "#field_definition" + }, { + defaultToken: "source.prisma.embedded.source" + }] + }], + "#enum_block_definition": [{ + token: [ + "source.prisma.embedded.source", + "storage.type.enum.prisma", + "source.prisma.embedded.source", + "entity.name.type.enum.prisma", + "source.prisma.embedded.source", + "punctuation.definition.tag.prisma" + ], + regex: /^(\s*)(enum)(\s+)([A-Za-z][\w]*)(\s+)({)/, + push: [{ + token: "punctuation.definition.tag.prisma", + regex: /\s*\}/, + next: "pop" + }, { + include: "#triple_comment" + }, { + include: "#double_comment" + }, { + include: "#enum_value_definition" + }, { + defaultToken: "source.prisma.embedded.source" + }] + }], + "#config_block_definition": [{ + token: [ + "source.prisma.embedded.source", + "storage.type.config.prisma", + "source.prisma.embedded.source", + "entity.name.type.config.prisma", + "source.prisma.embedded.source", + "punctuation.definition.tag.prisma" + ], + regex: /^(\s*)(generator|datasource)(\s+)([A-Za-z][\w]*)(\s+)({)/, + push: [{ + token: "source.prisma.embedded.source", + regex: /\s*\}/, + next: "pop" + }, { + include: "#triple_comment" + }, { + include: "#double_comment" + }, { + include: "#assignment" + }, { + defaultToken: "source.prisma.embedded.source" + }] + }], + "#assignment": [{ + token: [ + "text", + "variable.other.assignment.prisma", + "text", + "keyword.operator.terraform", + "text" + ], + regex: /^(\s*)(\w+)(\s*)(=)(\s*)/, + push: [{ + token: "text", + regex: /$/, + next: "pop" + }, { + include: "#value" + }, { + include: "#double_comment_inline" + }] + }], + "#field_definition": [{ + token: [ + "text", + "variable.other.assignment.prisma", + "invalid.illegal.colon.prisma", + "text", + "support.type.primitive.prisma", + "keyword.operator.list_type.prisma", + "keyword.operator.optional_type.prisma", + "invalid.illegal.required_type.prisma" + ], + regex: /^(\s*)(\w+)((?:\s*:)?)(\s+)(\w+)((?:\[\])?)((?:\?)?)((?:\!)?)/ + }, { + include: "#attribute_with_arguments" + }, { + include: "#attribute" + }], + "#type_definition": [{ + token: [ + "text", + "storage.type.type.prisma", + "text", + "entity.name.type.type.prisma", + "text", + "support.type.primitive.prisma" + ], + regex: /^(\s*)(type)(\s+)(\w+)(\s*=\s*)(\w+)/ + }, { + include: "#attribute_with_arguments" + }, { + include: "#attribute" + }], + "#enum_value_definition": [{ + token: [ + "text", + "variable.other.assignment.prisma", + "text" + ], + regex: /^(\s*)(\w+)(\s*$)/ + }, { + include: "#attribute_with_arguments" + }, { + include: "#attribute" + }], + "#attribute_with_arguments": [{ + token: [ + "entity.name.function.attribute.prisma", + "punctuation.definition.tag.prisma" + ], + regex: /(@@?[\w\.]+)(\()/, + push: [{ + token: "punctuation.definition.tag.prisma", + regex: /\)/, + next: "pop" + }, { + include: "#named_argument" + }, { + include: "#value" + }, { + defaultToken: "source.prisma.attribute.with_arguments" + }] + }], + "#attribute": [{ + token: "entity.name.function.attribute.prisma", + regex: /@@?[\w\.]+/ + }], + "#array": [{ + token: "source.prisma.array", + regex: /\[/, + push: [{ + token: "source.prisma.array", + regex: /\]/, + next: "pop" + }, { + include: "#value" + }, { + defaultToken: "source.prisma.array" + }] + }], + "#value": [{ + include: "#array" + }, { + include: "#functional" + }, { + include: "#literal" + }], + "#functional": [{ + token: [ + "support.function.functional.prisma", + "punctuation.definition.tag.prisma" + ], + regex: /(\w+)(\()/, + push: [{ + token: "punctuation.definition.tag.prisma", + regex: /\)/, + next: "pop" + }, { + include: "#value" + }, { + defaultToken: "source.prisma.functional" + }] + }], + "#literal": [{ + include: "#boolean" + }, { + include: "#number" + }, { + include: "#double_quoted_string" + }, { + include: "#identifier" + }], + "#identifier": [{ + token: "support.constant.constant.prisma", + regex: /\b(?:\w)+\b/ + }], + "#map_key": [{ + token: [ + "variable.parameter.key.prisma", + "text", + "punctuation.definition.separator.key-value.prisma", + "text" + ], + regex: /(\w+)(\s*)(:)(\s*)/ + }], + "#named_argument": [{ + include: "#map_key" + }, { + include: "#value" + }], + "#triple_comment": [{ + token: "comment.prisma", + regex: /\/\/\//, + push: [{ + token: "comment.prisma", + regex: /$/, + next: "pop" + }, { + defaultToken: "comment.prisma" + }] + }], + "#double_comment": [{ + token: "comment.prisma", + regex: /\/\//, + push: [{ + token: "comment.prisma", + regex: /$/, + next: "pop" + }, { + defaultToken: "comment.prisma" + }] + }], + "#double_comment_inline": [{ + token: "comment.prisma", + regex: /\/\/[^$]*/ + }], + "#boolean": [{ + token: "constant.language.boolean.prisma", + regex: /\b(?:true|false)\b/ + }], + "#number": [{ + token: "constant.numeric.prisma", + regex: /(?:0(?:x|X)[0-9a-fA-F]*|(?:\+|-)?\b(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:(?:e|E)(?:\+|-)?[0-9]+)?)(?:[LlFfUuDdg]|UL|ul)?\b/ + }], + "#double_quoted_string": [{ + token: "string.quoted.double.start.prisma", + regex: /"/, + push: [{ + token: "string.quoted.double.end.prisma", + regex: /"/, + next: "pop" + }, { + include: "#string_interpolation" + }, { + token: "string.quoted.double.prisma", + regex: /[\w\-\/\._\\%@:\?=]+/ + }, { + defaultToken: "unnamed" + }] + }], + "#string_interpolation": [{ + token: "keyword.control.interpolation.start.prisma", + regex: /\$\{/, + push: [{ + token: "keyword.control.interpolation.end.prisma", + regex: /\s*\}/, + next: "pop" + }, { + include: "#value" + }, { + defaultToken: "source.tag.embedded.source.prisma" + }] + }] + }; + + this.normalizeRules(); +}; + +PrismaHighlightRules.metaData = { + name: "Prisma", + scopeName: "source.prisma" +}; + + +oop.inherits(PrismaHighlightRules, TextHighlightRules); + +exports.PrismaHighlightRules = PrismaHighlightRules; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/prisma",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/prisma_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var PrismaHighlightRules = require("./prisma_highlight_rules").PrismaHighlightRules; +var FoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = PrismaHighlightRules; + this.foldingRules = new FoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = "//"; + this.$id = "ace/mode/prisma"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/prisma"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-protobuf.js b/htdocs/includes/ace/src/mode-protobuf.js index 0d1a19a5cc4..a4463de826b 100644 --- a/htdocs/includes/ace/src/mode-protobuf.js +++ b/htdocs/includes/ace/src/mode-protobuf.js @@ -65,7 +65,7 @@ var c_cppHighlightRules = function() { var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + - "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + + "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); @@ -489,6 +489,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/c_cpp"; + this.snippetFileId = "ace/snippets/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-puppet.js b/htdocs/includes/ace/src/mode-puppet.js index ea6b2356261..d647dea6f7e 100644 --- a/htdocs/includes/ace/src/mode-puppet.js +++ b/htdocs/includes/ace/src/mode-puppet.js @@ -44,7 +44,7 @@ var PuppetHighlightRules = function () { }, { token: "multiline.comment.begin.puppet", - regex: '^\\s*\\/\\*\\s*$', + regex: '^\\s*\\/\\*', push: "blockComment" }, { @@ -82,11 +82,7 @@ var PuppetHighlightRules = function () { } ], blockComment: [{ - regex: "^\\s*\\/\\*\\s*$", - token: "multiline.comment.begin.puppet", - push: "blockComment" - }, { - regex: "^\\s*\\*\\/\\s*$", + regex: "\\*\\/", token: "multiline.comment.end.puppet", next: "pop" }, { @@ -355,6 +351,9 @@ oop.inherits(Mode, TextMode); (function () { + this.lineCommentStart = "#"; + this.blockComment = {start: "/*", end: "*/"}; + this.$id = "ace/mode/puppet"; }).call(Mode.prototype); diff --git a/htdocs/includes/ace/src/mode-python.js b/htdocs/includes/ace/src/mode-python.js index e2045c8ac18..6c46043a46b 100644 --- a/htdocs/includes/ace/src/mode-python.js +++ b/htdocs/includes/ace/src/mode-python.js @@ -343,10 +343,10 @@ var PythonHighlightRules = function() { regex: "\\s+" }, { token: "string", - regex: "'(.)*'" + regex: "'[^']*'" }, { token: "string", - regex: '"(.)*"' + regex: '"[^"]*"' }, { token: "function.support", regex: "(!s|!r|!a)" @@ -494,6 +494,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/python"; + this.snippetFileId = "ace/snippets/python"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-qml.js b/htdocs/includes/ace/src/mode-qml.js new file mode 100644 index 00000000000..ba61ca66439 --- /dev/null +++ b/htdocs/includes/ace/src/mode-qml.js @@ -0,0 +1,381 @@ +define("ace/mode/qml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + + var QmlHighlightRules = function() { + var keywordMapper = this.createKeywordMapper({ + "variable.language": + "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors + "Namespace|QName|XML|XMLList|" + // E4X + "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors + "SyntaxError|TypeError|URIError|" + + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions + "isNaN|parseFloat|parseInt|" + + "JSON|Math|" + // Other + "this|arguments|prototype|window|document" , // Pseudo + "keyword": + "const|yield|import|get|set|async|await|" + + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + + "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + + "__parent__|__count__|escape|unescape|with|__proto__|" + + "class|enum|extends|super|export|implements|private|public|interface|package|protected|static|" + + "readonly|string|int|bool|date|color|url|real|double|var|variant|" + + "height|width|anchors|parent|" + + "Abstract3DSeries|AbstractActionInput|AbstractAnimation|AbstractAxis|AbstractAxis3D|AbstractAxisInput|" + + "AbstractBarSeries|AbstractButton|AbstractClipAnimator|AbstractClipBlendNode|AbstractDataProxy|AbstractGraph3D|" + + "AbstractInputHandler3D|AbstractPhysicalDevice|AbstractRayCaster|AbstractSeries|AbstractSkeleton|AbstractTextureImage|" + + "Accelerometer|AccelerometerReading|Accessible|Action|ActionGroup|ActionInput|" + + "AdditiveClipBlend|Address|Affector|Age|AlphaCoverage|AlphaTest|" + + "Altimeter|AltimeterReading|AmbientLightReading|AmbientLightSensor|AmbientTemperatureReading|AmbientTemperatureSensor|" + + "AnalogAxisInput|AnchorAnimation|AnchorChanges|AngleDirection|AnimatedImage|AnimatedSprite|" + + "Animation|AnimationController|AnimationGroup|Animator|ApplicationWindow|ApplicationWindowStyle|" + + "AreaSeries|Armature|AttenuationModelInverse|AttenuationModelLinear|Attractor|Attribute|" + + "Audio|AudioCategory|AudioEngine|AudioListener|AudioSample|AuthenticationDialogRequest|" + + "Axis|AxisAccumulator|AxisSetting|BackspaceKey|Bar3DSeries|BarCategoryAxis|" + + "BarDataProxy|BarSeries|BarSet|Bars3D|BaseKey|Behavior|" + + "Binding|Blend|BlendEquation|BlendEquationArguments|BlendedClipAnimator|BlitFramebuffer|" + + "BluetoothDiscoveryModel|BluetoothService|BluetoothSocket|BorderImage|BorderImageMesh|BoxPlotSeries|" + + "BoxSet|BrightnessContrast|Buffer|BusyIndicator|BusyIndicatorStyle|Button|" + + "ButtonAxisInput|ButtonGroup|ButtonStyle|Calendar|CalendarStyle|Camera|" + + "Camera3D|CameraCapabilities|CameraCapture|CameraExposure|CameraFlash|CameraFocus|" + + "CameraImageProcessing|CameraLens|CameraRecorder|CameraSelector|CandlestickSeries|CandlestickSet|" + + "Canvas|Canvas3D|Canvas3DAbstractObject|Canvas3DActiveInfo|Canvas3DBuffer|Canvas3DContextAttributes|" + + "Canvas3DFrameBuffer|Canvas3DProgram|Canvas3DRenderBuffer|Canvas3DShader|Canvas3DShaderPrecisionFormat|Canvas3DTexture|" + + "Canvas3DTextureProvider|Canvas3DUniformLocation|CanvasGradient|CanvasImageData|CanvasPixelArray|Category|" + + "CategoryAxis|CategoryAxis3D|CategoryModel|CategoryRange|ChangeLanguageKey|ChartView|" + + "CheckBox|CheckBoxStyle|CheckDelegate|CircularGauge|CircularGaugeStyle|ClearBuffers|" + + "ClipAnimator|ClipPlane|CloseEvent|ColorAnimation|ColorDialog|ColorDialogRequest|" + + "ColorGradient|ColorGradientStop|ColorMask|ColorOverlay|Colorize|Column|" + + "ColumnLayout|ComboBox|ComboBoxStyle|Compass|CompassReading|Component|Component3D|" + + "ComputeCommand|ConeGeometry|ConeMesh|ConicalGradient|Connections|ContactDetail|" + + "ContactDetails|Container|Context2D|Context3D|ContextMenuRequest|Control|" + + "CoordinateAnimation|CuboidGeometry|CuboidMesh|CullFace|CumulativeDirection|" + + "Custom3DItem|Custom3DLabel|Custom3DVolume|CustomParticle|CylinderGeometry|CylinderMesh|" + + "Date|DateTimeAxis|DelayButton|DelayButtonStyle|DelegateChoice|DelegateChooser|DelegateModel|" + + "DelegateModelGroup|DepthTest|Desaturate|Dial|DialStyle|Dialog|DialogButtonBox|DiffuseMapMaterial|" + + "DiffuseSpecularMapMaterial|DiffuseSpecularMaterial|Direction|DirectionalBlur|DirectionalLight|DispatchCompute|" + + "Displace|DistanceReading|DistanceSensor|Dithering|DoubleValidator|Drag|DragEvent|DragHandler|Drawer|DropArea|" + + "DropShadow|DwmFeatures|DynamicParameter|EditorialModel|Effect|EllipseShape|Emitter|EnterKey|EnterKeyAction|" + + "Entity|EntityLoader|EnvironmentLight|EventConnection|EventPoint|EventTouchPoint|ExclusiveGroup|ExtendedAttributes|" + + "ExtrudedTextGeometry|ExtrudedTextMesh|FastBlur|FileDialog|FileDialogRequest|FillerKey|FilterKey|FinalState|" + + "FirstPersonCameraController|Flickable|Flipable|Flow|FocusScope|FolderListModel|FontDialog|FontLoader|" + + "FontMetrics|FormValidationMessageRequest|ForwardRenderer|Frame|FrameAction|FrameGraphNode|Friction|" + + "FrontFace|FrustumCulling|FullScreenRequest|GLStateDumpExt|GammaAdjust|Gauge|GaugeStyle|GaussianBlur|" + + "GeocodeModel|Geometry|GeometryRenderer|GestureEvent|Glow|GoochMaterial|Gradient|GradientStop|GraphicsApiFilter|" + + "GraphicsInfo|Gravity|Grid|GridLayout|GridMesh|GridView|GroupBox|GroupGoal|Gyroscope|GyroscopeReading|HBarModelMapper|" + + "HBoxPlotModelMapper|HCandlestickModelMapper|HPieModelMapper|HXYModelMapper|HandlerPoint|HandwritingInputPanel|" + + "HandwritingModeKey|HeightMapSurfaceDataProxy|HideKeyboardKey|HistoryState|HolsterReading|HolsterSensor|HorizontalBarSeries|" + + "|HorizontalPercentBarSeries|HorizontalStackedBarSeries|HoverHandler|HueSaturation|HumidityReading|HumiditySensor|" + + "IRProximityReading|IRProximitySensor|Icon|Image|ImageModel|ImageParticle|InnerShadow|InputChord|InputContext|InputEngine|" + + "InputHandler3D|InputMethod|InputModeKey|InputPanel|InputSequence|InputSettings|Instantiator|IntValidator|InvokedServices|" + + "Item|ItemDelegate|ItemGrabResult|ItemModelBarDataProxy|ItemModelScatterDataProxy|ItemModelSurfaceDataProxy|ItemParticle|" + + "ItemSelectionModel|IviApplication|IviSurface|JavaScriptDialogRequest|Joint|JumpList|JumpListCategory|JumpListDestination|" + + "JumpListLink|JumpListSeparator|Key|KeyEvent|KeyIcon|KeyNavigation|KeyPanel|KeyboardColumn|KeyboardDevice|KeyboardHandler|" + + "KeyboardLayout|KeyboardLayoutLoader|KeyboardRow|KeyboardStyle|KeyframeAnimation|Keys|Label|Layer|LayerFilter|Layout|" + + "LayoutMirroring|Legend|LerpBlend|LevelAdjust|LevelOfDetail|LevelOfDetailBoundingSphere|LevelOfDetailLoader|" + + "LevelOfDetailSwitch|LidReading|LidSensor|Light|Light3D|LightReading|LightSensor|LineSeries|LineShape|LineWidth|" + + "LinearGradient|ListElement|ListModel|ListView|Loader|Locale|Location|LogValueAxis|LogValueAxis3DFormatter|LoggingCategory|" + + "LogicalDevice|Magnetometer|MagnetometerReading|Map|MapCircle|MapCircleObject|MapCopyrightNotice|MapGestureArea|MapIconObject|" + + "MapItemGroup|MapItemView|MapObjectView|MapParameter|MapPinchEvent|MapPolygon|MapPolygonObject|MapPolyline|MapPolylineObject|" + + "MapQuickItem|MapRectangle|MapRoute|MapRouteObject|MapType|Margins|MaskShape|MaskedBlur|Material|Matrix4x4|MediaPlayer|" + + "MemoryBarrier|Menu|MenuBar|MenuBarItem|MenuBarStyle|MenuItem|MenuSeparator|MenuStyle|Mesh|MessageDialog|ModeKey|MorphTarget|" + + "MorphingAnimation|MouseArea|MouseDevice|MouseEvent|MouseHandler|MultiPointHandler|MultiPointTouchArea|MultiSampleAntiAliasing|" + + "Navigator|NdefFilter|NdefMimeRecord|NdefRecord|NdefTextRecord|NdefUriRecord|NearField|NoDepthMask|NoDraw|Node|NodeInstantiator|" + + "NormalDiffuseMapAlphaMaterial|NormalDiffuseMapMaterial|NormalDiffuseSpecularMapMaterial|Number|NumberAnimation|NumberKey|Object3D|" + + "ObjectModel|ObjectPicker|OpacityAnimator|OpacityMask|OpenGLInfo|OrbitCameraController|OrientationReading|OrientationSensor|Overlay|" + + "Package|Page|PageIndicator|Pane|ParallelAnimation|Parameter|ParentAnimation|ParentChange|Particle|ParticleGroup|ParticlePainter|" + + "ParticleSystem|Path|PathAngleArc|PathAnimation|PathArc|PathAttribute|PathCubic|PathCurve|PathElement|PathInterpolator|PathLine|" + + "PathMove|PathPercent|PathQuad|PathSvg|PathView|PauseAnimation|PerVertexColorMaterial|PercentBarSeries|PhongAlphaMaterial|" + + "PhongMaterial|PickEvent|PickLineEvent|PickPointEvent|PickTriangleEvent|PickingSettings|Picture|PieMenu|PieMenuStyle|PieSeries|" + + "PieSlice|PinchArea|PinchEvent|PinchHandler|Place|PlaceAttribute|PlaceSearchModel|PlaceSearchSuggestionModel|PlaneGeometry|" + + "PlaneMesh|PlayVariation|Playlist|PlaylistItem|Plugin|PluginParameter|PointDirection|PointHandler|PointLight|PointSize|" + + "PointerDevice|PointerDeviceHandler|PointerEvent|PointerHandler|PolarChartView|PolygonOffset|Popup|Position|PositionSource|" + + "Positioner|PressureReading|PressureSensor|Product|ProgressBar|ProgressBarStyle|PropertyAction|PropertyAnimation|PropertyChanges|" + + "ProximityFilter|ProximityReading|ProximitySensor|QAbstractState|QAbstractTransition|QSignalTransition|" + + "QVirtualKeyboardSelectionListModel|Qt|QtMultimedia|QtObject|QtPositioning|QuaternionAnimation|QuotaRequest|RadialBlur|" + + "RadialGradient|Radio|RadioButton|RadioButtonStyle|RadioData|RadioDelegate|RangeSlider|Ratings|RayCaster|Rectangle|" + + "RectangleShape|RectangularGlow|RecursiveBlur|RegExpValidator|RegisterProtocolHandlerRequest|RenderCapture|" + + "RenderCaptureReply|RenderPass|RenderPassFilter|RenderSettings|RenderState|RenderStateSet|RenderSurfaceSelector|" + + "RenderTarget|RenderTargetOutput|RenderTargetSelector|Repeater|ReviewModel|Rotation|RotationAnimation|RotationAnimator|" + + "RotationReading|RotationSensor|RoundButton|Route|RouteLeg|RouteManeuver|RouteModel|RouteQuery|RouteSegment|Row|" + + "RowLayout|Scale|ScaleAnimator|Scatter3D|Scatter3DSeries|ScatterDataProxy|ScatterSeries|Scene2D|Scene3D|SceneLoader|" + + "ScissorTest|Screen|ScreenRayCaster|ScriptAction|ScrollBar|ScrollIndicator|ScrollView|ScrollViewStyle|ScxmlStateMachine|" + + "SeamlessCubemap|SelectionListItem|Sensor|SensorGesture|SensorGlobal|SensorReading|SequentialAnimation|Settings|" + + "SettingsStore|ShaderEffect|ShaderEffectSource|ShaderProgram|ShaderProgramBuilder|Shape|ShellSurface|ShellSurfaceItem|" + + "ShiftHandler|ShiftKey|Shortcut|SignalSpy|SignalTransition|SinglePointHandler|Skeleton|SkeletonLoader|Slider|SliderStyle|" + + "SmoothedAnimation|SortPolicy|Sound|SoundEffect|SoundInstance|SpaceKey|SphereGeometry|SphereMesh|SpinBox|SpinBoxStyle|" + + "SplineSeries|SplitView|SpotLight|SpringAnimation|Sprite|SpriteGoal|SpriteSequence|Stack|StackLayout|StackView|" + + "StackViewDelegate|StackedBarSeries|State|StateChangeScript|StateGroup|StateMachine|StateMachineLoader|StatusBar|" + + "StatusBarStyle|StatusIndicator|StatusIndicatorStyle|StencilMask|StencilOperation|StencilOperationArguments|StencilTest|" + + "StencilTestArguments|Store|String|Supplier|Surface3D|Surface3DSeries|SurfaceDataProxy|SwipeDelegate|SwipeView|Switch|" + + "SwitchDelegate|SwitchStyle|SymbolModeKey|SystemPalette|Tab|TabBar|TabButton|TabView|TabViewStyle|TableView|TableViewColumn|" + + "TableViewStyle|TapHandler|TapReading|TapSensor|TargetDirection|TaskbarButton|Technique|TechniqueFilter|TestCase|Text|TextArea|" + + "TextAreaStyle|TextEdit|TextField|TextFieldStyle|TextInput|TextMetrics|TextureImage|TextureImageFactory|Theme3D|ThemeColor|" + + "ThresholdMask|ThumbnailToolBar|ThumbnailToolButton|TiltReading|TiltSensor|TimeoutTransition|Timer|ToggleButton|" + + "ToggleButtonStyle|ToolBar|ToolBarStyle|ToolButton|ToolSeparator|ToolTip|Torch|TorusGeometry|TorusMesh|TouchEventSequence|" + + "TouchInputHandler3D|TouchPoint|Trace|TraceCanvas|TraceInputArea|TraceInputKey|TraceInputKeyPanel|TrailEmitter|Transaction|" + + "Transform|Transition|Translate|TreeView|TreeViewStyle|Tumbler|TumblerColumn|TumblerStyle|Turbulence|UniformAnimator|User|" + + "VBarModelMapper|VBoxPlotModelMapper|VCandlestickModelMapper|VPieModelMapper|VXYModelMapper|ValueAxis|ValueAxis3D|" + + "ValueAxis3DFormatter|Vector3dAnimation|VertexBlendAnimation|Video|VideoOutput|ViewTransition|Viewport|" + + "VirtualKeyboardSettings|Wander|WavefrontMesh|WaylandClient|WaylandCompositor|WaylandHardwareLayer|" + + "WaylandOutput|WaylandQuickItem|WaylandSeat|WaylandSurface|WaylandView|Waypoint|" + + "WebChannel|WebEngine|WebEngineAction|WebEngineCertificateError|WebEngineDownloadItem|WebEngineHistory|" + + "WebEngineHistoryListModel|WebEngineLoadRequest|WebEngineNavigationRequest|WebEngineNewViewRequest|WebEngineProfile|WebEngineScript|" + + "WebEngineSettings|WebEngineView|WebSocket|WebSocketServer|WebView|WebViewLoadRequest|" + + "WheelEvent|Window|WlShell|WlShellSurface|WorkerScript|XAnimator|" + + "XYPoint|XYSeries|XdgDecorationManagerV1|XdgPopup|XdgPopupV5|XdgPopupV6|" + + "XdgShell|XdgShellV5|XdgShellV6|XdgSurface|XdgSurfaceV5|XdgSurfaceV6|" + + "XdgToplevel|XdgToplevelV6|XmlListModel|XmlRole|YAnimator|ZoomBlur", + "storage.type": + "const|let|var|function|" + // js + "property|", // qml + "constant.language": + "null|Infinity|NaN|undefined", + "support.function": + "print|console\\.log", + "constant.language.boolean": "true|false" + }, "identifier"); + this.$rules = { + "start" : [ + { + token : "string", // single line + regex : '"', + next : "string" + }, { + token : "constant.numeric", // hex + regex : "0[xX][0-9a-fA-F]+\\b" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false)\\b" + }, { + token : "text", + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "comment", + regex : "\\/\\/.*$" + }, { + token : "comment.start", + regex : "\\/\\*", + next : "comment" + }, { + token : "paren.lparen", + regex : "[[({]" + }, { + token : "paren.rparen", + regex : "[\\])}]" + }, { + token : "text", + regex : "\\s+" + }, { + token : keywordMapper, + regex : "\\b\\w+\\b" + } + ], + "string" : [ + { + token : "constant.language.escape", + regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/ + }, { + token : "string", + regex : '"|$', + next : "start" + }, { + defaultToken : "string" + } + ], + "comment" : [ + { + token : "comment.end", + regex : "\\*\\/", + next : "start" + }, { + defaultToken: "comment" + } + ] + }; + + }; + + oop.inherits(QmlHighlightRules, TextHighlightRules); + + exports.QmlHighlightRules = QmlHighlightRules; + }); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/qml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/qml_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var TextMode = require("./text").Mode; + var QmlHighlightRules = require("./qml_highlight_rules").QmlHighlightRules; + var FoldMode = require("./folding/cstyle").FoldMode; + + var Mode = function() { + this.HighlightRules = QmlHighlightRules; + this.foldingRules = new FoldMode(); + this.$behaviour = this.$defaultBehaviour; + }; + oop.inherits(Mode, TextMode); + + (function() { + this.lineCommentStart = "//"; + this.blockComment = {start: "/*", end: "*/"}; + this.$quotes = { '"': '"', "'": "'" }; + this.$id = "ace/mode/qml"; + }).call(Mode.prototype); + + exports.Mode = Mode; + }); (function() { + window.require(["ace/mode/qml"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-r.js b/htdocs/includes/ace/src/mode-r.js index 5a6ca976129..2fd49378749 100644 --- a/htdocs/includes/ace/src/mode-r.js +++ b/htdocs/includes/ace/src/mode-r.js @@ -299,6 +299,7 @@ define("ace/mode/r",["require","exports","module","ace/unicode","ace/range","ace this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "._]|\s])+", "g"); this.$id = "ace/mode/r"; + this.snippetFileId = "ace/snippets/r"; }).call(Mode.prototype); exports.Mode = Mode; }); (function() { diff --git a/htdocs/includes/ace/src/mode-perl6.js b/htdocs/includes/ace/src/mode-raku.js similarity index 96% rename from htdocs/includes/ace/src/mode-perl6.js rename to htdocs/includes/ace/src/mode-raku.js index 4d25513c3ee..d2a829c08cc 100644 --- a/htdocs/includes/ace/src/mode-perl6.js +++ b/htdocs/includes/ace/src/mode-raku.js @@ -1,10 +1,10 @@ -define("ace/mode/perl6_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +define("ace/mode/raku_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; -var Perl6HighlightRules = function() { +var RakuHighlightRules = function() { var keywords = ( "my|our|class|role|grammar|is|does|sub|method|submethod|try|" + @@ -34,7 +34,7 @@ var Perl6HighlightRules = function() { "Pod::Block|Pod::Block::Code|Pod::Block::Comment|Pod::Block::Declarator|"+ "Pod::Block::Named|Pod::Block::Para|Pod::Block::Table|Pod::Heading|Pod::Item|"+ "Positional|PositionalBindFailover|Proc|Proc::Async|Promise|Proxy|PseudoStash|"+ - "QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+ + "Raku|QuantHash|Range|Rat|Rational|RatStr|Real|Regex|Routine|Scalar|Scheduler|"+ "Semaphore|Seq|Set|SetHash|Setty|Signature|Slip|Stash|Str|StrDistance|Stringy|"+ "Sub|Submethod|Supplier|Supplier::Preserving|Supply|Systemic|Tap|Telemetry|"+ "Telemetry::Instrument::Thread|Telemetry::Instrument::Usage|Telemetry::Period|"+ @@ -120,7 +120,7 @@ var Perl6HighlightRules = function() { "positional|posix|postfix|postmatch|precomp-ext|precomp-target|pred|prefix|prematch|prepend|"+ "print|printf|print-nl|print-to|private|private_method_table|proc|produce|Promise|prompt|"+ "protect|pull-one|push|push-all|push-at-least|push-exactly|push-until-lazy|put|"+ - "qualifier-type|quit|r|race|radix|rand|range|raw|re|read|readchars|readonly|"+ + "qualifier-type|quit|r|race|radix|raku|rand|range|raw|re|read|readchars|readonly|"+ "ready|Real|reallocate|reals|reason|rebless|receive|recv|redispatcher|redo|reduce|"+ "rel2abs|relative|release|rename|repeated|replacement|report|reserved|resolve|"+ "restore|result|resume|rethrow|reverse|right|rindex|rmdir|roles_to_compose|"+ @@ -339,9 +339,9 @@ var Perl6HighlightRules = function() { }; }; -oop.inherits(Perl6HighlightRules, TextHighlightRules); +oop.inherits(RakuHighlightRules, TextHighlightRules); -exports.Perl6HighlightRules = Perl6HighlightRules; +exports.RakuHighlightRules = RakuHighlightRules; }); define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { @@ -524,17 +524,17 @@ oop.inherits(FoldMode, BaseFoldMode); }); -define("ace/mode/perl6",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/perl6_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module) { +define("ace/mode/raku",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/raku_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; -var Perl6HighlightRules = require("./perl6_highlight_rules").Perl6HighlightRules; +var RakuHighlightRules = require("./raku_highlight_rules").RakuHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { - this.HighlightRules = Perl6HighlightRules; + this.HighlightRules = RakuHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new CStyleFoldMode({start: "^=(begin)\\b", end: "^=(end)\\b"}); @@ -579,12 +579,12 @@ oop.inherits(Mode, TextMode); this.$outdent.autoOutdent(doc, row); }; - this.$id = "ace/mode/perl6"; + this.$id = "ace/mode/raku"; }).call(Mode.prototype); exports.Mode = Mode; }); (function() { - window.require(["ace/mode/perl6"], function(m) { + window.require(["ace/mode/raku"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; } diff --git a/htdocs/includes/ace/src/mode-razor.js b/htdocs/includes/ace/src/mode-razor.js index 5733efd213e..49b7588eee5 100644 --- a/htdocs/includes/ace/src/mode-razor.js +++ b/htdocs/includes/ace/src/mode-razor.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2858,6 +2861,7 @@ oop.inherits(Mode, HtmlMode); }; this.$id = "ace/mode/razor"; + this.snippetFileId = "ace/snippets/razor"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-rhtml.js b/htdocs/includes/ace/src/mode-rhtml.js index f389e63d28e..de4788dfd88 100644 --- a/htdocs/includes/ace/src/mode-rhtml.js +++ b/htdocs/includes/ace/src/mode-rhtml.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-rst.js b/htdocs/includes/ace/src/mode-rst.js index 8a093c05701..23e17db0989 100644 --- a/htdocs/includes/ace/src/mode-rst.js +++ b/htdocs/includes/ace/src/mode-rst.js @@ -242,6 +242,7 @@ oop.inherits(Mode, TextMode); this.type = "text"; this.$id = "ace/mode/rst"; + this.snippetFileId = "ace/snippets/rst"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-ruby.js b/htdocs/includes/ace/src/mode-ruby.js index 6e8afa36877..12398cc9193 100644 --- a/htdocs/includes/ace/src/mode-ruby.js +++ b/htdocs/includes/ace/src/mode-ruby.js @@ -8,17 +8,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -28,9 +28,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -70,18 +95,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -97,126 +123,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -233,7 +324,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -248,38 +339,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -332,94 +646,271 @@ var MatchingBraceOutdent = function() {}; exports.MatchingBraceOutdent = MatchingBraceOutdent; }); -define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { +define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var BaseFoldMode = require("./fold_mode").FoldMode; var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function () { +}; -var FoldMode = exports.FoldMode = function() {}; oop.inherits(FoldMode, BaseFoldMode); -(function() { - - this.getFoldWidgetRange = function(session, foldStyle, row) { - var range = this.indentationBlock(session, row); - if (range) - return range; - - var re = /\S/; - var line = session.getLine(row); - var startLevel = line.search(re); - if (startLevel == -1 || line[startLevel] != "#") - return; - - var startColumn = line.length; - var maxRow = session.getLength(); - var startRow = row; - var endRow = row; - - while (++row < maxRow) { - line = session.getLine(row); - var level = line.search(re); - - if (level == -1) - continue; - - if (line[level] != "#") - break; - - endRow = row; - } - - if (endRow > startRow) { - var endColumn = session.getLine(endRow).length; - return new Range(startRow, startColumn, endRow, endColumn); - } +(function () { + this.indentKeywords = { + "class": 1, + "def": 1, + "module": 1, + "do": 1, + "unless": 1, + "if": 1, + "while": 1, + "for": 1, + "until": 1, + "begin": 1, + "else": 0, + "elsif": 0, + "rescue": 0, + "ensure": 0, + "when": 0, + "end": -1, + "case": 1, + "=begin": 1, + "=end": -1 }; - this.getFoldWidget = function(session, foldStyle, row) { - var line = session.getLine(row); - var indent = line.search(/\S/); - var next = session.getLine(row + 1); - var prev = session.getLine(row - 1); - var prevIndent = prev.search(/\S/); - var nextIndent = next.search(/\S/); - if (indent == -1) { - session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; - return ""; - } - if (prevIndent == -1) { - if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { - session.foldWidgets[row - 1] = ""; - session.foldWidgets[row + 1] = ""; + this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; + this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; + + this.getFoldWidget = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + + if (isStart && !isEnd) { + var match = line.match(this.foldingStartMarker); + if (match[1]) { + if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { + if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { + return; + } + if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { + return; + } + } + + if (match[1] == "when") { + if (/\sthen\s/.test(line) === true) { + return; + } + } + if (session.getTokenAt(row, match.index + 2).type === "keyword") + return "start"; + } else if (match[3]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "start"; + } else { return "start"; } - } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { - if (session.getLine(row - 2).search(/\S/) == -1) { - session.foldWidgets[row - 1] = "start"; - session.foldWidgets[row + 1] = ""; - return ""; + } + if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) + return ""; + + var match = line.match(this.foldingStopMarker); + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return "end"; + } else if (match[1]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "end"; + } else + return "end"; + }; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.doc.getLine(row); + var match = this.foldingStartMarker.exec(line); + if (match) { + if (match[1] || match[3]) + return this.rubyBlock(session, row, match.index + 2); + + return this.openingBracketBlock(session, "{", row, match.index); + } + + var match = this.foldingStopMarker.exec(line); + if (match) { + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return this.rubyBlock(session, row, match.index + 1); + } + + if (match[1] === "=end") { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return this.rubyBlock(session, row, match.index + 1); + } + + return this.closingBracketBlock(session, "}", row, match.index + match[0].length); + } + }; + + this.rubyBlock = function (session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword" && token.type != "comment.multiline")) + return; + + var val = token.value; + var line = session.getLine(row); + switch (token.value) { + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + return; + } + var dir = this.indentKeywords[val]; + break; + case "when": + if (/\sthen\s/.test(line)) { + return; + } + case "elsif": + case "rescue": + case "ensure": + var dir = 1; + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line)) { + return; + } + var dir = 1; + break; + default: + var dir = this.indentKeywords[val]; + break; + } + + var stack = [val]; + if (!dir) + return; + + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(stream.getCurrentTokenRange()); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + if (token.type == "comment.multiline") { + while (token = stream.step()) { + if (token.type !== "comment.multiline") + continue; + if (dir == 1) { + startColumn = 6; + if (token.value == "=end") { + break; + } + } else { + if (token.value == "=begin") { + break; + } + } + } + } else { + while (token = stream.step()) { + var ignore = false; + if (token.type !== "keyword") + continue; + var level = dir * this.indentKeywords[token.value]; + line = session.getLine(stream.getCurrentTokenRow()); + switch (token.value) { + case "do": + for (var i = stream.$tokenIndex - 1; i >= 0; i--) { + var prevToken = stream.$rowTokens[i]; + if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { + level = 0; + break; + } + } + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "when": + if (/\sthen\s/.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(token.value); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + if ((val == "while" || val == "until" || val == "for") && token.value != "do") { + break; + } + if (token.value == "do" && dir == -1 && level != 0) + break; + if (token.value != "do") + break; + } + + if (level === 0) { + stack.unshift(token.value); + } + } } } - if (prevIndent!= -1 && prevIndent < indent) - session.foldWidgets[row - 1] = "start"; - else - session.foldWidgets[row - 1] = ""; + if (!token) + return null; - if (indent < nextIndent) - return "start"; - else - return ""; + if (tokenRange) { + ranges.push(stream.getCurrentTokenRange()); + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + if (token.type === "comment.multiline") { + var endColumn = 6; + } else { + var endColumn = session.getLine(row).length; + } + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); }; }).call(FoldMode.prototype); }); -define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) { +define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); @@ -428,13 +919,14 @@ 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 FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new FoldMode(); + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); @@ -449,7 +941,7 @@ oop.inherits(Mode, TextMode); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; - if (tokens.length && tokens[tokens.length-1].type == "comment") { + if (tokens.length && tokens[tokens.length - 1].type == "comment") { return indent; } @@ -457,7 +949,7 @@ oop.inherits(Mode, TextMode); var match = line.match(/^.*[\{\(\[]\s*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else|when)\s*/); + var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } @@ -467,7 +959,7 @@ oop.inherits(Mode, TextMode); }; this.checkOutdent = function(state, line, input) { - return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); + return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { @@ -480,11 +972,24 @@ oop.inherits(Mode, TextMode); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) - session.remove(new Range(row, indent.length-tab.length, row, indent.length)); + session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; + this.getMatching = function(session, row, column) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + + var startToken = session.getTokenAt(row, column); + if (startToken && startToken.value in this.indentKeywords) + return this.foldingRules.rubyBlock(session, row, column, true); + }; + this.$id = "ace/mode/ruby"; + this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-rust.js b/htdocs/includes/ace/src/mode-rust.js index e24ed47a680..19f6a989963 100644 --- a/htdocs/includes/ace/src/mode-rust.js +++ b/htdocs/includes/ace/src/mode-rust.js @@ -5,15 +5,16 @@ var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var stringEscape = /\\(?:[nrt0'"\\]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source; +var wordPattern = /[a-zA-Z_\xa1-\uffff][a-zA-Z0-9_\xa1-\uffff]*/.source; var RustHighlightRules = function() { this.$rules = { start: [ { token: 'variable.other.source.rust', - regex: '\'[a-zA-Z_][a-zA-Z0-9_]*(?![\\\'])' }, + regex: '\'' + wordPattern + '(?![\\\'])' }, { token: 'string.quoted.single.source.rust', regex: "'(?:[^'\\\\]|" + stringEscape + ")'" }, { token: 'identifier', - regex: /r#[a-zA-Z_][a-zA-Z0-9_]*\b/ }, + regex: "r#" + wordPattern + "\\b" }, { stateName: "bracketedComment", onMatch : function(value, currentState, stack){ @@ -53,8 +54,8 @@ var RustHighlightRules = function() { regex: stringEscape }, { defaultToken: 'string.quoted.double.source.rust' } ] }, { token: [ 'keyword.source.rust', 'text', 'entity.name.function.source.rust' ], - regex: '\\b(fn)(\\s+)((?:r#)?[a-zA-Z_][a-zA-Z0-9_]*)' }, - { token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' }, + regex: '\\b(fn)(\\s+)((?:r#)?'+ wordPattern + ')' }, + { token: 'support.constant', regex: wordPattern + '::' }, { token: 'keyword.source.rust', regex: '\\b(?:abstract|alignof|as|async|await|become|box|break|catch|continue|const|crate|default|do|dyn|else|enum|extern|for|final|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\\b' }, { token: 'storage.type.source.rust', diff --git a/htdocs/includes/ace/src/mode-scala.js b/htdocs/includes/ace/src/mode-scala.js index b3cd18a601b..68a320ca8fd 100644 --- a/htdocs/includes/ace/src/mode-scala.js +++ b/htdocs/includes/ace/src/mode-scala.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-scrypt.js b/htdocs/includes/ace/src/mode-scrypt.js new file mode 100644 index 00000000000..80feb0ed02d --- /dev/null +++ b/htdocs/includes/ace/src/mode-scrypt.js @@ -0,0 +1,364 @@ +define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var DocCommentHighlightRules = function() { + this.$rules = { + "start" : [ { + token : "comment.doc.tag", + regex : "@[\\w\\d_]+" // TODO: fix email addresses + }, + DocCommentHighlightRules.getTagRule(), + { + defaultToken : "comment.doc", + caseInsensitive: true + }] + }; +}; + +oop.inherits(DocCommentHighlightRules, TextHighlightRules); + +DocCommentHighlightRules.getTagRule = function(start) { + return { + token : "comment.doc.tag.storage.type", + regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" + }; +}; + +DocCommentHighlightRules.getStartRule = function(start) { + return { + token : "comment.doc", // doc comment + regex : "\\/\\*(?=\\*)", + next : start + }; +}; + +DocCommentHighlightRules.getEndRule = function (start) { + return { + token : "comment.doc", // closing comment + regex : "\\*\\/", + next : start + }; +}; + + +exports.DocCommentHighlightRules = DocCommentHighlightRules; + +}); + +define("ace/mode/scrypt_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function (require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + + var scryptHighlightRules = function () { + + var keywords = ( + "contract|library|loop|new|private|" + + "public|if|else|struct|type|" + + "require|static|const|import|exit|return|asm" + ); + + var buildinConstants = ("true|false"); + + + var langClasses = ( + "function|auto|constructor|bytes|int|bool|SigHashPreimage|PrivKey|PubKey|Sig|Ripemd160|Sha1|Sha256|" + + "SigHashType|SigHashPreimage|OpCodeType" + ); + + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "constant.language": buildinConstants, + "support.function": langClasses + }, "identifier"); + + this.$rules = { + "start": [ + { + token: "comment", + regex: "\\/\\/.*$" + }, + DocCommentHighlightRules.getStartRule("doc-start"), + { + token: "comment", // multi line comment + regex: "\\/\\*", + next: "comment" + }, { + token: "string", // single line + regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token: "string", // single line + regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token: "constant.numeric", // hex + regex: /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/ + }, { + token: "constant.numeric", // float + regex: /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/ + }, { + token: "constant.language.boolean", + regex: "(?:true|false)\\b" + }, + { + token: ["support.function.math.scrypt", "text", "text"], + regex: /\b(abs|min|max|within|ripemd160|sha1|sha256|hash160|hash256|checkSig|checkMultiSig|num2bin|pack|unpack|len|reverseBytes|repeat)(\s*)(\()/ + }, { + token: [ + "entity.name.type.scrypt", + "text", + "text", + "text", + "variable.object.property.scrypt" + ], + regex: /\b(SigHash)(\s*)(\.)(\s*)(ANYONECANPAY|ALL|FORKID|NONE|SINGLE)\b/ + }, + { + token: [ + "entity.name.type.scrypt", + "text", + "text", + "text", + "variable.object.property.scrypt" + ], + regex: /\b(OpCode)(\s*)(\.)(\s*)(OP_PUSHDATA1|OP_PUSHDATA2|OP_PUSHDATA4|OP_0|OP_FALSE|OP_1NEGATE|OP_1|OP_TRUE|OP_2|OP_3|OP_4|OP_5|OP_6|OP_7|OP_8|OP_9|OP_10|OP_11|OP_12|OP_13|OP_14|OP_15|OP_16|OP_1ADD|OP_1SUB|OP_NEGATE|OP_ABS|OP_NOT|OP_0NOTEQUAL|OP_ADD|OP_SUB|OP_MUL|OP_DIV|OP_MOD|OP_LSHIFT|OP_RSHIFT|OP_BOOLAND|OP_BOOLOR|OP_NUMEQUAL|OP_NUMEQUALVERIFY|OP_NUMNOTEQUAL|OP_LESSTHAN|OP_GREATERTHAN|OP_LESSTHANOREQUAL|OP_GREATERTHANOREQUAL|OP_MIN|OP_MAX|OP_WITHIN|OP_CAT|OP_SPLIT|OP_BIN2NUM|OP_NUM2BIN|OP_SIZE|OP_NOP|OP_IF|OP_NOTIF|OP_ELSE|OP_ENDIF|OP_VERIFY|OP_RETURN|OP_TOALTSTACK|OP_FROMALTSTACK|OP_IFDUP|OP_DEPTH|OP_DROP|OP_DUP|OP_NIP|OP_OVER|OP_PICK|OP_ROLL|OP_ROT|OP_SWAP|OP_TUCK|OP_2DROP|OP_2DUP|OP_3DUP|OP_2OVER|OP_2ROT|OP_2SWAP|OP_RIPEMD160|OP_SHA1|OP_SHA256|OP_HASH160|OP_HASH256|OP_CODESEPARATOR|OP_CHECKSIG|OP_CHECKSIGVERIFY|OP_CHECKMULTISIG|OP_CHECKMULTISIGVERIFY|OP_INVERT|OP_AND|OP_OR|OP_XOR|OP_EQUAL|OP_EQUALVERIFY)\b/ + }, { + token: "entity.name.type.scrypt", + regex: /\b(?:P2PKH|P2PK|Tx|HashPuzzleRipemd160|HashPuzzleSha1|HashPuzzleSha256|HashPuzzleHash160|OpCode|SigHash)\b/ + }, { + token: [ + "punctuation.separator.period.scrypt", + 'text', + "entity.name.function.scrypt", + "text", + "punctuation.definition.parameters.begin.bracket.round.scrypt" + ], + regex: /(\.)([^\S$\r]*)([\w][\w\d]*)(\s*)(\()/, + push: [{ + token: "punctuation.definition.parameters.end.bracket.round.scrypt", + regex: /\)/, + next: "pop" + }, { + defaultToken: "start" + }] + }, { + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\||\\^|\\*|\\/|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\*=|\\/=|%=|\\+=|\\-=|&=|\\|=|\\^=" + }, { + token: "lparen", + regex: "[[({]" + }, { + token: "rparen", + regex: "[\\])}]" + }, { + token: "text", + regex: "\\s+" + } + ], + "comment": [ + { + token: "comment", // closing comment + regex: "\\*\\/", + next: "start" + }, { + defaultToken: "comment" + } + ] + }; + + + this.embedRules(DocCommentHighlightRules, "doc-", + [DocCommentHighlightRules.getEndRule("start")]); + this.normalizeRules(); + }; + + oop.inherits(scryptHighlightRules, TextHighlightRules); + + exports.scryptHighlightRules = scryptHighlightRules; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/scrypt",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scrypt_highlight_rules","ace/mode/folding/cstyle"], function (require, exports, module) { + "use strict"; + + var oop = require("../lib/oop"); + var TextMode = require("./text").Mode; + var scryptHighlightRules = require("./scrypt_highlight_rules").scryptHighlightRules; + var FoldMode = require("./folding/cstyle").FoldMode; + + var Mode = function () { + this.HighlightRules = scryptHighlightRules; + this.foldingRules = new FoldMode(); + }; + oop.inherits(Mode, TextMode); + + (function () { + this.lineCommentStart = "//"; + this.blockComment = { start: "/*", end: "*/" }; + this.$quotes = { '"': '"', "'": "'" }; + + this.createWorker = function (session) { + + return null; + }; + + + this.$id = "ace/mode/scrypt"; + }).call(Mode.prototype); + + exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/scrypt"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-sh.js b/htdocs/includes/ace/src/mode-sh.js index db130f99563..56df9c69694 100644 --- a/htdocs/includes/ace/src/mode-sh.js +++ b/htdocs/includes/ace/src/mode-sh.js @@ -435,6 +435,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/sh"; + this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-sjs.js b/htdocs/includes/ace/src/mode-sjs.js index 218cab19b44..93855df3cee 100644 --- a/htdocs/includes/ace/src/mode-sjs.js +++ b/htdocs/includes/ace/src/mode-sjs.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-slim.js b/htdocs/includes/ace/src/mode-slim.js index 7f243bde705..85d09c8693d 100644 --- a/htdocs/includes/ace/src/mode-slim.js +++ b/htdocs/includes/ace/src/mode-slim.js @@ -990,6 +990,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2192,6 +2193,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2745,6 +2747,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3330,6 +3333,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/sh"; + this.snippetFileId = "ace/snippets/sh"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3382,6 +3386,7 @@ oop.inherits(Mode, TextMode); } }; this.$id = "ace/mode/markdown"; + this.snippetFileId = "ace/snippets/markdown"; }).call(Mode.prototype); exports.Mode = Mode; @@ -3734,6 +3739,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/coffee"; + this.snippetFileId = "ace/snippets/coffee"; }).call(Mode.prototype); exports.Mode = Mode; @@ -4247,17 +4253,17 @@ var constantOtherSymbol = exports.constantOtherSymbol = { regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" }; -var qString = exports.qString = { +exports.qString = { token : "string", // single line regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" }; -var qqString = exports.qqString = { +exports.qqString = { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' }; -var tString = exports.tString = { +exports.tString = { token : "string", // backtick string regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]" }; @@ -4267,9 +4273,34 @@ var constantNumericHex = exports.constantNumericHex = { regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b" }; +var constantNumericBinary = exports.constantNumericBinary = { + token: "constant.numeric", + regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/ +}; + +var constantNumericDecimal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/ +}; + +var constantNumericOctal = exports.constantNumericDecimal = { + token: "constant.numeric", + regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/ +}; + +var constantNumericRational = exports.constantNumericRational = { + token: "constant.numeric", //rational + complex + regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/ +}; + +var constantNumericComplex = exports.constantNumericComplex = { + token: "constant.numeric", //simple complex numbers + regex: /\b([\d]i)\b/ +}; + var constantNumericFloat = exports.constantNumericFloat = { - token : "constant.numeric", // float - regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b" + token : "constant.numeric", // float + complex + regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b" }; var instanceVariable = exports.instanceVariable = { @@ -4309,18 +4340,19 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many" + "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" + + "private_class_method|remove_method|undef_method" ); var keywords = ( "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend" ); var buildinConstants = ( "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION" ); var builtinVariables = ( @@ -4336,126 +4368,191 @@ var RubyHighlightRules = function() { "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? }, "identifier"); + var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})"; + + var closeParen = { + "(": ")", + "[": "]", + "{": "}", + "<": ">", + "^": "^", + "|": "|", + "%": "%" + }; + this.$rules = { - "start" : [ + "start": [ { - token : "comment", - regex : "#.*$" + token: "comment", + regex: "#.*$" }, { - token : "comment", // multi line comment - regex : "^=begin(?:$|\\s.*$)", - next : "comment" + token: "comment.multiline", // multi line comment + regex: "^=begin(?=$|\\s.*$)", + next: "comment" }, { - token : "string.regexp", - regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + token: "string.regexp", + regex: /[/](?=.*\/)/, + next: "regex" }, [{ - regex: "[{}]", onMatch: function(val, state, stack) { - this.next = val == "{" ? this.nextState : ""; - if (val == "{" && stack.length) { - stack.unshift("start", state); - return "paren.lparen"; - } - if (val == "}" && stack.length) { - stack.shift(); - this.next = stack.shift(); - if (this.next.indexOf("string") != -1) - return "paren.end"; - } - return val == "{" ? "paren.lparen" : "paren.rparen"; - }, - nextState: "start" - }, { - token : "string.start", - regex : /"/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(")/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /"/, - next : "pop" + token: "string.end", + regex: /"/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /`/, - push : [{ - token : "constant.language.escape", - regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/ + token: "string.start", + regex: /`/, + push: [{ + token: "constant.language.escape", + regex: escapedChars }, { - token : "paren.start", - regex : /#{/, - push : "start" + token: "paren.start", + regex: /#{/, + push: "start" }, { - token : "string.end", - regex : /`/, - next : "pop" + token: "string.end", + regex: /`/, + next: "pop" }, { defaultToken: "string" }] }, { - token : "string.start", - regex : /'/, - push : [{ - token : "constant.language.escape", - regex : /\\['\\]/ - }, { - token : "string.end", - regex : /'/, - next : "pop" + token: ["constant.other.symbol.ruby", "string.start"], + regex: /(:)?(')/, + push: [{ + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "string.end", + regex: /'/, + next: "pop" }, { defaultToken: "string" }] + }, { + token: "string.start",//doesn't see any differences between strings and array of strings in highlighting + regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithoutInterpolation"; + return this.token; + } + }, { + token: "string.start", //doesn't see any differences between strings and array of strings in highlighting + regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "qStateWithInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithoutInterpolation"; + return this.token; + } + }, { + token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting + regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "sStateWithInterpolation"; + return this.token; + } + }, { + token: "string.regexp", + regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) { + if (stack.length) + stack = []; + var paren = val[val.length - 1]; + stack.unshift(paren, state); + this.next = "rState"; + return this.token; + } }], { - token : "text", // namespaces aren't symbols - regex : "::" + token: "punctuation", // namespaces aren't symbols + regex: "::" + }, + instanceVariable, + { + token: "variable.global", // global variable + regex: "[$][a-zA-Z_\\d]+" }, { - token : "variable.instance", // instance variable - regex : "@{1,2}[a-zA-Z_\\d]+" + token: "support.class", // class name + regex: "[A-Z][a-zA-Z_\\d]*" }, { - token : "support.class", // class name - regex : "[A-Z][a-zA-Z_\\d]+" + token: ["punctuation.operator", "support.function"], + regex: /(\.)([a-zA-Z_\d]+)(?=\()/ + }, { + token: ["punctuation.operator", "identifier"], + regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/ + }, { + token: "string.character", + regex: "\\B\\?(?:" + escapedChars + "|\\S)" + }, { + token: "punctuation.operator", + regex: /\?(?=.+:)/ }, + constantNumericRational, + constantNumericComplex, constantOtherSymbol, constantNumericHex, constantNumericFloat, - + constantNumericBinary, + constantNumericDecimal, + constantNumericOctal, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" + token: "constant.language.boolean", + regex: "(?:true|false)\\b" }, { - token : keywordMapper, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + token: keywordMapper, + regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { - token : "punctuation.separator.key-value", - regex : "=>" + token: "punctuation.separator.key-value", + regex: "=>" }, { stateName: "heredoc", - onMatch : function(value, currentState, stack) { - var next = value[2] == '-' ? "indentedHeredoc" : "heredoc"; + onMatch: function (value, currentState, stack) { + var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc"; var tokens = value.split(this.splitRegex); stack.push(next, tokens[3]); return [ - {type:"constant", value: tokens[1]}, - {type:"string", value: tokens[2]}, - {type:"support.class", value: tokens[3]}, - {type:"string", value: tokens[4]} + {type: "constant", value: tokens[1]}, + {type: "string", value: tokens[2]}, + {type: "support.class", value: tokens[3]}, + {type: "string", value: tokens[4]} ]; }, - regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)", + regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)", rules: { heredoc: [{ - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -4472,7 +4569,7 @@ var RubyHighlightRules = function() { token: "string", regex: "^ +" }, { - onMatch: function(value, currentState, stack) { + onMatch: function(value, currentState, stack) { if (value === stack[1]) { stack.shift(); stack.shift(); @@ -4487,38 +4584,261 @@ var RubyHighlightRules = function() { }] } }, { - regex : "$", - token : "empty", - next : function(currentState, stack) { + regex: "$", + token: "empty", + next: function(currentState, stack) { if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc") return stack[0]; return currentState; } + }, { + token: "keyword.operator", + regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)" }, { - token : "string.character", - regex : "\\B\\?." + token: "paren.lparen", + regex: "[[({]" }, { - token : "keyword.operator", - regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + token: "paren.rparen", + regex: "[\\])}]", + onMatch: function(value, currentState, stack) { + this.next = ''; + if (value == "}" && stack.length > 1 && stack[1] != "start") { + stack.shift(); + this.next = stack.shift(); + } + return this.token; + } }, { - token : "paren.lparen", - regex : "[[({]" + token: "text", + regex: "\\s+" }, { - token : "paren.rparen", - regex : "[\\])}]" - }, { - token : "text", - regex : "\\s+" + token: "punctuation.operator", + regex: /[?:,;.]/ } ], - "comment" : [ + "comment": [ { - token : "comment", // closing comment - regex : "^=end(?:$|\\s.*$)", - next : "start" + token: "comment.multiline", // closing comment + regex: "^=end(?=$|\\s.*$)", + next: "start" }, { - token : "comment", // comment spanning whole line - regex : ".+" + token: "comment", // comment spanning whole line + regex: ".+" + } + ], + "qStateWithInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "qStateWithoutInterpolation": [{ + token: "string.start",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "string"; + } + }, { + token: "constant.language.escape", + regex: /\\['\\]/ + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "string.end", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "string"; + } + }, { + defaultToken: "string" + }], + "sStateWithoutInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "sStateWithInterpolation": [{ + token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.other.symbol.ruby"; + } + }, { + token: "constant.language.escape", + regex: escapedChars + }, { + token: "constant.language.escape", + regex: /\\./ + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "constant.other.symbol.ruby", + regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) { + if (stack.length && val === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.other.symbol.ruby"; + } + }, { + defaultToken: "constant.other.symbol.ruby" + }], + "rState": [{ + token: "string.regexp",// excluded nested |^% due to difficulty in realization + regex: /[(\[<{]/, onMatch: function (val, state, stack) { + if (stack.length && val === stack[0]) { + stack.unshift(val, state); + return this.token; + } + return "constant.language.escape"; + } + }, { + token: "paren.start", + regex: /#{/, + push: "start" + }, { + token: "string.regexp", + regex: /\// + }, { + token: "string.regexp", + regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) { + if (stack.length && val[0] === closeParen[stack[0]]) { + stack.shift(); + this.next = stack.shift(); + return this.token; + } + this.next = ''; + return "constant.language.escape"; + } + }, + {include: "regex"}, + { + defaultToken: "string.regexp" + }], + "regex": [ + {// character classes + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "constant.language.escape", + regex: /\\[AGbBzZ]/ + }, { + token: "constant.language.escape", + regex: /\\g<[a-zA-Z0-9]*>/ + }, { + token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"], + regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/ + }, { + token: ["constant.language.escape", "invalid", "constant.language.escape"], + regex: /(\\p{\^?)([^/]*)(})/ + }, {// escapes + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, {// flag + token: "string.regexp", + regex: /[/][imxouesn]*/, + next: "start" + }, {// invalid operators + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, {// operators + token: "constant.language.escape", + regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, { + token: "constant.language.delimiter", + regex: /\|/ + }, { + token: "regexp.keyword", + regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/ + }, { + token: "constant.language.escape", + regex: /\[\^?/, + push: "regex_character_class" + }, { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.keyword", + regex: /\\[wWdDhHsS]/ + }, { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, { + token: "constant.language.escape", + regex: /&?&?\[\^?/, + push: "regex_character_class" + }, { + token: "constant.language.escape", + regex: "]", + next: "pop" + }, { + token: "constant.language.escape", + regex: "-" + }, { + defaultToken: "string.regexp.characterclass" } ] }; @@ -4531,7 +4851,271 @@ oop.inherits(RubyHighlightRules, TextHighlightRules); exports.RubyHighlightRules = RubyHighlightRules; }); -define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) { +define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var BaseFoldMode = require("./fold_mode").FoldMode; +var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function () { +}; + +oop.inherits(FoldMode, BaseFoldMode); + +(function () { + this.indentKeywords = { + "class": 1, + "def": 1, + "module": 1, + "do": 1, + "unless": 1, + "if": 1, + "while": 1, + "for": 1, + "until": 1, + "begin": 1, + "else": 0, + "elsif": 0, + "rescue": 0, + "ensure": 0, + "when": 0, + "end": -1, + "case": 1, + "=begin": 1, + "=end": -1 + }; + + this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/; + this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/; + + this.getFoldWidget = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + + if (isStart && !isEnd) { + var match = line.match(this.foldingStartMarker); + if (match[1]) { + if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") { + if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) { + return; + } + if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) { + return; + } + } + + if (match[1] == "when") { + if (/\sthen\s/.test(line) === true) { + return; + } + } + if (session.getTokenAt(row, match.index + 2).type === "keyword") + return "start"; + } else if (match[3]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "start"; + } else { + return "start"; + } + } + if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd) + return ""; + + var match = line.match(this.foldingStopMarker); + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return "end"; + } else if (match[1]) { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return "end"; + } else + return "end"; + }; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.doc.getLine(row); + var match = this.foldingStartMarker.exec(line); + if (match) { + if (match[1] || match[3]) + return this.rubyBlock(session, row, match.index + 2); + + return this.openingBracketBlock(session, "{", row, match.index); + } + + var match = this.foldingStopMarker.exec(line); + if (match) { + if (match[3] === "end") { + if (session.getTokenAt(row, match.index + 1).type === "keyword") + return this.rubyBlock(session, row, match.index + 1); + } + + if (match[1] === "=end") { + if (session.getTokenAt(row, match.index + 1).type === "comment.multiline") + return this.rubyBlock(session, row, match.index + 1); + } + + return this.closingBracketBlock(session, "}", row, match.index + match[0].length); + } + }; + + this.rubyBlock = function (session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword" && token.type != "comment.multiline")) + return; + + var val = token.value; + var line = session.getLine(row); + switch (token.value) { + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + return; + } + var dir = this.indentKeywords[val]; + break; + case "when": + if (/\sthen\s/.test(line)) { + return; + } + case "elsif": + case "rescue": + case "ensure": + var dir = 1; + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line)) { + return; + } + var dir = 1; + break; + default: + var dir = this.indentKeywords[val]; + break; + } + + var stack = [val]; + if (!dir) + return; + + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(stream.getCurrentTokenRange()); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + if (token.type == "comment.multiline") { + while (token = stream.step()) { + if (token.type !== "comment.multiline") + continue; + if (dir == 1) { + startColumn = 6; + if (token.value == "=end") { + break; + } + } else { + if (token.value == "=begin") { + break; + } + } + } + } else { + while (token = stream.step()) { + var ignore = false; + if (token.type !== "keyword") + continue; + var level = dir * this.indentKeywords[token.value]; + line = session.getLine(stream.getCurrentTokenRow()); + switch (token.value) { + case "do": + for (var i = stream.$tokenIndex - 1; i >= 0; i--) { + var prevToken = stream.$rowTokens[i]; + if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) { + level = 0; + break; + } + } + break; + case "else": + var checkToken = new RegExp("^\\s*" + token.value + "\\s*$"); + if (!checkToken.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + case "if": + case "unless": + case "while": + case "until": + var checkToken = new RegExp("^\\s*" + token.value); + if (!checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "when": + if (/\sthen\s/.test(line) || val == "case") { + level = 0; + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(token.value); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + if ((val == "while" || val == "until" || val == "for") && token.value != "do") { + break; + } + if (token.value == "do" && dir == -1 && level != 0) + break; + if (token.value != "do") + break; + } + + if (level === 0) { + stack.unshift(token.value); + } + } + } + } + + if (!token) + return null; + + if (tokenRange) { + ranges.push(stream.getCurrentTokenRange()); + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + if (token.type === "comment.multiline") { + var endColumn = 6; + } else { + var endColumn = session.getLine(row).length; + } + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); @@ -4540,13 +5124,14 @@ 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 FoldMode = require("./folding/ruby").FoldMode; var Mode = function() { this.HighlightRules = RubyHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new FoldMode(); + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); @@ -4561,7 +5146,7 @@ oop.inherits(Mode, TextMode); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; - if (tokens.length && tokens[tokens.length-1].type == "comment") { + if (tokens.length && tokens[tokens.length - 1].type == "comment") { return indent; } @@ -4569,7 +5154,7 @@ oop.inherits(Mode, TextMode); var match = line.match(/^.*[\{\(\[]\s*$/); var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/); var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/); - var startingConditional = line.match(/^\s*(if|else|when)\s*/); + var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/); if (match || startingClassOrMethod || startingDoBlock || startingConditional) { indent += tab; } @@ -4579,7 +5164,7 @@ oop.inherits(Mode, TextMode); }; this.checkOutdent = function(state, line, input) { - return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input); + return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, session, row) { @@ -4592,11 +5177,24 @@ oop.inherits(Mode, TextMode); var tab = session.getTabString(); if (prevIndent.length <= indent.length) { if (indent.slice(-tab.length) == tab) - session.remove(new Range(row, indent.length-tab.length, row, indent.length)); + session.remove(new Range(row, indent.length - tab.length, row, indent.length)); } }; + this.getMatching = function(session, row, column) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + + var startToken = session.getTokenAt(row, column); + if (startToken && startToken.value in this.indentKeywords) + return this.foldingRules.rubyBlock(session, row, column, true); + }; + this.$id = "ace/mode/ruby"; + this.snippetFileId = "ace/snippets/ruby"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-smarty.js b/htdocs/includes/ace/src/mode-smarty.js index 8c044c1698b..03a1654ffac 100644 --- a/htdocs/includes/ace/src/mode-smarty.js +++ b/htdocs/includes/ace/src/mode-smarty.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-smithy.js b/htdocs/includes/ace/src/mode-smithy.js new file mode 100644 index 00000000000..6dd0bcfaa81 --- /dev/null +++ b/htdocs/includes/ace/src/mode-smithy.js @@ -0,0 +1,507 @@ +define("ace/mode/smithy_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var SmithyHighlightRules = function() { + + this.$rules = { + start: [{ + include: "#comment" + }, { + token: [ + "meta.keyword.statement.smithy", + "variable.other.smithy", + "text", + "keyword.operator.smithy" + ], + regex: /^(\$)(\s+.+)(\s*)(=)/ + }, { + token: [ + "keyword.statement.smithy", + "text", + "entity.name.type.namespace.smithy" + ], + regex: /^(namespace)(\s+)([A-Z-a-z0-9_\.#$-]+)/ + }, { + token: [ + "keyword.statement.smithy", + "text", + "keyword.statement.smithy", + "text", + "entity.name.type.smithy" + ], + regex: /^(use)(\s+)(shape|trait)(\s+)([A-Z-a-z0-9_\.#$-]+)\b/ + }, { + token: [ + "keyword.statement.smithy", + "variable.other.smithy", + "text", + "keyword.operator.smithy" + ], + regex: /^(metadata)(\s+.+)(\s*)(=)/ + }, { + token: [ + "keyword.statement.smithy", + "text", + "entity.name.type.smithy" + ], + regex: /^(apply|byte|short|integer|long|float|double|bigInteger|bigDecimal|boolean|blob|string|timestamp|service|resource|trait|list|map|set|structure|union|document)(\s+)([A-Z-a-z0-9_\.#$-]+)\b/ + }, { + token: [ + "keyword.operator.smithy", + "text", + "entity.name.type.smithy", + "text", + "text", + "support.function.smithy", + "text", + "text", + "support.function.smithy" + ], + regex: /^(operation)(\s+)([A-Z-a-z0-9_\.#$-]+)(\(.*\))(?:(\s*)(->)(\s*[A-Z-a-z0-9_\.#$-]+))?(?:(\s+)(errors))?/ + }, { + include: "#trait" + }, { + token: [ + "support.type.property-name.smithy", + "punctuation.separator.dictionary.pair.smithy" + ], + regex: /([A-Z-a-z0-9_\.#$-]+)(:)/ + }, { + include: "#value" + }, { + token: "keyword.other.smithy", + regex: /\->/ + }], + "#comment": [{ + include: "#doc_comment" + }, { + include: "#line_comment" + }], + "#doc_comment": [{ + token: "comment.block.documentation.smithy", + regex: /\/\/\/.*/ + }], + "#line_comment": [{ + token: "comment.line.double-slash.smithy", + regex: /\/\/.*/ + }], + "#trait": [{ + token: [ + "punctuation.definition.annotation.smithy", + "storage.type.annotation.smithy" + ], + regex: /(@)([0-9a-zA-Z\.#-]+)/ + }, { + token: [ + "punctuation.definition.annotation.smithy", + "punctuation.definition.object.end.smithy", + "meta.structure.smithy" + ], + regex: /(@)([0-9a-zA-Z\.#-]+)(\()/, + push: [{ + token: "punctuation.definition.object.end.smithy", + regex: /\)/, + next: "pop" + }, { + include: "#value" + }, { + include: "#object_inner" + }, { + defaultToken: "meta.structure.smithy" + }] + }], + "#value": [{ + include: "#constant" + }, { + include: "#number" + }, { + include: "#string" + }, { + include: "#array" + }, { + include: "#object" + }], + "#array": [{ + token: "punctuation.definition.array.begin.smithy", + regex: /\[/, + push: [{ + token: "punctuation.definition.array.end.smithy", + regex: /\]/, + next: "pop" + }, { + include: "#comment" + }, { + include: "#value" + }, { + token: "punctuation.separator.array.smithy", + regex: /,/ + }, { + token: "invalid.illegal.expected-array-separator.smithy", + regex: /[^\s\]]/ + }, { + defaultToken: "meta.structure.array.smithy" + }] + }], + "#constant": [{ + token: "constant.language.smithy", + regex: /\b(?:true|false|null)\b/ + }], + "#number": [{ + token: "constant.numeric.smithy", + regex: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/ + }], + "#object": [{ + token: "punctuation.definition.dictionary.begin.smithy", + regex: /\{/, + push: [{ + token: "punctuation.definition.dictionary.end.smithy", + regex: /\}/, + next: "pop" + }, { + include: "#trait" + }, { + include: "#object_inner" + }, { + defaultToken: "meta.structure.dictionary.smithy" + }] + }], + "#object_inner": [{ + include: "#comment" + }, { + include: "#string_key" + }, { + token: "punctuation.separator.dictionary.key-value.smithy", + regex: /:/, + push: [{ + token: "punctuation.separator.dictionary.pair.smithy", + regex: /,|(?=\})/, + next: "pop" + }, { + include: "#value" + }, { + token: "invalid.illegal.expected-dictionary-separator.smithy", + regex: /[^\s,]/ + }, { + defaultToken: "meta.structure.dictionary.value.smithy" + }] + }, { + token: "invalid.illegal.expected-dictionary-separator.smithy", + regex: /[^\s\}]/ + }], + "#string_key": [{ + include: "#identifier_key" + }, { + include: "#dquote_key" + }, { + include: "#squote_key" + }], + "#identifier_key": [{ + token: "support.type.property-name.smithy", + regex: /[A-Z-a-z0-9_\.#$-]+/ + }], + "#dquote_key": [{ + include: "#dquote" + }], + "#squote_key": [{ + include: "#squote" + }], + "#string": [{ + include: "#textblock" + }, { + include: "#dquote" + }, { + include: "#squote" + }, { + include: "#identifier" + }], + "#textblock": [{ + token: "punctuation.definition.string.begin.smithy", + regex: /"""/, + push: [{ + token: "punctuation.definition.string.end.smithy", + regex: /"""/, + next: "pop" + }, { + token: "constant.character.escape.smithy", + regex: /\\./ + }, { + defaultToken: "string.quoted.double.smithy" + }] + }], + "#dquote": [{ + token: "punctuation.definition.string.begin.smithy", + regex: /"/, + push: [{ + token: "punctuation.definition.string.end.smithy", + regex: /"/, + next: "pop" + }, { + token: "constant.character.escape.smithy", + regex: /\\./ + }, { + defaultToken: "string.quoted.double.smithy" + }] + }], + "#squote": [{ + token: "punctuation.definition.string.begin.smithy", + regex: /'/, + push: [{ + token: "punctuation.definition.string.end.smithy", + regex: /'/, + next: "pop" + }, { + token: "constant.character.escape.smithy", + regex: /\\./ + }, { + defaultToken: "string.quoted.single.smithy" + }] + }], + "#identifier": [{ + token: "storage.type.smithy", + regex: /[A-Z-a-z_][A-Z-a-z0-9_\.#$-]*/ + }] + }; + + this.normalizeRules(); +}; + +SmithyHighlightRules.metaData = { + name: "Smithy", + fileTypes: ["smithy"], + scopeName: "source.smithy", + foldingStartMarker: "(\\{|\\[)\\s*", + foldingStopMarker: "\\s*(\\}|\\])" +}; + + +oop.inherits(SmithyHighlightRules, TextHighlightRules); + +exports.SmithyHighlightRules = SmithyHighlightRules; +}); + +define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { +"use strict"; + +var Range = require("../range").Range; + +var MatchingBraceOutdent = function() {}; + +(function() { + + this.checkOutdent = function(line, input) { + if (! /^\s+$/.test(line)) + return false; + + return /^\s*\}/.test(input); + }; + + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + + if (!match) return 0; + + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({row: row, column: column}); + + if (!openBracePos || openBracePos.row == row) return 0; + + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column-1), indent); + }; + + this.$getIndent = function(line) { + return line.match(/^\s*/)[0]; + }; + +}).call(MatchingBraceOutdent.prototype); + +exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); + +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/smithy",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/smithy_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var SmithyHighlightRules = require("./smithy_highlight_rules").SmithyHighlightRules; +var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; +var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; +var CStyleFoldMode = require("./folding/cstyle").FoldMode; + +var Mode = function() { + this.HighlightRules = SmithyHighlightRules; + + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CstyleBehaviour(); + this.foldingRules = new CStyleFoldMode(); +}; +oop.inherits(Mode, TextMode); + +(function() { + this.lineCommentStart = "//"; + this.$quotes = {'"': '"'}; + + 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/smithy"; +}).call(Mode.prototype); + +exports.Mode = Mode; +}); (function() { + window.require(["ace/mode/smithy"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/mode-snippets.js b/htdocs/includes/ace/src/mode-snippets.js index 600463bf3e5..32276191d16 100644 --- a/htdocs/includes/ace/src/mode-snippets.js +++ b/htdocs/includes/ace/src/mode-snippets.js @@ -192,6 +192,7 @@ oop.inherits(Mode, TextMode); this.$indentWithTabs = true; this.lineCommentStart = "#"; this.$id = "ace/mode/snippets"; + this.snippetFileId = "ace/snippets/snippets"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-soy_template.js b/htdocs/includes/ace/src/mode-soy_template.js index 83b35c0c673..a9674ac5730 100644 --- a/htdocs/includes/ace/src/mode-soy_template.js +++ b/htdocs/includes/ace/src/mode-soy_template.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-sql.js b/htdocs/includes/ace/src/mode-sql.js index 77ba37a8ed1..3bb9e83b7af 100644 --- a/htdocs/includes/ace/src/mode-sql.js +++ b/htdocs/includes/ace/src/mode-sql.js @@ -78,15 +78,174 @@ oop.inherits(SqlHighlightRules, TextHighlightRules); exports.SqlHighlightRules = SqlHighlightRules; }); -define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules"], function(require, exports, module) { +define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var Range = require("../../range").Range; +var BaseFoldMode = require("./fold_mode").FoldMode; + +var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp( + this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) + ); + this.foldingStopMarker = new RegExp( + this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) + ); + } +}; +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) + return ""; + } + + var fw = this._getFoldWidgetBase(session, foldStyle, row); + + if (!fw && this.startRegionRe.test(line)) + return "start"; // lineCommentRegionStart + + return fw; + }; + + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + + if (this.startRegionRe.test(line)) + return this.getCommentRegionBlock(session, line, row); + + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + + if (match[1]) + return this.openingBracketBlock(session, match[1], row, i); + + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + + if (range && !range.isMultiLine()) { + if (forceMultiline) { + range = this.getSectionRange(session, row); + } else if (foldStyle != "all") + range = null; + } + + return range; + } + + if (foldStyle === "markbegin") + return; + + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + + if (match[1]) + return this.closingBracketBlock(session, match[1], row, i); + + return session.getCommentFoldRange(row, i, -1); + } + }; + + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while (++row < maxRow) { + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) + continue; + if (startIndent > indent) + break; + var subRange = this.getFoldWidgetRange(session, "all", row); + + if (subRange) { + if (subRange.start.row <= startRow) { + break; + } else if (subRange.isMultiLine()) { + row = subRange.end.row; + } else if (startIndent == indent) { + break; + } + } + endRow = row; + } + + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while (++row < maxRow) { + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + + if (!depth) break; + } + + var endRow = row; + if (endRow > startRow) { + return new Range(startRow, startColumn, endRow, line.length); + } + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/folding/sql",["require","exports","module","ace/lib/oop","ace/mode/folding/cstyle"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var BaseFoldMode = require("./cstyle").FoldMode; + +var FoldMode = exports.FoldMode = function() {}; + +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules","ace/mode/folding/sql"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules; +var SqlFoldMode = require("./folding/sql").FoldMode; var Mode = function() { this.HighlightRules = SqlHighlightRules; + this.foldingRules = new SqlFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); @@ -94,8 +253,10 @@ oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; + this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/sql"; + this.snippetFileId = "ace/snippets/sql"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-sqlserver.js b/htdocs/includes/ace/src/mode-sqlserver.js index 41f53c3e598..69aa4384ff1 100644 --- a/htdocs/includes/ace/src/mode-sqlserver.js +++ b/htdocs/includes/ace/src/mode-sqlserver.js @@ -429,7 +429,8 @@ oop.inherits(Mode, TextMode); return session.$mode.$highlightRules.completions; }; - this.$id = "ace/mode/sql"; + this.$id = "ace/mode/sqlserver"; + this.snippetFileId = "ace/snippets/sqlserver"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-svg.js b/htdocs/includes/ace/src/mode-svg.js index 6dc3c60c6dd..d8e0358d1b5 100644 --- a/htdocs/includes/ace/src/mode-svg.js +++ b/htdocs/includes/ace/src/mode-svg.js @@ -1454,6 +1454,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-swift.js b/htdocs/includes/ace/src/mode-swift.js index b207deb7652..06644d6fdda 100644 --- a/htdocs/includes/ace/src/mode-swift.js +++ b/htdocs/includes/ace/src/mode-swift.js @@ -165,6 +165,12 @@ var SwiftHighlightRules = function() { this.$rules = { start: [ + string('"""', { + escape: /\\(?:[0\\tnr"']|u{[a-fA-F1-9]{0,8}})/, + interpolation: {lead: "\\", open: "(", close: ")"}, + error: /\\./, + multiline: true + }), string('"', { escape: /\\(?:[0\\tnr"']|u{[a-fA-F1-9]{0,8}})/, interpolation: {lead: "\\", open: "(", close: ")"}, diff --git a/htdocs/includes/ace/src/mode-tcl.js b/htdocs/includes/ace/src/mode-tcl.js index b898da9c528..632f928adbc 100644 --- a/htdocs/includes/ace/src/mode-tcl.js +++ b/htdocs/includes/ace/src/mode-tcl.js @@ -373,6 +373,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/tcl"; + this.snippetFileId = "ace/snippets/tcl"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-terraform.js b/htdocs/includes/ace/src/mode-terraform.js index 76e2cf2db63..bd252bc32b5 100644 --- a/htdocs/includes/ace/src/mode-terraform.js +++ b/htdocs/includes/ace/src/mode-terraform.js @@ -40,11 +40,15 @@ var TerraformHighlightRules = function () { { token: "singleline.comment.terraform", - regex: '#(.)*$' + regex: '#.*$' + }, + { + token: "singleline.comment.terraform", + regex: '//.*$' }, { token: "multiline.comment.begin.terraform", - regex: '^\\s*\\/\\*', + regex: /\/\*/, push: "blockComment" }, { @@ -66,11 +70,7 @@ var TerraformHighlightRules = function () { {include: "variables"} ], blockComment: [{ - regex: "^\\s*\\/\\*", - token: "multiline.comment.begin.terraform", - push: "blockComment" - }, { - regex: "\\*\\/\\s*$", + regex: /\*\//, token: "multiline.comment.end.terraform", next: "pop" }, { @@ -383,6 +383,9 @@ oop.inherits(Mode, TextMode); (function () { + this.lineCommentStart = ["#", "//"]; + this.blockComment = {start: "/*", end: "*/"}; + this.$id = "ace/mode/terraform"; }).call(Mode.prototype); diff --git a/htdocs/includes/ace/src/mode-tex.js b/htdocs/includes/ace/src/mode-tex.js index 22673ec6222..9b3fb3b3722 100644 --- a/htdocs/includes/ace/src/mode-tex.js +++ b/htdocs/includes/ace/src/mode-tex.js @@ -146,6 +146,7 @@ oop.inherits(Mode, TextMode); return false; }; this.$id = "ace/mode/tex"; + this.snippetFileId = "ace/snippets/tex"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-textile.js b/htdocs/includes/ace/src/mode-textile.js index 203bbbeb31a..8ce8ad64dfd 100644 --- a/htdocs/includes/ace/src/mode-textile.js +++ b/htdocs/includes/ace/src/mode-textile.js @@ -135,6 +135,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/textile"; + this.snippetFileId = "ace/snippets/textile"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-tsx.js b/htdocs/includes/ace/src/mode-tsx.js index b4292219847..2b5d18d632c 100644 --- a/htdocs/includes/ace/src/mode-tsx.js +++ b/htdocs/includes/ace/src/mode-tsx.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-twig.js b/htdocs/includes/ace/src/mode-twig.js index a7c3c2b4bd2..b5eac5b2b68 100644 --- a/htdocs/includes/ace/src/mode-twig.js +++ b/htdocs/includes/ace/src/mode-twig.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-typescript.js b/htdocs/includes/ace/src/mode-typescript.js index d4e8cdb3876..3bebbdaba3d 100644 --- a/htdocs/includes/ace/src/mode-typescript.js +++ b/htdocs/includes/ace/src/mode-typescript.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-vala.js b/htdocs/includes/ace/src/mode-vala.js index 5e51a584107..2fe15bac55d 100644 --- a/htdocs/includes/ace/src/mode-vala.js +++ b/htdocs/includes/ace/src/mode-vala.js @@ -663,6 +663,7 @@ oop.inherits(Mode, TextMode); this.$outdent.autoOutdent(doc, row); }; this.$id = "ace/mode/vala"; + this.snippetFileId = "ace/snippets/vala"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-vbscript.js b/htdocs/includes/ace/src/mode-vbscript.js index 482c2f95c96..19a3a002781 100644 --- a/htdocs/includes/ace/src/mode-vbscript.js +++ b/htdocs/includes/ace/src/mode-vbscript.js @@ -8,11 +8,13 @@ var VBScriptHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "keyword.control.asp": "If|Then|Else|ElseIf|End|While|Wend|For|To|Each|Case|Select|Return" - + "|Continue|Do|Until|Loop|Next|With|Exit|Function|Property|Type|Enum|Sub|IIf", - "storage.type.asp": "Dim|Call|Class|Const|Dim|Redim|Set|Let|Get|New|Randomize|Option|Explicit", + + "|Continue|Do|Until|Loop|Next|With|Exit|Function|Property|Type|Enum|Sub|IIf|Class", + "storage.type.asp": "Dim|Call|Const|Redim|Set|Let|Get|New|Randomize|Option|Explicit|Preserve|Erase|Execute|ExecuteGlobal", "storage.modifier.asp": "Private|Public|Default", - "keyword.operator.asp": "Mod|And|Not|Or|Xor|as", + "keyword.operator.asp": "Mod|And|Not|Or|Xor|As|Eqv|Imp|Is", "constant.language.asp": "Empty|False|Nothing|Null|True", + "variable.language.vb.asp": "Me", + "support.class.vb.asp": "RegExp", "support.class.asp": "Application|ObjectContext|Request|Response|Server|Session", "support.class.collection.asp": "Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables", "support.constant.asp": "TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute" @@ -30,13 +32,17 @@ var VBScriptHighlightRules = function() { + "|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace" + "|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion" + "|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse" - + "|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year", - "support.type.vb.asp": "vbtrue|vbfalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|" - + "int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday" - + "|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek" - + "|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger" + + "|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year" + + "|AscB|AscW|ChrB|ChrW|InStrB|LeftB|LenB|MidB|RightB|Abs|GetUILanguage", + "support.type.vb.asp": "vbTrue|vbFalse|vbCr|vbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString" + + "|vbTab|vbVerticalTab|vbBinaryCompare|vbTextCompare|vbSunday|vbMonday|vbTuesday|vbWednesday" + + "|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek|vbFirstJan1|vbFirstFourDays|vbFirstFullWeek" + + "|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime|vbObjectError|vbEmpty|vbNull|vbInteger" + "|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant" - + "|vbDataObject|vbDecimal|vbByte|vbArray" + + "|vbDataObject|vbDecimal|vbByte|vbArray|vbOKOnly|vbOKCancel|vbAbortRetryIgnore|vbYesNoCancel|vbYesNo" + + "|vbRetryCancel|vbCritical|vbQuestion|vbExclamation|vbInformation|vbDefaultButton1|vbDefaultButton2" + + "|vbDefaultButton3|vbDefaultButton4|vbApplicationModal|vbSystemModal|vbOK|vbCancel|vbAbort|vbRetry|vbIgnore|vbYes|vbNo" + + "|vbUseDefault" }, "identifier", true); this.$rules = { @@ -78,7 +84,7 @@ var VBScriptHighlightRules = function() { }, { token: "storage.type.asp", - regex: "On Error Resume Next|On Error GoTo", + regex: "On\\s+Error\\s+(?:Resume\\s+Next|GoTo)\\b", caseInsensitive: true }, { @@ -106,7 +112,7 @@ var VBScriptHighlightRules = function() { }, { token: ["keyword.operator.asp"], - regex: "\\-|\\+|\\*\\/|\\>|\\<|\\=|\\&" + regex: "\\-|\\+|\\*|\\/|\\>|\\<|\\=|\\&|\\\\|\\^" } ], "state_3": [ @@ -145,7 +151,7 @@ var VBScriptHighlightRules = function() { "comment": [ { token: "comment.line.apostrophe.asp", - regex: "$|(?=(?:%>))", + regex: "$", next: "start" }, { @@ -175,23 +181,446 @@ oop.inherits(VBScriptHighlightRules, TextHighlightRules); exports.VBScriptHighlightRules = VBScriptHighlightRules; }); -define("ace/mode/vbscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/vbscript_highlight_rules"], function(require, exports, module) { +define("ace/mode/folding/vbscript",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function(require, exports, module) { +"use strict"; + +var oop = require("../../lib/oop"); +var BaseFoldMode = require("./fold_mode").FoldMode; +var Range = require("../../range").Range; +var TokenIterator = require("../../token_iterator").TokenIterator; + + +var FoldMode = exports.FoldMode = function() {}; + +oop.inherits(FoldMode, BaseFoldMode); + +(function() { + this.indentKeywords = { + "class": 1, + "function": 1, + "sub": 1, + "if": 1, + "select": 1, + "do": 1, + "for": 1, + "while": 1, + "with": 1, + "property": 1, + "else": 1, + "elseif": 1, + "end": -1, + "loop": -1, + "next": -1, + "wend": -1 + }; + + this.foldingStartMarker = /(?:\s|^)(class|function|sub|if|select|do|for|while|with|property|else|elseif)\b/i; + this.foldingStopMarker = /\b(end|loop|next|wend)\b/i; + + this.getFoldWidgetRange = function (session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + if (isStart || isEnd) { + var match = (isEnd) ? this.foldingStopMarker.exec(line) : this.foldingStartMarker.exec(line); + var keyword = match && match[1].toLowerCase(); + if (keyword) { + var type = session.getTokenAt(row, match.index + 2).type; + if (type === "keyword.control.asp" || type === "storage.type.function.asp") + return this.vbsBlock(session, row, match.index + 2); + } + } + }; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + var isStart = this.foldingStartMarker.test(line); + var isEnd = this.foldingStopMarker.test(line); + if (isStart && !isEnd) { + var match = this.foldingStartMarker.exec(line); + var keyword = match && match[1].toLowerCase(); + if (keyword) { + var type = session.getTokenAt(row, match.index + 2).type; + if (type == "keyword.control.asp" || type == "storage.type.function.asp") { + if (keyword == "if" && !/then\s*('|$)/i.test(line)) + return ""; + return "start"; + } + } + } + return ""; + }; + + this.vbsBlock = function(session, row, column, tokenRange) { + var stream = new TokenIterator(session, row, column); + + var endOpenings = { + "class": 1, + "function": 1, + "sub": 1, + "if": 1, + "select": 1, + "with": 1, + "property": 1, + "else": 1, + "elseif": 1 + }; + + var token = stream.getCurrentToken(); + if (!token || (token.type != "keyword.control.asp" && token.type != "storage.type.function.asp")) + return; + + var startTokenValue = token.value.toLowerCase(); + var val = token.value.toLowerCase(); + + var stack = [val]; + var dir = this.indentKeywords[val]; + + if (!dir) + return; + + var firstRange = stream.getCurrentTokenRange(); + switch (val) { + case "property": + case "sub": + case "function": + case "if": + case "select": + case "do": + case "for": + case "class": + case "while": + case "with": + var line = session.getLine(row); + var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); + if (singleLineCondition) + return; + var checkToken = new RegExp("(?:^|\\s)" + val, "i"); + var endTest = /^\s*End\s(If|Sub|Select|Function|Class|With|Property)\s*/i.test(line); + if (!checkToken.test(line) && !endTest) { + return; + } + if (endTest) { + var tokenRange = stream.getCurrentTokenRange(); + stream.step = stream.stepBackward; + stream.step(); + stream.step(); + token = stream.getCurrentToken(); + if (token) { + val = token.value.toLowerCase(); + if (val == "end") { + firstRange = stream.getCurrentTokenRange(); + firstRange = new Range(firstRange.start.row, firstRange.start.column, tokenRange.start.row, tokenRange.end.column); + } + } + dir = -1; + } + break; + case "end": + var tokenPos = stream.getCurrentTokenPosition(); + firstRange = stream.getCurrentTokenRange(); + stream.step = stream.stepForward; + stream.step(); + stream.step(); + token = stream.getCurrentToken(); + if (token) { + val = token.value.toLowerCase(); + if (val in endOpenings) { + startTokenValue = val; + var nextTokenPos = stream.getCurrentTokenPosition(); + var endColumn = nextTokenPos.column + val.length; + firstRange = new Range(tokenPos.row, tokenPos.column, nextTokenPos.row, endColumn); + } + } + stream.step = stream.stepBackward; + stream.step(); + stream.step(); + break; + } + var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length; + var startRow = row; + var ranges = []; + ranges.push(firstRange); + + stream.step = dir === -1 ? stream.stepBackward : stream.stepForward; + while(token = stream.step()) { + var outputRange = null; + var ignore = false; + if (token.type != "keyword.control.asp" && token.type != "storage.type.function.asp") + continue; + val = token.value.toLowerCase(); + var level = dir * this.indentKeywords[val]; + + switch (val) { + case "property": + case "sub": + case "function": + case "if": + case "select": + case "do": + case "for": + case "class": + case "while": + case "with": + var line = session.getLine(stream.getCurrentTokenRow()); + var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); + if (singleLineCondition) { + level = 0; + ignore = true; + } + var checkToken = new RegExp("^\\s* end\\s+" + val, "i"); + if (checkToken.test(line)) { + level = 0; + ignore = true; + } + break; + case "elseif": + case "else": + level = 0; + if (startTokenValue != "elseif") { + ignore = true; + } + break; + } + + if (level > 0) { + stack.unshift(val); + } else if (level <= 0 && ignore === false) { + stack.shift(); + if (!stack.length) { + switch (val) { + case "end": + var tokenPos = stream.getCurrentTokenPosition(); + outputRange = stream.getCurrentTokenRange(); + stream.step(); + stream.step(); + token = stream.getCurrentToken(); + if (token) { + val = token.value.toLowerCase(); + if (val in endOpenings) { + if ((startTokenValue == "else" || startTokenValue == "elseif")) { + if (val !== "if") { + ranges.shift(); + } + } else { + if (val != startTokenValue) + ranges.shift(); + } + var nextTokenPos = stream.getCurrentTokenPosition(); + var endColumn = nextTokenPos.column + val.length; + outputRange = new Range(tokenPos.row, tokenPos.column, nextTokenPos.row, endColumn); + } else { + ranges.shift(); + } + } else { + ranges.shift(); + } + stream.step = stream.stepBackward; + stream.step(); + stream.step(); + token = stream.getCurrentToken(); + val = token.value.toLowerCase(); + break; + case "select": + case "sub": + case "if": + case "function": + case "class": + case "with": + case "property": + if (val != startTokenValue) + ranges.shift(); + break; + case "do": + if (startTokenValue != "loop") + ranges.shift(); + break; + case "loop": + if (startTokenValue != "do") + ranges.shift(); + break; + case "for": + if (startTokenValue != "next") + ranges.shift(); + break; + case "next": + if (startTokenValue != "for") + ranges.shift(); + break; + case "while": + if (startTokenValue != "wend") + ranges.shift(); + break; + case "wend": + if (startTokenValue != "while") + ranges.shift(); + break; + } + break; + } + + if (level === 0){ + stack.unshift(val); + } + } + } + + if (!token) + return null; + + if (tokenRange) { + if (!outputRange) { + ranges.push(stream.getCurrentTokenRange()); + } else { + ranges.push(outputRange); + } + return ranges; + } + + var row = stream.getCurrentTokenRow(); + if (dir === -1) { + var endColumn = session.getLine(row).length; + return new Range(row, endColumn, startRow - 1, startColumn); + } else + return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length); + }; + +}).call(FoldMode.prototype); + +}); + +define("ace/mode/vbscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/vbscript_highlight_rules","ace/mode/folding/vbscript","ace/range"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules; +var FoldMode = require("./folding/vbscript").FoldMode; +var Range = require("../range").Range; var Mode = function() { this.HighlightRules = VBScriptHighlightRules; + this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; + this.indentKeywords = this.foldingRules.indentKeywords; }; oop.inherits(Mode, TextMode); (function() { - + this.lineCommentStart = ["'", "REM"]; - + + var outdentKeywords = [ + "else", + "elseif", + "end", + "loop", + "next", + "wend" + ]; + + function getNetIndentLevel(tokens, line, indentKeywords) { + var level = 0; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (token.type == "keyword.control.asp" || token.type == "storage.type.function.asp") { + var val = token.value.toLowerCase(); + if (val in indentKeywords) { + switch (val) { + case "property": + case "sub": + case "function": + case "select": + case "do": + case "for": + case "class": + case "while": + case "with": + case "if": + var checkToken = new RegExp("^\\s* end\\s+" + val, "i"); + var singleLineCondition = /^\s*If\s+.*\s+Then(?!')\s+(?!')\S/i.test(line); + if (!singleLineCondition && !checkToken.test(line)) + level += indentKeywords[val]; + break; + default: + level += indentKeywords[val]; + break; + } + } + } + } + if (level < 0) { + return -1; + } else if (level > 0) { + return 1; + } else { + return 0; + } + } + + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + var level = 0; + + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); + var tokens = tokenizedLine.tokens; + + if (state == "start") { + level = getNetIndentLevel(tokens, line, this.indentKeywords); + } + if (level > 0) { + return indent + tab; + } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) { + if (!this.checkOutdent(state, line, "\n")) { + return indent.substr(0, indent.length - tab.length); + } + } + return indent; + }; + + this.checkOutdent = function(state, line, input) { + if (input != "\n" && input != "\r" && input != "\r\n") + return false; + + var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; + + if (!tokens || !tokens.length) + return false; + var val = tokens[0].value.toLowerCase(); + return ((tokens[0].type == "keyword.control.asp" || tokens[0].type == "storage.type.function.asp") && outdentKeywords.indexOf(val) != -1); + }; + + this.getMatching = function(session, row, column, tokenRange) { + if (row == undefined) { + var pos = session.selection.lead; + column = pos.column; + row = pos.row; + } + if (tokenRange == undefined) + tokenRange = true; + + var startToken = session.getTokenAt(row, column); + if (startToken) { + var val = startToken.value.toLowerCase(); + if (val in this.indentKeywords) + return this.foldingRules.vbsBlock(session, row, column, tokenRange); + } + }; + + this.autoOutdent = function(state, session, row) { + var line = session.getLine(row); + var column = line.match(/^\s*/)[0].length; + if (!column || !row) return; + + var startRange = this.getMatching(session, row, column + 1, false); + if (!startRange || startRange.start.row == row) + return; + var indent = this.$getIndent(session.getLine(startRange.start.row)); + if (indent.length != column) { + session.replace(new Range(row, 0, row, column), indent); + session.outdentRows(new Range(row + 1, 0, row + 1, 0)); + } + }; + this.$id = "ace/mode/vbscript"; }).call(Mode.prototype); diff --git a/htdocs/includes/ace/src/mode-velocity.js b/htdocs/includes/ace/src/mode-velocity.js index ea94a8fd9ad..98458db2d49 100644 --- a/htdocs/includes/ace/src/mode-velocity.js +++ b/htdocs/includes/ace/src/mode-velocity.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2775,6 +2778,7 @@ oop.inherits(Mode, HtmlMode); this.lineCommentStart = "##"; this.blockComment = {start: "#*", end: "*#"}; this.$id = "ace/mode/velocity"; + this.snippetFileId = "ace/snippets/velocity"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-vhdl.js b/htdocs/includes/ace/src/mode-vhdl.js index 75f22a1f512..d3e4ba6fd59 100644 --- a/htdocs/includes/ace/src/mode-vhdl.js +++ b/htdocs/includes/ace/src/mode-vhdl.js @@ -8,18 +8,21 @@ var VHDLHighlightRules = function() { - var keywords = "access|after|ailas|all|architecture|assert|attribute|"+ - "begin|block|buffer|bus|case|component|configuration|"+ - "disconnect|downto|else|elsif|end|entity|file|for|function|"+ - "generate|generic|guarded|if|impure|in|inertial|inout|is|"+ - "label|linkage|literal|loop|mapnew|next|of|on|open|others|"+ - "out|port|process|pure|range|record|reject|report|return|"+ - "select|severity|shared|signal|subtype|then|to|transport|"+ - "type|unaffected|united|until|wait|when|while|with"; + var keywords = "access|after|alias|all|architecture|assert|attribute|"+ + "begin|block|body|buffer|bus|case|component|configuration|"+ + "context|disconnect|downto|else|elsif|end|entity|exit|"+ + "file|for|force|function|generate|generic|group|guarded|"+ + "if|impure|in|inertial|inout|is|label|library|linkage|"+ + "literal|loop|map|new|next|of|on|or|open|others|out|"+ + "package|parameter|port|postponed|procedure|process|"+ + "protected|pure|range|record|register|reject|release|"+ + "report|return|select|severity|shared|signal|subtype|then|"+ + "to|transport|type|unaffected|units|until|use|variable|"+ + "wait|when|while|with"; var storageType = "bit|bit_vector|boolean|character|integer|line|natural|"+ "positive|real|register|signed|std_logic|"+ - "std_logic_vector|string||text|time|unsigned|variable"; + "std_logic_vector|string||text|time|unsigned"; var storageModifiers = "array|constant"; diff --git a/htdocs/includes/ace/src/mode-visualforce.js b/htdocs/includes/ace/src/mode-visualforce.js index ad9ab780b74..30c2cd90d18 100644 --- a/htdocs/includes/ace/src/mode-visualforce.js +++ b/htdocs/includes/ace/src/mode-visualforce.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -1316,6 +1317,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/css"; + this.snippetFileId = "ace/snippets/css"; }).call(Mode.prototype); exports.Mode = Mode; @@ -2493,6 +2495,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/html"; + this.snippetFileId = "ace/snippets/html"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-wollok.js b/htdocs/includes/ace/src/mode-wollok.js index a4dba0f9ce4..e62e249a84d 100644 --- a/htdocs/includes/ace/src/mode-wollok.js +++ b/htdocs/includes/ace/src/mode-wollok.js @@ -784,6 +784,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; }).call(Mode.prototype); exports.Mode = Mode; @@ -899,6 +900,7 @@ oop.inherits(Mode, JavaScriptMode); }; this.$id = "ace/mode/wollok"; + this.snippetFileId = "ace/snippets/wollok"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/mode-xquery.js b/htdocs/includes/ace/src/mode-xquery.js index 0a87a75fa2b..4512ba9d91e 100644 --- a/htdocs/includes/ace/src/mode-xquery.js +++ b/htdocs/includes/ace/src/mode-xquery.js @@ -2630,6 +2630,7 @@ oop.inherits(Mode, TextMode); }; this.$id = "ace/mode/xquery"; + this.snippetFileId = "ace/snippets/xquery"; }).call(Mode.prototype); exports.Mode = Mode; diff --git a/htdocs/includes/ace/src/snippets/abap.js b/htdocs/includes/ace/src/snippets/abap.js index 39342f476a4..8a6b11f7d6f 100644 --- a/htdocs/includes/ace/src/snippets/abap.js +++ b/htdocs/includes/ace/src/snippets/abap.js @@ -1,10 +1,5 @@ -define("ace/snippets/abap",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "abap"; - -}); (function() { +; (function() { window.require(["ace/snippets/abap"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ada.js b/htdocs/includes/ace/src/snippets/ada.js index 94be2e5962e..8eb30a101bd 100644 --- a/htdocs/includes/ace/src/snippets/ada.js +++ b/htdocs/includes/ace/src/snippets/ada.js @@ -1,10 +1,5 @@ -define("ace/snippets/ada",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ada"; - -}); (function() { +; (function() { window.require(["ace/snippets/ada"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/alda.js b/htdocs/includes/ace/src/snippets/alda.js new file mode 100644 index 00000000000..a7827995831 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/alda.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/alda"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/apache_conf.js b/htdocs/includes/ace/src/snippets/apache_conf.js index c4e29459270..21986504c25 100644 --- a/htdocs/includes/ace/src/snippets/apache_conf.js +++ b/htdocs/includes/ace/src/snippets/apache_conf.js @@ -1,10 +1,5 @@ -define("ace/snippets/apache_conf",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "apache_conf"; - -}); (function() { +; (function() { window.require(["ace/snippets/apache_conf"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/apex.js b/htdocs/includes/ace/src/snippets/apex.js index 0c1f767377d..2dbcd0fce11 100644 --- a/htdocs/includes/ace/src/snippets/apex.js +++ b/htdocs/includes/ace/src/snippets/apex.js @@ -1,10 +1,5 @@ -define("ace/snippets/apex",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "apex"; - -}); (function() { +; (function() { window.require(["ace/snippets/apex"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/applescript.js b/htdocs/includes/ace/src/snippets/applescript.js index 2412c72c9af..ea322dbde2b 100644 --- a/htdocs/includes/ace/src/snippets/applescript.js +++ b/htdocs/includes/ace/src/snippets/applescript.js @@ -1,10 +1,5 @@ -define("ace/snippets/applescript",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "applescript"; - -}); (function() { +; (function() { window.require(["ace/snippets/applescript"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/aql.js b/htdocs/includes/ace/src/snippets/aql.js index f9ef46d179d..5568f6a1084 100644 --- a/htdocs/includes/ace/src/snippets/aql.js +++ b/htdocs/includes/ace/src/snippets/aql.js @@ -1,10 +1,5 @@ -define("ace/snippets/aql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "aql"; - -}); (function() { +; (function() { window.require(["ace/snippets/aql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/asciidoc.js b/htdocs/includes/ace/src/snippets/asciidoc.js index 7c68e42e3f0..e5b47cfa570 100644 --- a/htdocs/includes/ace/src/snippets/asciidoc.js +++ b/htdocs/includes/ace/src/snippets/asciidoc.js @@ -1,10 +1,5 @@ -define("ace/snippets/asciidoc",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "asciidoc"; - -}); (function() { +; (function() { window.require(["ace/snippets/asciidoc"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/asl.js b/htdocs/includes/ace/src/snippets/asl.js index e077ac0e4ab..0166b95535e 100644 --- a/htdocs/includes/ace/src/snippets/asl.js +++ b/htdocs/includes/ace/src/snippets/asl.js @@ -1,9 +1,5 @@ -define("ace/snippets/asl",["require","exports","module"], function (require, exports, module) { - "use strict"; - exports.snippetText =undefined; - exports.scope = "asl"; -}); (function() { +; (function() { window.require(["ace/snippets/asl"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/assembly_x86.js b/htdocs/includes/ace/src/snippets/assembly_x86.js index 7b16369e1be..ffbf5971f61 100644 --- a/htdocs/includes/ace/src/snippets/assembly_x86.js +++ b/htdocs/includes/ace/src/snippets/assembly_x86.js @@ -1,10 +1,5 @@ -define("ace/snippets/assembly_x86",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "assembly_x86"; - -}); (function() { +; (function() { window.require(["ace/snippets/assembly_x86"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/autohotkey.js b/htdocs/includes/ace/src/snippets/autohotkey.js index 601d201ce16..e0674d4eac6 100644 --- a/htdocs/includes/ace/src/snippets/autohotkey.js +++ b/htdocs/includes/ace/src/snippets/autohotkey.js @@ -1,10 +1,5 @@ -define("ace/snippets/autohotkey",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "autohotkey"; - -}); (function() { +; (function() { window.require(["ace/snippets/autohotkey"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/batchfile.js b/htdocs/includes/ace/src/snippets/batchfile.js index dfae8ab00bc..0404a41ee28 100644 --- a/htdocs/includes/ace/src/snippets/batchfile.js +++ b/htdocs/includes/ace/src/snippets/batchfile.js @@ -1,10 +1,5 @@ -define("ace/snippets/batchfile",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "batchfile"; - -}); (function() { +; (function() { window.require(["ace/snippets/batchfile"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/bro.js b/htdocs/includes/ace/src/snippets/bro.js deleted file mode 100644 index 9412c6003e3..00000000000 --- a/htdocs/includes/ace/src/snippets/bro.js +++ /dev/null @@ -1,14 +0,0 @@ -define("ace/snippets/bro",["require","exports","module"], function(require, exports, module) { -"use strict"; - -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { - window.require(["ace/snippets/bro"], function(m) { - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = m; - } - }); - })(); - \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/c9search.js b/htdocs/includes/ace/src/snippets/c9search.js index b5c7058137b..d83a158fc79 100644 --- a/htdocs/includes/ace/src/snippets/c9search.js +++ b/htdocs/includes/ace/src/snippets/c9search.js @@ -1,10 +1,5 @@ -define("ace/snippets/c9search",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "c9search"; - -}); (function() { +; (function() { window.require(["ace/snippets/c9search"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/cirru.js b/htdocs/includes/ace/src/snippets/cirru.js index 882b0c9741f..8bd664ed3f9 100644 --- a/htdocs/includes/ace/src/snippets/cirru.js +++ b/htdocs/includes/ace/src/snippets/cirru.js @@ -1,10 +1,5 @@ -define("ace/snippets/cirru",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "cirru"; - -}); (function() { +; (function() { window.require(["ace/snippets/cirru"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/cobol.js b/htdocs/includes/ace/src/snippets/cobol.js index 303dea71778..1fece5b6445 100644 --- a/htdocs/includes/ace/src/snippets/cobol.js +++ b/htdocs/includes/ace/src/snippets/cobol.js @@ -1,10 +1,5 @@ -define("ace/snippets/cobol",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "cobol"; - -}); (function() { +; (function() { window.require(["ace/snippets/cobol"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/coldfusion.js b/htdocs/includes/ace/src/snippets/coldfusion.js index db72fad9320..0f1ff4d2b8a 100644 --- a/htdocs/includes/ace/src/snippets/coldfusion.js +++ b/htdocs/includes/ace/src/snippets/coldfusion.js @@ -1,10 +1,5 @@ -define("ace/snippets/coldfusion",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "coldfusion"; - -}); (function() { +; (function() { window.require(["ace/snippets/coldfusion"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/crystal.js b/htdocs/includes/ace/src/snippets/crystal.js index ef64a9fdce1..39614eb1fe5 100644 --- a/htdocs/includes/ace/src/snippets/crystal.js +++ b/htdocs/includes/ace/src/snippets/crystal.js @@ -1,10 +1,5 @@ -define("ace/snippets/crystal",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "crystal"; - -}); (function() { +; (function() { window.require(["ace/snippets/crystal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/csharp.js b/htdocs/includes/ace/src/snippets/csharp.js index f36041cbcd7..22c8f86c0a7 100644 --- a/htdocs/includes/ace/src/snippets/csharp.js +++ b/htdocs/includes/ace/src/snippets/csharp.js @@ -1,10 +1,5 @@ -define("ace/snippets/csharp",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "csharp"; - -}); (function() { +; (function() { window.require(["ace/snippets/csharp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/csound_score.js b/htdocs/includes/ace/src/snippets/csound_score.js index 82ee2c17d35..3d7ae0e6720 100644 --- a/htdocs/includes/ace/src/snippets/csound_score.js +++ b/htdocs/includes/ace/src/snippets/csound_score.js @@ -1,10 +1,5 @@ -define("ace/snippets/csound_score",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "csound_score"; - -}); (function() { +; (function() { window.require(["ace/snippets/csound_score"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/csp.js b/htdocs/includes/ace/src/snippets/csp.js index 8225367a49b..685814919fa 100644 --- a/htdocs/includes/ace/src/snippets/csp.js +++ b/htdocs/includes/ace/src/snippets/csp.js @@ -1,10 +1,5 @@ -define("ace/snippets/csp",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/csp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/curly.js b/htdocs/includes/ace/src/snippets/curly.js index 1d7b8f7b290..d0c5487d9f0 100644 --- a/htdocs/includes/ace/src/snippets/curly.js +++ b/htdocs/includes/ace/src/snippets/curly.js @@ -1,10 +1,5 @@ -define("ace/snippets/curly",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "curly"; - -}); (function() { +; (function() { window.require(["ace/snippets/curly"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/d.js b/htdocs/includes/ace/src/snippets/d.js index 117da84d0eb..18257d4f6c6 100644 --- a/htdocs/includes/ace/src/snippets/d.js +++ b/htdocs/includes/ace/src/snippets/d.js @@ -1,10 +1,5 @@ -define("ace/snippets/d",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "d"; - -}); (function() { +; (function() { window.require(["ace/snippets/d"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/dockerfile.js b/htdocs/includes/ace/src/snippets/dockerfile.js index 6ebfb397359..cd5d4182f1a 100644 --- a/htdocs/includes/ace/src/snippets/dockerfile.js +++ b/htdocs/includes/ace/src/snippets/dockerfile.js @@ -1,10 +1,5 @@ -define("ace/snippets/dockerfile",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "dockerfile"; - -}); (function() { +; (function() { window.require(["ace/snippets/dockerfile"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/dot.js b/htdocs/includes/ace/src/snippets/dot.js index 0af0a491752..aec363b01d6 100644 --- a/htdocs/includes/ace/src/snippets/dot.js +++ b/htdocs/includes/ace/src/snippets/dot.js @@ -1,10 +1,5 @@ -define("ace/snippets/dot",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "dot"; - -}); (function() { +; (function() { window.require(["ace/snippets/dot"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/eiffel.js b/htdocs/includes/ace/src/snippets/eiffel.js index bc6a66a93b3..60a36440f0d 100644 --- a/htdocs/includes/ace/src/snippets/eiffel.js +++ b/htdocs/includes/ace/src/snippets/eiffel.js @@ -1,10 +1,5 @@ -define("ace/snippets/eiffel",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "eiffel"; - -}); (function() { +; (function() { window.require(["ace/snippets/eiffel"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ejs.js b/htdocs/includes/ace/src/snippets/ejs.js index 83368d91ee0..3e0f355e747 100644 --- a/htdocs/includes/ace/src/snippets/ejs.js +++ b/htdocs/includes/ace/src/snippets/ejs.js @@ -1,10 +1,5 @@ -define("ace/snippets/ejs",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ejs"; - -}); (function() { +; (function() { window.require(["ace/snippets/ejs"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/elixir.js b/htdocs/includes/ace/src/snippets/elixir.js index 8ddaf1c4495..f408337980b 100644 --- a/htdocs/includes/ace/src/snippets/elixir.js +++ b/htdocs/includes/ace/src/snippets/elixir.js @@ -1,10 +1,5 @@ -define("ace/snippets/elixir",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/elixir"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/elm.js b/htdocs/includes/ace/src/snippets/elm.js index 71d7a7e15b0..c1122649f1b 100644 --- a/htdocs/includes/ace/src/snippets/elm.js +++ b/htdocs/includes/ace/src/snippets/elm.js @@ -1,10 +1,5 @@ -define("ace/snippets/elm",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "elm"; - -}); (function() { +; (function() { window.require(["ace/snippets/elm"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/forth.js b/htdocs/includes/ace/src/snippets/forth.js index 0861c05f3e9..a7a0c053f63 100644 --- a/htdocs/includes/ace/src/snippets/forth.js +++ b/htdocs/includes/ace/src/snippets/forth.js @@ -1,10 +1,5 @@ -define("ace/snippets/forth",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "forth"; - -}); (function() { +; (function() { window.require(["ace/snippets/forth"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/fortran.js b/htdocs/includes/ace/src/snippets/fortran.js index 69bffe8f2aa..ec3ae4e6457 100644 --- a/htdocs/includes/ace/src/snippets/fortran.js +++ b/htdocs/includes/ace/src/snippets/fortran.js @@ -1,10 +1,5 @@ -define("ace/snippets/fortran",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "fortran"; - -}); (function() { +; (function() { window.require(["ace/snippets/fortran"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/fsharp.js b/htdocs/includes/ace/src/snippets/fsharp.js index bbc8eb65b5e..dfe6a1391e1 100644 --- a/htdocs/includes/ace/src/snippets/fsharp.js +++ b/htdocs/includes/ace/src/snippets/fsharp.js @@ -1,10 +1,5 @@ -define("ace/snippets/fsharp",["require","exports","module"], function(require, exports, module) { - "use strict"; - exports.snippetText =undefined; - exports.scope = "fsharp"; - -}); (function() { +; (function() { window.require(["ace/snippets/fsharp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ftl.js b/htdocs/includes/ace/src/snippets/ftl.js index 7b7cb67948e..aa9f0e0bbfc 100644 --- a/htdocs/includes/ace/src/snippets/ftl.js +++ b/htdocs/includes/ace/src/snippets/ftl.js @@ -1,10 +1,5 @@ -define("ace/snippets/ftl",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ftl"; - -}); (function() { +; (function() { window.require(["ace/snippets/ftl"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/gcode.js b/htdocs/includes/ace/src/snippets/gcode.js index b44f1656ce3..d85b1b4838b 100644 --- a/htdocs/includes/ace/src/snippets/gcode.js +++ b/htdocs/includes/ace/src/snippets/gcode.js @@ -1,10 +1,5 @@ -define("ace/snippets/gcode",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "gcode"; - -}); (function() { +; (function() { window.require(["ace/snippets/gcode"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/gherkin.js b/htdocs/includes/ace/src/snippets/gherkin.js index 8986e377a7d..11c54661bdc 100644 --- a/htdocs/includes/ace/src/snippets/gherkin.js +++ b/htdocs/includes/ace/src/snippets/gherkin.js @@ -1,10 +1,5 @@ -define("ace/snippets/gherkin",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "gherkin"; - -}); (function() { +; (function() { window.require(["ace/snippets/gherkin"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/gitignore.js b/htdocs/includes/ace/src/snippets/gitignore.js index aea0fb0df9a..a6af8361d76 100644 --- a/htdocs/includes/ace/src/snippets/gitignore.js +++ b/htdocs/includes/ace/src/snippets/gitignore.js @@ -1,10 +1,5 @@ -define("ace/snippets/gitignore",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "gitignore"; - -}); (function() { +; (function() { window.require(["ace/snippets/gitignore"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/glsl.js b/htdocs/includes/ace/src/snippets/glsl.js index f638fbc6eac..bdea4bfaa64 100644 --- a/htdocs/includes/ace/src/snippets/glsl.js +++ b/htdocs/includes/ace/src/snippets/glsl.js @@ -1,10 +1,5 @@ -define("ace/snippets/glsl",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "glsl"; - -}); (function() { +; (function() { window.require(["ace/snippets/glsl"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/golang.js b/htdocs/includes/ace/src/snippets/golang.js index b16e805474f..18a9f97b64c 100644 --- a/htdocs/includes/ace/src/snippets/golang.js +++ b/htdocs/includes/ace/src/snippets/golang.js @@ -1,10 +1,5 @@ -define("ace/snippets/golang",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "golang"; - -}); (function() { +; (function() { window.require(["ace/snippets/golang"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/groovy.js b/htdocs/includes/ace/src/snippets/groovy.js index 56091acbccd..72f2f32ecb1 100644 --- a/htdocs/includes/ace/src/snippets/groovy.js +++ b/htdocs/includes/ace/src/snippets/groovy.js @@ -1,10 +1,5 @@ -define("ace/snippets/groovy",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "groovy"; - -}); (function() { +; (function() { window.require(["ace/snippets/groovy"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/handlebars.js b/htdocs/includes/ace/src/snippets/handlebars.js index ca8b6354867..2eaf61de444 100644 --- a/htdocs/includes/ace/src/snippets/handlebars.js +++ b/htdocs/includes/ace/src/snippets/handlebars.js @@ -1,10 +1,5 @@ -define("ace/snippets/handlebars",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "handlebars"; - -}); (function() { +; (function() { window.require(["ace/snippets/handlebars"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/haskell_cabal.js b/htdocs/includes/ace/src/snippets/haskell_cabal.js index 471feb12baa..1a90a9cbf97 100644 --- a/htdocs/includes/ace/src/snippets/haskell_cabal.js +++ b/htdocs/includes/ace/src/snippets/haskell_cabal.js @@ -1,10 +1,5 @@ -define("ace/snippets/haskell_cabal",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "haskell_cabal"; - -}); (function() { +; (function() { window.require(["ace/snippets/haskell_cabal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/haxe.js b/htdocs/includes/ace/src/snippets/haxe.js index 8feed8d150c..b1f2dbe6c37 100644 --- a/htdocs/includes/ace/src/snippets/haxe.js +++ b/htdocs/includes/ace/src/snippets/haxe.js @@ -1,10 +1,5 @@ -define("ace/snippets/haxe",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "haxe"; - -}); (function() { +; (function() { window.require(["ace/snippets/haxe"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/hjson.js b/htdocs/includes/ace/src/snippets/hjson.js index 79be57d0cf3..96938d67d7a 100644 --- a/htdocs/includes/ace/src/snippets/hjson.js +++ b/htdocs/includes/ace/src/snippets/hjson.js @@ -1,10 +1,5 @@ -define("ace/snippets/hjson",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/hjson"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/html.js b/htdocs/includes/ace/src/snippets/html.js index 975496c1b49..885d2a2d64f 100644 --- a/htdocs/includes/ace/src/snippets/html.js +++ b/htdocs/includes/ace/src/snippets/html.js @@ -237,9 +237,7 @@ snippet button:s\n\ snippet button:r\n\ \n\ snippet canvas\n\ - \n\ - ${1}\n\ - \n\ + \n\ snippet caption\n\ ${1}\n\ snippet cite\n\ @@ -853,7 +851,7 @@ snippet ul+\n\ snippet var\n\ ${1}\n\ snippet video\n\ - ${8}\n\ + ${8}\n\ snippet wbr\n\ ${1}\n\ "; diff --git a/htdocs/includes/ace/src/snippets/html_elixir.js b/htdocs/includes/ace/src/snippets/html_elixir.js index c8521b55ca8..0db3e076f71 100644 --- a/htdocs/includes/ace/src/snippets/html_elixir.js +++ b/htdocs/includes/ace/src/snippets/html_elixir.js @@ -1,10 +1,5 @@ -define("ace/snippets/html_elixir",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "html_elixir"; - -}); (function() { +; (function() { window.require(["ace/snippets/html_elixir"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/html_ruby.js b/htdocs/includes/ace/src/snippets/html_ruby.js index ba20e65e72d..5d4499743c0 100644 --- a/htdocs/includes/ace/src/snippets/html_ruby.js +++ b/htdocs/includes/ace/src/snippets/html_ruby.js @@ -1,10 +1,5 @@ -define("ace/snippets/html_ruby",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "html_ruby"; - -}); (function() { +; (function() { window.require(["ace/snippets/html_ruby"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ini.js b/htdocs/includes/ace/src/snippets/ini.js index 07200fda5b7..f31743c5b0d 100644 --- a/htdocs/includes/ace/src/snippets/ini.js +++ b/htdocs/includes/ace/src/snippets/ini.js @@ -1,10 +1,5 @@ -define("ace/snippets/ini",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ini"; - -}); (function() { +; (function() { window.require(["ace/snippets/ini"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/jack.js b/htdocs/includes/ace/src/snippets/jack.js index 2688a3a1011..fc242d3c2a6 100644 --- a/htdocs/includes/ace/src/snippets/jack.js +++ b/htdocs/includes/ace/src/snippets/jack.js @@ -1,10 +1,5 @@ -define("ace/snippets/jack",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "jack"; - -}); (function() { +; (function() { window.require(["ace/snippets/jack"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/jade.js b/htdocs/includes/ace/src/snippets/jade.js index 6a4676b883d..1a1c1c25e37 100644 --- a/htdocs/includes/ace/src/snippets/jade.js +++ b/htdocs/includes/ace/src/snippets/jade.js @@ -1,10 +1,5 @@ -define("ace/snippets/jade",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "jade"; - -}); (function() { +; (function() { window.require(["ace/snippets/jade"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/json.js b/htdocs/includes/ace/src/snippets/json.js index 7c9c2eaf295..f1c015c4264 100644 --- a/htdocs/includes/ace/src/snippets/json.js +++ b/htdocs/includes/ace/src/snippets/json.js @@ -1,10 +1,5 @@ -define("ace/snippets/json",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "json"; - -}); (function() { +; (function() { window.require(["ace/snippets/json"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/json5.js b/htdocs/includes/ace/src/snippets/json5.js index 8afbead737d..4ae9f4b7b1f 100644 --- a/htdocs/includes/ace/src/snippets/json5.js +++ b/htdocs/includes/ace/src/snippets/json5.js @@ -1,10 +1,5 @@ -define("ace/snippets/json5",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "json5"; - -}); (function() { +; (function() { window.require(["ace/snippets/json5"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/jssm.js b/htdocs/includes/ace/src/snippets/jssm.js index fceb11ddfe9..2fcea71ccf0 100644 --- a/htdocs/includes/ace/src/snippets/jssm.js +++ b/htdocs/includes/ace/src/snippets/jssm.js @@ -1,10 +1,5 @@ -define("ace/snippets/jssm",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/jssm"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/jsx.js b/htdocs/includes/ace/src/snippets/jsx.js index 38f276f80a2..b26a3586bbb 100644 --- a/htdocs/includes/ace/src/snippets/jsx.js +++ b/htdocs/includes/ace/src/snippets/jsx.js @@ -1,10 +1,5 @@ -define("ace/snippets/jsx",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "jsx"; - -}); (function() { +; (function() { window.require(["ace/snippets/jsx"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/julia.js b/htdocs/includes/ace/src/snippets/julia.js index 360f7c3d200..30a74650766 100644 --- a/htdocs/includes/ace/src/snippets/julia.js +++ b/htdocs/includes/ace/src/snippets/julia.js @@ -1,10 +1,5 @@ -define("ace/snippets/julia",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "julia"; - -}); (function() { +; (function() { window.require(["ace/snippets/julia"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/kotlin.js b/htdocs/includes/ace/src/snippets/kotlin.js index b2e3d3cbb52..c9e543c7d58 100644 --- a/htdocs/includes/ace/src/snippets/kotlin.js +++ b/htdocs/includes/ace/src/snippets/kotlin.js @@ -1,10 +1,5 @@ -define("ace/snippets/kotlin",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/kotlin"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/latex.js b/htdocs/includes/ace/src/snippets/latex.js index 6afc3775b98..711a30b780f 100644 --- a/htdocs/includes/ace/src/snippets/latex.js +++ b/htdocs/includes/ace/src/snippets/latex.js @@ -1,10 +1,5 @@ -define("ace/snippets/latex",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "latex"; - -}); (function() { +; (function() { window.require(["ace/snippets/latex"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/latte.js b/htdocs/includes/ace/src/snippets/latte.js new file mode 100644 index 00000000000..d5c341ce881 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/latte.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/latte"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/less.js b/htdocs/includes/ace/src/snippets/less.js index a87b47b185c..2b4c6b3b469 100644 --- a/htdocs/includes/ace/src/snippets/less.js +++ b/htdocs/includes/ace/src/snippets/less.js @@ -1,10 +1,5 @@ -define("ace/snippets/less",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "less"; - -}); (function() { +; (function() { window.require(["ace/snippets/less"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/lisp.js b/htdocs/includes/ace/src/snippets/lisp.js index f6c13860ec9..a971e2131e5 100644 --- a/htdocs/includes/ace/src/snippets/lisp.js +++ b/htdocs/includes/ace/src/snippets/lisp.js @@ -1,10 +1,5 @@ -define("ace/snippets/lisp",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "lisp"; - -}); (function() { +; (function() { window.require(["ace/snippets/lisp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/livescript.js b/htdocs/includes/ace/src/snippets/livescript.js index 08b6cb107d6..ed4b397ac34 100644 --- a/htdocs/includes/ace/src/snippets/livescript.js +++ b/htdocs/includes/ace/src/snippets/livescript.js @@ -1,10 +1,5 @@ -define("ace/snippets/livescript",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "livescript"; - -}); (function() { +; (function() { window.require(["ace/snippets/livescript"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/logiql.js b/htdocs/includes/ace/src/snippets/logiql.js index 073da94b692..d0fea2bdae5 100644 --- a/htdocs/includes/ace/src/snippets/logiql.js +++ b/htdocs/includes/ace/src/snippets/logiql.js @@ -1,10 +1,5 @@ -define("ace/snippets/logiql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "logiql"; - -}); (function() { +; (function() { window.require(["ace/snippets/logiql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/logtalk.js b/htdocs/includes/ace/src/snippets/logtalk.js index 4ab4f1f9e8c..4ae82ed92b1 100644 --- a/htdocs/includes/ace/src/snippets/logtalk.js +++ b/htdocs/includes/ace/src/snippets/logtalk.js @@ -1,10 +1,5 @@ -define("ace/snippets/logtalk",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "logtalk"; - -}); (function() { +; (function() { window.require(["ace/snippets/logtalk"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/luapage.js b/htdocs/includes/ace/src/snippets/luapage.js index 8f52b58fc01..db7de782348 100644 --- a/htdocs/includes/ace/src/snippets/luapage.js +++ b/htdocs/includes/ace/src/snippets/luapage.js @@ -1,10 +1,5 @@ -define("ace/snippets/luapage",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "luapage"; - -}); (function() { +; (function() { window.require(["ace/snippets/luapage"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/lucene.js b/htdocs/includes/ace/src/snippets/lucene.js index c61509bea79..bb248e9c4b2 100644 --- a/htdocs/includes/ace/src/snippets/lucene.js +++ b/htdocs/includes/ace/src/snippets/lucene.js @@ -1,10 +1,5 @@ -define("ace/snippets/lucene",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "lucene"; - -}); (function() { +; (function() { window.require(["ace/snippets/lucene"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mask.js b/htdocs/includes/ace/src/snippets/mask.js index 1b9c0c56dc2..f63c0a61b6d 100644 --- a/htdocs/includes/ace/src/snippets/mask.js +++ b/htdocs/includes/ace/src/snippets/mask.js @@ -1,10 +1,5 @@ -define("ace/snippets/mask",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mask"; - -}); (function() { +; (function() { window.require(["ace/snippets/mask"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/matlab.js b/htdocs/includes/ace/src/snippets/matlab.js index d8fcd2bd071..cc5fb70e7a5 100644 --- a/htdocs/includes/ace/src/snippets/matlab.js +++ b/htdocs/includes/ace/src/snippets/matlab.js @@ -1,10 +1,5 @@ -define("ace/snippets/matlab",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "matlab"; - -}); (function() { +; (function() { window.require(["ace/snippets/matlab"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mediawiki.js b/htdocs/includes/ace/src/snippets/mediawiki.js new file mode 100644 index 00000000000..bd73d00064b --- /dev/null +++ b/htdocs/includes/ace/src/snippets/mediawiki.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/mediawiki"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/mel.js b/htdocs/includes/ace/src/snippets/mel.js index 4e43ab1be3f..fa5ecbc8985 100644 --- a/htdocs/includes/ace/src/snippets/mel.js +++ b/htdocs/includes/ace/src/snippets/mel.js @@ -1,10 +1,5 @@ -define("ace/snippets/mel",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mel"; - -}); (function() { +; (function() { window.require(["ace/snippets/mel"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mips.js b/htdocs/includes/ace/src/snippets/mips.js new file mode 100644 index 00000000000..9badca8efcf --- /dev/null +++ b/htdocs/includes/ace/src/snippets/mips.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/mips"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/mixal.js b/htdocs/includes/ace/src/snippets/mixal.js index 60b08ea8f52..8246ef784c3 100644 --- a/htdocs/includes/ace/src/snippets/mixal.js +++ b/htdocs/includes/ace/src/snippets/mixal.js @@ -1,10 +1,5 @@ -define("ace/snippets/mixal",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mixal"; - -}); (function() { +; (function() { window.require(["ace/snippets/mixal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mushcode.js b/htdocs/includes/ace/src/snippets/mushcode.js index 1ff99c4abae..8eddd370b3d 100644 --- a/htdocs/includes/ace/src/snippets/mushcode.js +++ b/htdocs/includes/ace/src/snippets/mushcode.js @@ -1,10 +1,5 @@ -define("ace/snippets/mushcode",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mushcode"; - -}); (function() { +; (function() { window.require(["ace/snippets/mushcode"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/mysql.js b/htdocs/includes/ace/src/snippets/mysql.js index 2791c37f87a..d8544a1b7a8 100644 --- a/htdocs/includes/ace/src/snippets/mysql.js +++ b/htdocs/includes/ace/src/snippets/mysql.js @@ -1,10 +1,5 @@ -define("ace/snippets/mysql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "mysql"; - -}); (function() { +; (function() { window.require(["ace/snippets/mysql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nginx.js b/htdocs/includes/ace/src/snippets/nginx.js index 4305b2cae3e..565e3b8a6ce 100644 --- a/htdocs/includes/ace/src/snippets/nginx.js +++ b/htdocs/includes/ace/src/snippets/nginx.js @@ -1,10 +1,5 @@ -define("ace/snippets/nginx",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "nginx"; - -}); (function() { +; (function() { window.require(["ace/snippets/nginx"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nim.js b/htdocs/includes/ace/src/snippets/nim.js index f73018ce124..b3b4dfc0489 100644 --- a/htdocs/includes/ace/src/snippets/nim.js +++ b/htdocs/includes/ace/src/snippets/nim.js @@ -1,10 +1,5 @@ -define("ace/snippets/nim",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "nim"; - -}); (function() { +; (function() { window.require(["ace/snippets/nim"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nix.js b/htdocs/includes/ace/src/snippets/nix.js index c7d9035a6d3..bc63bd3d5ce 100644 --- a/htdocs/includes/ace/src/snippets/nix.js +++ b/htdocs/includes/ace/src/snippets/nix.js @@ -1,10 +1,5 @@ -define("ace/snippets/nix",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "nix"; - -}); (function() { +; (function() { window.require(["ace/snippets/nix"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nsis.js b/htdocs/includes/ace/src/snippets/nsis.js index 423a1a8b336..caf0839d1af 100644 --- a/htdocs/includes/ace/src/snippets/nsis.js +++ b/htdocs/includes/ace/src/snippets/nsis.js @@ -1,10 +1,5 @@ -define("ace/snippets/nsis",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/nsis"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/nunjucks.js b/htdocs/includes/ace/src/snippets/nunjucks.js index 961adec5778..748d2d9ffc4 100644 --- a/htdocs/includes/ace/src/snippets/nunjucks.js +++ b/htdocs/includes/ace/src/snippets/nunjucks.js @@ -1,10 +1,5 @@ -define("ace/snippets/nunjucks",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "nunjucks"; - -}); (function() { +; (function() { window.require(["ace/snippets/nunjucks"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/objectivec.js b/htdocs/includes/ace/src/snippets/objectivec.js index 32816f0b2a1..77bad68f2c2 100644 --- a/htdocs/includes/ace/src/snippets/objectivec.js +++ b/htdocs/includes/ace/src/snippets/objectivec.js @@ -1,10 +1,5 @@ -define("ace/snippets/objectivec",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "objectivec"; - -}); (function() { +; (function() { window.require(["ace/snippets/objectivec"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/ocaml.js b/htdocs/includes/ace/src/snippets/ocaml.js index 2d1f07a0043..23789d1ec6f 100644 --- a/htdocs/includes/ace/src/snippets/ocaml.js +++ b/htdocs/includes/ace/src/snippets/ocaml.js @@ -1,10 +1,5 @@ -define("ace/snippets/ocaml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "ocaml"; - -}); (function() { +; (function() { window.require(["ace/snippets/ocaml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/pascal.js b/htdocs/includes/ace/src/snippets/pascal.js index 296a7565525..f6d60d88ec4 100644 --- a/htdocs/includes/ace/src/snippets/pascal.js +++ b/htdocs/includes/ace/src/snippets/pascal.js @@ -1,10 +1,5 @@ -define("ace/snippets/pascal",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "pascal"; - -}); (function() { +; (function() { window.require(["ace/snippets/pascal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/perl6.js b/htdocs/includes/ace/src/snippets/perl6.js deleted file mode 100644 index 90ecfbe0c82..00000000000 --- a/htdocs/includes/ace/src/snippets/perl6.js +++ /dev/null @@ -1,14 +0,0 @@ -define("ace/snippets/perl6",["require","exports","module"], function(require, exports, module) { -"use strict"; - -exports.snippetText =undefined; -exports.scope = "perl6"; - -}); (function() { - window.require(["ace/snippets/perl6"], function(m) { - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = m; - } - }); - })(); - \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/pgsql.js b/htdocs/includes/ace/src/snippets/pgsql.js index b8b45fb8acb..c15cb260ae6 100644 --- a/htdocs/includes/ace/src/snippets/pgsql.js +++ b/htdocs/includes/ace/src/snippets/pgsql.js @@ -1,10 +1,5 @@ -define("ace/snippets/pgsql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "pgsql"; - -}); (function() { +; (function() { window.require(["ace/snippets/pgsql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/php_laravel_blade.js b/htdocs/includes/ace/src/snippets/php_laravel_blade.js index 9a722c9b371..d4790ba2852 100644 --- a/htdocs/includes/ace/src/snippets/php_laravel_blade.js +++ b/htdocs/includes/ace/src/snippets/php_laravel_blade.js @@ -1,10 +1,5 @@ -define("ace/snippets/php_laravel_blade",["require","exports","module"], function(require, exports, module) { - "use strict"; - exports.snippetText =undefined; - exports.scope = "php"; - -}); (function() { +; (function() { window.require(["ace/snippets/php_laravel_blade"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/pig.js b/htdocs/includes/ace/src/snippets/pig.js index 94d46c7cc7f..157d1921126 100644 --- a/htdocs/includes/ace/src/snippets/pig.js +++ b/htdocs/includes/ace/src/snippets/pig.js @@ -1,10 +1,5 @@ -define("ace/snippets/pig",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "pig"; - -}); (function() { +; (function() { window.require(["ace/snippets/pig"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/plain_text.js b/htdocs/includes/ace/src/snippets/plain_text.js index 988880c9c97..92dfce5cd7b 100644 --- a/htdocs/includes/ace/src/snippets/plain_text.js +++ b/htdocs/includes/ace/src/snippets/plain_text.js @@ -1,10 +1,5 @@ -define("ace/snippets/plain_text",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "plain_text"; - -}); (function() { +; (function() { window.require(["ace/snippets/plain_text"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/powershell.js b/htdocs/includes/ace/src/snippets/powershell.js index 4d8388a81ea..0f36eededab 100644 --- a/htdocs/includes/ace/src/snippets/powershell.js +++ b/htdocs/includes/ace/src/snippets/powershell.js @@ -1,10 +1,5 @@ -define("ace/snippets/powershell",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "powershell"; - -}); (function() { +; (function() { window.require(["ace/snippets/powershell"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/praat.js b/htdocs/includes/ace/src/snippets/praat.js index 75fa2e423e5..e4e734fc77b 100644 --- a/htdocs/includes/ace/src/snippets/praat.js +++ b/htdocs/includes/ace/src/snippets/praat.js @@ -1,10 +1,5 @@ -define("ace/snippets/praat",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "praat"; - -}); (function() { +; (function() { window.require(["ace/snippets/praat"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/prisma.js b/htdocs/includes/ace/src/snippets/prisma.js new file mode 100644 index 00000000000..4a9e2b3e3e6 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/prisma.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/prisma"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/prolog.js b/htdocs/includes/ace/src/snippets/prolog.js index 9147ec6dfaf..4c23dac3852 100644 --- a/htdocs/includes/ace/src/snippets/prolog.js +++ b/htdocs/includes/ace/src/snippets/prolog.js @@ -1,10 +1,5 @@ -define("ace/snippets/prolog",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "prolog"; - -}); (function() { +; (function() { window.require(["ace/snippets/prolog"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/properties.js b/htdocs/includes/ace/src/snippets/properties.js index 1ef5ff3e732..36c01dcb83e 100644 --- a/htdocs/includes/ace/src/snippets/properties.js +++ b/htdocs/includes/ace/src/snippets/properties.js @@ -1,10 +1,5 @@ -define("ace/snippets/properties",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "properties"; - -}); (function() { +; (function() { window.require(["ace/snippets/properties"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/protobuf.js b/htdocs/includes/ace/src/snippets/protobuf.js index 98f00415c7e..b169bbfc539 100644 --- a/htdocs/includes/ace/src/snippets/protobuf.js +++ b/htdocs/includes/ace/src/snippets/protobuf.js @@ -1,10 +1,5 @@ -define("ace/snippets/protobuf",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText = ""; -exports.scope = "protobuf"; - -}); (function() { +; (function() { window.require(["ace/snippets/protobuf"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/puppet.js b/htdocs/includes/ace/src/snippets/puppet.js index 5c7b31650a3..52021e3a5a5 100644 --- a/htdocs/includes/ace/src/snippets/puppet.js +++ b/htdocs/includes/ace/src/snippets/puppet.js @@ -1,10 +1,5 @@ -define("ace/snippets/puppet",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "puppet"; - -}); (function() { +; (function() { window.require(["ace/snippets/puppet"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/qml.js b/htdocs/includes/ace/src/snippets/qml.js new file mode 100644 index 00000000000..cb4f66ede73 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/qml.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/qml"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/raku.js b/htdocs/includes/ace/src/snippets/raku.js new file mode 100644 index 00000000000..8beaf95dc05 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/raku.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/raku"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/rdoc.js b/htdocs/includes/ace/src/snippets/rdoc.js index f4dc8927f84..e4845db4c67 100644 --- a/htdocs/includes/ace/src/snippets/rdoc.js +++ b/htdocs/includes/ace/src/snippets/rdoc.js @@ -1,10 +1,5 @@ -define("ace/snippets/rdoc",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "rdoc"; - -}); (function() { +; (function() { window.require(["ace/snippets/rdoc"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/red.js b/htdocs/includes/ace/src/snippets/red.js index 900634e691e..80cbd1b55af 100644 --- a/htdocs/includes/ace/src/snippets/red.js +++ b/htdocs/includes/ace/src/snippets/red.js @@ -1,10 +1,5 @@ -define("ace/snippets/red",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText = " "; -exports.scope = "red"; - -}); (function() { +; (function() { window.require(["ace/snippets/red"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/redshift.js b/htdocs/includes/ace/src/snippets/redshift.js index 088f0febf03..bedd1473317 100644 --- a/htdocs/includes/ace/src/snippets/redshift.js +++ b/htdocs/includes/ace/src/snippets/redshift.js @@ -1,10 +1,5 @@ -define("ace/snippets/redshift",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "redshift"; - -}); (function() { +; (function() { window.require(["ace/snippets/redshift"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/rhtml.js b/htdocs/includes/ace/src/snippets/rhtml.js index e31ed6f8e92..7eb8a5eba86 100644 --- a/htdocs/includes/ace/src/snippets/rhtml.js +++ b/htdocs/includes/ace/src/snippets/rhtml.js @@ -1,10 +1,5 @@ -define("ace/snippets/rhtml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "rhtml"; - -}); (function() { +; (function() { window.require(["ace/snippets/rhtml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/rust.js b/htdocs/includes/ace/src/snippets/rust.js index 9ee8633e254..63d42815a5d 100644 --- a/htdocs/includes/ace/src/snippets/rust.js +++ b/htdocs/includes/ace/src/snippets/rust.js @@ -1,10 +1,5 @@ -define("ace/snippets/rust",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "rust"; - -}); (function() { +; (function() { window.require(["ace/snippets/rust"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/sass.js b/htdocs/includes/ace/src/snippets/sass.js index 684485dd0ee..0a4de9b4442 100644 --- a/htdocs/includes/ace/src/snippets/sass.js +++ b/htdocs/includes/ace/src/snippets/sass.js @@ -1,10 +1,5 @@ -define("ace/snippets/sass",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "sass"; - -}); (function() { +; (function() { window.require(["ace/snippets/sass"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/scad.js b/htdocs/includes/ace/src/snippets/scad.js index 4d7eec20085..2fb0826416f 100644 --- a/htdocs/includes/ace/src/snippets/scad.js +++ b/htdocs/includes/ace/src/snippets/scad.js @@ -1,10 +1,5 @@ -define("ace/snippets/scad",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "scad"; - -}); (function() { +; (function() { window.require(["ace/snippets/scad"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/scala.js b/htdocs/includes/ace/src/snippets/scala.js index 03eb329e7a4..adc0abbd496 100644 --- a/htdocs/includes/ace/src/snippets/scala.js +++ b/htdocs/includes/ace/src/snippets/scala.js @@ -1,10 +1,5 @@ -define("ace/snippets/scala",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "scala"; - -}); (function() { +; (function() { window.require(["ace/snippets/scala"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/scheme.js b/htdocs/includes/ace/src/snippets/scheme.js index 0f0906f147f..29c3d357914 100644 --- a/htdocs/includes/ace/src/snippets/scheme.js +++ b/htdocs/includes/ace/src/snippets/scheme.js @@ -1,10 +1,5 @@ -define("ace/snippets/scheme",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "scheme"; - -}); (function() { +; (function() { window.require(["ace/snippets/scheme"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/scrypt.js b/htdocs/includes/ace/src/snippets/scrypt.js new file mode 100644 index 00000000000..2d0601a1046 --- /dev/null +++ b/htdocs/includes/ace/src/snippets/scrypt.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/scrypt"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/scss.js b/htdocs/includes/ace/src/snippets/scss.js index 8e636cea79c..6e808dea9f3 100644 --- a/htdocs/includes/ace/src/snippets/scss.js +++ b/htdocs/includes/ace/src/snippets/scss.js @@ -1,10 +1,5 @@ -define("ace/snippets/scss",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "scss"; - -}); (function() { +; (function() { window.require(["ace/snippets/scss"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/sjs.js b/htdocs/includes/ace/src/snippets/sjs.js index a0756ae154d..bc8c1872023 100644 --- a/htdocs/includes/ace/src/snippets/sjs.js +++ b/htdocs/includes/ace/src/snippets/sjs.js @@ -1,10 +1,5 @@ -define("ace/snippets/sjs",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "sjs"; - -}); (function() { +; (function() { window.require(["ace/snippets/sjs"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/slim.js b/htdocs/includes/ace/src/snippets/slim.js index 7b159a94d6a..2fcd039ac1c 100644 --- a/htdocs/includes/ace/src/snippets/slim.js +++ b/htdocs/includes/ace/src/snippets/slim.js @@ -1,10 +1,5 @@ -define("ace/snippets/slim",["require","exports","module"], function(require, exports, module) { - "use strict"; - exports.snippetText =undefined; - exports.scope = "slim"; - -}); (function() { +; (function() { window.require(["ace/snippets/slim"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/smarty.js b/htdocs/includes/ace/src/snippets/smarty.js index 84c3d8eee1c..3affd2eac6e 100644 --- a/htdocs/includes/ace/src/snippets/smarty.js +++ b/htdocs/includes/ace/src/snippets/smarty.js @@ -1,10 +1,5 @@ -define("ace/snippets/smarty",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "smarty"; - -}); (function() { +; (function() { window.require(["ace/snippets/smarty"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/smithy.js b/htdocs/includes/ace/src/snippets/smithy.js new file mode 100644 index 00000000000..4077f9eeeaa --- /dev/null +++ b/htdocs/includes/ace/src/snippets/smithy.js @@ -0,0 +1,9 @@ + +; (function() { + window.require(["ace/snippets/smithy"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/snippets/soy_template.js b/htdocs/includes/ace/src/snippets/soy_template.js index d087ef1d21a..c7409658633 100644 --- a/htdocs/includes/ace/src/snippets/soy_template.js +++ b/htdocs/includes/ace/src/snippets/soy_template.js @@ -1,10 +1,5 @@ -define("ace/snippets/soy_template",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "soy_template"; - -}); (function() { +; (function() { window.require(["ace/snippets/soy_template"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/space.js b/htdocs/includes/ace/src/snippets/space.js index ae87ec48d82..8f485977088 100644 --- a/htdocs/includes/ace/src/snippets/space.js +++ b/htdocs/includes/ace/src/snippets/space.js @@ -1,10 +1,5 @@ -define("ace/snippets/space",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "space"; - -}); (function() { +; (function() { window.require(["ace/snippets/space"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/sparql.js b/htdocs/includes/ace/src/snippets/sparql.js index e021a74fb94..fe60397edb4 100644 --- a/htdocs/includes/ace/src/snippets/sparql.js +++ b/htdocs/includes/ace/src/snippets/sparql.js @@ -1,10 +1,5 @@ -define("ace/snippets/sparql",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/sparql"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/stylus.js b/htdocs/includes/ace/src/snippets/stylus.js index 0172b391622..34f1d714119 100644 --- a/htdocs/includes/ace/src/snippets/stylus.js +++ b/htdocs/includes/ace/src/snippets/stylus.js @@ -1,10 +1,5 @@ -define("ace/snippets/stylus",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "stylus"; - -}); (function() { +; (function() { window.require(["ace/snippets/stylus"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/svg.js b/htdocs/includes/ace/src/snippets/svg.js index 9f63d38fa3b..1aa4a8502e7 100644 --- a/htdocs/includes/ace/src/snippets/svg.js +++ b/htdocs/includes/ace/src/snippets/svg.js @@ -1,10 +1,5 @@ -define("ace/snippets/svg",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "svg"; - -}); (function() { +; (function() { window.require(["ace/snippets/svg"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/swift.js b/htdocs/includes/ace/src/snippets/swift.js index 8b510938dd3..143e32b7acd 100644 --- a/htdocs/includes/ace/src/snippets/swift.js +++ b/htdocs/includes/ace/src/snippets/swift.js @@ -1,10 +1,5 @@ -define("ace/snippets/swift",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "swift"; - -}); (function() { +; (function() { window.require(["ace/snippets/swift"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/terraform.js b/htdocs/includes/ace/src/snippets/terraform.js index 7e0593733b5..c9d8d31d601 100644 --- a/htdocs/includes/ace/src/snippets/terraform.js +++ b/htdocs/includes/ace/src/snippets/terraform.js @@ -1,10 +1,5 @@ -define("ace/snippets/terraform",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "terraform"; - -}); (function() { +; (function() { window.require(["ace/snippets/terraform"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/text.js b/htdocs/includes/ace/src/snippets/text.js index 949bb2a72dd..85b4d10e5f7 100644 --- a/htdocs/includes/ace/src/snippets/text.js +++ b/htdocs/includes/ace/src/snippets/text.js @@ -1,10 +1,5 @@ -define("ace/snippets/text",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "text"; - -}); (function() { +; (function() { window.require(["ace/snippets/text"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/toml.js b/htdocs/includes/ace/src/snippets/toml.js index 4f0c1fa463f..e585672c285 100644 --- a/htdocs/includes/ace/src/snippets/toml.js +++ b/htdocs/includes/ace/src/snippets/toml.js @@ -1,10 +1,5 @@ -define("ace/snippets/toml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "toml"; - -}); (function() { +; (function() { window.require(["ace/snippets/toml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/tsx.js b/htdocs/includes/ace/src/snippets/tsx.js index fd1bba27203..f0456fdd9a1 100644 --- a/htdocs/includes/ace/src/snippets/tsx.js +++ b/htdocs/includes/ace/src/snippets/tsx.js @@ -1,10 +1,5 @@ -define("ace/snippets/tsx",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "tsx"; - -}); (function() { +; (function() { window.require(["ace/snippets/tsx"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/turtle.js b/htdocs/includes/ace/src/snippets/turtle.js index c6bc21bfa50..7e0a30cec5b 100644 --- a/htdocs/includes/ace/src/snippets/turtle.js +++ b/htdocs/includes/ace/src/snippets/turtle.js @@ -1,10 +1,5 @@ -define("ace/snippets/turtle",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/turtle"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/twig.js b/htdocs/includes/ace/src/snippets/twig.js index fe757895eb6..2cec7aaa7ff 100644 --- a/htdocs/includes/ace/src/snippets/twig.js +++ b/htdocs/includes/ace/src/snippets/twig.js @@ -1,10 +1,5 @@ -define("ace/snippets/twig",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "twig"; - -}); (function() { +; (function() { window.require(["ace/snippets/twig"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/typescript.js b/htdocs/includes/ace/src/snippets/typescript.js index 2da2fb807fa..27dc42bf129 100644 --- a/htdocs/includes/ace/src/snippets/typescript.js +++ b/htdocs/includes/ace/src/snippets/typescript.js @@ -1,10 +1,5 @@ -define("ace/snippets/typescript",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "typescript"; - -}); (function() { +; (function() { window.require(["ace/snippets/typescript"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/vbscript.js b/htdocs/includes/ace/src/snippets/vbscript.js index 0989a0810c9..637e51913ff 100644 --- a/htdocs/includes/ace/src/snippets/vbscript.js +++ b/htdocs/includes/ace/src/snippets/vbscript.js @@ -1,10 +1,5 @@ -define("ace/snippets/vbscript",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "vbscript"; - -}); (function() { +; (function() { window.require(["ace/snippets/vbscript"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/verilog.js b/htdocs/includes/ace/src/snippets/verilog.js index 2ed2eef0e45..d824e8463ef 100644 --- a/htdocs/includes/ace/src/snippets/verilog.js +++ b/htdocs/includes/ace/src/snippets/verilog.js @@ -1,10 +1,5 @@ -define("ace/snippets/verilog",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "verilog"; - -}); (function() { +; (function() { window.require(["ace/snippets/verilog"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/vhdl.js b/htdocs/includes/ace/src/snippets/vhdl.js index d9b716461be..015c2fbf371 100644 --- a/htdocs/includes/ace/src/snippets/vhdl.js +++ b/htdocs/includes/ace/src/snippets/vhdl.js @@ -1,10 +1,5 @@ -define("ace/snippets/vhdl",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "vhdl"; - -}); (function() { +; (function() { window.require(["ace/snippets/vhdl"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/visualforce.js b/htdocs/includes/ace/src/snippets/visualforce.js index 11c0781cef2..135cf6bdea8 100644 --- a/htdocs/includes/ace/src/snippets/visualforce.js +++ b/htdocs/includes/ace/src/snippets/visualforce.js @@ -1,10 +1,5 @@ -define("ace/snippets/visualforce",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "visualforce"; - -}); (function() { +; (function() { window.require(["ace/snippets/visualforce"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/xml.js b/htdocs/includes/ace/src/snippets/xml.js index 9bbe62ad7b6..927c6659786 100644 --- a/htdocs/includes/ace/src/snippets/xml.js +++ b/htdocs/includes/ace/src/snippets/xml.js @@ -1,10 +1,5 @@ -define("ace/snippets/xml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "xml"; - -}); (function() { +; (function() { window.require(["ace/snippets/xml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/yaml.js b/htdocs/includes/ace/src/snippets/yaml.js index bbfecbc21da..13a274dc84c 100644 --- a/htdocs/includes/ace/src/snippets/yaml.js +++ b/htdocs/includes/ace/src/snippets/yaml.js @@ -1,10 +1,5 @@ -define("ace/snippets/yaml",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = "yaml"; - -}); (function() { +; (function() { window.require(["ace/snippets/yaml"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/snippets/zeek.js b/htdocs/includes/ace/src/snippets/zeek.js index e432c22e116..a1fc7cdff3c 100644 --- a/htdocs/includes/ace/src/snippets/zeek.js +++ b/htdocs/includes/ace/src/snippets/zeek.js @@ -1,10 +1,5 @@ -define("ace/snippets/zeek",["require","exports","module"], function(require, exports, module) { -"use strict"; -exports.snippetText =undefined; -exports.scope = ""; - -}); (function() { +; (function() { window.require(["ace/snippets/zeek"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; diff --git a/htdocs/includes/ace/src/theme-ambiance.js b/htdocs/includes/ace/src/theme-ambiance.js index bac9b4d6339..0830aed50b4 100644 --- a/htdocs/includes/ace/src/theme-ambiance.js +++ b/htdocs/includes/ace/src/theme-ambiance.js @@ -25,7 +25,7 @@ color: #777;\ .ace-ambiance .ace_fold-widget.ace_start,\ .ace-ambiance .ace_fold-widget.ace_end,\ .ace-ambiance .ace_fold-widget.ace_closed{\ -background: none;\ +background: none !important;\ border: none;\ box-shadow: none;\ }\ @@ -169,10 +169,11 @@ background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICA }\ .ace-ambiance .ace_indent-guide {\ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNQUFD4z6Crq/sfAAuYAuYl+7lfAAAAAElFTkSuQmCC\") right repeat-y;\ -}"; +}\ +"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/ambiance"], function(m) { diff --git a/htdocs/includes/ace/src/theme-chaos.js b/htdocs/includes/ace/src/theme-chaos.js index 1a46b5b1d02..630a72f72ce 100644 --- a/htdocs/includes/ace/src/theme-chaos.js +++ b/htdocs/includes/ace/src/theme-chaos.js @@ -121,7 +121,7 @@ color: #777;\ .ace-chaos .ace_fold-widget.ace_start,\ .ace-chaos .ace_fold-widget.ace_end,\ .ace-chaos .ace_fold-widget.ace_closed{\ -background: none;\ +background: none !important;\ border: none;\ box-shadow: none;\ }\ @@ -151,7 +151,7 @@ color: #000;\ "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/chaos"], function(m) { diff --git a/htdocs/includes/ace/src/theme-chrome.js b/htdocs/includes/ace/src/theme-chrome.js index e55118cb13d..9fa527e4a3f 100644 --- a/htdocs/includes/ace/src/theme-chrome.js +++ b/htdocs/includes/ace/src/theme-chrome.js @@ -124,7 +124,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/chrome"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-clouds.js b/htdocs/includes/ace/src/theme-clouds.js index 01e6cc0b172..2673f62f815 100644 --- a/htdocs/includes/ace/src/theme-clouds.js +++ b/htdocs/includes/ace/src/theme-clouds.js @@ -91,7 +91,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/clouds"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-clouds_midnight.js b/htdocs/includes/ace/src/theme-clouds_midnight.js index 60f0f654365..d88ece21d43 100644 --- a/htdocs/includes/ace/src/theme-clouds_midnight.js +++ b/htdocs/includes/ace/src/theme-clouds_midnight.js @@ -92,7 +92,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/clouds_midnight"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-cobalt.js b/htdocs/includes/ace/src/theme-cobalt.js index 74f20385609..5459c756153 100644 --- a/htdocs/includes/ace/src/theme-cobalt.js +++ b/htdocs/includes/ace/src/theme-cobalt.js @@ -109,7 +109,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/cobalt"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-crimson_editor.js b/htdocs/includes/ace/src/theme-crimson_editor.js index 88d70538c49..b162e5be5a3 100644 --- a/htdocs/includes/ace/src/theme-crimson_editor.js +++ b/htdocs/includes/ace/src/theme-crimson_editor.js @@ -114,7 +114,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ exports.cssClass = "ace-crimson-editor"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/crimson_editor"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-dawn.js b/htdocs/includes/ace/src/theme-dawn.js index 8a635b3ddff..923dad68d5f 100644 --- a/htdocs/includes/ace/src/theme-dawn.js +++ b/htdocs/includes/ace/src/theme-dawn.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/dawn"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-dracula.js b/htdocs/includes/ace/src/theme-dracula.js index 78942e2867b..3085b9d9693 100644 --- a/htdocs/includes/ace/src/theme-dracula.js +++ b/htdocs/includes/ace/src/theme-dracula.js @@ -124,7 +124,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb exports.$selectionColorConflict = true; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/dracula"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-dreamweaver.js b/htdocs/includes/ace/src/theme-dreamweaver.js index 26abc55bf93..fa9771e9233 100644 --- a/htdocs/includes/ace/src/theme-dreamweaver.js +++ b/htdocs/includes/ace/src/theme-dreamweaver.js @@ -137,7 +137,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/dreamweaver"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-eclipse.js b/htdocs/includes/ace/src/theme-eclipse.js index 31057e66f0f..5deddde3f19 100644 --- a/htdocs/includes/ace/src/theme-eclipse.js +++ b/htdocs/includes/ace/src/theme-eclipse.js @@ -94,7 +94,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ exports.cssClass = "ace-eclipse"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/eclipse"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-github.js b/htdocs/includes/ace/src/theme-github.js index 7f6baf4acd2..12d70bc7746 100644 --- a/htdocs/includes/ace/src/theme-github.js +++ b/htdocs/includes/ace/src/theme-github.js @@ -99,7 +99,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ }"; var dom = require("../lib/dom"); - dom.importCssString(exports.cssText, exports.cssClass); + dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/github"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-gob.js b/htdocs/includes/ace/src/theme-gob.js index 9c03e7bd055..7326db1ec07 100644 --- a/htdocs/includes/ace/src/theme-gob.js +++ b/htdocs/includes/ace/src/theme-gob.js @@ -108,7 +108,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/gob"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-gruvbox.js b/htdocs/includes/ace/src/theme-gruvbox.js index d2e6ded6b27..c52e8f0fca8 100644 --- a/htdocs/includes/ace/src/theme-gruvbox.js +++ b/htdocs/includes/ace/src/theme-gruvbox.js @@ -77,7 +77,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/gruvbox"], function(m) { diff --git a/htdocs/includes/ace/src/theme-idle_fingers.js b/htdocs/includes/ace/src/theme-idle_fingers.js index 877b884dc3c..1af5e27a28b 100644 --- a/htdocs/includes/ace/src/theme-idle_fingers.js +++ b/htdocs/includes/ace/src/theme-idle_fingers.js @@ -92,7 +92,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/idle_fingers"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-iplastic.js b/htdocs/includes/ace/src/theme-iplastic.js index d09b09f2b42..6eaf7abe3c7 100644 --- a/htdocs/includes/ace/src/theme-iplastic.js +++ b/htdocs/includes/ace/src/theme-iplastic.js @@ -117,7 +117,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/iplastic"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-katzenmilch.js b/htdocs/includes/ace/src/theme-katzenmilch.js index 45dd629a12b..596d9702050 100644 --- a/htdocs/includes/ace/src/theme-katzenmilch.js +++ b/htdocs/includes/ace/src/theme-katzenmilch.js @@ -117,7 +117,7 @@ rbackground-color: rgba(73, 166, 210, 0.039)\ }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/katzenmilch"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-kr_theme.js b/htdocs/includes/ace/src/theme-kr_theme.js index bb32770a2a4..1509c0b1ead 100644 --- a/htdocs/includes/ace/src/theme-kr_theme.js +++ b/htdocs/includes/ace/src/theme-kr_theme.js @@ -100,7 +100,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/kr_theme"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-kuroir.js b/htdocs/includes/ace/src/theme-kuroir.js index 6d12d2c71c0..85af8e85ba9 100644 --- a/htdocs/includes/ace/src/theme-kuroir.js +++ b/htdocs/includes/ace/src/theme-kuroir.js @@ -57,7 +57,7 @@ background-color:rgba(191, 97, 51, 0.051);}.ace-kuroir .ace_markup.ace_list{colo "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/kuroir"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-merbivore.js b/htdocs/includes/ace/src/theme-merbivore.js index 636fbe44d43..e638fb1c6e7 100644 --- a/htdocs/includes/ace/src/theme-merbivore.js +++ b/htdocs/includes/ace/src/theme-merbivore.js @@ -91,7 +91,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/merbivore"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-merbivore_soft.js b/htdocs/includes/ace/src/theme-merbivore_soft.js index 4ce881ae5a7..d79865b0f66 100644 --- a/htdocs/includes/ace/src/theme-merbivore_soft.js +++ b/htdocs/includes/ace/src/theme-merbivore_soft.js @@ -92,7 +92,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/merbivore_soft"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-mono_industrial.js b/htdocs/includes/ace/src/theme-mono_industrial.js index 6a00097b0d2..0bd57662e85 100644 --- a/htdocs/includes/ace/src/theme-mono_industrial.js +++ b/htdocs/includes/ace/src/theme-mono_industrial.js @@ -103,7 +103,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/mono_industrial"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-monokai.js b/htdocs/includes/ace/src/theme-monokai.js index ce64226bda5..7eed6b445d9 100644 --- a/htdocs/includes/ace/src/theme-monokai.js +++ b/htdocs/includes/ace/src/theme-monokai.js @@ -101,7 +101,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/monokai"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-nord_dark.js b/htdocs/includes/ace/src/theme-nord_dark.js new file mode 100644 index 00000000000..c97f58317ad --- /dev/null +++ b/htdocs/includes/ace/src/theme-nord_dark.js @@ -0,0 +1,102 @@ +define("ace/theme/nord_dark",["require","exports","module","ace/lib/dom"], function(require, exports, module) { + +exports.isDark = true; +exports.cssClass = "ace-nord-dark"; +exports.cssText = ".ace-nord-dark .ace_gutter {\ +color: #616e88;\ +}\ +.ace-nord-dark .ace_print-margin {\ +width: 1px;\ +background: #4c566a;\ +}\ +.ace-nord-dark {\ +background-color: #2e3440;\ +color: #d8dee9;\ +}\ +.ace-nord-dark .ace_entity.ace_other.ace_attribute-name,\ +.ace-nord-dark .ace_storage {\ +color: #d8dee9;\ +}\ +.ace-nord-dark .ace_cursor {\ +color: #d8dee9;\ +},\ +.ace-nord-dark .ace_string.ace_regexp {\ +color: #bf616a;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_active-line {\ +background: #434c5ecc;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_selection {\ +background: #434c5ecc;\ +}\ +.ace-nord-dark.ace_multiselect .ace_selection.ace_start {\ +box-shadow: 0 0 3px 0px #2e3440;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_step {\ +background: #ebcb8b;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid #88c0d066;\ +}\ +.ace-nord-dark .ace_gutter-active-line {\ +background-color: #434c5ecc;\ +}\ +.ace-nord-dark .ace_marker-layer .ace_selected-word {\ +border: 1px solid #88c0d066;\ +}\ +.ace-nord-dark .ace_invisible {\ +color: #4c566a;\ +}\ +.ace-nord-dark .ace_keyword,\ +.ace-nord-dark .ace_meta,\ +.ace-nord-dark .ace_support.ace_class,\ +.ace-nord-dark .ace_support.ace_type {\ +color: #81a1c1;\ +}\ +.ace-nord-dark .ace_constant.ace_character,\ +.ace-nord-dark .ace_constant.ace_other {\ +color: #d8dee9;\ +}\ +.ace-nord-dark .ace_constant.ace_language {\ +color: #5e81ac;\ +}\ +.ace-nord-dark .ace_constant.ace_escape {\ +color: #ebcB8b;\ +}\ +.ace-nord-dark .ace_constant.ace_numeric {\ +color: #b48ead;\ +}\ +.ace-nord-dark .ace_fold {\ +background-color: #4c566a;\ +border-color: #d8dee9;\ +}\ +.ace-nord-dark .ace_entity.ace_name.ace_function,\ +.ace-nord-dark .ace_entity.ace_name.ace_tag,\ +.ace-nord-dark .ace_support.ace_function,\ +.ace-nord-dark .ace_variable,\ +.ace-nord-dark .ace_variable.ace_language {\ +color: #8fbcbb;\ +}\ +.ace-nord-dark .ace_string {\ +color: #a3be8c;\ +}\ +.ace-nord-dark .ace_comment {\ +color: #616e88;\ +}\ +.ace-nord-dark .ace_indent-guide {\ +box-shadow: inset -1px 0 0 0 #434c5eb3;\ +}\ +"; +exports.$selectionColorConflict = true; + +var dom = require("../lib/dom"); +dom.importCssString(exports.cssText, exports.cssClass, false); +}); (function() { + window.require(["ace/theme/nord_dark"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/theme-one_dark.js b/htdocs/includes/ace/src/theme-one_dark.js new file mode 100644 index 00000000000..b99f2287b92 --- /dev/null +++ b/htdocs/includes/ace/src/theme-one_dark.js @@ -0,0 +1,139 @@ +define("ace/theme/one_dark",["require","exports","module","ace/lib/dom"], function(require, exports, module) { + + exports.isDark = true; + exports.cssClass = "ace-one-dark"; + exports.cssText = ".ace-one-dark .ace_gutter {\ +background: #282c34;\ +color: #6a6f7a\ +}\ +.ace-one-dark .ace_print-margin {\ +width: 1px;\ +background: #e8e8e8\ +}\ +.ace-one-dark {\ +background-color: #282c34;\ +color: #abb2bf\ +}\ +.ace-one-dark .ace_cursor {\ +color: #528bff\ +}\ +.ace-one-dark .ace_marker-layer .ace_selection {\ +background: #3d4350\ +}\ +.ace-one-dark.ace_multiselect .ace_selection.ace_start {\ +box-shadow: 0 0 3px 0 #282c34;\ +border-radius: 2px\ +}\ +.ace-one-dark .ace_marker-layer .ace_step {\ +background: #c6dbae\ +}\ +.ace-one-dark .ace_marker-layer .ace_bracket {\ +margin: -1px 0 0 -1px;\ +border: 1px solid #747369\ +}\ +.ace-one-dark .ace_marker-layer .ace_active-line {\ +background: rgba(76, 87, 103, .19)\ +}\ +.ace-one-dark .ace_gutter-active-line {\ +background-color: rgba(76, 87, 103, .19)\ +}\ +.ace-one-dark .ace_marker-layer .ace_selected-word {\ +border: 1px solid #3d4350\ +}\ +.ace-one-dark .ace_fold {\ +background-color: #61afef;\ +border-color: #abb2bf\ +}\ +.ace-one-dark .ace_keyword {\ +color: #c678dd\ +}\ +.ace-one-dark .ace_keyword.ace_operator {\ +color: #c678dd\ +}\ +.ace-one-dark .ace_keyword.ace_other.ace_unit {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_constant.ace_language {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_constant.ace_numeric {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_constant.ace_character {\ +color: #56b6c2\ +}\ +.ace-one-dark .ace_constant.ace_other {\ +color: #56b6c2\ +}\ +.ace-one-dark .ace_support.ace_function {\ +color: #61afef\ +}\ +.ace-one-dark .ace_support.ace_constant {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_support.ace_class {\ +color: #e5c07b\ +}\ +.ace-one-dark .ace_support.ace_type {\ +color: #e5c07b\ +}\ +.ace-one-dark .ace_storage {\ +color: #c678dd\ +}\ +.ace-one-dark .ace_storage.ace_type {\ +color: #c678dd\ +}\ +.ace-one-dark .ace_invalid {\ +color: #fff;\ +background-color: #f2777a\ +}\ +.ace-one-dark .ace_invalid.ace_deprecated {\ +color: #272b33;\ +background-color: #d27b53\ +}\ +.ace-one-dark .ace_string {\ +color: #98c379\ +}\ +.ace-one-dark .ace_string.ace_regexp {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_comment {\ +font-style: italic;\ +color: #5c6370\ +}\ +.ace-one-dark .ace_variable {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_variable.ace_parameter {\ +color: #d19a66\ +}\ +.ace-one-dark .ace_meta.ace_tag {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_entity.ace_other.ace_attribute-name {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_entity.ace_name.ace_function {\ +color: #61afef\ +}\ +.ace-one-dark .ace_entity.ace_name.ace_tag {\ +color: #e06c75\ +}\ +.ace-one-dark .ace_markup.ace_heading {\ +color: #98c379\ +}\ +.ace-one-dark .ace_indent-guide {\ +background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ09NrYAgMjP4PAAtGAwchHMyAAAAAAElFTkSuQmCC) right repeat-y\ +}\ +"; + + var dom = require("../lib/dom"); + dom.importCssString(exports.cssText, exports.cssClass, false); + }); (function() { + window.require(["ace/theme/one_dark"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/htdocs/includes/ace/src/theme-pastel_on_dark.js b/htdocs/includes/ace/src/theme-pastel_on_dark.js index e02957c99b8..cc51053dc43 100644 --- a/htdocs/includes/ace/src/theme-pastel_on_dark.js +++ b/htdocs/includes/ace/src/theme-pastel_on_dark.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/pastel_on_dark"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-solarized_dark.js b/htdocs/includes/ace/src/theme-solarized_dark.js index dad8d3896b9..e9a2664d166 100644 --- a/htdocs/includes/ace/src/theme-solarized_dark.js +++ b/htdocs/includes/ace/src/theme-solarized_dark.js @@ -84,7 +84,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/solarized_dark"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-solarized_light.js b/htdocs/includes/ace/src/theme-solarized_light.js index 70f9383041c..2746ea63c78 100644 --- a/htdocs/includes/ace/src/theme-solarized_light.js +++ b/htdocs/includes/ace/src/theme-solarized_light.js @@ -87,7 +87,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/solarized_light"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-sqlserver.js b/htdocs/includes/ace/src/theme-sqlserver.js index 91724014b01..1b626a28fcf 100644 --- a/htdocs/includes/ace/src/theme-sqlserver.js +++ b/htdocs/includes/ace/src/theme-sqlserver.js @@ -134,7 +134,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/sqlserver"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-terminal.js b/htdocs/includes/ace/src/theme-terminal.js index 8f87077cae7..b10de0bd323 100644 --- a/htdocs/includes/ace/src/theme-terminal.js +++ b/htdocs/includes/ace/src/theme-terminal.js @@ -110,7 +110,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb "; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/terminal"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-textmate.js b/htdocs/includes/ace/src/theme-textmate.js index 6ad09556895..dc651d74b73 100644 --- a/htdocs/includes/ace/src/theme-textmate.js +++ b/htdocs/includes/ace/src/theme-textmate.js @@ -126,7 +126,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ exports.$id = "ace/theme/textmate"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/textmate"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow.js b/htdocs/includes/ace/src/theme-tomorrow.js index 5a2e3b5a4f2..b1f73da83b6 100644 --- a/htdocs/includes/ace/src/theme-tomorrow.js +++ b/htdocs/includes/ace/src/theme-tomorrow.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow_night.js b/htdocs/includes/ace/src/theme-tomorrow_night.js index 9cdeedce37b..36c748fd64b 100644 --- a/htdocs/includes/ace/src/theme-tomorrow_night.js +++ b/htdocs/includes/ace/src/theme-tomorrow_night.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow_night"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow_night_blue.js b/htdocs/includes/ace/src/theme-tomorrow_night_blue.js index 52afc918d78..7bf7fc64680 100644 --- a/htdocs/includes/ace/src/theme-tomorrow_night_blue.js +++ b/htdocs/includes/ace/src/theme-tomorrow_night_blue.js @@ -102,7 +102,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow_night_blue"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow_night_bright.js b/htdocs/includes/ace/src/theme-tomorrow_night_bright.js index b90c17921a4..3bf12ddd420 100644 --- a/htdocs/includes/ace/src/theme-tomorrow_night_bright.js +++ b/htdocs/includes/ace/src/theme-tomorrow_night_bright.js @@ -117,7 +117,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow_night_bright"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-tomorrow_night_eighties.js b/htdocs/includes/ace/src/theme-tomorrow_night_eighties.js index 5759eadbc3d..e5c48fcaedf 100644 --- a/htdocs/includes/ace/src/theme-tomorrow_night_eighties.js +++ b/htdocs/includes/ace/src/theme-tomorrow_night_eighties.js @@ -104,7 +104,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/tomorrow_night_eighties"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-twilight.js b/htdocs/includes/ace/src/theme-twilight.js index 34857c311a4..03e9d07da2a 100644 --- a/htdocs/includes/ace/src/theme-twilight.js +++ b/htdocs/includes/ace/src/theme-twilight.js @@ -80,8 +80,7 @@ color: #DAD085\ color: #F9EE98\ }\ .ace-twilight .ace_entity.ace_name.ace_function,\ -.ace-twilight .ace_meta.ace_tag,\ -.ace-twilight .ace_variable {\ +.ace-twilight .ace_meta.ace_tag {\ color: #AC885B\ }\ .ace-twilight .ace_string {\ @@ -102,10 +101,11 @@ color: #494949\ }\ .ace-twilight .ace_indent-guide {\ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQERFpYLC1tf0PAAgOAnPnhxyiAAAAAElFTkSuQmCC) right repeat-y\ -}"; +}\ +"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/twilight"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-vibrant_ink.js b/htdocs/includes/ace/src/theme-vibrant_ink.js index 6fbc5094c93..26f7de9043a 100644 --- a/htdocs/includes/ace/src/theme-vibrant_ink.js +++ b/htdocs/includes/ace/src/theme-vibrant_ink.js @@ -90,7 +90,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/vibrant_ink"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/theme-xcode.js b/htdocs/includes/ace/src/theme-xcode.js index 99a5b75ef9a..daded3a15eb 100644 --- a/htdocs/includes/ace/src/theme-xcode.js +++ b/htdocs/includes/ace/src/theme-xcode.js @@ -84,7 +84,7 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb }"; var dom = require("../lib/dom"); -dom.importCssString(exports.cssText, exports.cssClass); +dom.importCssString(exports.cssText, exports.cssClass, false); }); (function() { window.require(["ace/theme/xcode"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { diff --git a/htdocs/includes/ace/src/worker-base.js b/htdocs/includes/ace/src/worker-base.js new file mode 100644 index 00000000000..ca582ac58ec --- /dev/null +++ b/htdocs/includes/ace/src/worker-base.js @@ -0,0 +1,1421 @@ +"no use strict"; +!(function(window) { +if (typeof window.window != "undefined" && window.document) + return; +if (window.require && window.define) + return; + +if (!window.console) { + window.console = function() { + var msgs = Array.prototype.slice.call(arguments, 0); + postMessage({type: "log", data: msgs}); + }; + window.console.error = + window.console.warn = + window.console.log = + window.console.trace = window.console; +} +window.window = window; +window.ace = window; + +window.onerror = function(message, file, line, col, err) { + postMessage({type: "error", data: { + message: message, + data: err.data, + file: file, + line: line, + col: col, + stack: err.stack + }}); +}; + +window.normalizeModule = function(parentId, moduleName) { + // normalize plugin requires + if (moduleName.indexOf("!") !== -1) { + var chunks = moduleName.split("!"); + return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]); + } + // normalize relative requires + if (moduleName.charAt(0) == ".") { + var base = parentId.split("/").slice(0, -1).join("/"); + moduleName = (base ? base + "/" : "") + moduleName; + + while (moduleName.indexOf(".") !== -1 && previous != moduleName) { + var previous = moduleName; + moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); + } + } + + return moduleName; +}; + +window.require = function require(parentId, id) { + if (!id) { + id = parentId; + parentId = null; + } + if (!id.charAt) + throw new Error("worker.js require() accepts only (parentId, id) as arguments"); + + id = window.normalizeModule(parentId, id); + + var module = window.require.modules[id]; + if (module) { + if (!module.initialized) { + module.initialized = true; + module.exports = module.factory().exports; + } + return module.exports; + } + + if (!window.require.tlns) + return console.log("unable to load " + id); + + var path = resolveModuleId(id, window.require.tlns); + if (path.slice(-3) != ".js") path += ".js"; + + window.require.id = id; + window.require.modules[id] = {}; // prevent infinite loop on broken modules + importScripts(path); + return window.require(parentId, id); +}; +function resolveModuleId(id, paths) { + var testPath = id, tail = ""; + while (testPath) { + var alias = paths[testPath]; + if (typeof alias == "string") { + return alias + tail; + } else if (alias) { + return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name); + } else if (alias === false) { + return ""; + } + var i = testPath.lastIndexOf("/"); + if (i === -1) break; + tail = testPath.substr(i) + tail; + testPath = testPath.slice(0, i); + } + return id; +} +window.require.modules = {}; +window.require.tlns = {}; + +window.define = function(id, deps, factory) { + if (arguments.length == 2) { + factory = deps; + if (typeof id != "string") { + deps = id; + id = window.require.id; + } + } else if (arguments.length == 1) { + factory = id; + deps = []; + id = window.require.id; + } + + if (typeof factory != "function") { + window.require.modules[id] = { + exports: factory, + initialized: true + }; + return; + } + + if (!deps.length) + // If there is no dependencies, we inject "require", "exports" and + // "module" as dependencies, to provide CommonJS compatibility. + deps = ["require", "exports", "module"]; + + var req = function(childId) { + return window.require(id, childId); + }; + + window.require.modules[id] = { + exports: {}, + factory: function() { + var module = this; + var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) { + switch (dep) { + // Because "require", "exports" and "module" aren't actual + // dependencies, we must handle them seperately. + case "require": return req; + case "exports": return module.exports; + case "module": return module; + // But for all other dependencies, we can just go ahead and + // require them. + default: return req(dep); + } + })); + if (returnExports) + module.exports = returnExports; + return module; + } + }; +}; +window.define.amd = {}; +require.tlns = {}; +window.initBaseUrls = function initBaseUrls(topLevelNamespaces) { + for (var i in topLevelNamespaces) + require.tlns[i] = topLevelNamespaces[i]; +}; + +window.initSender = function initSender() { + + var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter; + var oop = window.require("ace/lib/oop"); + + var Sender = function() {}; + + (function() { + + oop.implement(this, EventEmitter); + + this.callback = function(data, callbackId) { + postMessage({ + type: "call", + id: callbackId, + data: data + }); + }; + + this.emit = function(name, data) { + postMessage({ + type: "event", + name: name, + data: data + }); + }; + + }).call(Sender.prototype); + + return new Sender(); +}; + +var main = window.main = null; +var sender = window.sender = null; + +window.onmessage = function(e) { + var msg = e.data; + if (msg.event && sender) { + sender._signal(msg.event, msg.data); + } + else if (msg.command) { + if (main[msg.command]) + main[msg.command].apply(main, msg.args); + else if (window[msg.command]) + window[msg.command].apply(window, msg.args); + else + throw new Error("Unknown command:" + msg.command); + } + else if (msg.init) { + window.initBaseUrls(msg.tlns); + sender = window.sender = window.initSender(); + var clazz = require(msg.module)[msg.classname]; + main = window.main = new clazz(sender); + } +}; +})(this); + +define("ace/range",[], function(require, exports, module) { +"use strict"; +var comparePoints = function(p1, p2) { + return p1.row - p2.row || p1.column - p2.column; +}; +var Range = function(startRow, startColumn, endRow, endColumn) { + this.start = { + row: startRow, + column: startColumn + }; + + this.end = { + row: endRow, + column: endColumn + }; +}; + +(function() { + this.isEqual = function(range) { + return this.start.row === range.start.row && + this.end.row === range.end.row && + this.start.column === range.start.column && + this.end.column === range.end.column; + }; + this.toString = function() { + return ("Range: [" + this.start.row + "/" + this.start.column + + "] -> [" + this.end.row + "/" + this.end.column + "]"); + }; + + this.contains = function(row, column) { + return this.compare(row, column) == 0; + }; + this.compareRange = function(range) { + var cmp, + end = range.end, + start = range.start; + + cmp = this.compare(end.row, end.column); + if (cmp == 1) { + cmp = this.compare(start.row, start.column); + if (cmp == 1) { + return 2; + } else if (cmp == 0) { + return 1; + } else { + return 0; + } + } else if (cmp == -1) { + return -2; + } else { + cmp = this.compare(start.row, start.column); + if (cmp == -1) { + return -1; + } else if (cmp == 1) { + return 42; + } else { + return 0; + } + } + }; + this.comparePoint = function(p) { + return this.compare(p.row, p.column); + }; + this.containsRange = function(range) { + return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; + }; + this.intersects = function(range) { + var cmp = this.compareRange(range); + return (cmp == -1 || cmp == 0 || cmp == 1); + }; + this.isEnd = function(row, column) { + return this.end.row == row && this.end.column == column; + }; + this.isStart = function(row, column) { + return this.start.row == row && this.start.column == column; + }; + this.setStart = function(row, column) { + if (typeof row == "object") { + this.start.column = row.column; + this.start.row = row.row; + } else { + this.start.row = row; + this.start.column = column; + } + }; + this.setEnd = function(row, column) { + if (typeof row == "object") { + this.end.column = row.column; + this.end.row = row.row; + } else { + this.end.row = row; + this.end.column = column; + } + }; + this.inside = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isEnd(row, column) || this.isStart(row, column)) { + return false; + } else { + return true; + } + } + return false; + }; + this.insideStart = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isEnd(row, column)) { + return false; + } else { + return true; + } + } + return false; + }; + this.insideEnd = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isStart(row, column)) { + return false; + } else { + return true; + } + } + return false; + }; + this.compare = function(row, column) { + if (!this.isMultiLine()) { + if (row === this.start.row) { + return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0); + } + } + + if (row < this.start.row) + return -1; + + if (row > this.end.row) + return 1; + + if (this.start.row === row) + return column >= this.start.column ? 0 : -1; + + if (this.end.row === row) + return column <= this.end.column ? 0 : 1; + + return 0; + }; + this.compareStart = function(row, column) { + if (this.start.row == row && this.start.column == column) { + return -1; + } else { + return this.compare(row, column); + } + }; + this.compareEnd = function(row, column) { + if (this.end.row == row && this.end.column == column) { + return 1; + } else { + return this.compare(row, column); + } + }; + this.compareInside = function(row, column) { + if (this.end.row == row && this.end.column == column) { + return 1; + } else if (this.start.row == row && this.start.column == column) { + return -1; + } else { + return this.compare(row, column); + } + }; + this.clipRows = function(firstRow, lastRow) { + if (this.end.row > lastRow) + var end = {row: lastRow + 1, column: 0}; + else if (this.end.row < firstRow) + var end = {row: firstRow, column: 0}; + + if (this.start.row > lastRow) + var start = {row: lastRow + 1, column: 0}; + else if (this.start.row < firstRow) + var start = {row: firstRow, column: 0}; + + return Range.fromPoints(start || this.start, end || this.end); + }; + this.extend = function(row, column) { + var cmp = this.compare(row, column); + + if (cmp == 0) + return this; + else if (cmp == -1) + var start = {row: row, column: column}; + else + var end = {row: row, column: column}; + + return Range.fromPoints(start || this.start, end || this.end); + }; + + this.isEmpty = function() { + return (this.start.row === this.end.row && this.start.column === this.end.column); + }; + this.isMultiLine = function() { + return (this.start.row !== this.end.row); + }; + this.clone = function() { + return Range.fromPoints(this.start, this.end); + }; + this.collapseRows = function() { + if (this.end.column == 0) + return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0); + else + return new Range(this.start.row, 0, this.end.row, 0); + }; + this.toScreenRange = function(session) { + var screenPosStart = session.documentToScreenPosition(this.start); + var screenPosEnd = session.documentToScreenPosition(this.end); + + return new Range( + screenPosStart.row, screenPosStart.column, + screenPosEnd.row, screenPosEnd.column + ); + }; + this.moveBy = function(row, column) { + this.start.row += row; + this.start.column += column; + this.end.row += row; + this.end.column += column; + }; + +}).call(Range.prototype); +Range.fromPoints = function(start, end) { + return new Range(start.row, start.column, end.row, end.column); +}; +Range.comparePoints = comparePoints; + +Range.comparePoints = function(p1, p2) { + return p1.row - p2.row || p1.column - p2.column; +}; + + +exports.Range = Range; +}); + +define("ace/lib/oop",[], function(require, exports, module) { +"use strict"; + +exports.inherits = function(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); +}; + +exports.mixin = function(obj, mixin) { + for (var key in mixin) { + obj[key] = mixin[key]; + } + return obj; +}; + +exports.implement = function(proto, mixin) { + exports.mixin(proto, mixin); +}; + +}); + +define("ace/apply_delta",[], function(require, exports, module) { +"use strict"; + +function throwDeltaError(delta, errorText){ + console.log("Invalid Delta:", delta); + throw "Invalid Delta: " + errorText; +} + +function positionInDocument(docLines, position) { + return position.row >= 0 && position.row < docLines.length && + position.column >= 0 && position.column <= docLines[position.row].length; +} + +function validateDelta(docLines, delta) { + if (delta.action != "insert" && delta.action != "remove") + throwDeltaError(delta, "delta.action must be 'insert' or 'remove'"); + if (!(delta.lines instanceof Array)) + throwDeltaError(delta, "delta.lines must be an Array"); + if (!delta.start || !delta.end) + throwDeltaError(delta, "delta.start/end must be an present"); + var start = delta.start; + if (!positionInDocument(docLines, delta.start)) + throwDeltaError(delta, "delta.start must be contained in document"); + var end = delta.end; + if (delta.action == "remove" && !positionInDocument(docLines, end)) + throwDeltaError(delta, "delta.end must contained in document for 'remove' actions"); + var numRangeRows = end.row - start.row; + var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0)); + if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars) + throwDeltaError(delta, "delta.range must match delta lines"); +} + +exports.applyDelta = function(docLines, delta, doNotValidate) { + + var row = delta.start.row; + var startColumn = delta.start.column; + var line = docLines[row] || ""; + switch (delta.action) { + case "insert": + var lines = delta.lines; + if (lines.length === 1) { + docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn); + } else { + var args = [row, 1].concat(delta.lines); + docLines.splice.apply(docLines, args); + docLines[row] = line.substring(0, startColumn) + docLines[row]; + docLines[row + delta.lines.length - 1] += line.substring(startColumn); + } + break; + case "remove": + var endColumn = delta.end.column; + var endRow = delta.end.row; + if (row === endRow) { + docLines[row] = line.substring(0, startColumn) + line.substring(endColumn); + } else { + docLines.splice( + row, endRow - row + 1, + line.substring(0, startColumn) + docLines[endRow].substring(endColumn) + ); + } + break; + } +}; +}); + +define("ace/lib/event_emitter",[], function(require, exports, module) { +"use strict"; + +var EventEmitter = {}; +var stopPropagation = function() { this.propagationStopped = true; }; +var preventDefault = function() { this.defaultPrevented = true; }; + +EventEmitter._emit = +EventEmitter._dispatchEvent = function(eventName, e) { + this._eventRegistry || (this._eventRegistry = {}); + this._defaultHandlers || (this._defaultHandlers = {}); + + var listeners = this._eventRegistry[eventName] || []; + var defaultHandler = this._defaultHandlers[eventName]; + if (!listeners.length && !defaultHandler) + return; + + if (typeof e != "object" || !e) + e = {}; + + if (!e.type) + e.type = eventName; + if (!e.stopPropagation) + e.stopPropagation = stopPropagation; + if (!e.preventDefault) + e.preventDefault = preventDefault; + + listeners = listeners.slice(); + for (var i=0; i this.row) + return; + + var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight); + this.setPosition(point.row, point.column, true); + }; + + function $pointsInOrder(point1, point2, equalPointsInOrder) { + var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column; + return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter); + } + + function $getTransformedPoint(delta, point, moveIfEqual) { + var deltaIsInsert = delta.action == "insert"; + var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row); + var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column); + var deltaStart = delta.start; + var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range. + if ($pointsInOrder(point, deltaStart, moveIfEqual)) { + return { + row: point.row, + column: point.column + }; + } + if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) { + return { + row: point.row + deltaRowShift, + column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0) + }; + } + + return { + row: deltaStart.row, + column: deltaStart.column + }; + } + this.setPosition = function(row, column, noClip) { + var pos; + if (noClip) { + pos = { + row: row, + column: column + }; + } else { + pos = this.$clipPositionToDocument(row, column); + } + + if (this.row == pos.row && this.column == pos.column) + return; + + var old = { + row: this.row, + column: this.column + }; + + this.row = pos.row; + this.column = pos.column; + this._signal("change", { + old: old, + value: pos + }); + }; + this.detach = function() { + this.document.off("change", this.$onChange); + }; + this.attach = function(doc) { + this.document = doc || this.document; + this.document.on("change", this.$onChange); + }; + this.$clipPositionToDocument = function(row, column) { + var pos = {}; + + if (row >= this.document.getLength()) { + pos.row = Math.max(0, this.document.getLength() - 1); + pos.column = this.document.getLine(pos.row).length; + } + else if (row < 0) { + pos.row = 0; + pos.column = 0; + } + else { + pos.row = row; + pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); + } + + if (column < 0) + pos.column = 0; + + return pos; + }; + +}).call(Anchor.prototype); + +}); + +define("ace/document",[], function(require, exports, module) { +"use strict"; + +var oop = require("./lib/oop"); +var applyDelta = require("./apply_delta").applyDelta; +var EventEmitter = require("./lib/event_emitter").EventEmitter; +var Range = require("./range").Range; +var Anchor = require("./anchor").Anchor; + +var Document = function(textOrLines) { + this.$lines = [""]; + if (textOrLines.length === 0) { + this.$lines = [""]; + } else if (Array.isArray(textOrLines)) { + this.insertMergedLines({row: 0, column: 0}, textOrLines); + } else { + this.insert({row: 0, column:0}, textOrLines); + } +}; + +(function() { + + oop.implement(this, EventEmitter); + this.setValue = function(text) { + var len = this.getLength() - 1; + this.remove(new Range(0, 0, len, this.getLine(len).length)); + this.insert({row: 0, column: 0}, text); + }; + this.getValue = function() { + return this.getAllLines().join(this.getNewLineCharacter()); + }; + this.createAnchor = function(row, column) { + return new Anchor(this, row, column); + }; + if ("aaa".split(/a/).length === 0) { + this.$split = function(text) { + return text.replace(/\r\n|\r/g, "\n").split("\n"); + }; + } else { + this.$split = function(text) { + return text.split(/\r\n|\r|\n/); + }; + } + + + this.$detectNewLine = function(text) { + var match = text.match(/^.*?(\r\n|\r|\n)/m); + this.$autoNewLine = match ? match[1] : "\n"; + this._signal("changeNewLineMode"); + }; + this.getNewLineCharacter = function() { + switch (this.$newLineMode) { + case "windows": + return "\r\n"; + case "unix": + return "\n"; + default: + return this.$autoNewLine || "\n"; + } + }; + + this.$autoNewLine = ""; + this.$newLineMode = "auto"; + this.setNewLineMode = function(newLineMode) { + if (this.$newLineMode === newLineMode) + return; + + this.$newLineMode = newLineMode; + this._signal("changeNewLineMode"); + }; + this.getNewLineMode = function() { + return this.$newLineMode; + }; + this.isNewLine = function(text) { + return (text == "\r\n" || text == "\r" || text == "\n"); + }; + this.getLine = function(row) { + return this.$lines[row] || ""; + }; + this.getLines = function(firstRow, lastRow) { + return this.$lines.slice(firstRow, lastRow + 1); + }; + this.getAllLines = function() { + return this.getLines(0, this.getLength()); + }; + this.getLength = function() { + return this.$lines.length; + }; + this.getTextRange = function(range) { + return this.getLinesForRange(range).join(this.getNewLineCharacter()); + }; + this.getLinesForRange = function(range) { + var lines; + if (range.start.row === range.end.row) { + lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)]; + } else { + lines = this.getLines(range.start.row, range.end.row); + lines[0] = (lines[0] || "").substring(range.start.column); + var l = lines.length - 1; + if (range.end.row - range.start.row == l) + lines[l] = lines[l].substring(0, range.end.column); + } + return lines; + }; + this.insertLines = function(row, lines) { + console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."); + return this.insertFullLines(row, lines); + }; + this.removeLines = function(firstRow, lastRow) { + console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."); + return this.removeFullLines(firstRow, lastRow); + }; + this.insertNewLine = function(position) { + console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."); + return this.insertMergedLines(position, ["", ""]); + }; + this.insert = function(position, text) { + if (this.getLength() <= 1) + this.$detectNewLine(text); + + return this.insertMergedLines(position, this.$split(text)); + }; + this.insertInLine = function(position, text) { + var start = this.clippedPos(position.row, position.column); + var end = this.pos(position.row, position.column + text.length); + + this.applyDelta({ + start: start, + end: end, + action: "insert", + lines: [text] + }, true); + + return this.clonePos(end); + }; + + this.clippedPos = function(row, column) { + var length = this.getLength(); + if (row === undefined) { + row = length; + } else if (row < 0) { + row = 0; + } else if (row >= length) { + row = length - 1; + column = undefined; + } + var line = this.getLine(row); + if (column == undefined) + column = line.length; + column = Math.min(Math.max(column, 0), line.length); + return {row: row, column: column}; + }; + + this.clonePos = function(pos) { + return {row: pos.row, column: pos.column}; + }; + + this.pos = function(row, column) { + return {row: row, column: column}; + }; + + this.$clipPosition = function(position) { + var length = this.getLength(); + if (position.row >= length) { + position.row = Math.max(0, length - 1); + position.column = this.getLine(length - 1).length; + } else { + position.row = Math.max(0, position.row); + position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length); + } + return position; + }; + this.insertFullLines = function(row, lines) { + row = Math.min(Math.max(row, 0), this.getLength()); + var column = 0; + if (row < this.getLength()) { + lines = lines.concat([""]); + column = 0; + } else { + lines = [""].concat(lines); + row--; + column = this.$lines[row].length; + } + this.insertMergedLines({row: row, column: column}, lines); + }; + this.insertMergedLines = function(position, lines) { + var start = this.clippedPos(position.row, position.column); + var end = { + row: start.row + lines.length - 1, + column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length + }; + + this.applyDelta({ + start: start, + end: end, + action: "insert", + lines: lines + }); + + return this.clonePos(end); + }; + this.remove = function(range) { + var start = this.clippedPos(range.start.row, range.start.column); + var end = this.clippedPos(range.end.row, range.end.column); + this.applyDelta({ + start: start, + end: end, + action: "remove", + lines: this.getLinesForRange({start: start, end: end}) + }); + return this.clonePos(start); + }; + this.removeInLine = function(row, startColumn, endColumn) { + var start = this.clippedPos(row, startColumn); + var end = this.clippedPos(row, endColumn); + + this.applyDelta({ + start: start, + end: end, + action: "remove", + lines: this.getLinesForRange({start: start, end: end}) + }, true); + + return this.clonePos(start); + }; + this.removeFullLines = function(firstRow, lastRow) { + firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1); + lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1); + var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0; + var deleteLastNewLine = lastRow < this.getLength() - 1; + var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow ); + var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 ); + var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow ); + var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length ); + var range = new Range(startRow, startCol, endRow, endCol); + var deletedLines = this.$lines.slice(firstRow, lastRow + 1); + + this.applyDelta({ + start: range.start, + end: range.end, + action: "remove", + lines: this.getLinesForRange(range) + }); + return deletedLines; + }; + this.removeNewLine = function(row) { + if (row < this.getLength() - 1 && row >= 0) { + this.applyDelta({ + start: this.pos(row, this.getLine(row).length), + end: this.pos(row + 1, 0), + action: "remove", + lines: ["", ""] + }); + } + }; + this.replace = function(range, text) { + if (!(range instanceof Range)) + range = Range.fromPoints(range.start, range.end); + if (text.length === 0 && range.isEmpty()) + return range.start; + if (text == this.getTextRange(range)) + return range.end; + + this.remove(range); + var end; + if (text) { + end = this.insert(range.start, text); + } + else { + end = range.start; + } + + return end; + }; + this.applyDeltas = function(deltas) { + for (var i=0; i=0; i--) { + this.revertDelta(deltas[i]); + } + }; + this.applyDelta = function(delta, doNotValidate) { + var isInsert = delta.action == "insert"; + if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] + : !Range.comparePoints(delta.start, delta.end)) { + return; + } + + if (isInsert && delta.lines.length > 20000) { + this.$splitAndapplyLargeDelta(delta, 20000); + } + else { + applyDelta(this.$lines, delta, doNotValidate); + this._signal("change", delta); + } + }; + + this.$safeApplyDelta = function(delta) { + var docLength = this.$lines.length; + if ( + delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength + || delta.action == "insert" && delta.start.row <= docLength + ) { + this.applyDelta(delta); + } + }; + + this.$splitAndapplyLargeDelta = function(delta, MAX) { + var lines = delta.lines; + var l = lines.length - MAX + 1; + var row = delta.start.row; + var column = delta.start.column; + for (var from = 0, to = 0; from < l; from = to) { + to += MAX - 1; + var chunk = lines.slice(from, to); + chunk.push(""); + this.applyDelta({ + start: this.pos(row + from, column), + end: this.pos(row + to, column = 0), + action: delta.action, + lines: chunk + }, true); + } + delta.lines = lines.slice(from); + delta.start.row = row + from; + delta.start.column = column; + this.applyDelta(delta, true); + }; + this.revertDelta = function(delta) { + this.$safeApplyDelta({ + start: this.clonePos(delta.start), + end: this.clonePos(delta.end), + action: (delta.action == "insert" ? "remove" : "insert"), + lines: delta.lines.slice() + }); + }; + this.indexToPosition = function(index, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + for (var i = startRow || 0, l = lines.length; i < l; i++) { + index -= lines[i].length + newlineLength; + if (index < 0) + return {row: i, column: index + lines[i].length + newlineLength}; + } + return {row: l-1, column: index + lines[l-1].length + newlineLength}; + }; + this.positionToIndex = function(pos, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + var index = 0; + var row = Math.min(pos.row, lines.length); + for (var i = startRow || 0; i < row; ++i) + index += lines[i].length + newlineLength; + + return index + pos.column; + }; + +}).call(Document.prototype); + +exports.Document = Document; +}); + +define("ace/lib/lang",[], function(require, exports, module) { +"use strict"; + +exports.last = function(a) { + return a[a.length - 1]; +}; + +exports.stringReverse = function(string) { + return string.split("").reverse().join(""); +}; + +exports.stringRepeat = function (string, count) { + var result = ''; + while (count > 0) { + if (count & 1) + result += string; + + if (count >>= 1) + string += string; + } + return result; +}; + +var trimBeginRegexp = /^\s\s*/; +var trimEndRegexp = /\s\s*$/; + +exports.stringTrimLeft = function (string) { + return string.replace(trimBeginRegexp, ''); +}; + +exports.stringTrimRight = function (string) { + return string.replace(trimEndRegexp, ''); +}; + +exports.copyObject = function(obj) { + var copy = {}; + for (var key in obj) { + copy[key] = obj[key]; + } + return copy; +}; + +exports.copyArray = function(array){ + var copy = []; + for (var i=0, l=array.length; i 0) { - if (pos > length) - pos = length; - } else if (pos == void 0) { - pos = 0; - } else if (pos < 0) { - pos = Math.max(length + pos, 0); - } - - if (!(pos+removeCount < length)) - removeCount = length - pos; - - var removed = this.slice(pos, pos+removeCount); - var insert = slice.call(arguments, 2); - var add = insert.length; - if (pos === length) { - if (add) { - this.push.apply(this, insert); - } - } else { - var remove = Math.min(removeCount, length - pos); - var tailOldPos = pos + remove; - var tailNewPos = tailOldPos + add - remove; - var tailCount = length - tailOldPos; - var lengthAfterRemove = length - remove; - - if (tailNewPos < tailOldPos) { // case A - for (var i = 0; i < tailCount; ++i) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } else if (tailNewPos > tailOldPos) { // case B - for (i = tailCount; i--; ) { - this[tailNewPos+i] = this[tailOldPos+i]; - } - } // else, add == remove (nothing to do) - - if (add && pos === lengthAfterRemove) { - this.length = lengthAfterRemove; // truncate array - this.push.apply(this, insert); - } else { - this.length = lengthAfterRemove + add; // reserves space - for (i = 0; i < add; ++i) { - this[pos+i] = insert[i]; - } - } - } - return removed; - }; - } -} -if (!Array.isArray) { - Array.isArray = function isArray(obj) { - return _toString(obj) == "[object Array]"; - }; -} -var boxedString = Object("a"), - splitString = boxedString[0] != "a" || !(0 in boxedString); - -if (!Array.prototype.forEach) { - Array.prototype.forEach = function forEach(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - thisp = arguments[1], - i = -1, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(); // TODO message - } - - while (++i < length) { - if (i in self) { - fun.call(thisp, self[i], i, object); - } - } - }; -} -if (!Array.prototype.map) { - Array.prototype.map = function map(fun /*, thisp*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = Array(length), - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) - result[i] = fun.call(thisp, self[i], i, object); - } - return result; - }; -} -if (!Array.prototype.filter) { - Array.prototype.filter = function filter(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - result = [], - value, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self) { - value = self[i]; - if (fun.call(thisp, value, i, object)) { - result.push(value); - } - } - } - return result; - }; -} -if (!Array.prototype.every) { - Array.prototype.every = function every(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && !fun.call(thisp, self[i], i, object)) { - return false; - } - } - return true; - }; -} -if (!Array.prototype.some) { - Array.prototype.some = function some(fun /*, thisp */) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0, - thisp = arguments[1]; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - - for (var i = 0; i < length; i++) { - if (i in self && fun.call(thisp, self[i], i, object)) { - return true; - } - } - return false; - }; -} -if (!Array.prototype.reduce) { - Array.prototype.reduce = function reduce(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduce of empty array with no initial value"); - } - - var i = 0; - var result; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i++]; - break; - } - if (++i >= length) { - throw new TypeError("reduce of empty array with no initial value"); - } - } while (true); - } - - for (; i < length; i++) { - if (i in self) { - result = fun.call(void 0, result, self[i], i, object); - } - } - - return result; - }; -} -if (!Array.prototype.reduceRight) { - Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { - var object = toObject(this), - self = splitString && _toString(this) == "[object String]" ? - this.split("") : - object, - length = self.length >>> 0; - if (_toString(fun) != "[object Function]") { - throw new TypeError(fun + " is not a function"); - } - if (!length && arguments.length == 1) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - - var result, i = length - 1; - if (arguments.length >= 2) { - result = arguments[1]; - } else { - do { - if (i in self) { - result = self[i--]; - break; - } - if (--i < 0) { - throw new TypeError("reduceRight of empty array with no initial value"); - } - } while (true); - } - - do { - if (i in this) { - result = fun.call(void 0, result, self[i], i, object); - } - } while (i--); - - return result; - }; -} -if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { - Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - - var i = 0; - if (arguments.length > 1) { - i = toInteger(arguments[1]); - } - i = i >= 0 ? i : Math.max(0, length + i); - for (; i < length; i++) { - if (i in self && self[i] === sought) { - return i; - } - } - return -1; - }; -} -if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { - Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { - var self = splitString && _toString(this) == "[object String]" ? - this.split("") : - toObject(this), - length = self.length >>> 0; - - if (!length) { - return -1; - } - var i = length - 1; - if (arguments.length > 1) { - i = Math.min(i, toInteger(arguments[1])); - } - i = i >= 0 ? i : length - Math.abs(i); - for (; i >= 0; i--) { - if (i in self && sought === self[i]) { - return i; - } - } - return -1; - }; -} -if (!Object.getPrototypeOf) { - Object.getPrototypeOf = function getPrototypeOf(object) { - return object.__proto__ || ( - object.constructor ? - object.constructor.prototype : - prototypeOfObject - ); - }; -} -if (!Object.getOwnPropertyDescriptor) { - var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + - "non-object: "; - Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT + object); - if (!owns(object, property)) - return; - - var descriptor, getter, setter; - descriptor = { enumerable: true, configurable: true }; - if (supportsAccessors) { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - - var getter = lookupGetter(object, property); - var setter = lookupSetter(object, property); - object.__proto__ = prototype; - - if (getter || setter) { - if (getter) descriptor.get = getter; - if (setter) descriptor.set = setter; - return descriptor; - } - } - descriptor.value = object[property]; - return descriptor; - }; -} -if (!Object.getOwnPropertyNames) { - Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - return Object.keys(object); - }; -} -if (!Object.create) { - var createEmpty; - if (Object.prototype.__proto__ === null) { - createEmpty = function () { - return { "__proto__": null }; - }; - } else { - createEmpty = function () { - var empty = {}; - for (var i in empty) - empty[i] = null; - empty.constructor = - empty.hasOwnProperty = - empty.propertyIsEnumerable = - empty.isPrototypeOf = - empty.toLocaleString = - empty.toString = - empty.valueOf = - empty.__proto__ = null; - return empty; - } - } - - Object.create = function create(prototype, properties) { - var object; - if (prototype === null) { - object = createEmpty(); - } else { - if (typeof prototype != "object") - throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); - var Type = function () {}; - Type.prototype = prototype; - object = new Type(); - object.__proto__ = prototype; - } - if (properties !== void 0) - Object.defineProperties(object, properties); - return object; - }; -} - -function doesDefinePropertyWork(object) { - try { - Object.defineProperty(object, "sentinel", {}); - return "sentinel" in object; - } catch (exception) { - } -} -if (Object.defineProperty) { - var definePropertyWorksOnObject = doesDefinePropertyWork({}); - var definePropertyWorksOnDom = typeof document == "undefined" || - doesDefinePropertyWork(document.createElement("div")); - if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { - var definePropertyFallback = Object.defineProperty; - } -} - -if (!Object.defineProperty || definePropertyFallback) { - var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; - var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " - var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + - "on this javascript engine"; - - Object.defineProperty = function defineProperty(object, property, descriptor) { - if ((typeof object != "object" && typeof object != "function") || object === null) - throw new TypeError(ERR_NON_OBJECT_TARGET + object); - if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) - throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); - if (definePropertyFallback) { - try { - return definePropertyFallback.call(Object, object, property, descriptor); - } catch (exception) { - } - } - if (owns(descriptor, "value")) { - - if (supportsAccessors && (lookupGetter(object, property) || - lookupSetter(object, property))) - { - var prototype = object.__proto__; - object.__proto__ = prototypeOfObject; - delete object[property]; - object[property] = descriptor.value; - object.__proto__ = prototype; - } else { - object[property] = descriptor.value; - } - } else { - if (!supportsAccessors) - throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); - if (owns(descriptor, "get")) - defineGetter(object, property, descriptor.get); - if (owns(descriptor, "set")) - defineSetter(object, property, descriptor.set); - } - - return object; - }; -} -if (!Object.defineProperties) { - Object.defineProperties = function defineProperties(object, properties) { - for (var property in properties) { - if (owns(properties, property)) - Object.defineProperty(object, property, properties[property]); - } - return object; - }; -} -if (!Object.seal) { - Object.seal = function seal(object) { - return object; - }; -} -if (!Object.freeze) { - Object.freeze = function freeze(object) { - return object; - }; -} -try { - Object.freeze(function () {}); -} catch (exception) { - Object.freeze = (function freeze(freezeObject) { - return function freeze(object) { - if (typeof object == "function") { - return object; - } else { - return freezeObject(object); - } - }; - })(Object.freeze); -} -if (!Object.preventExtensions) { - Object.preventExtensions = function preventExtensions(object) { - return object; - }; -} -if (!Object.isSealed) { - Object.isSealed = function isSealed(object) { - return false; - }; -} -if (!Object.isFrozen) { - Object.isFrozen = function isFrozen(object) { - return false; - }; -} -if (!Object.isExtensible) { - Object.isExtensible = function isExtensible(object) { - if (Object(object) === object) { - throw new TypeError(); // TODO message - } - var name = ''; - while (owns(object, name)) { - name += '?'; - } - object[name] = true; - var returnValue = owns(object, name); - delete object[name]; - return returnValue; - }; -} -if (!Object.keys) { - var hasDontEnumBug = true, - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ], - dontEnumsLength = dontEnums.length; - - for (var key in {"toString": null}) { - hasDontEnumBug = false; - } - - Object.keys = function keys(object) { - - if ( - (typeof object != "object" && typeof object != "function") || - object === null - ) { - throw new TypeError("Object.keys called on a non-object"); - } - - var keys = []; - for (var name in object) { - if (owns(object, name)) { - keys.push(name); - } - } - - if (hasDontEnumBug) { - for (var i = 0, ii = dontEnumsLength; i < ii; i++) { - var dontEnum = dontEnums[i]; - if (owns(object, dontEnum)) { - keys.push(dontEnum); - } - } - } - return keys; - }; - -} -if (!Date.now) { - Date.now = function now() { - return new Date().getTime(); - }; -} -var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" + - "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + - "\u2029\uFEFF"; -if (!String.prototype.trim) { - ws = "[" + ws + "]"; - var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), - trimEndRegexp = new RegExp(ws + ws + "*$"); - String.prototype.trim = function trim() { - return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); - }; -} - -function toInteger(n) { - n = +n; - if (n !== n) { // isNaN - n = 0; - } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - return n; -} - -function isPrimitive(input) { - var type = typeof input; - return ( - input === null || - type === "undefined" || - type === "boolean" || - type === "number" || - type === "string" - ); -} - -function toPrimitive(input) { - var val, valueOf, toString; - if (isPrimitive(input)) { - return input; - } - valueOf = input.valueOf; - if (typeof valueOf === "function") { - val = valueOf.call(input); - if (isPrimitive(val)) { - return val; - } - } - toString = input.toString; - if (typeof toString === "function") { - val = toString.call(input); - if (isPrimitive(val)) { - return val; - } - } - throw new TypeError(); -} -var toObject = function (o) { - if (o == null) { // this matches both null and undefined - throw new TypeError("can't convert "+o+" to object"); - } - return Object(o); -}; - -}); diff --git a/htdocs/includes/ace/src/worker-css.js b/htdocs/includes/ace/src/worker-css.js index a7d914e3397..8cccc059adb 100644 --- a/htdocs/includes/ace/src/worker-css.js +++ b/htdocs/includes/ace/src/worker-css.js @@ -209,7 +209,6 @@ window.onmessage = function(e) { } else if (msg.init) { window.initBaseUrls(msg.tlns); - require("ace/lib/es5-shim"); sender = window.sender = window.initSender(); var clazz = require(msg.module)[msg.classname]; main = window.main = new clazz(sender); @@ -787,8 +786,8 @@ EventEmitter._signal = function(eventName, e) { EventEmitter.once = function(eventName, callback) { var _self = this; - this.addEventListener(eventName, function newCallback() { - _self.removeEventListener(eventName, newCallback); + this.on(eventName, function newCallback() { + _self.off(eventName, newCallback); callback.apply(null, arguments); }); if (!callback) { @@ -860,7 +859,9 @@ EventEmitter.removeEventListener = function(eventName, callback) { }; EventEmitter.removeAllListeners = function(eventName) { - if (this._eventRegistry) this._eventRegistry[eventName] = []; + if (!eventName) this._eventRegistry = this._defaultHandlers = undefined; + if (this._eventRegistry) this._eventRegistry[eventName] = undefined; + if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined; }; exports.EventEmitter = EventEmitter; @@ -960,7 +961,7 @@ var Anchor = exports.Anchor = function(doc, row, column) { }); }; this.detach = function() { - this.document.removeEventListener("change", this.$onChange); + this.document.off("change", this.$onChange); }; this.attach = function(doc) { this.document = doc || this.document; @@ -1292,6 +1293,16 @@ var Document = function(textOrLines) { } }; + this.$safeApplyDelta = function(delta) { + var docLength = this.$lines.length; + if ( + delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength + || delta.action == "insert" && delta.start.row <= docLength + ) { + this.applyDelta(delta); + } + }; + this.$splitAndapplyLargeDelta = function(delta, MAX) { var lines = delta.lines; var l = lines.length - MAX + 1; @@ -1314,7 +1325,7 @@ var Document = function(textOrLines) { this.applyDelta(delta, true); }; this.revertDelta = function(delta) { - this.applyDelta({ + this.$safeApplyDelta({ start: this.clonePos(delta.start), end: this.clonePos(delta.end), action: (delta.action == "insert" ? "remove" : "insert"), @@ -1410,589 +1421,217 @@ var Mirror = exports.Mirror = function(sender) { }); define("ace/mode/css/csslint",[], function(require, exports, module) { -var parserlib = {}; -(function(){ -function EventTarget(){ - this._listeners = {}; -} -EventTarget.prototype = { - constructor: EventTarget, - addListener: function(type, listener){ - if (!this._listeners[type]){ - this._listeners[type] = []; - } +var CSSLint = (function(){ + var module = module || {}, + exports = exports || {}; +var parserlib = (function () { +var require; +require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= 0 && this._ltIndex < this._lt.length){ - - i++; - this._token = this._lt[this._ltIndex++]; - info = tokenInfo[this._token.type]; - while((info.channel !== undefined && channel !== info.channel) && - this._ltIndex < this._lt.length){ - this._token = this._lt[this._ltIndex++]; - info = tokenInfo[this._token.type]; - i++; - } - if ((info.channel === undefined || channel === info.channel) && - this._ltIndex <= this._lt.length){ - this._ltIndexCache.push(i); - return this._token.type; - } - } - token = this._getToken(); - if (token.type > -1 && !tokenInfo[token.type].hide){ - token.channel = tokenInfo[token.type].channel; - this._token = token; - this._lt.push(token); - this._ltIndexCache.push(this._lt.length - this._ltIndex + i); - if (this._lt.length > 5){ - this._lt.shift(); - } - if (this._ltIndexCache.length > 5){ - this._ltIndexCache.shift(); - } - this._ltIndex = this._lt.length; - } - info = tokenInfo[token.type]; - if (info && - (info.hide || - (info.channel !== undefined && channel !== info.channel))){ - return this.get(channel); - } else { - return token.type; - } - }, - LA: function(index){ - var total = index, - tt; - if (index > 0){ - if (index > 5){ - throw new Error("Too much lookahead."); - } - while(total){ - tt = this.get(); - total--; - } - while(total < index){ - this.unget(); - total++; - } - } else if (index < 0){ - - if(this._lt[this._ltIndex+index]){ - tt = this._lt[this._ltIndex+index].type; - } else { - throw new Error("Too much lookbehind."); - } - - } else { - tt = this._token.type; - } - - return tt; - - }, - LT: function(index){ - this.LA(index); - return this._lt[this._ltIndex+index-1]; - }, - peek: function(){ - return this.LA(1); - }, - token: function(){ - return this._token; - }, - tokenName: function(tokenType){ - if (tokenType < 0 || tokenType > this._tokenData.length){ - return "UNKNOWN_TOKEN"; - } else { - return this._tokenData[tokenType].name; - } - }, - tokenType: function(tokenName){ - return this._tokenData[tokenName] || -1; - }, - unget: function(){ - if (this._ltIndexCache.length){ - this._ltIndex -= this._ltIndexCache.pop();//--; - this._token = this._lt[this._ltIndex - 1]; - } else { - throw new Error("Too much lookahead."); - } - } - -}; - - -parserlib.util = { -StringReader: StringReader, -SyntaxError : SyntaxError, -SyntaxUnit : SyntaxUnit, -EventTarget : EventTarget, -TokenStreamBase : TokenStreamBase -}; -})(); -(function(){ -var EventTarget = parserlib.util.EventTarget, -TokenStreamBase = parserlib.util.TokenStreamBase, -StringReader = parserlib.util.StringReader, -SyntaxError = parserlib.util.SyntaxError, -SyntaxUnit = parserlib.util.SyntaxUnit; - -var Colors = { - aliceblue :"#f0f8ff", - antiquewhite :"#faebd7", - aqua :"#00ffff", - aquamarine :"#7fffd4", - azure :"#f0ffff", - beige :"#f5f5dc", - bisque :"#ffe4c4", - black :"#000000", - blanchedalmond :"#ffebcd", - blue :"#0000ff", - blueviolet :"#8a2be2", - brown :"#a52a2a", - burlywood :"#deb887", - cadetblue :"#5f9ea0", - chartreuse :"#7fff00", - chocolate :"#d2691e", - coral :"#ff7f50", - cornflowerblue :"#6495ed", - cornsilk :"#fff8dc", - crimson :"#dc143c", - cyan :"#00ffff", - darkblue :"#00008b", - darkcyan :"#008b8b", - darkgoldenrod :"#b8860b", - darkgray :"#a9a9a9", - darkgrey :"#a9a9a9", - darkgreen :"#006400", - darkkhaki :"#bdb76b", - darkmagenta :"#8b008b", - darkolivegreen :"#556b2f", - darkorange :"#ff8c00", - darkorchid :"#9932cc", - darkred :"#8b0000", - darksalmon :"#e9967a", - darkseagreen :"#8fbc8f", - darkslateblue :"#483d8b", - darkslategray :"#2f4f4f", - darkslategrey :"#2f4f4f", - darkturquoise :"#00ced1", - darkviolet :"#9400d3", - deeppink :"#ff1493", - deepskyblue :"#00bfff", - dimgray :"#696969", - dimgrey :"#696969", - dodgerblue :"#1e90ff", - firebrick :"#b22222", - floralwhite :"#fffaf0", - forestgreen :"#228b22", - fuchsia :"#ff00ff", - gainsboro :"#dcdcdc", - ghostwhite :"#f8f8ff", - gold :"#ffd700", - goldenrod :"#daa520", - gray :"#808080", - grey :"#808080", - green :"#008000", - greenyellow :"#adff2f", - honeydew :"#f0fff0", - hotpink :"#ff69b4", - indianred :"#cd5c5c", - indigo :"#4b0082", - ivory :"#fffff0", - khaki :"#f0e68c", - lavender :"#e6e6fa", - lavenderblush :"#fff0f5", - lawngreen :"#7cfc00", - lemonchiffon :"#fffacd", - lightblue :"#add8e6", - lightcoral :"#f08080", - lightcyan :"#e0ffff", - lightgoldenrodyellow :"#fafad2", - lightgray :"#d3d3d3", - lightgrey :"#d3d3d3", - lightgreen :"#90ee90", - lightpink :"#ffb6c1", - lightsalmon :"#ffa07a", - lightseagreen :"#20b2aa", - lightskyblue :"#87cefa", - lightslategray :"#778899", - lightslategrey :"#778899", - lightsteelblue :"#b0c4de", - lightyellow :"#ffffe0", - lime :"#00ff00", - limegreen :"#32cd32", - linen :"#faf0e6", - magenta :"#ff00ff", - maroon :"#800000", - mediumaquamarine:"#66cdaa", - mediumblue :"#0000cd", - mediumorchid :"#ba55d3", - mediumpurple :"#9370d8", - mediumseagreen :"#3cb371", - mediumslateblue :"#7b68ee", - mediumspringgreen :"#00fa9a", - mediumturquoise :"#48d1cc", - mediumvioletred :"#c71585", - midnightblue :"#191970", - mintcream :"#f5fffa", - mistyrose :"#ffe4e1", - moccasin :"#ffe4b5", - navajowhite :"#ffdead", - navy :"#000080", - oldlace :"#fdf5e6", - olive :"#808000", - olivedrab :"#6b8e23", - orange :"#ffa500", - orangered :"#ff4500", - orchid :"#da70d6", - palegoldenrod :"#eee8aa", - palegreen :"#98fb98", - paleturquoise :"#afeeee", - palevioletred :"#d87093", - papayawhip :"#ffefd5", - peachpuff :"#ffdab9", - peru :"#cd853f", - pink :"#ffc0cb", - plum :"#dda0dd", - powderblue :"#b0e0e6", - purple :"#800080", - red :"#ff0000", - rosybrown :"#bc8f8f", - royalblue :"#4169e1", - saddlebrown :"#8b4513", - salmon :"#fa8072", - sandybrown :"#f4a460", - seagreen :"#2e8b57", - seashell :"#fff5ee", - sienna :"#a0522d", - silver :"#c0c0c0", - skyblue :"#87ceeb", - slateblue :"#6a5acd", - slategray :"#708090", - slategrey :"#708090", - snow :"#fffafa", - springgreen :"#00ff7f", - steelblue :"#4682b4", - tan :"#d2b48c", - teal :"#008080", - thistle :"#d8bfd8", - tomato :"#ff6347", - turquoise :"#40e0d0", - violet :"#ee82ee", - wheat :"#f5deb3", - white :"#ffffff", - whitesmoke :"#f5f5f5", - yellow :"#ffff00", - yellowgreen :"#9acd32", - activeBorder :"Active window border.", - activecaption :"Active window caption.", - appworkspace :"Background color of multiple document interface.", - background :"Desktop background.", - buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", - buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", - buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", - buttontext :"Text on push buttons.", - captiontext :"Text in caption, size box, and scrollbar arrow box.", - graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", - greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", - highlight :"Item(s) selected in a control.", - highlighttext :"Text of item(s) selected in a control.", - inactiveborder :"Inactive window border.", - inactivecaption :"Inactive window caption.", - inactivecaptiontext :"Color of text in an inactive caption.", - infobackground :"Background color for tooltip controls.", - infotext :"Text color for tooltip controls.", - menu :"Menu background.", - menutext :"Text in menus.", - scrollbar :"Scroll bar gray area.", - threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", - window :"Window background.", - windowframe :"Window frame.", - windowtext :"Text in windows." -}; -function Combinator(text, line, col){ +var Parser = require("./Parser"); +function Combinator(text, line, col) { SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); this.type = "unknown"; - if (/^\s+$/.test(text)){ + if (/^\s+$/.test(text)) { this.type = "descendant"; - } else if (text == ">"){ + } else if (text === ">") { this.type = "child"; - } else if (text == "+"){ + } else if (text === "+") { this.type = "adjacent-sibling"; - } else if (text == "~"){ + } else if (text === "~") { this.type = "sibling"; } @@ -2000,7 +1639,322 @@ function Combinator(text, line, col){ Combinator.prototype = new SyntaxUnit(); Combinator.prototype.constructor = Combinator; -function MediaFeature(name, value){ + + +},{"../util/SyntaxUnit":26,"./Parser":6}],3:[function(require,module,exports){ +"use strict"; + +module.exports = Matcher; + +var StringReader = require("../util/StringReader"); +var SyntaxError = require("../util/SyntaxError"); +function Matcher(matchFunc, toString) { + this.match = function(expression) { + var result; + expression.mark(); + result = matchFunc(expression); + if (result) { + expression.drop(); + } else { + expression.restore(); + } + return result; + }; + this.toString = typeof toString === "function" ? toString : function() { + return toString; + }; +} +Matcher.prec = { + MOD: 5, + SEQ: 4, + ANDAND: 3, + OROR: 2, + ALT: 1 +}; +Matcher.parse = function(str) { + var reader, eat, expr, oror, andand, seq, mod, term, result; + reader = new StringReader(str); + eat = function(matcher) { + var result = reader.readMatch(matcher); + if (result === null) { + throw new SyntaxError( + "Expected " + matcher, reader.getLine(), reader.getCol()); + } + return result; + }; + expr = function() { + var m = [ oror() ]; + while (reader.readMatch(" | ") !== null) { + m.push(oror()); + } + return m.length === 1 ? m[0] : Matcher.alt.apply(Matcher, m); + }; + oror = function() { + var m = [ andand() ]; + while (reader.readMatch(" || ") !== null) { + m.push(andand()); + } + return m.length === 1 ? m[0] : Matcher.oror.apply(Matcher, m); + }; + andand = function() { + var m = [ seq() ]; + while (reader.readMatch(" && ") !== null) { + m.push(seq()); + } + return m.length === 1 ? m[0] : Matcher.andand.apply(Matcher, m); + }; + seq = function() { + var m = [ mod() ]; + while (reader.readMatch(/^ (?![&|\]])/) !== null) { + m.push(mod()); + } + return m.length === 1 ? m[0] : Matcher.seq.apply(Matcher, m); + }; + mod = function() { + var m = term(); + if (reader.readMatch("?") !== null) { + return m.question(); + } else if (reader.readMatch("*") !== null) { + return m.star(); + } else if (reader.readMatch("+") !== null) { + return m.plus(); + } else if (reader.readMatch("#") !== null) { + return m.hash(); + } else if (reader.readMatch(/^\{\s*/) !== null) { + var min = eat(/^\d+/); + eat(/^\s*,\s*/); + var max = eat(/^\d+/); + eat(/^\s*\}/); + return m.braces(Number(min), Number(max)); + } + return m; + }; + term = function() { + if (reader.readMatch("[ ") !== null) { + var m = expr(); + eat(" ]"); + return m; + } + return Matcher.fromType(eat(/^[^ ?*+#{]+/)); + }; + result = expr(); + if (!reader.eof()) { + throw new SyntaxError( + "Expected end of string", reader.getLine(), reader.getCol()); + } + return result; +}; +Matcher.cast = function(m) { + if (m instanceof Matcher) { + return m; + } + return Matcher.parse(m); +}; +Matcher.fromType = function(type) { + var ValidationTypes = require("./ValidationTypes"); + return new Matcher(function(expression) { + return expression.hasNext() && ValidationTypes.isType(expression, type); + }, type); +}; +Matcher.seq = function() { + var ms = Array.prototype.slice.call(arguments).map(Matcher.cast); + if (ms.length === 1) { + return ms[0]; + } + return new Matcher(function(expression) { + var i, result = true; + for (i = 0; result && i < ms.length; i++) { + result = ms[i].match(expression); + } + return result; + }, function(prec) { + var p = Matcher.prec.SEQ; + var s = ms.map(function(m) { + return m.toString(p); + }).join(" "); + if (prec > p) { + s = "[ " + s + " ]"; + } + return s; + }); +}; +Matcher.alt = function() { + var ms = Array.prototype.slice.call(arguments).map(Matcher.cast); + if (ms.length === 1) { + return ms[0]; + } + return new Matcher(function(expression) { + var i, result = false; + for (i = 0; !result && i < ms.length; i++) { + result = ms[i].match(expression); + } + return result; + }, function(prec) { + var p = Matcher.prec.ALT; + var s = ms.map(function(m) { + return m.toString(p); + }).join(" | "); + if (prec > p) { + s = "[ " + s + " ]"; + } + return s; + }); +}; +Matcher.many = function(required) { + var ms = Array.prototype.slice.call(arguments, 1).reduce(function(acc, v) { + if (v.expand) { + var ValidationTypes = require("./ValidationTypes"); + acc.push.apply(acc, ValidationTypes.complex[v.expand].options); + } else { + acc.push(Matcher.cast(v)); + } + return acc; + }, []); + + if (required === true) { + required = ms.map(function() { + return true; + }); + } + + var result = new Matcher(function(expression) { + var seen = [], max = 0, pass = 0; + var success = function(matchCount) { + if (pass === 0) { + max = Math.max(matchCount, max); + return matchCount === ms.length; + } else { + return matchCount === max; + } + }; + var tryMatch = function(matchCount) { + for (var i = 0; i < ms.length; i++) { + if (seen[i]) { + continue; + } + expression.mark(); + if (ms[i].match(expression)) { + seen[i] = true; + if (tryMatch(matchCount + (required === false || required[i] ? 1 : 0))) { + expression.drop(); + return true; + } + expression.restore(); + seen[i] = false; + } else { + expression.drop(); + } + } + return success(matchCount); + }; + if (!tryMatch(0)) { + pass++; + tryMatch(0); + } + + if (required === false) { + return max > 0; + } + for (var i = 0; i < ms.length; i++) { + if (required[i] && !seen[i]) { + return false; + } + } + return true; + }, function(prec) { + var p = required === false ? Matcher.prec.OROR : Matcher.prec.ANDAND; + var s = ms.map(function(m, i) { + if (required !== false && !required[i]) { + return m.toString(Matcher.prec.MOD) + "?"; + } + return m.toString(p); + }).join(required === false ? " || " : " && "); + if (prec > p) { + s = "[ " + s + " ]"; + } + return s; + }); + result.options = ms; + return result; +}; +Matcher.andand = function() { + var args = Array.prototype.slice.call(arguments); + args.unshift(true); + return Matcher.many.apply(Matcher, args); +}; +Matcher.oror = function() { + var args = Array.prototype.slice.call(arguments); + args.unshift(false); + return Matcher.many.apply(Matcher, args); +}; +Matcher.prototype = { + constructor: Matcher, + match: function() { + throw new Error("unimplemented"); + }, + toString: function() { + throw new Error("unimplemented"); + }, + func: function() { + return this.match.bind(this); + }, + then: function(m) { + return Matcher.seq(this, m); + }, + or: function(m) { + return Matcher.alt(this, m); + }, + andand: function(m) { + return Matcher.many(true, this, m); + }, + oror: function(m) { + return Matcher.many(false, this, m); + }, + star: function() { + return this.braces(0, Infinity, "*"); + }, + plus: function() { + return this.braces(1, Infinity, "+"); + }, + question: function() { + return this.braces(0, 1, "?"); + }, + hash: function() { + return this.braces(1, Infinity, "#", Matcher.cast(",")); + }, + braces: function(min, max, marker, optSep) { + var m1 = this, m2 = optSep ? optSep.then(this) : this; + if (!marker) { + marker = "{" + min + "," + max + "}"; + } + return new Matcher(function(expression) { + var result = true, i; + for (i = 0; i < max; i++) { + if (i > 0 && optSep) { + result = m2.match(expression); + } else { + result = m1.match(expression); + } + if (!result) { + break; + } + } + return i >= min; + }, function() { + return m1.toString(Matcher.prec.MOD) + marker; + }); + } +}; + +},{"../util/StringReader":24,"../util/SyntaxError":25,"./ValidationTypes":21}],4:[function(require,module,exports){ +"use strict"; + +module.exports = MediaFeature; + +var SyntaxUnit = require("../util/SyntaxUnit"); + +var Parser = require("./Parser"); +function MediaFeature(name, value) { SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); this.name = name; @@ -2009,9 +1963,19 @@ function MediaFeature(name, value){ MediaFeature.prototype = new SyntaxUnit(); MediaFeature.prototype.constructor = MediaFeature; -function MediaQuery(modifier, mediaType, features, line, col){ - SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + +},{"../util/SyntaxUnit":26,"./Parser":6}],5:[function(require,module,exports){ +"use strict"; + +module.exports = MediaQuery; + +var SyntaxUnit = require("../util/SyntaxUnit"); + +var Parser = require("./Parser"); +function MediaQuery(modifier, mediaType, features, line, col) { + + SyntaxUnit.call(this, (modifier ? modifier + " " : "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); this.modifier = modifier; this.mediaType = mediaType; this.features = features; @@ -2020,7 +1984,30 @@ function MediaQuery(modifier, mediaType, features, line, col){ MediaQuery.prototype = new SyntaxUnit(); MediaQuery.prototype.constructor = MediaQuery; -function Parser(options){ + + +},{"../util/SyntaxUnit":26,"./Parser":6}],6:[function(require,module,exports){ +"use strict"; + +module.exports = Parser; + +var EventTarget = require("../util/EventTarget"); +var SyntaxError = require("../util/SyntaxError"); +var SyntaxUnit = require("../util/SyntaxUnit"); + +var Combinator = require("./Combinator"); +var MediaFeature = require("./MediaFeature"); +var MediaQuery = require("./MediaQuery"); +var PropertyName = require("./PropertyName"); +var PropertyValue = require("./PropertyValue"); +var PropertyValuePart = require("./PropertyValuePart"); +var Selector = require("./Selector"); +var SelectorPart = require("./SelectorPart"); +var SelectorSubPart = require("./SelectorSubPart"); +var TokenStream = require("./TokenStream"); +var Tokens = require("./Tokens"); +var Validation = require("./Validation"); +function Parser(options) { EventTarget.call(this); @@ -2039,11 +2026,12 @@ Parser.SELECTOR_TYPE = 7; Parser.SELECTOR_PART_TYPE = 8; Parser.SELECTOR_SUB_PART_TYPE = 9; -Parser.prototype = function(){ +Parser.prototype = function() { - var proto = new EventTarget(), //new prototype + var proto = new EventTarget(), // new prototype prop, additions = { + __proto__: null, constructor: Parser, DEFAULT_TYPE : 0, COMBINATOR_TYPE : 1, @@ -2056,10 +2044,9 @@ Parser.prototype = function(){ SELECTOR_PART_TYPE : 8, SELECTOR_SUB_PART_TYPE : 9, - _stylesheet: function(){ + _stylesheet: function() { var tokenStream = this._tokenStream, - charset = null, count, token, tt; @@ -2068,20 +2055,20 @@ Parser.prototype = function(){ this._charset(); this._skipCruft(); - while (tokenStream.peek() == Tokens.IMPORT_SYM){ + while (tokenStream.peek() === Tokens.IMPORT_SYM) { this._import(); this._skipCruft(); } - while (tokenStream.peek() == Tokens.NAMESPACE_SYM){ + while (tokenStream.peek() === Tokens.NAMESPACE_SYM) { this._namespace(); this._skipCruft(); } tt = tokenStream.peek(); - while(tt > Tokens.EOF){ + while (tt > Tokens.EOF) { try { - switch(tt){ + switch (tt) { case Tokens.MEDIA_SYM: this._media(); this._skipCruft(); @@ -2102,9 +2089,17 @@ Parser.prototype = function(){ this._viewport(); this._skipCruft(); break; - case Tokens.UNKNOWN_SYM: //unknown @ rule + case Tokens.DOCUMENT_SYM: + this._document(); + this._skipCruft(); + break; + case Tokens.SUPPORTS_SYM: + this._supports(); + this._skipCruft(); + break; + case Tokens.UNKNOWN_SYM: // unknown @ rule tokenStream.get(); - if (!this.options.strict){ + if (!this.options.strict) { this.fire({ type: "error", error: null, @@ -2112,12 +2107,12 @@ Parser.prototype = function(){ line: tokenStream.LT(0).startLine, col: tokenStream.LT(0).startCol }); - count=0; - while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) == Tokens.LBRACE){ - count++; //keep track of nesting depth + count = 0; + while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE) { + count++; // keep track of nesting depth } - while(count){ + while (count) { tokenStream.advance([Tokens.RBRACE]); count--; } @@ -2130,8 +2125,8 @@ Parser.prototype = function(){ this._readWhitespace(); break; default: - if(!this._ruleset()){ - switch(tt){ + if (!this._ruleset()) { + switch (tt) { case Tokens.CHARSET_SYM: token = tokenStream.LT(1); this._charset(false); @@ -2145,14 +2140,14 @@ Parser.prototype = function(){ this._namespace(false); throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); default: - tokenStream.get(); //get the last token + tokenStream.get(); // get the last token this._unexpectedToken(tokenStream.token()); } } } - } catch(ex) { - if (ex instanceof SyntaxError && !this.options.strict){ + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict) { this.fire({ type: "error", error: ex, @@ -2168,21 +2163,21 @@ Parser.prototype = function(){ tt = tokenStream.peek(); } - if (tt != Tokens.EOF){ + if (tt !== Tokens.EOF) { this._unexpectedToken(tokenStream.token()); } this.fire("endstylesheet"); }, - _charset: function(emit){ + _charset: function(emit) { var tokenStream = this._tokenStream, charset, token, line, col; - if (tokenStream.match(Tokens.CHARSET_SYM)){ + if (tokenStream.match(Tokens.CHARSET_SYM)) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -2195,7 +2190,7 @@ Parser.prototype = function(){ this._readWhitespace(); tokenStream.mustMatch(Tokens.SEMICOLON); - if (emit !== false){ + if (emit !== false) { this.fire({ type: "charset", charset:charset, @@ -2206,10 +2201,9 @@ Parser.prototype = function(){ } }, - _import: function(emit){ + _import: function(emit) { var tokenStream = this._tokenStream, - tt, uri, importToken, mediaList = []; @@ -2226,7 +2220,7 @@ Parser.prototype = function(){ tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); - if (emit !== false){ + if (emit !== false) { this.fire({ type: "import", uri: uri, @@ -2238,7 +2232,7 @@ Parser.prototype = function(){ }, - _namespace: function(emit){ + _namespace: function(emit) { var tokenStream = this._tokenStream, line, @@ -2249,7 +2243,7 @@ Parser.prototype = function(){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { prefix = tokenStream.token().value; this._readWhitespace(); } @@ -2261,7 +2255,7 @@ Parser.prototype = function(){ tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); - if (emit !== false){ + if (emit !== false) { this.fire({ type: "namespace", prefix: prefix, @@ -2273,11 +2267,119 @@ Parser.prototype = function(){ }, - _media: function(){ + _supports: function(emit) { + var tokenStream = this._tokenStream, + line, + col; + + if (tokenStream.match(Tokens.SUPPORTS_SYM)) { + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + this._supports_condition(); + this._readWhitespace(); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + if (emit !== false) { + this.fire({ + type: "startsupports", + line: line, + col: col + }); + } + + while (true) { + if (!this._ruleset()) { + break; + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "endsupports", + line: line, + col: col + }); + } + }, + + _supports_condition: function() { + var tokenStream = this._tokenStream, + ident; + + if (tokenStream.match(Tokens.IDENT)) { + ident = tokenStream.token().value.toLowerCase(); + + if (ident === "not") { + tokenStream.mustMatch(Tokens.S); + this._supports_condition_in_parens(); + } else { + tokenStream.unget(); + } + } else { + this._supports_condition_in_parens(); + this._readWhitespace(); + + while (tokenStream.peek() === Tokens.IDENT) { + ident = tokenStream.LT(1).value.toLowerCase(); + if (ident === "and" || ident === "or") { + tokenStream.mustMatch(Tokens.IDENT); + this._readWhitespace(); + this._supports_condition_in_parens(); + this._readWhitespace(); + } + } + } + }, + + _supports_condition_in_parens: function() { + var tokenStream = this._tokenStream, + ident; + + if (tokenStream.match(Tokens.LPAREN)) { + this._readWhitespace(); + if (tokenStream.match(Tokens.IDENT)) { + ident = tokenStream.token().value.toLowerCase(); + if (ident === "not") { + this._readWhitespace(); + this._supports_condition(); + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RPAREN); + } else { + tokenStream.unget(); + this._supports_declaration_condition(false); + } + } else { + this._supports_condition(); + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RPAREN); + } + } else { + this._supports_declaration_condition(); + } + }, + + _supports_declaration_condition: function(requireStartParen) { + var tokenStream = this._tokenStream; + + if (requireStartParen !== false) { + tokenStream.mustMatch(Tokens.LPAREN); + } + this._readWhitespace(); + this._declaration(); + tokenStream.mustMatch(Tokens.RPAREN); + }, + + _media: function() { var tokenStream = this._tokenStream, line, col, - mediaList;// = []; + mediaList; // = []; tokenStream.mustMatch(Tokens.MEDIA_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -2296,14 +2398,20 @@ Parser.prototype = function(){ col: col }); - while(true) { - if (tokenStream.peek() == Tokens.PAGE_SYM){ + while (true) { + if (tokenStream.peek() === Tokens.PAGE_SYM) { this._page(); - } else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){ + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM) { this._font_face(); - } else if (tokenStream.peek() == Tokens.VIEWPORT_SYM){ + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM) { this._viewport(); - } else if (!this._ruleset()){ + } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM) { + this._document(); + } else if (tokenStream.peek() === Tokens.SUPPORTS_SYM) { + this._supports(); + } else if (tokenStream.peek() === Tokens.MEDIA_SYM) { + this._media(); + } else if (!this._ruleset()) { break; } } @@ -2318,34 +2426,34 @@ Parser.prototype = function(){ col: col }); }, - _media_query_list: function(){ + _media_query_list: function() { var tokenStream = this._tokenStream, mediaList = []; this._readWhitespace(); - if (tokenStream.peek() == Tokens.IDENT || tokenStream.peek() == Tokens.LPAREN){ + if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN) { mediaList.push(this._media_query()); } - while(tokenStream.match(Tokens.COMMA)){ + while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); mediaList.push(this._media_query()); } return mediaList; }, - _media_query: function(){ + _media_query: function() { var tokenStream = this._tokenStream, type = null, ident = null, token = null, expressions = []; - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { ident = tokenStream.token().value.toLowerCase(); - if (ident != "only" && ident != "not"){ + if (ident !== "only" && ident !== "not") { tokenStream.unget(); ident = null; } else { @@ -2355,24 +2463,24 @@ Parser.prototype = function(){ this._readWhitespace(); - if (tokenStream.peek() == Tokens.IDENT){ + if (tokenStream.peek() === Tokens.IDENT) { type = this._media_type(); - if (token === null){ + if (token === null) { token = tokenStream.token(); } - } else if (tokenStream.peek() == Tokens.LPAREN){ - if (token === null){ + } else if (tokenStream.peek() === Tokens.LPAREN) { + if (token === null) { token = tokenStream.LT(1); } expressions.push(this._media_expression()); } - if (type === null && expressions.length === 0){ + if (type === null && expressions.length === 0) { return null; } else { this._readWhitespace(); - while (tokenStream.match(Tokens.IDENT)){ - if (tokenStream.token().value.toLowerCase() != "and"){ + while (tokenStream.match(Tokens.IDENT)) { + if (tokenStream.token().value.toLowerCase() !== "and") { this._unexpectedToken(tokenStream.token()); } @@ -2383,10 +2491,10 @@ Parser.prototype = function(){ return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); }, - _media_type: function(){ + _media_type: function() { return this._media_feature(); }, - _media_expression: function(){ + _media_expression: function() { var tokenStream = this._tokenStream, feature = null, token, @@ -2398,7 +2506,7 @@ Parser.prototype = function(){ feature = this._media_feature(); this._readWhitespace(); - if (tokenStream.match(Tokens.COLON)){ + if (tokenStream.match(Tokens.COLON)) { this._readWhitespace(); token = tokenStream.LT(1); expression = this._expression(); @@ -2407,16 +2515,18 @@ Parser.prototype = function(){ tokenStream.mustMatch(Tokens.RPAREN); this._readWhitespace(); - return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); + return new MediaFeature(feature, expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null); }, - _media_feature: function(){ + _media_feature: function() { var tokenStream = this._tokenStream; + this._readWhitespace(); + tokenStream.mustMatch(Tokens.IDENT); return SyntaxUnit.fromToken(tokenStream.token()); }, - _page: function(){ + _page: function() { var tokenStream = this._tokenStream, line, col, @@ -2428,13 +2538,13 @@ Parser.prototype = function(){ this._readWhitespace(); - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { identifier = tokenStream.token().value; - if (identifier.toLowerCase() === "auto"){ + if (identifier.toLowerCase() === "auto") { this._unexpectedToken(tokenStream.token()); } } - if (tokenStream.peek() == Tokens.COLON){ + if (tokenStream.peek() === Tokens.COLON) { pseudoPage = this._pseudo_page(); } @@ -2459,13 +2569,13 @@ Parser.prototype = function(){ }); }, - _margin: function(){ + _margin: function() { var tokenStream = this._tokenStream, line, col, marginSym = this._margin_sym(); - if (marginSym){ + if (marginSym) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -2489,18 +2599,17 @@ Parser.prototype = function(){ return false; } }, - _margin_sym: function(){ + _margin_sym: function() { var tokenStream = this._tokenStream; - if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, - Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, - Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, - Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, - Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, - Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, - Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) - { + if (tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, + Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, + Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, + Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, + Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, + Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, + Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) { return SyntaxUnit.fromToken(tokenStream.token()); } else { return null; @@ -2508,7 +2617,7 @@ Parser.prototype = function(){ }, - _pseudo_page: function(){ + _pseudo_page: function() { var tokenStream = this._tokenStream; @@ -2518,7 +2627,7 @@ Parser.prototype = function(){ return tokenStream.token().value; }, - _font_face: function(){ + _font_face: function() { var tokenStream = this._tokenStream, line, col; @@ -2543,40 +2652,126 @@ Parser.prototype = function(){ }); }, - _viewport: function(){ - var tokenStream = this._tokenStream, + _viewport: function() { + var tokenStream = this._tokenStream, line, col; - tokenStream.mustMatch(Tokens.VIEWPORT_SYM); - line = tokenStream.token().startLine; - col = tokenStream.token().startCol; + tokenStream.mustMatch(Tokens.VIEWPORT_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; - this._readWhitespace(); + this._readWhitespace(); - this.fire({ - type: "startviewport", - line: line, - col: col - }); + this.fire({ + type: "startviewport", + line: line, + col: col + }); - this._readDeclarations(true); + this._readDeclarations(true); - this.fire({ - type: "endviewport", - line: line, - col: col - }); + this.fire({ + type: "endviewport", + line: line, + col: col + }); }, - _operator: function(inFunction){ + _document: function() { + + var tokenStream = this._tokenStream, + token, + functions = [], + prefix = ""; + + tokenStream.mustMatch(Tokens.DOCUMENT_SYM); + token = tokenStream.token(); + if (/^@-([^-]+)-/.test(token.value)) { + prefix = RegExp.$1; + } + + this._readWhitespace(); + functions.push(this._document_function()); + + while (tokenStream.match(Tokens.COMMA)) { + this._readWhitespace(); + functions.push(this._document_function()); + } + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startdocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + var ok = true; + while (ok) { + switch (tokenStream.peek()) { + case Tokens.PAGE_SYM: + this._page(); + break; + case Tokens.FONT_FACE_SYM: + this._font_face(); + break; + case Tokens.VIEWPORT_SYM: + this._viewport(); + break; + case Tokens.MEDIA_SYM: + this._media(); + break; + case Tokens.KEYFRAMES_SYM: + this._keyframes(); + break; + case Tokens.DOCUMENT_SYM: + this._document(); + break; + default: + ok = Boolean(this._ruleset()); + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + token = tokenStream.token(); + this._readWhitespace(); + + this.fire({ + type: "enddocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + }, + + _document_function: function() { + + var tokenStream = this._tokenStream, + value; + + if (tokenStream.match(Tokens.URI)) { + value = tokenStream.token().value; + this._readWhitespace(); + } else { + value = this._function(); + } + + return value; + }, + + _operator: function(inFunction) { var tokenStream = this._tokenStream, token = null; if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || - (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ + inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS])) { token = tokenStream.token(); this._readWhitespace(); } @@ -2584,13 +2779,13 @@ Parser.prototype = function(){ }, - _combinator: function(){ + _combinator: function() { var tokenStream = this._tokenStream, value = null, token; - if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ + if (tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])) { token = tokenStream.token(); value = new Combinator(token.value, token.startLine, token.startCol); this._readWhitespace(); @@ -2599,57 +2794,67 @@ Parser.prototype = function(){ return value; }, - _unary_operator: function(){ + _unary_operator: function() { var tokenStream = this._tokenStream; - if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ + if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])) { return tokenStream.token().value; } else { return null; } }, - _property: function(){ + _property: function() { - var tokenStream = this._tokenStream, - value = null, - hack = null, - tokenValue, + var tokenStream = this._tokenStream, + value = null, + hack = null, + propertyName = "", token, line, col; - if (tokenStream.peek() == Tokens.STAR && this.options.starHack){ + if (tokenStream.peek() === Tokens.STAR && this.options.starHack) { tokenStream.get(); token = tokenStream.token(); hack = token.value; line = token.startLine; col = token.startCol; } - - if(tokenStream.match(Tokens.IDENT)){ + if (tokenStream.peek() === Tokens.MINUS) { + tokenStream.get(); token = tokenStream.token(); - tokenValue = token.value; - if (tokenValue.charAt(0) == "_" && this.options.underscoreHack){ + propertyName = token.value; + line = token.startLine; + col = token.startCol; + } + + if (tokenStream.match(Tokens.IDENT)) { + token = tokenStream.token(); + propertyName += token.value; + if (propertyName.charAt(0) === "_" && this.options.underscoreHack) { hack = "_"; - tokenValue = tokenValue.substring(1); + propertyName = propertyName.substring(1); } - value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); + value = new PropertyName(propertyName, hack, line || token.startLine, col || token.startCol); this._readWhitespace(); + } else if (tokenStream.peek() === Tokens.RBRACE) { + } else { + this._unexpectedToken(tokenStream.LT(1)); } return value; }, - _ruleset: function(){ + _ruleset: function() { var tokenStream = this._tokenStream, tt, selectors; try { selectors = this._selectors_group(); - } catch (ex){ - if (ex instanceof SyntaxError && !this.options.strict){ + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict) { this.fire({ type: "error", error: ex, @@ -2658,7 +2863,7 @@ Parser.prototype = function(){ col: ex.col }); tt = tokenStream.advance([Tokens.RBRACE]); - if (tt == Tokens.RBRACE){ + if (tt === Tokens.RBRACE) { } else { throw ex; } @@ -2668,7 +2873,7 @@ Parser.prototype = function(){ } return true; } - if (selectors){ + if (selectors) { this.fire({ type: "startrule", @@ -2691,19 +2896,19 @@ Parser.prototype = function(){ return selectors; }, - _selectors_group: function(){ + _selectors_group: function() { var tokenStream = this._tokenStream, selectors = [], selector; selector = this._selector(); - if (selector !== null){ + if (selector !== null) { selectors.push(selector); - while(tokenStream.match(Tokens.COMMA)){ + while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); selector = this._selector(); - if (selector !== null){ + if (selector !== null) { selectors.push(selector); } else { this._unexpectedToken(tokenStream.LT(1)); @@ -2713,7 +2918,7 @@ Parser.prototype = function(){ return selectors.length ? selectors : null; }, - _selector: function(){ + _selector: function() { var tokenStream = this._tokenStream, selector = [], @@ -2721,7 +2926,7 @@ Parser.prototype = function(){ combinator = null, ws = null; nextSelector = this._simple_selector_sequence(); - if (nextSelector === null){ + if (nextSelector === null) { return null; } @@ -2730,26 +2935,26 @@ Parser.prototype = function(){ do { combinator = this._combinator(); - if (combinator !== null){ + if (combinator !== null) { selector.push(combinator); nextSelector = this._simple_selector_sequence(); - if (nextSelector === null){ + if (nextSelector === null) { this._unexpectedToken(tokenStream.LT(1)); } else { selector.push(nextSelector); } } else { - if (this._readWhitespace()){ + if (this._readWhitespace()) { ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); combinator = this._combinator(); nextSelector = this._simple_selector_sequence(); - if (nextSelector === null){ - if (combinator !== null){ + if (nextSelector === null) { + if (combinator !== null) { this._unexpectedToken(tokenStream.LT(1)); } } else { - if (combinator !== null){ + if (combinator !== null) { selector.push(combinator); } else { selector.push(ws); @@ -2762,18 +2967,18 @@ Parser.prototype = function(){ } } - } while(true); + } while (true); return new Selector(selector, selector[0].line, selector[0].col); }, - _simple_selector_sequence: function(){ + _simple_selector_sequence: function() { var tokenStream = this._tokenStream, elementName = null, modifiers = [], - selectorText= "", + selectorText = "", components = [ - function(){ + function() { return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null; @@ -2786,31 +2991,30 @@ Parser.prototype = function(){ i = 0, len = components.length, component = null, - found = false, line, col; line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; elementName = this._type_selector(); - if (!elementName){ + if (!elementName) { elementName = this._universal(); } - if (elementName !== null){ + if (elementName !== null) { selectorText += elementName; } - while(true){ - if (tokenStream.peek() === Tokens.S){ + while (true) { + if (tokenStream.peek() === Tokens.S) { break; } - while(i < len && component === null){ + while (i < len && component === null) { component = components[i++].call(this); } - if (component === null){ - if (selectorText === ""){ + if (component === null) { + if (selectorText === "") { return null; } else { break; @@ -2828,35 +3032,35 @@ Parser.prototype = function(){ new SelectorPart(elementName, modifiers, selectorText, line, col) : null; }, - _type_selector: function(){ + _type_selector: function() { var tokenStream = this._tokenStream, ns = this._namespace_prefix(), elementName = this._element_name(); - if (!elementName){ - if (ns){ + if (!elementName) { + if (ns) { tokenStream.unget(); - if (ns.length > 1){ + if (ns.length > 1) { tokenStream.unget(); } } return null; } else { - if (ns){ + if (ns) { elementName.text = ns + elementName.text; elementName.col -= ns.length; } return elementName; } }, - _class: function(){ + _class: function() { var tokenStream = this._tokenStream, token; - if (tokenStream.match(Tokens.DOT)){ + if (tokenStream.match(Tokens.DOT)) { tokenStream.mustMatch(Tokens.IDENT); token = tokenStream.token(); return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); @@ -2865,12 +3069,12 @@ Parser.prototype = function(){ } }, - _element_name: function(){ + _element_name: function() { var tokenStream = this._tokenStream, token; - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { token = tokenStream.token(); return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); @@ -2878,12 +3082,12 @@ Parser.prototype = function(){ return null; } }, - _namespace_prefix: function(){ + _namespace_prefix: function() { var tokenStream = this._tokenStream, value = ""; - if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ + if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE) { - if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ + if (tokenStream.match([Tokens.IDENT, Tokens.STAR])) { value += tokenStream.token().value; } @@ -2894,38 +3098,38 @@ Parser.prototype = function(){ return value.length ? value : null; }, - _universal: function(){ + _universal: function() { var tokenStream = this._tokenStream, value = "", ns; ns = this._namespace_prefix(); - if(ns){ + if (ns) { value += ns; } - if(tokenStream.match(Tokens.STAR)){ + if (tokenStream.match(Tokens.STAR)) { value += "*"; } return value.length ? value : null; - }, - _attrib: function(){ + }, + _attrib: function() { var tokenStream = this._tokenStream, value = null, ns, token; - if (tokenStream.match(Tokens.LBRACKET)){ + if (tokenStream.match(Tokens.LBRACKET)) { token = tokenStream.token(); value = token.value; value += this._readWhitespace(); ns = this._namespace_prefix(); - if (ns){ + if (ns) { value += ns; } @@ -2933,8 +3137,8 @@ Parser.prototype = function(){ value += tokenStream.token().value; value += this._readWhitespace(); - if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, - Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ + if (tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, + Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])) { value += tokenStream.token().value; value += this._readWhitespace(); @@ -2951,7 +3155,7 @@ Parser.prototype = function(){ return null; } }, - _pseudo: function(){ + _pseudo: function() { var tokenStream = this._tokenStream, pseudo = null, @@ -2959,35 +3163,39 @@ Parser.prototype = function(){ line, col; - if (tokenStream.match(Tokens.COLON)){ + if (tokenStream.match(Tokens.COLON)) { - if (tokenStream.match(Tokens.COLON)){ + if (tokenStream.match(Tokens.COLON)) { colons += ":"; } - if (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.match(Tokens.IDENT)) { pseudo = tokenStream.token().value; line = tokenStream.token().startLine; col = tokenStream.token().startCol - colons.length; - } else if (tokenStream.peek() == Tokens.FUNCTION){ + } else if (tokenStream.peek() === Tokens.FUNCTION) { line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol - colons.length; pseudo = this._functional_pseudo(); } - if (pseudo){ + if (pseudo) { pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); + } else { + var startLine = tokenStream.LT(1).startLine, + startCol = tokenStream.LT(0).startCol; + throw new SyntaxError("Expected a `FUNCTION` or `IDENT` after colon at line " + startLine + ", col " + startCol + ".", startLine, startCol); } } return pseudo; }, - _functional_pseudo: function(){ + _functional_pseudo: function() { var tokenStream = this._tokenStream, value = null; - if(tokenStream.match(Tokens.FUNCTION)){ + if (tokenStream.match(Tokens.FUNCTION)) { value = tokenStream.token().value; value += this._readWhitespace(); value += this._expression(); @@ -2997,15 +3205,15 @@ Parser.prototype = function(){ return value; }, - _expression: function(){ + _expression: function() { var tokenStream = this._tokenStream, value = ""; - while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, - Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, - Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, - Tokens.RESOLUTION, Tokens.SLASH])){ + while (tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, + Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, + Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, + Tokens.RESOLUTION, Tokens.SLASH])) { value += tokenStream.token().value; value += this._readWhitespace(); @@ -3014,7 +3222,7 @@ Parser.prototype = function(){ return value.length ? value : null; }, - _negation: function(){ + _negation: function() { var tokenStream = this._tokenStream, line, @@ -3023,7 +3231,7 @@ Parser.prototype = function(){ arg, subpart = null; - if (tokenStream.match(Tokens.NOT)){ + if (tokenStream.match(Tokens.NOT)) { value = tokenStream.token().value; line = tokenStream.token().startLine; col = tokenStream.token().startCol; @@ -3040,13 +3248,13 @@ Parser.prototype = function(){ return subpart; }, - _negation_arg: function(){ + _negation_arg: function() { var tokenStream = this._tokenStream, args = [ this._type_selector, this._universal, - function(){ + function() { return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null; @@ -3058,7 +3266,6 @@ Parser.prototype = function(){ arg = null, i = 0, len = args.length, - elementName, line, col, part; @@ -3066,15 +3273,15 @@ Parser.prototype = function(){ line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; - while(i < len && arg === null){ + while (i < len && arg === null) { arg = args[i].call(this); i++; } - if (arg === null){ + if (arg === null) { this._unexpectedToken(tokenStream.LT(1)); } - if (arg.type == "elementName"){ + if (arg.type === "elementName") { part = new SelectorPart(arg, [], arg.toString(), line, col); } else { part = new SelectorPart(null, [arg], arg.toString(), line, col); @@ -3083,31 +3290,30 @@ Parser.prototype = function(){ return part; }, - _declaration: function(){ + _declaration: function() { - var tokenStream = this._tokenStream, - property = null, - expr = null, - prio = null, - error = null, - invalid = null, - propertyName= ""; + var tokenStream = this._tokenStream, + property = null, + expr = null, + prio = null, + invalid = null, + propertyName = ""; property = this._property(); - if (property !== null){ + if (property !== null) { tokenStream.mustMatch(Tokens.COLON); this._readWhitespace(); expr = this._expr(); - if (!expr || expr.length === 0){ + if (!expr || expr.length === 0) { this._unexpectedToken(tokenStream.LT(1)); } prio = this._prio(); propertyName = property.toString(); - if (this.options.starHack && property.hack == "*" || - this.options.underscoreHack && property.hack == "_") { + if (this.options.starHack && property.hack === "*" || + this.options.underscoreHack && property.hack === "_") { propertyName = property.text; } @@ -3134,7 +3340,7 @@ Parser.prototype = function(){ } }, - _prio: function(){ + _prio: function() { var tokenStream = this._tokenStream, result = tokenStream.match(Tokens.IMPORTANT_SYM); @@ -3143,21 +3349,20 @@ Parser.prototype = function(){ return result; }, - _expr: function(inFunction){ + _expr: function(inFunction) { - var tokenStream = this._tokenStream, - values = [], + var values = [], value = null, operator = null; value = this._term(inFunction); - if (value !== null){ + if (value !== null) { values.push(value); do { operator = this._operator(inFunction); - if (operator){ + if (operator) { values.push(operator); } /*else { values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); @@ -3166,44 +3371,45 @@ Parser.prototype = function(){ value = this._term(inFunction); - if (value === null){ + if (value === null) { break; } else { values.push(value); } - } while(true); + } while (true); } return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; }, - _term: function(inFunction){ + _term: function(inFunction) { var tokenStream = this._tokenStream, unary = null, value = null, endChar = null, + part = null, token, line, col; unary = this._unary_operator(); - if (unary !== null){ + if (unary !== null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } - if (tokenStream.peek() == Tokens.IE_FUNCTION && this.options.ieFilters){ + if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters) { value = this._ie_function(); - if (unary === null){ + if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } - } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])) { token = tokenStream.token(); endChar = token.endChar; value = token.value + this._expr(inFunction).text; - if (unary === null){ + if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; } @@ -3211,24 +3417,25 @@ Parser.prototype = function(){ value += endChar; this._readWhitespace(); } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, - Tokens.ANGLE, Tokens.TIME, - Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ + Tokens.ANGLE, Tokens.TIME, + Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])) { value = tokenStream.token().value; - if (unary === null){ + if (unary === null) { line = tokenStream.token().startLine; col = tokenStream.token().startCol; + part = PropertyValuePart.fromToken(tokenStream.token()); } this._readWhitespace(); } else { token = this._hexcolor(); - if (token === null){ - if (unary === null){ + if (token === null) { + if (unary === null) { line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; } - if (value === null){ - if (tokenStream.LA(3) == Tokens.EQUALS && this.options.ieFilters){ + if (value === null) { + if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters) { value = this._ie_function(); } else { value = this._function(); @@ -3237,7 +3444,7 @@ Parser.prototype = function(){ } else { value = token.value; - if (unary === null){ + if (unary === null) { line = token.startLine; col = token.startCol; } @@ -3245,31 +3452,31 @@ Parser.prototype = function(){ } - return value !== null ? + return part !== null ? part : value !== null ? new PropertyValuePart(unary !== null ? unary + value : value, line, col) : null; }, - _function: function(){ + _function: function() { var tokenStream = this._tokenStream, functionText = null, expr = null, lt; - if (tokenStream.match(Tokens.FUNCTION)){ + if (tokenStream.match(Tokens.FUNCTION)) { functionText = tokenStream.token().value; this._readWhitespace(); expr = this._expr(true); functionText += expr; - if (this.options.ieFilters && tokenStream.peek() == Tokens.EQUALS){ + if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS) { do { - if (this._readWhitespace()){ + if (this._readWhitespace()) { functionText += tokenStream.token().value; } - if (tokenStream.LA(0) == Tokens.COMMA){ + if (tokenStream.LA(0) === Tokens.COMMA) { functionText += tokenStream.token().value; } @@ -3279,12 +3486,12 @@ Parser.prototype = function(){ tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; lt = tokenStream.peek(); - while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){ + while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) { tokenStream.get(); functionText += tokenStream.token().value; lt = tokenStream.peek(); } - } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } while (tokenStream.match([Tokens.COMMA, Tokens.S])); } tokenStream.match(Tokens.RPAREN); @@ -3295,21 +3502,20 @@ Parser.prototype = function(){ return functionText; }, - _ie_function: function(){ + _ie_function: function() { var tokenStream = this._tokenStream, functionText = null, - expr = null, lt; - if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ + if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])) { functionText = tokenStream.token().value; do { - if (this._readWhitespace()){ + if (this._readWhitespace()) { functionText += tokenStream.token().value; } - if (tokenStream.LA(0) == Tokens.COMMA){ + if (tokenStream.LA(0) === Tokens.COMMA) { functionText += tokenStream.token().value; } @@ -3319,12 +3525,12 @@ Parser.prototype = function(){ tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; lt = tokenStream.peek(); - while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){ + while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) { tokenStream.get(); functionText += tokenStream.token().value; lt = tokenStream.peek(); } - } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } while (tokenStream.match([Tokens.COMMA, Tokens.S])); tokenStream.match(Tokens.RPAREN); functionText += ")"; @@ -3334,17 +3540,17 @@ Parser.prototype = function(){ return functionText; }, - _hexcolor: function(){ + _hexcolor: function() { var tokenStream = this._tokenStream, token = null, color; - if(tokenStream.match(Tokens.HASH)){ + if (tokenStream.match(Tokens.HASH)) { token = tokenStream.token(); color = token.value; - if (!/#[a-f0-9]{3,6}/i.test(color)){ + if (!/#[a-f0-9]{3,6}/i.test(color)) { throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); } this._readWhitespace(); @@ -3353,7 +3559,7 @@ Parser.prototype = function(){ return token; }, - _keyframes: function(){ + _keyframes: function() { var tokenStream = this._tokenStream, token, tt, @@ -3362,7 +3568,7 @@ Parser.prototype = function(){ tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); token = tokenStream.token(); - if (/^@\-([^\-]+)\-/.test(token.value)) { + if (/^@-([^-]+)-/.test(token.value)) { prefix = RegExp.$1; } @@ -3382,7 +3588,7 @@ Parser.prototype = function(){ this._readWhitespace(); tt = tokenStream.peek(); - while(tt == Tokens.IDENT || tt == Tokens.PERCENTAGE) { + while (tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { this._keyframe_rule(); this._readWhitespace(); tt = tokenStream.peek(); @@ -3398,21 +3604,19 @@ Parser.prototype = function(){ this._readWhitespace(); tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); }, - _keyframe_name: function(){ - var tokenStream = this._tokenStream, - token; + _keyframe_name: function() { + var tokenStream = this._tokenStream; tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); return SyntaxUnit.fromToken(tokenStream.token()); }, - _keyframe_rule: function(){ - var tokenStream = this._tokenStream, - token, - keyList = this._key_list(); + _keyframe_rule: function() { + var keyList = this._key_list(); this.fire({ type: "startkeyframerule", @@ -3432,16 +3636,14 @@ Parser.prototype = function(){ }, - _key_list: function(){ + _key_list: function() { var tokenStream = this._tokenStream, - token, - key, keyList = []; keyList.push(this._key()); this._readWhitespace(); - while(tokenStream.match(Tokens.COMMA)){ + while (tokenStream.match(Tokens.COMMA)) { this._readWhitespace(); keyList.push(this._key()); this._readWhitespace(); @@ -3450,17 +3652,17 @@ Parser.prototype = function(){ return keyList; }, - _key: function(){ + _key: function() { var tokenStream = this._tokenStream, token; - if (tokenStream.match(Tokens.PERCENTAGE)){ + if (tokenStream.match(Tokens.PERCENTAGE)) { return SyntaxUnit.fromToken(tokenStream.token()); - } else if (tokenStream.match(Tokens.IDENT)){ + } else if (tokenStream.match(Tokens.IDENT)) { token = tokenStream.token(); - if (/from|to/i.test(token.value)){ + if (/from|to/i.test(token.value)) { return SyntaxUnit.fromToken(token); } @@ -3468,18 +3670,18 @@ Parser.prototype = function(){ } this._unexpectedToken(tokenStream.LT(1)); }, - _skipCruft: function(){ - while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + _skipCruft: function() { + while (this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])) { } }, - _readDeclarations: function(checkStart, readMargins){ + _readDeclarations: function(checkStart, readMargins) { var tokenStream = this._tokenStream, tt; this._readWhitespace(); - if (checkStart){ + if (checkStart) { tokenStream.mustMatch(Tokens.LBRACE); } @@ -3487,11 +3689,11 @@ Parser.prototype = function(){ try { - while(true){ + while (true) { - if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ - } else if (this._declaration()){ - if (!tokenStream.match(Tokens.SEMICOLON)){ + if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())) { + } else if (this._declaration()) { + if (!tokenStream.match(Tokens.SEMICOLON)) { break; } } else { @@ -3504,7 +3706,7 @@ Parser.prototype = function(){ this._readWhitespace(); } catch (ex) { - if (ex instanceof SyntaxError && !this.options.strict){ + if (ex instanceof SyntaxError && !this.options.strict) { this.fire({ type: "error", error: ex, @@ -3513,9 +3715,9 @@ Parser.prototype = function(){ col: ex.col }); tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); - if (tt == Tokens.SEMICOLON){ + if (tt === Tokens.SEMICOLON) { this._readDeclarations(false, readMargins); - } else if (tt != Tokens.RBRACE){ + } else if (tt !== Tokens.RBRACE) { throw ex; } @@ -3525,45 +3727,45 @@ Parser.prototype = function(){ } }, - _readWhitespace: function(){ + _readWhitespace: function() { var tokenStream = this._tokenStream, ws = ""; - while(tokenStream.match(Tokens.S)){ + while (tokenStream.match(Tokens.S)) { ws += tokenStream.token().value; } return ws; }, - _unexpectedToken: function(token){ + _unexpectedToken: function(token) { throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); }, - _verifyEnd: function(){ - if (this._tokenStream.LA(1) != Tokens.EOF){ + _verifyEnd: function() { + if (this._tokenStream.LA(1) !== Tokens.EOF) { this._unexpectedToken(this._tokenStream.LT(1)); } }, - _validateProperty: function(property, value){ + _validateProperty: function(property, value) { Validation.validate(property, value); }, - parse: function(input){ + parse: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._stylesheet(); }, - parseStyleSheet: function(input){ + parseStyleSheet: function(input) { return this.parse(input); }, - parseMediaQuery: function(input){ + parseMediaQuery: function(input) { this._tokenStream = new TokenStream(input, Tokens); var result = this._media_query(); this._verifyEnd(); return result; }, - parsePropertyValue: function(input){ + parsePropertyValue: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); @@ -3573,7 +3775,7 @@ Parser.prototype = function(){ this._verifyEnd(); return result; }, - parseRule: function(input){ + parseRule: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); @@ -3582,7 +3784,7 @@ Parser.prototype = function(){ this._verifyEnd(); return result; }, - parseSelector: function(input){ + parseSelector: function(input) { this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); @@ -3592,510 +3794,482 @@ Parser.prototype = function(){ this._verifyEnd(); return result; }, - parseStyleAttribute: function(input){ - input += "}"; // for error recovery in _readDeclarations() + parseStyleAttribute: function(input) { + input += "}"; // for error recovery in _readDeclarations() this._tokenStream = new TokenStream(input, Tokens); this._readDeclarations(); } }; - for (prop in additions){ - if (additions.hasOwnProperty(prop)){ + for (prop in additions) { + if (Object.prototype.hasOwnProperty.call(additions, prop)) { proto[prop] = additions[prop]; } } return proto; }(); -var Properties = { - "align-items" : "flex-start | flex-end | center | baseline | stretch", - "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", - "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", - "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", - "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", - "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", - "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", - "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", - "animation" : 1, - "animation-delay" : { multi: "