WPide - Version 2.0.9

Version Description

  • Upload snapshot of current ajaxorg editor (master/build/src) at 00:30 on the 22 May 2012. Which fixes some issues with selecting big blocks of text, code folding seems better with gutter interface hidden when not in use
Download this release

Release Info

Developer WPsites
Plugin Icon 128x128 WPide
Version 2.0.9
Comparing to
See all releases

Code changes from version 2.0.8 to 2.0.9

WPide.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: WPide
4
  Plugin URI: https://github.com/WPsites/WPide
5
  Description: WordPress code editor with auto completion of both WordPress and PHP functions with reference, syntax highlighting, line numbers, tabbed editing, automatic backup.
6
- Version: 2.0.8
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
1
  <?php
2
  /*
3
+ Plugin Name: WPide
4
  Plugin URI: https://github.com/WPsites/WPide
5
  Description: WordPress code editor with auto completion of both WordPress and PHP functions with reference, syntax highlighting, line numbers, tabbed editing, automatic backup.
6
+ Version: 2.0.9
7
  Author: Simon Dunton
8
  Author URI: http://www.wpsites.co.uk
9
  */
ace-0.2.0/ChangeLog.txt CHANGED
@@ -1,116 +1,116 @@
1
- 2011.08.02, Version 0.2.0
2
-
3
- * Split view (Julian Viereck)
4
- - split editor area horizontally or vertivally to show two files at the same
5
- time
6
-
7
- * Code Folding (Julian Viereck)
8
- - Unstructured code folding
9
- - Will be the basis for language aware folding
10
-
11
- * Mode bahaviours (Chris Spencer)
12
- - Adds mode specific hooks which allow transformations of entered text
13
- - Autoclosing of braces, paranthesis and quotation marks in C style modes
14
- - Autoclosing of angular brackets in XML style modes
15
-
16
- * New language modes
17
- - Clojure (Carin Meier)
18
- - C# (Rob Conery)
19
- - Groovy (Ben Tilford)
20
- - Scala (Ben Tilford)
21
- - JSON
22
- - OCaml (Sergi Mansilla)
23
- - Perl (Panagiotis Astithas)
24
- - SCSS/SASS (Andreas Madsen)
25
- - SVG
26
- - Textile (Kelley van Evert)
27
- - SCAD (Jacob Hansson)
28
-
29
- * Live syntax checks
30
- - Lint for Css using CSS Lint <http://csslint.net/>
31
- - CoffeeScript
32
-
33
- * New Themes
34
- - Crimson Editor (iebuggy)
35
- - Merbivore (Michael Schwartz)
36
- - Merbivore soft (Michael Schwartz)
37
- - Solarized dark/light <http://ethanschoonover.com/solarized> (David Alan
38
- Hjelle)
39
- - Vibrant Ink (Michael Schwartz)
40
-
41
- * Small Features/Enhancements
42
- - Lots of render performance optimizations (Harutyun Amirjanyan)
43
- - Improved Ruby highlighting (Chris Wanstrath, Trent Ogren)
44
- - Improved PHP highlighting (Thomas Hruska)
45
- - Improved CSS highlighting (Sean Kellogg)
46
- - Clicks which cause the editor to be focused don't reset the selection
47
- - Make padding text layer specific so that print margin and active line
48
- highlight are not affected (Irakli Gozalishvili)
49
- - Added setFontSize method
50
- - Improved vi keybindings (Trent Ogren)
51
- - When unfocused make cursor transparent instead of removing it (Harutyun
52
- Amirjanyan)
53
- - Support for matching groups in tokenizer with arrays of tokens (Chris
54
- Spencer)
55
-
56
- * Bug fixes
57
- - Add support for the new OSX scroll bars
58
- - Properly highlight JavaScript regexp literals
59
- - Proper handling of unicode characters in JavaScript identifiers
60
- - Fix remove lines command on last line (Harutyun Amirjanyan)
61
- - Fix scroll wheel sluggishness in Safari
62
- - Make keyboard infrastructure route keys like []^$ the right way (Julian
63
- Viereck)
64
-
65
- 2011.02.14, Version 0.1.6
66
-
67
- * Floating Anchors
68
- - An Anchor is a floating pointer in the document.
69
- - Whenever text is inserted or deleted before the cursor, the position of
70
- the cursor is updated
71
- - Usesd for the cursor and selection
72
- - Basis for bookmarks, multiple cursors and snippets in the future
73
- * Extensive support for Cocoa style keybindings on the Mac <https://github.com/ajaxorg/ace/issues/closed#issue/116/comment/767803>
74
- * New commands:
75
- - center selection in viewport
76
- - remove to end/start of line
77
- - split line
78
- - transpose letters
79
- * Refator markers
80
- - Custom code can be used to render markers
81
- - Markers can be in front or behind the text
82
- - Markers are now stored in the session (was in the renderer)
83
- * Lots of IE8 fixes including copy, cut and selections
84
- * Unit tests can also be run in the browser
85
- <https://github.com/ajaxorg/ace/blob/master/lib/ace/test/tests.html>
86
- * Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng)
87
- * Add minimal node server server.js to run the Ace demo in Chrome
88
- * The top level editor.html demo has been renamed to index.html
89
- * Bug fixes
90
- - Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen)
91
- - Fixed isues when the editor was scrolled in the web page (Eric Allam)
92
- - Highlighting of Python string literals
93
- - Syntax rule for PHP comments
94
-
95
- 2011.02.08, Version 0.1.5
96
-
97
- * Add Coffeescript Mode (Satoshi Murakami)
98
- * Fix word wrap bug (Julian Viereck)
99
- * Fix packaged version of the Eclipse mode
100
- * Loading of workers is more robust
101
- * Fix "click selection"
102
- * Allow tokizing empty lines (Daniel Krech)
103
- * Make PageUp/Down behavior more consistent with native OS (Joe Cheng)
104
-
105
- 2011.02.04, Version 0.1.4
106
-
107
- * Add C/C++ mode contributed by Gastón Kleiman
108
- * Fix exception in key input
109
-
110
- 2011.02.04, Version 0.1.3
111
-
112
- * Let the packaged version play nice with requireJS
113
- * Add Ruby mode contributed by Shlomo Zalman Heigh
114
- * Add Java mode contributed by Tom Tasche
115
- * Fix annotation bug
116
  * Changing a document added a new empty line at the end
1
+ 2011.08.02, Version 0.2.0
2
+
3
+ * Split view (Julian Viereck)
4
+ - split editor area horizontally or vertivally to show two files at the same
5
+ time
6
+
7
+ * Code Folding (Julian Viereck)
8
+ - Unstructured code folding
9
+ - Will be the basis for language aware folding
10
+
11
+ * Mode behaviours (Chris Spencer)
12
+ - Adds mode specific hooks which allow transformations of entered text
13
+ - Autoclosing of braces, paranthesis and quotation marks in C style modes
14
+ - Autoclosing of angular brackets in XML style modes
15
+
16
+ * New language modes
17
+ - Clojure (Carin Meier)
18
+ - C# (Rob Conery)
19
+ - Groovy (Ben Tilford)
20
+ - Scala (Ben Tilford)
21
+ - JSON
22
+ - OCaml (Sergi Mansilla)
23
+ - Perl (Panagiotis Astithas)
24
+ - SCSS/SASS (Andreas Madsen)
25
+ - SVG
26
+ - Textile (Kelley van Evert)
27
+ - SCAD (Jacob Hansson)
28
+
29
+ * Live syntax checks
30
+ - Lint for Css using CSS Lint <http://csslint.net/>
31
+ - CoffeeScript
32
+
33
+ * New Themes
34
+ - Crimson Editor (iebuggy)
35
+ - Merbivore (Michael Schwartz)
36
+ - Merbivore soft (Michael Schwartz)
37
+ - Solarized dark/light <http://ethanschoonover.com/solarized> (David Alan
38
+ Hjelle)
39
+ - Vibrant Ink (Michael Schwartz)
40
+
41
+ * Small Features/Enhancements
42
+ - Lots of render performance optimizations (Harutyun Amirjanyan)
43
+ - Improved Ruby highlighting (Chris Wanstrath, Trent Ogren)
44
+ - Improved PHP highlighting (Thomas Hruska)
45
+ - Improved CSS highlighting (Sean Kellogg)
46
+ - Clicks which cause the editor to be focused don't reset the selection
47
+ - Make padding text layer specific so that print margin and active line
48
+ highlight are not affected (Irakli Gozalishvili)
49
+ - Added setFontSize method
50
+ - Improved vi keybindings (Trent Ogren)
51
+ - When unfocused make cursor transparent instead of removing it (Harutyun
52
+ Amirjanyan)
53
+ - Support for matching groups in tokenizer with arrays of tokens (Chris
54
+ Spencer)
55
+
56
+ * Bug fixes
57
+ - Add support for the new OSX scroll bars
58
+ - Properly highlight JavaScript regexp literals
59
+ - Proper handling of unicode characters in JavaScript identifiers
60
+ - Fix remove lines command on last line (Harutyun Amirjanyan)
61
+ - Fix scroll wheel sluggishness in Safari
62
+ - Make keyboard infrastructure route keys like []^$ the right way (Julian
63
+ Viereck)
64
+
65
+ 2011.02.14, Version 0.1.6
66
+
67
+ * Floating Anchors
68
+ - An Anchor is a floating pointer in the document.
69
+ - Whenever text is inserted or deleted before the cursor, the position of
70
+ the cursor is updated
71
+ - Usesd for the cursor and selection
72
+ - Basis for bookmarks, multiple cursors and snippets in the future
73
+ * Extensive support for Cocoa style keybindings on the Mac <https://github.com/ajaxorg/ace/issues/closed#issue/116/comment/767803>
74
+ * New commands:
75
+ - center selection in viewport
76
+ - remove to end/start of line
77
+ - split line
78
+ - transpose letters
79
+ * Refator markers
80
+ - Custom code can be used to render markers
81
+ - Markers can be in front or behind the text
82
+ - Markers are now stored in the session (was in the renderer)
83
+ * Lots of IE8 fixes including copy, cut and selections
84
+ * Unit tests can also be run in the browser
85
+ <https://github.com/ajaxorg/ace/blob/master/lib/ace/test/tests.html>
86
+ * Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng)
87
+ * Add minimal node server server.js to run the Ace demo in Chrome
88
+ * The top level editor.html demo has been renamed to index.html
89
+ * Bug fixes
90
+ - Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen)
91
+ - Fixed isues when the editor was scrolled in the web page (Eric Allam)
92
+ - Highlighting of Python string literals
93
+ - Syntax rule for PHP comments
94
+
95
+ 2011.02.08, Version 0.1.5
96
+
97
+ * Add Coffeescript Mode (Satoshi Murakami)
98
+ * Fix word wrap bug (Julian Viereck)
99
+ * Fix packaged version of the Eclipse mode
100
+ * Loading of workers is more robust
101
+ * Fix "click selection"
102
+ * Allow tokizing empty lines (Daniel Krech)
103
+ * Make PageUp/Down behavior more consistent with native OS (Joe Cheng)
104
+
105
+ 2011.02.04, Version 0.1.4
106
+
107
+ * Add C/C++ mode contributed by Gastón Kleiman
108
+ * Fix exception in key input
109
+
110
+ 2011.02.04, Version 0.1.3
111
+
112
+ * Let the packaged version play nice with requireJS
113
+ * Add Ruby mode contributed by Shlomo Zalman Heigh
114
+ * Add Java mode contributed by Tom Tasche
115
+ * Fix annotation bug
116
  * Changing a document added a new empty line at the end
ace-0.2.0/LICENSE CHANGED
@@ -1,476 +1,476 @@
1
- Licensed under the tri-license MPL/LGPL/GPL.
2
-
3
- MOZILLA PUBLIC LICENSE
4
- Version 1.1
5
-
6
- ---------------
7
-
8
- 1. Definitions.
9
-
10
- 1.0.1. "Commercial Use" means distribution or otherwise making the
11
- Covered Code available to a third party.
12
-
13
- 1.1. "Contributor" means each entity that creates or contributes to
14
- the creation of Modifications.
15
-
16
- 1.2. "Contributor Version" means the combination of the Original
17
- Code, prior Modifications used by a Contributor, and the Modifications
18
- made by that particular Contributor.
19
-
20
- 1.3. "Covered Code" means the Original Code or Modifications or the
21
- combination of the Original Code and Modifications, in each case
22
- including portions thereof.
23
-
24
- 1.4. "Electronic Distribution Mechanism" means a mechanism generally
25
- accepted in the software development community for the electronic
26
- transfer of data.
27
-
28
- 1.5. "Executable" means Covered Code in any form other than Source
29
- Code.
30
-
31
- 1.6. "Initial Developer" means the individual or entity identified
32
- as the Initial Developer in the Source Code notice required by Exhibit
33
- A.
34
-
35
- 1.7. "Larger Work" means a work which combines Covered Code or
36
- portions thereof with code not governed by the terms of this License.
37
-
38
- 1.8. "License" means this document.
39
-
40
- 1.8.1. "Licensable" means having the right to grant, to the maximum
41
- extent possible, whether at the time of the initial grant or
42
- subsequently acquired, any and all of the rights conveyed herein.
43
-
44
- 1.9. "Modifications" means any addition to or deletion from the
45
- substance or structure of either the Original Code or any previous
46
- Modifications. When Covered Code is released as a series of files, a
47
- Modification is:
48
- A. Any addition to or deletion from the contents of a file
49
- containing Original Code or previous Modifications.
50
-
51
- B. Any new file that contains any part of the Original Code or
52
- previous Modifications.
53
-
54
- 1.10. "Original Code" means Source Code of computer software code
55
- which is described in the Source Code notice required by Exhibit A as
56
- Original Code, and which, at the time of its release under this
57
- License is not already Covered Code governed by this License.
58
-
59
- 1.10.1. "Patent Claims" means any patent claim(s), now owned or
60
- hereafter acquired, including without limitation, method, process,
61
- and apparatus claims, in any patent Licensable by grantor.
62
-
63
- 1.11. "Source Code" means the preferred form of the Covered Code for
64
- making modifications to it, including all modules it contains, plus
65
- any associated interface definition files, scripts used to control
66
- compilation and installation of an Executable, or source code
67
- differential comparisons against either the Original Code or another
68
- well known, available Covered Code of the Contributor's choice. The
69
- Source Code can be in a compressed or archival form, provided the
70
- appropriate decompression or de-archiving software is widely available
71
- for no charge.
72
-
73
- 1.12. "You" (or "Your") means an individual or a legal entity
74
- exercising rights under, and complying with all of the terms of, this
75
- License or a future version of this License issued under Section 6.1.
76
- For legal entities, "You" includes any entity which controls, is
77
- controlled by, or is under common control with You. For purposes of
78
- this definition, "control" means (a) the power, direct or indirect,
79
- to cause the direction or management of such entity, whether by
80
- contract or otherwise, or (b) ownership of more than fifty percent
81
- (50%) of the outstanding shares or beneficial ownership of such
82
- entity.
83
-
84
- 2. Source Code License.
85
-
86
- 2.1. The Initial Developer Grant.
87
- The Initial Developer hereby grants You a world-wide, royalty-free,
88
- non-exclusive license, subject to third party intellectual property
89
- claims:
90
- (a) under intellectual property rights (other than patent or
91
- trademark) Licensable by Initial Developer to use, reproduce,
92
- modify, display, perform, sublicense and distribute the Original
93
- Code (or portions thereof) with or without Modifications, and/or
94
- as part of a Larger Work; and
95
-
96
- (b) under Patents Claims infringed by the making, using or
97
- selling of Original Code, to make, have made, use, practice,
98
- sell, and offer for sale, and/or otherwise dispose of the
99
- Original Code (or portions thereof).
100
-
101
- (c) the licenses granted in this Section 2.1(a) and (b) are
102
- effective on the date Initial Developer first distributes
103
- Original Code under the terms of this License.
104
-
105
- (d) Notwithstanding Section 2.1(b) above, no patent license is
106
- granted: 1) for code that You delete from the Original Code; 2)
107
- separate from the Original Code; or 3) for infringements caused
108
- by: i) the modification of the Original Code or ii) the
109
- combination of the Original Code with other software or devices.
110
-
111
- 2.2. Contributor Grant.
112
- Subject to third party intellectual property claims, each Contributor
113
- hereby grants You a world-wide, royalty-free, non-exclusive license
114
-
115
- (a) under intellectual property rights (other than patent or
116
- trademark) Licensable by Contributor, to use, reproduce, modify,
117
- display, perform, sublicense and distribute the Modifications
118
- created by such Contributor (or portions thereof) either on an
119
- unmodified basis, with other Modifications, as Covered Code
120
- and/or as part of a Larger Work; and
121
-
122
- (b) under Patent Claims infringed by the making, using, or
123
- selling of Modifications made by that Contributor either alone
124
- and/or in combination with its Contributor Version (or portions
125
- of such combination), to make, use, sell, offer for sale, have
126
- made, and/or otherwise dispose of: 1) Modifications made by that
127
- Contributor (or portions thereof); and 2) the combination of
128
- Modifications made by that Contributor with its Contributor
129
- Version (or portions of such combination).
130
-
131
- (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
132
- effective on the date Contributor first makes Commercial Use of
133
- the Covered Code.
134
-
135
- (d) Notwithstanding Section 2.2(b) above, no patent license is
136
- granted: 1) for any code that Contributor has deleted from the
137
- Contributor Version; 2) separate from the Contributor Version;
138
- 3) for infringements caused by: i) third party modifications of
139
- Contributor Version or ii) the combination of Modifications made
140
- by that Contributor with other software (except as part of the
141
- Contributor Version) or other devices; or 4) under Patent Claims
142
- infringed by Covered Code in the absence of Modifications made by
143
- that Contributor.
144
-
145
- 3. Distribution Obligations.
146
-
147
- 3.1. Application of License.
148
- The Modifications which You create or to which You contribute are
149
- governed by the terms of this License, including without limitation
150
- Section 2.2. The Source Code version of Covered Code may be
151
- distributed only under the terms of this License or a future version
152
- of this License released under Section 6.1, and You must include a
153
- copy of this License with every copy of the Source Code You
154
- distribute. You may not offer or impose any terms on any Source Code
155
- version that alters or restricts the applicable version of this
156
- License or the recipients' rights hereunder. However, You may include
157
- an additional document offering the additional rights described in
158
- Section 3.5.
159
-
160
- 3.2. Availability of Source Code.
161
- Any Modification which You create or to which You contribute must be
162
- made available in Source Code form under the terms of this License
163
- either on the same media as an Executable version or via an accepted
164
- Electronic Distribution Mechanism to anyone to whom you made an
165
- Executable version available; and if made available via Electronic
166
- Distribution Mechanism, must remain available for at least twelve (12)
167
- months after the date it initially became available, or at least six
168
- (6) months after a subsequent version of that particular Modification
169
- has been made available to such recipients. You are responsible for
170
- ensuring that the Source Code version remains available even if the
171
- Electronic Distribution Mechanism is maintained by a third party.
172
-
173
- 3.3. Description of Modifications.
174
- You must cause all Covered Code to which You contribute to contain a
175
- file documenting the changes You made to create that Covered Code and
176
- the date of any change. You must include a prominent statement that
177
- the Modification is derived, directly or indirectly, from Original
178
- Code provided by the Initial Developer and including the name of the
179
- Initial Developer in (a) the Source Code, and (b) in any notice in an
180
- Executable version or related documentation in which You describe the
181
- origin or ownership of the Covered Code.
182
-
183
- 3.4. Intellectual Property Matters
184
- (a) Third Party Claims.
185
- If Contributor has knowledge that a license under a third party's
186
- intellectual property rights is required to exercise the rights
187
- granted by such Contributor under Sections 2.1 or 2.2,
188
- Contributor must include a text file with the Source Code
189
- distribution titled "LEGAL" which describes the claim and the
190
- party making the claim in sufficient detail that a recipient will
191
- know whom to contact. If Contributor obtains such knowledge after
192
- the Modification is made available as described in Section 3.2,
193
- Contributor shall promptly modify the LEGAL file in all copies
194
- Contributor makes available thereafter and shall take other steps
195
- (such as notifying appropriate mailing lists or newsgroups)
196
- reasonably calculated to inform those who received the Covered
197
- Code that new knowledge has been obtained.
198
-
199
- (b) Contributor APIs.
200
- If Contributor's Modifications include an application programming
201
- interface and Contributor has knowledge of patent licenses which
202
- are reasonably necessary to implement that API, Contributor must
203
- also include this information in the LEGAL file.
204
-
205
- (c) Representations.
206
- Contributor represents that, except as disclosed pursuant to
207
- Section 3.4(a) above, Contributor believes that Contributor's
208
- Modifications are Contributor's original creation(s) and/or
209
- Contributor has sufficient rights to grant the rights conveyed by
210
- this License.
211
-
212
- 3.5. Required Notices.
213
- You must duplicate the notice in Exhibit A in each file of the Source
214
- Code. If it is not possible to put such notice in a particular Source
215
- Code file due to its structure, then You must include such notice in a
216
- location (such as a relevant directory) where a user would be likely
217
- to look for such a notice. If You created one or more Modification(s)
218
- You may add your name as a Contributor to the notice described in
219
- Exhibit A. You must also duplicate this License in any documentation
220
- for the Source Code where You describe recipients' rights or ownership
221
- rights relating to Covered Code. You may choose to offer, and to
222
- charge a fee for, warranty, support, indemnity or liability
223
- obligations to one or more recipients of Covered Code. However, You
224
- may do so only on Your own behalf, and not on behalf of the Initial
225
- Developer or any Contributor. You must make it absolutely clear than
226
- any such warranty, support, indemnity or liability obligation is
227
- offered by You alone, and You hereby agree to indemnify the Initial
228
- Developer and every Contributor for any liability incurred by the
229
- Initial Developer or such Contributor as a result of warranty,
230
- support, indemnity or liability terms You offer.
231
-
232
- 3.6. Distribution of Executable Versions.
233
- You may distribute Covered Code in Executable form only if the
234
- requirements of Section 3.1-3.5 have been met for that Covered Code,
235
- and if You include a notice stating that the Source Code version of
236
- the Covered Code is available under the terms of this License,
237
- including a description of how and where You have fulfilled the
238
- obligations of Section 3.2. The notice must be conspicuously included
239
- in any notice in an Executable version, related documentation or
240
- collateral in which You describe recipients' rights relating to the
241
- Covered Code. You may distribute the Executable version of Covered
242
- Code or ownership rights under a license of Your choice, which may
243
- contain terms different from this License, provided that You are in
244
- compliance with the terms of this License and that the license for the
245
- Executable version does not attempt to limit or alter the recipient's
246
- rights in the Source Code version from the rights set forth in this
247
- License. If You distribute the Executable version under a different
248
- license You must make it absolutely clear that any terms which differ
249
- from this License are offered by You alone, not by the Initial
250
- Developer or any Contributor. You hereby agree to indemnify the
251
- Initial Developer and every Contributor for any liability incurred by
252
- the Initial Developer or such Contributor as a result of any such
253
- terms You offer.
254
-
255
- 3.7. Larger Works.
256
- You may create a Larger Work by combining Covered Code with other code
257
- not governed by the terms of this License and distribute the Larger
258
- Work as a single product. In such a case, You must make sure the
259
- requirements of this License are fulfilled for the Covered Code.
260
-
261
- 4. Inability to Comply Due to Statute or Regulation.
262
-
263
- If it is impossible for You to comply with any of the terms of this
264
- License with respect to some or all of the Covered Code due to
265
- statute, judicial order, or regulation then You must: (a) comply with
266
- the terms of this License to the maximum extent possible; and (b)
267
- describe the limitations and the code they affect. Such description
268
- must be included in the LEGAL file described in Section 3.4 and must
269
- be included with all distributions of the Source Code. Except to the
270
- extent prohibited by statute or regulation, such description must be
271
- sufficiently detailed for a recipient of ordinary skill to be able to
272
- understand it.
273
-
274
- 5. Application of this License.
275
-
276
- This License applies to code to which the Initial Developer has
277
- attached the notice in Exhibit A and to related Covered Code.
278
-
279
- 6. Versions of the License.
280
-
281
- 6.1. New Versions.
282
- Netscape Communications Corporation ("Netscape") may publish revised
283
- and/or new versions of the License from time to time. Each version
284
- will be given a distinguishing version number.
285
-
286
- 6.2. Effect of New Versions.
287
- Once Covered Code has been published under a particular version of the
288
- License, You may always continue to use it under the terms of that
289
- version. You may also choose to use such Covered Code under the terms
290
- of any subsequent version of the License published by Netscape. No one
291
- other than Netscape has the right to modify the terms applicable to
292
- Covered Code created under this License.
293
-
294
- 6.3. Derivative Works.
295
- If You create or use a modified version of this License (which you may
296
- only do in order to apply it to code which is not already Covered Code
297
- governed by this License), You must (a) rename Your license so that
298
- the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
299
- "MPL", "NPL" or any confusingly similar phrase do not appear in your
300
- license (except to note that your license differs from this License)
301
- and (b) otherwise make it clear that Your version of the license
302
- contains terms which differ from the Mozilla Public License and
303
- Netscape Public License. (Filling in the name of the Initial
304
- Developer, Original Code or Contributor in the notice described in
305
- Exhibit A shall not of themselves be deemed to be modifications of
306
- this License.)
307
-
308
- 7. DISCLAIMER OF WARRANTY.
309
-
310
- COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
311
- WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
312
- WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
313
- DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
314
- THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
315
- IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
316
- YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
317
- COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
318
- OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
319
- ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
320
-
321
- 8. TERMINATION.
322
-
323
- 8.1. This License and the rights granted hereunder will terminate
324
- automatically if You fail to comply with terms herein and fail to cure
325
- such breach within 30 days of becoming aware of the breach. All
326
- sublicenses to the Covered Code which are properly granted shall
327
- survive any termination of this License. Provisions which, by their
328
- nature, must remain in effect beyond the termination of this License
329
- shall survive.
330
-
331
- 8.2. If You initiate litigation by asserting a patent infringement
332
- claim (excluding declatory judgment actions) against Initial Developer
333
- or a Contributor (the Initial Developer or Contributor against whom
334
- You file such action is referred to as "Participant") alleging that:
335
-
336
- (a) such Participant's Contributor Version directly or indirectly
337
- infringes any patent, then any and all rights granted by such
338
- Participant to You under Sections 2.1 and/or 2.2 of this License
339
- shall, upon 60 days notice from Participant terminate prospectively,
340
- unless if within 60 days after receipt of notice You either: (i)
341
- agree in writing to pay Participant a mutually agreeable reasonable
342
- royalty for Your past and future use of Modifications made by such
343
- Participant, or (ii) withdraw Your litigation claim with respect to
344
- the Contributor Version against such Participant. If within 60 days
345
- of notice, a reasonable royalty and payment arrangement are not
346
- mutually agreed upon in writing by the parties or the litigation claim
347
- is not withdrawn, the rights granted by Participant to You under
348
- Sections 2.1 and/or 2.2 automatically terminate at the expiration of
349
- the 60 day notice period specified above.
350
-
351
- (b) any software, hardware, or device, other than such Participant's
352
- Contributor Version, directly or indirectly infringes any patent, then
353
- any rights granted to You by such Participant under Sections 2.1(b)
354
- and 2.2(b) are revoked effective as of the date You first made, used,
355
- sold, distributed, or had made, Modifications made by that
356
- Participant.
357
-
358
- 8.3. If You assert a patent infringement claim against Participant
359
- alleging that such Participant's Contributor Version directly or
360
- indirectly infringes any patent where such claim is resolved (such as
361
- by license or settlement) prior to the initiation of patent
362
- infringement litigation, then the reasonable value of the licenses
363
- granted by such Participant under Sections 2.1 or 2.2 shall be taken
364
- into account in determining the amount or value of any payment or
365
- license.
366
-
367
- 8.4. In the event of termination under Sections 8.1 or 8.2 above,
368
- all end user license agreements (excluding distributors and resellers)
369
- which have been validly granted by You or any distributor hereunder
370
- prior to termination shall survive termination.
371
-
372
- 9. LIMITATION OF LIABILITY.
373
-
374
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
375
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
376
- DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
377
- OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
378
- ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
379
- CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
380
- WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
381
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
382
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
383
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
384
- RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
385
- PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
386
- EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
387
- THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
388
-
389
- 10. U.S. GOVERNMENT END USERS.
390
-
391
- The Covered Code is a "commercial item," as that term is defined in
392
- 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
393
- software" and "commercial computer software documentation," as such
394
- terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
395
- C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
396
- all U.S. Government End Users acquire Covered Code with only those
397
- rights set forth herein.
398
-
399
- 11. MISCELLANEOUS.
400
-
401
- This License represents the complete agreement concerning subject
402
- matter hereof. If any provision of this License is held to be
403
- unenforceable, such provision shall be reformed only to the extent
404
- necessary to make it enforceable. This License shall be governed by
405
- California law provisions (except to the extent applicable law, if
406
- any, provides otherwise), excluding its conflict-of-law provisions.
407
- With respect to disputes in which at least one party is a citizen of,
408
- or an entity chartered or registered to do business in the United
409
- States of America, any litigation relating to this License shall be
410
- subject to the jurisdiction of the Federal Courts of the Northern
411
- District of California, with venue lying in Santa Clara County,
412
- California, with the losing party responsible for costs, including
413
- without limitation, court costs and reasonable attorneys' fees and
414
- expenses. The application of the United Nations Convention on
415
- Contracts for the International Sale of Goods is expressly excluded.
416
- Any law or regulation which provides that the language of a contract
417
- shall be construed against the drafter shall not apply to this
418
- License.
419
-
420
- 12. RESPONSIBILITY FOR CLAIMS.
421
-
422
- As between Initial Developer and the Contributors, each party is
423
- responsible for claims and damages arising, directly or indirectly,
424
- out of its utilization of rights under this License and You agree to
425
- work with Initial Developer and Contributors to distribute such
426
- responsibility on an equitable basis. Nothing herein is intended or
427
- shall be deemed to constitute any admission of liability.
428
-
429
- 13. MULTIPLE-LICENSED CODE.
430
-
431
- Initial Developer may designate portions of the Covered Code as
432
- "Multiple-Licensed". "Multiple-Licensed" means that the Initial
433
- Developer permits you to utilize portions of the Covered Code under
434
- Your choice of the NPL or the alternative licenses, if any, specified
435
- by the Initial Developer in the file described in Exhibit A.
436
-
437
- EXHIBIT A -Mozilla Public License.
438
-
439
- ``The contents of this file are subject to the Mozilla Public License
440
- Version 1.1 (the "License"); you may not use this file except in
441
- compliance with the License. You may obtain a copy of the License at
442
- http://www.mozilla.org/MPL/
443
-
444
- Software distributed under the License is distributed on an "AS IS"
445
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
446
- License for the specific language governing rights and limitations
447
- under the License.
448
-
449
- The Original Code is ______________________________________.
450
-
451
- The Initial Developer of the Original Code is ________________________.
452
- Portions created by ______________________ are Copyright (C) ______
453
- _______________________. All Rights Reserved.
454
-
455
- Contributor(s): ______________________________________.
456
-
457
- Alternatively, the contents of this file may be used under the terms
458
- of the _____ license (the "[___] License"), in which case the
459
- provisions of [______] License are applicable instead of those
460
- above. If you wish to allow use of your version of this file only
461
- under the terms of the [____] License and not to allow others to use
462
- your version of this file under the MPL, indicate your decision by
463
- deleting the provisions above and replace them with the notice and
464
- other provisions required by the [___] License. If you do not delete
465
- the provisions above, a recipient may use your version of this file
466
- under either the MPL or the [___] License."
467
-
468
- [NOTE: The text of this Exhibit A may differ slightly from the text of
469
- the notices in the Source Code files of the Original Code. You should
470
- use the text of this Exhibit A rather than the text found in the
471
- Original Code Source Code for Your Modifications.]
472
-
473
-
474
-
475
- GNU LESSER GENERAL PUBLIC LICENSE
476
  Version 3, 29 June 2007
1
+ Licensed under the tri-license MPL/LGPL/GPL.
2
+
3
+ MOZILLA PUBLIC LICENSE
4
+ Version 1.1
5
+
6
+ ---------------
7
+
8
+ 1. Definitions.
9
+
10
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
11
+ Covered Code available to a third party.
12
+
13
+ 1.1. "Contributor" means each entity that creates or contributes to
14
+ the creation of Modifications.
15
+
16
+ 1.2. "Contributor Version" means the combination of the Original
17
+ Code, prior Modifications used by a Contributor, and the Modifications
18
+ made by that particular Contributor.
19
+
20
+ 1.3. "Covered Code" means the Original Code or Modifications or the
21
+ combination of the Original Code and Modifications, in each case
22
+ including portions thereof.
23
+
24
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
25
+ accepted in the software development community for the electronic
26
+ transfer of data.
27
+
28
+ 1.5. "Executable" means Covered Code in any form other than Source
29
+ Code.
30
+
31
+ 1.6. "Initial Developer" means the individual or entity identified
32
+ as the Initial Developer in the Source Code notice required by Exhibit
33
+ A.
34
+
35
+ 1.7. "Larger Work" means a work which combines Covered Code or
36
+ portions thereof with code not governed by the terms of this License.
37
+
38
+ 1.8. "License" means this document.
39
+
40
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
41
+ extent possible, whether at the time of the initial grant or
42
+ subsequently acquired, any and all of the rights conveyed herein.
43
+
44
+ 1.9. "Modifications" means any addition to or deletion from the
45
+ substance or structure of either the Original Code or any previous
46
+ Modifications. When Covered Code is released as a series of files, a
47
+ Modification is:
48
+ A. Any addition to or deletion from the contents of a file
49
+ containing Original Code or previous Modifications.
50
+
51
+ B. Any new file that contains any part of the Original Code or
52
+ previous Modifications.
53
+
54
+ 1.10. "Original Code" means Source Code of computer software code
55
+ which is described in the Source Code notice required by Exhibit A as
56
+ Original Code, and which, at the time of its release under this
57
+ License is not already Covered Code governed by this License.
58
+
59
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
60
+ hereafter acquired, including without limitation, method, process,
61
+ and apparatus claims, in any patent Licensable by grantor.
62
+
63
+ 1.11. "Source Code" means the preferred form of the Covered Code for
64
+ making modifications to it, including all modules it contains, plus
65
+ any associated interface definition files, scripts used to control
66
+ compilation and installation of an Executable, or source code
67
+ differential comparisons against either the Original Code or another
68
+ well known, available Covered Code of the Contributor's choice. The
69
+ Source Code can be in a compressed or archival form, provided the
70
+ appropriate decompression or de-archiving software is widely available
71
+ for no charge.
72
+
73
+ 1.12. "You" (or "Your") means an individual or a legal entity
74
+ exercising rights under, and complying with all of the terms of, this
75
+ License or a future version of this License issued under Section 6.1.
76
+ For legal entities, "You" includes any entity which controls, is
77
+ controlled by, or is under common control with You. For purposes of
78
+ this definition, "control" means (a) the power, direct or indirect,
79
+ to cause the direction or management of such entity, whether by
80
+ contract or otherwise, or (b) ownership of more than fifty percent
81
+ (50%) of the outstanding shares or beneficial ownership of such
82
+ entity.
83
+
84
+ 2. Source Code License.
85
+
86
+ 2.1. The Initial Developer Grant.
87
+ The Initial Developer hereby grants You a world-wide, royalty-free,
88
+ non-exclusive license, subject to third party intellectual property
89
+ claims:
90
+ (a) under intellectual property rights (other than patent or
91
+ trademark) Licensable by Initial Developer to use, reproduce,
92
+ modify, display, perform, sublicense and distribute the Original
93
+ Code (or portions thereof) with or without Modifications, and/or
94
+ as part of a Larger Work; and
95
+
96
+ (b) under Patents Claims infringed by the making, using or
97
+ selling of Original Code, to make, have made, use, practice,
98
+ sell, and offer for sale, and/or otherwise dispose of the
99
+ Original Code (or portions thereof).
100
+
101
+ (c) the licenses granted in this Section 2.1(a) and (b) are
102
+ effective on the date Initial Developer first distributes
103
+ Original Code under the terms of this License.
104
+
105
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
106
+ granted: 1) for code that You delete from the Original Code; 2)
107
+ separate from the Original Code; or 3) for infringements caused
108
+ by: i) the modification of the Original Code or ii) the
109
+ combination of the Original Code with other software or devices.
110
+
111
+ 2.2. Contributor Grant.
112
+ Subject to third party intellectual property claims, each Contributor
113
+ hereby grants You a world-wide, royalty-free, non-exclusive license
114
+
115
+ (a) under intellectual property rights (other than patent or
116
+ trademark) Licensable by Contributor, to use, reproduce, modify,
117
+ display, perform, sublicense and distribute the Modifications
118
+ created by such Contributor (or portions thereof) either on an
119
+ unmodified basis, with other Modifications, as Covered Code
120
+ and/or as part of a Larger Work; and
121
+
122
+ (b) under Patent Claims infringed by the making, using, or
123
+ selling of Modifications made by that Contributor either alone
124
+ and/or in combination with its Contributor Version (or portions
125
+ of such combination), to make, use, sell, offer for sale, have
126
+ made, and/or otherwise dispose of: 1) Modifications made by that
127
+ Contributor (or portions thereof); and 2) the combination of
128
+ Modifications made by that Contributor with its Contributor
129
+ Version (or portions of such combination).
130
+
131
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
132
+ effective on the date Contributor first makes Commercial Use of
133
+ the Covered Code.
134
+
135
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
136
+ granted: 1) for any code that Contributor has deleted from the
137
+ Contributor Version; 2) separate from the Contributor Version;
138
+ 3) for infringements caused by: i) third party modifications of
139
+ Contributor Version or ii) the combination of Modifications made
140
+ by that Contributor with other software (except as part of the
141
+ Contributor Version) or other devices; or 4) under Patent Claims
142
+ infringed by Covered Code in the absence of Modifications made by
143
+ that Contributor.
144
+
145
+ 3. Distribution Obligations.
146
+
147
+ 3.1. Application of License.
148
+ The Modifications which You create or to which You contribute are
149
+ governed by the terms of this License, including without limitation
150
+ Section 2.2. The Source Code version of Covered Code may be
151
+ distributed only under the terms of this License or a future version
152
+ of this License released under Section 6.1, and You must include a
153
+ copy of this License with every copy of the Source Code You
154
+ distribute. You may not offer or impose any terms on any Source Code
155
+ version that alters or restricts the applicable version of this
156
+ License or the recipients' rights hereunder. However, You may include
157
+ an additional document offering the additional rights described in
158
+ Section 3.5.
159
+
160
+ 3.2. Availability of Source Code.
161
+ Any Modification which You create or to which You contribute must be
162
+ made available in Source Code form under the terms of this License
163
+ either on the same media as an Executable version or via an accepted
164
+ Electronic Distribution Mechanism to anyone to whom you made an
165
+ Executable version available; and if made available via Electronic
166
+ Distribution Mechanism, must remain available for at least twelve (12)
167
+ months after the date it initially became available, or at least six
168
+ (6) months after a subsequent version of that particular Modification
169
+ has been made available to such recipients. You are responsible for
170
+ ensuring that the Source Code version remains available even if the
171
+ Electronic Distribution Mechanism is maintained by a third party.
172
+
173
+ 3.3. Description of Modifications.
174
+ You must cause all Covered Code to which You contribute to contain a
175
+ file documenting the changes You made to create that Covered Code and
176
+ the date of any change. You must include a prominent statement that
177
+ the Modification is derived, directly or indirectly, from Original
178
+ Code provided by the Initial Developer and including the name of the
179
+ Initial Developer in (a) the Source Code, and (b) in any notice in an
180
+ Executable version or related documentation in which You describe the
181
+ origin or ownership of the Covered Code.
182
+
183
+ 3.4. Intellectual Property Matters
184
+ (a) Third Party Claims.
185
+ If Contributor has knowledge that a license under a third party's
186
+ intellectual property rights is required to exercise the rights
187
+ granted by such Contributor under Sections 2.1 or 2.2,
188
+ Contributor must include a text file with the Source Code
189
+ distribution titled "LEGAL" which describes the claim and the
190
+ party making the claim in sufficient detail that a recipient will
191
+ know whom to contact. If Contributor obtains such knowledge after
192
+ the Modification is made available as described in Section 3.2,
193
+ Contributor shall promptly modify the LEGAL file in all copies
194
+ Contributor makes available thereafter and shall take other steps
195
+ (such as notifying appropriate mailing lists or newsgroups)
196
+ reasonably calculated to inform those who received the Covered
197
+ Code that new knowledge has been obtained.
198
+
199
+ (b) Contributor APIs.
200
+ If Contributor's Modifications include an application programming
201
+ interface and Contributor has knowledge of patent licenses which
202
+ are reasonably necessary to implement that API, Contributor must
203
+ also include this information in the LEGAL file.
204
+
205
+ (c) Representations.
206
+ Contributor represents that, except as disclosed pursuant to
207
+ Section 3.4(a) above, Contributor believes that Contributor's
208
+ Modifications are Contributor's original creation(s) and/or
209
+ Contributor has sufficient rights to grant the rights conveyed by
210
+ this License.
211
+
212
+ 3.5. Required Notices.
213
+ You must duplicate the notice in Exhibit A in each file of the Source
214
+ Code. If it is not possible to put such notice in a particular Source
215
+ Code file due to its structure, then You must include such notice in a
216
+ location (such as a relevant directory) where a user would be likely
217
+ to look for such a notice. If You created one or more Modification(s)
218
+ You may add your name as a Contributor to the notice described in
219
+ Exhibit A. You must also duplicate this License in any documentation
220
+ for the Source Code where You describe recipients' rights or ownership
221
+ rights relating to Covered Code. You may choose to offer, and to
222
+ charge a fee for, warranty, support, indemnity or liability
223
+ obligations to one or more recipients of Covered Code. However, You
224
+ may do so only on Your own behalf, and not on behalf of the Initial
225
+ Developer or any Contributor. You must make it absolutely clear than
226
+ any such warranty, support, indemnity or liability obligation is
227
+ offered by You alone, and You hereby agree to indemnify the Initial
228
+ Developer and every Contributor for any liability incurred by the
229
+ Initial Developer or such Contributor as a result of warranty,
230
+ support, indemnity or liability terms You offer.
231
+
232
+ 3.6. Distribution of Executable Versions.
233
+ You may distribute Covered Code in Executable form only if the
234
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
235
+ and if You include a notice stating that the Source Code version of
236
+ the Covered Code is available under the terms of this License,
237
+ including a description of how and where You have fulfilled the
238
+ obligations of Section 3.2. The notice must be conspicuously included
239
+ in any notice in an Executable version, related documentation or
240
+ collateral in which You describe recipients' rights relating to the
241
+ Covered Code. You may distribute the Executable version of Covered
242
+ Code or ownership rights under a license of Your choice, which may
243
+ contain terms different from this License, provided that You are in
244
+ compliance with the terms of this License and that the license for the
245
+ Executable version does not attempt to limit or alter the recipient's
246
+ rights in the Source Code version from the rights set forth in this
247
+ License. If You distribute the Executable version under a different
248
+ license You must make it absolutely clear that any terms which differ
249
+ from this License are offered by You alone, not by the Initial
250
+ Developer or any Contributor. You hereby agree to indemnify the
251
+ Initial Developer and every Contributor for any liability incurred by
252
+ the Initial Developer or such Contributor as a result of any such
253
+ terms You offer.
254
+
255
+ 3.7. Larger Works.
256
+ You may create a Larger Work by combining Covered Code with other code
257
+ not governed by the terms of this License and distribute the Larger
258
+ Work as a single product. In such a case, You must make sure the
259
+ requirements of this License are fulfilled for the Covered Code.
260
+
261
+ 4. Inability to Comply Due to Statute or Regulation.
262
+
263
+ If it is impossible for You to comply with any of the terms of this
264
+ License with respect to some or all of the Covered Code due to
265
+ statute, judicial order, or regulation then You must: (a) comply with
266
+ the terms of this License to the maximum extent possible; and (b)
267
+ describe the limitations and the code they affect. Such description
268
+ must be included in the LEGAL file described in Section 3.4 and must
269
+ be included with all distributions of the Source Code. Except to the
270
+ extent prohibited by statute or regulation, such description must be
271
+ sufficiently detailed for a recipient of ordinary skill to be able to
272
+ understand it.
273
+
274
+ 5. Application of this License.
275
+
276
+ This License applies to code to which the Initial Developer has
277
+ attached the notice in Exhibit A and to related Covered Code.
278
+
279
+ 6. Versions of the License.
280
+
281
+ 6.1. New Versions.
282
+ Netscape Communications Corporation ("Netscape") may publish revised
283
+ and/or new versions of the License from time to time. Each version
284
+ will be given a distinguishing version number.
285
+
286
+ 6.2. Effect of New Versions.
287
+ Once Covered Code has been published under a particular version of the
288
+ License, You may always continue to use it under the terms of that
289
+ version. You may also choose to use such Covered Code under the terms
290
+ of any subsequent version of the License published by Netscape. No one
291
+ other than Netscape has the right to modify the terms applicable to
292
+ Covered Code created under this License.
293
+
294
+ 6.3. Derivative Works.
295
+ If You create or use a modified version of this License (which you may
296
+ only do in order to apply it to code which is not already Covered Code
297
+ governed by this License), You must (a) rename Your license so that
298
+ the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
299
+ "MPL", "NPL" or any confusingly similar phrase do not appear in your
300
+ license (except to note that your license differs from this License)
301
+ and (b) otherwise make it clear that Your version of the license
302
+ contains terms which differ from the Mozilla Public License and
303
+ Netscape Public License. (Filling in the name of the Initial
304
+ Developer, Original Code or Contributor in the notice described in
305
+ Exhibit A shall not of themselves be deemed to be modifications of
306
+ this License.)
307
+
308
+ 7. DISCLAIMER OF WARRANTY.
309
+
310
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
311
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
312
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
313
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
314
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
315
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
316
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
317
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
318
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
319
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
320
+
321
+ 8. TERMINATION.
322
+
323
+ 8.1. This License and the rights granted hereunder will terminate
324
+ automatically if You fail to comply with terms herein and fail to cure
325
+ such breach within 30 days of becoming aware of the breach. All
326
+ sublicenses to the Covered Code which are properly granted shall
327
+ survive any termination of this License. Provisions which, by their
328
+ nature, must remain in effect beyond the termination of this License
329
+ shall survive.
330
+
331
+ 8.2. If You initiate litigation by asserting a patent infringement
332
+ claim (excluding declatory judgment actions) against Initial Developer
333
+ or a Contributor (the Initial Developer or Contributor against whom
334
+ You file such action is referred to as "Participant") alleging that:
335
+
336
+ (a) such Participant's Contributor Version directly or indirectly
337
+ infringes any patent, then any and all rights granted by such
338
+ Participant to You under Sections 2.1 and/or 2.2 of this License
339
+ shall, upon 60 days notice from Participant terminate prospectively,
340
+ unless if within 60 days after receipt of notice You either: (i)
341
+ agree in writing to pay Participant a mutually agreeable reasonable
342
+ royalty for Your past and future use of Modifications made by such
343
+ Participant, or (ii) withdraw Your litigation claim with respect to
344
+ the Contributor Version against such Participant. If within 60 days
345
+ of notice, a reasonable royalty and payment arrangement are not
346
+ mutually agreed upon in writing by the parties or the litigation claim
347
+ is not withdrawn, the rights granted by Participant to You under
348
+ Sections 2.1 and/or 2.2 automatically terminate at the expiration of
349
+ the 60 day notice period specified above.
350
+
351
+ (b) any software, hardware, or device, other than such Participant's
352
+ Contributor Version, directly or indirectly infringes any patent, then
353
+ any rights granted to You by such Participant under Sections 2.1(b)
354
+ and 2.2(b) are revoked effective as of the date You first made, used,
355
+ sold, distributed, or had made, Modifications made by that
356
+ Participant.
357
+
358
+ 8.3. If You assert a patent infringement claim against Participant
359
+ alleging that such Participant's Contributor Version directly or
360
+ indirectly infringes any patent where such claim is resolved (such as
361
+ by license or settlement) prior to the initiation of patent
362
+ infringement litigation, then the reasonable value of the licenses
363
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
364
+ into account in determining the amount or value of any payment or
365
+ license.
366
+
367
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above,
368
+ all end user license agreements (excluding distributors and resellers)
369
+ which have been validly granted by You or any distributor hereunder
370
+ prior to termination shall survive termination.
371
+
372
+ 9. LIMITATION OF LIABILITY.
373
+
374
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
375
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
376
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
377
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
378
+ ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
379
+ CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
380
+ WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
381
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
382
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
383
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
384
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
385
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
386
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
387
+ THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
388
+
389
+ 10. U.S. GOVERNMENT END USERS.
390
+
391
+ The Covered Code is a "commercial item," as that term is defined in
392
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
393
+ software" and "commercial computer software documentation," as such
394
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
395
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
396
+ all U.S. Government End Users acquire Covered Code with only those
397
+ rights set forth herein.
398
+
399
+ 11. MISCELLANEOUS.
400
+
401
+ This License represents the complete agreement concerning subject
402
+ matter hereof. If any provision of this License is held to be
403
+ unenforceable, such provision shall be reformed only to the extent
404
+ necessary to make it enforceable. This License shall be governed by
405
+ California law provisions (except to the extent applicable law, if
406
+ any, provides otherwise), excluding its conflict-of-law provisions.
407
+ With respect to disputes in which at least one party is a citizen of,
408
+ or an entity chartered or registered to do business in the United
409
+ States of America, any litigation relating to this License shall be
410
+ subject to the jurisdiction of the Federal Courts of the Northern
411
+ District of California, with venue lying in Santa Clara County,
412
+ California, with the losing party responsible for costs, including
413
+ without limitation, court costs and reasonable attorneys' fees and
414
+ expenses. The application of the United Nations Convention on
415
+ Contracts for the International Sale of Goods is expressly excluded.
416
+ Any law or regulation which provides that the language of a contract
417
+ shall be construed against the drafter shall not apply to this
418
+ License.
419
+
420
+ 12. RESPONSIBILITY FOR CLAIMS.
421
+
422
+ As between Initial Developer and the Contributors, each party is
423
+ responsible for claims and damages arising, directly or indirectly,
424
+ out of its utilization of rights under this License and You agree to
425
+ work with Initial Developer and Contributors to distribute such
426
+ responsibility on an equitable basis. Nothing herein is intended or
427
+ shall be deemed to constitute any admission of liability.
428
+
429
+ 13. MULTIPLE-LICENSED CODE.
430
+
431
+ Initial Developer may designate portions of the Covered Code as
432
+ "Multiple-Licensed". "Multiple-Licensed" means that the Initial
433
+ Developer permits you to utilize portions of the Covered Code under
434
+ Your choice of the NPL or the alternative licenses, if any, specified
435
+ by the Initial Developer in the file described in Exhibit A.
436
+
437
+ EXHIBIT A -Mozilla Public License.
438
+
439
+ ``The contents of this file are subject to the Mozilla Public License
440
+ Version 1.1 (the "License"); you may not use this file except in
441
+ compliance with the License. You may obtain a copy of the License at
442
+ http://www.mozilla.org/MPL/
443
+
444
+ Software distributed under the License is distributed on an "AS IS"
445
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
446
+ License for the specific language governing rights and limitations
447
+ under the License.
448
+
449
+ The Original Code is ______________________________________.
450
+
451
+ The Initial Developer of the Original Code is ________________________.
452
+ Portions created by ______________________ are Copyright (C) ______
453
+ _______________________. All Rights Reserved.
454
+
455
+ Contributor(s): ______________________________________.
456
+
457
+ Alternatively, the contents of this file may be used under the terms
458
+ of the _____ license (the "[___] License"), in which case the
459
+ provisions of [______] License are applicable instead of those
460
+ above. If you wish to allow use of your version of this file only
461
+ under the terms of the [____] License and not to allow others to use
462
+ your version of this file under the MPL, indicate your decision by
463
+ deleting the provisions above and replace them with the notice and
464
+ other provisions required by the [___] License. If you do not delete
465
+ the provisions above, a recipient may use your version of this file
466
+ under either the MPL or the [___] License."
467
+
468
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
469
+ the notices in the Source Code files of the Original Code. You should
470
+ use the text of this Exhibit A rather than the text found in the
471
+ Original Code Source Code for Your Modifications.]
472
+
473
+
474
+
475
+ GNU LESSER GENERAL PUBLIC LICENSE
476
  Version 3, 29 June 2007
ace-0.2.0/Readme.md CHANGED
@@ -31,16 +31,18 @@ If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookma
31
  History
32
  -------
33
 
34
- Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects both aiming to build a no compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
35
 
36
  Getting the code
37
  ----------------
38
 
39
  Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
40
 
 
41
  git clone git://github.com/ajaxorg/ace.git
42
  cd ace
43
  git submodule update --init --recursive
 
44
 
45
  Embedding Ace
46
  -------------
@@ -49,6 +51,7 @@ Ace can be easily embedded into any existing web page. The Ace git repository sh
49
 
50
  The easiest version is simply:
51
 
 
52
  <div id="editor">some text</div>
53
  <script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
54
  <script>
@@ -56,32 +59,42 @@ The easiest version is simply:
56
  var editor = ace.edit("editor");
57
  };
58
  </script>
 
59
 
60
  With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g.
61
 
 
62
  #editor {
63
  position: absolute;
64
  width: 500px;
65
  height: 400px;
66
  }
67
-
68
 
69
  To change the theme simply include the Theme's JavaScript file
70
 
 
71
  <script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
 
72
 
73
  and configure the editor to use the theme:
74
 
 
75
  editor.setTheme("ace/theme/twilight");
 
76
 
77
  By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:
78
 
 
79
  <script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
 
80
 
81
  Then the mode can be used like this:
82
 
 
83
  var JavaScriptMode = require("ace/mode/javascript").Mode;
84
  editor.getSession().setMode(new JavaScriptMode());
 
85
 
86
  Documentation
87
  -------------
@@ -97,11 +110,16 @@ Running Ace
97
 
98
  After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
99
 
 
100
  ./static.py
 
101
 
102
  Or using Node.JS
103
 
 
 
104
  ./static.js
 
105
 
106
  The editor can then be opened at http://localhost:8888/index.html.
107
 
@@ -110,28 +128,44 @@ Package Ace
110
 
111
  To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
112
 
 
113
  git submodule update --init --recursive
 
 
 
 
 
 
 
114
 
115
  Afterwards Ace can be built by calling
116
 
 
117
  ./Makefile.dryice.js normal
 
118
 
119
  The packaged Ace will be put in the 'build' folder.
120
 
121
  To build the bookmarklet version execute
122
 
 
123
  ./Makefile.dryice.js bm
 
124
 
125
  Running the Unit Tests
126
  ----------------------
127
 
128
  The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
129
 
 
130
  npm link .
 
131
 
132
  To run the tests call:
133
 
 
134
  node lib/ace/test/all.js
 
135
 
136
  You can also run the tests in your browser by serving:
137
 
@@ -139,12 +173,16 @@ You can also run the tests in your browser by serving:
139
 
140
  This makes debugging failing tests way more easier.
141
 
142
- _Note_: Currently (2011-05-21) the tests seem to run on Chrome only.
 
 
 
 
143
 
144
  Contributing
145
  ------------
146
 
147
- Ace wouldn't be where it is now without contributions. Feel free to fork and improve/enhance Ace in any way your want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
148
 
149
  1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
150
  2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
31
  History
32
  -------
33
 
34
+ Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
35
 
36
  Getting the code
37
  ----------------
38
 
39
  Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
40
 
41
+ ```bash
42
  git clone git://github.com/ajaxorg/ace.git
43
  cd ace
44
  git submodule update --init --recursive
45
+ ```
46
 
47
  Embedding Ace
48
  -------------
51
 
52
  The easiest version is simply:
53
 
54
+ ```html
55
  <div id="editor">some text</div>
56
  <script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
57
  <script>
59
  var editor = ace.edit("editor");
60
  };
61
  </script>
62
+ ```
63
 
64
  With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g.
65
 
66
+ ```css
67
  #editor {
68
  position: absolute;
69
  width: 500px;
70
  height: 400px;
71
  }
72
+ ```
73
 
74
  To change the theme simply include the Theme's JavaScript file
75
 
76
+ ```html
77
  <script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
78
+ ```
79
 
80
  and configure the editor to use the theme:
81
 
82
+ ```javascript
83
  editor.setTheme("ace/theme/twilight");
84
+ ```
85
 
86
  By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:
87
 
88
+ ```html
89
  <script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
90
+ ```
91
 
92
  Then the mode can be used like this:
93
 
94
+ ```javascript
95
  var JavaScriptMode = require("ace/mode/javascript").Mode;
96
  editor.getSession().setMode(new JavaScriptMode());
97
+ ```
98
 
99
  Documentation
100
  -------------
110
 
111
  After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
112
 
113
+ ```bash
114
  ./static.py
115
+ ```
116
 
117
  Or using Node.JS
118
 
119
+ ```bash
120
+ npm install mime
121
  ./static.js
122
+ ```
123
 
124
  The editor can then be opened at http://localhost:8888/index.html.
125
 
128
 
129
  To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
130
 
131
+ ```bash
132
  git submodule update --init --recursive
133
+ ```
134
+
135
+ Make sure you at least version 0.3.0 of dryice
136
+
137
+ ```bash
138
+ npm install dryice
139
+ ```
140
 
141
  Afterwards Ace can be built by calling
142
 
143
+ ```bash
144
  ./Makefile.dryice.js normal
145
+ ```
146
 
147
  The packaged Ace will be put in the 'build' folder.
148
 
149
  To build the bookmarklet version execute
150
 
151
+ ```bash
152
  ./Makefile.dryice.js bm
153
+ ```
154
 
155
  Running the Unit Tests
156
  ----------------------
157
 
158
  The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
159
 
160
+ ```bash
161
  npm link .
162
+ ```
163
 
164
  To run the tests call:
165
 
166
+ ```bash
167
  node lib/ace/test/all.js
168
+ ```
169
 
170
  You can also run the tests in your browser by serving:
171
 
173
 
174
  This makes debugging failing tests way more easier.
175
 
176
+ Continuous Integration status
177
+ -----------------------------
178
+
179
+ This project is tested with [Travis CI](http://travis-ci.org)
180
+ [![Build Status](https://secure.travis-ci.org/ajaxorg/ace.png)](http://travis-ci.org/ajaxorg/ace)
181
 
182
  Contributing
183
  ------------
184
 
185
+ Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
186
 
187
  1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
188
  2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
ace-0.2.0/demo/kitchen-sink-uncompressed.js DELETED
@@ -1,28757 +0,0 @@
1
- /* ***** BEGIN LICENSE BLOCK *****
2
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
- *
4
- * The contents of this file are subject to the Mozilla Public License Version
5
- * 1.1 (the "License"); you may not use this file except in compliance with
6
- * the License. You may obtain a copy of the License at
7
- * http://www.mozilla.org/MPL/
8
- *
9
- * Software distributed under the License is distributed on an "AS IS" basis,
10
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
- * for the specific language governing rights and limitations under the
12
- * License.
13
- *
14
- * The Original Code is Ajax.org Code Editor (ACE).
15
- *
16
- * The Initial Developer of the Original Code is
17
- * Ajax.org B.V.
18
- * Portions created by the Initial Developer are Copyright (C) 2010
19
- * the Initial Developer. All Rights Reserved.
20
- *
21
- * Contributor(s):
22
- * Fabian Jakobs <fabian AT ajax DOT org>
23
- *
24
- * Alternatively, the contents of this file may be used under the terms of
25
- * either the GNU General Public License Version 2 or later (the "GPL"), or
26
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
- * in which case the provisions of the GPL or the LGPL are applicable instead
28
- * of those above. If you wish to allow use of your version of this file only
29
- * under the terms of either the GPL or the LGPL, and not to allow others to
30
- * use your version of this file under the terms of the MPL, indicate your
31
- * decision by deleting the provisions above and replace them with the notice
32
- * and other provisions required by the GPL or the LGPL. If you do not delete
33
- * the provisions above, a recipient may use your version of this file under
34
- * the terms of any one of the MPL, the GPL or the LGPL.
35
- *
36
- * ***** END LICENSE BLOCK ***** */
37
-
38
- /**
39
- * Define a module along with a payload
40
- * @param module a name for the payload
41
- * @param payload a function to call with (require, exports, module) params
42
- */
43
-
44
- (function() {
45
-
46
- var global = (function() {
47
- return this;
48
- })();
49
-
50
- // if we find an existing require function use it.
51
- if (global.require && global.define) {
52
- require.packaged = true;
53
- return;
54
- }
55
-
56
- var _define = function(module, deps, payload) {
57
- if (typeof module !== 'string') {
58
- if (_define.original)
59
- _define.original.apply(window, arguments);
60
- else {
61
- console.error('dropping module because define wasn\'t a string.');
62
- console.trace();
63
- }
64
- return;
65
- }
66
-
67
- if (arguments.length == 2)
68
- payload = deps;
69
-
70
- if (!define.modules)
71
- define.modules = {};
72
-
73
- define.modules[module] = payload;
74
- };
75
- if (global.define)
76
- _define.original = global.define;
77
-
78
- global.define = _define;
79
-
80
-
81
- /**
82
- * Get at functionality define()ed using the function above
83
- */
84
- var _require = function(module, callback) {
85
- if (Object.prototype.toString.call(module) === "[object Array]") {
86
- var params = [];
87
- for (var i = 0, l = module.length; i < l; ++i) {
88
- var dep = lookup(module[i]);
89
- if (!dep && _require.original)
90
- return _require.original.apply(window, arguments);
91
- params.push(dep);
92
- }
93
- if (callback) {
94
- callback.apply(null, params);
95
- }
96
- }
97
- else if (typeof module === 'string') {
98
- var payload = lookup(module);
99
- if (!payload && _require.original)
100
- return _require.original.apply(window, arguments);
101
-
102
- if (callback) {
103
- callback();
104
- }
105
-
106
- return payload;
107
- }
108
- else {
109
- if (_require.original)
110
- return _require.original.apply(window, arguments);
111
- }
112
- };
113
-
114
- if (global.require)
115
- _require.original = global.require;
116
-
117
- global.require = _require;
118
- require.packaged = true;
119
-
120
- /**
121
- * Internal function to lookup moduleNames and resolve them by calling the
122
- * definition function if needed.
123
- */
124
- var lookup = function(moduleName) {
125
- var module = define.modules[moduleName];
126
- if (module == null) {
127
- console.error('Missing module: ' + moduleName);
128
- return null;
129
- }
130
-
131
- if (typeof module === 'function') {
132
- var exports = {};
133
- module(require, exports, { id: moduleName, uri: '' });
134
- // cache the resulting module object for next time
135
- define.modules[moduleName] = exports;
136
- return exports;
137
- }
138
-
139
- return module;
140
- };
141
-
142
- })();/* ***** BEGIN LICENSE BLOCK *****
143
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
144
- *
145
- * The contents of this file are subject to the Mozilla Public License Version
146
- * 1.1 (the "License"); you may not use this file except in compliance with
147
- * the License. You may obtain a copy of the License at
148
- * http://www.mozilla.org/MPL/
149
- *
150
- * Software distributed under the License is distributed on an "AS IS" basis,
151
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
152
- * for the specific language governing rights and limitations under the
153
- * License.
154
- *
155
- * The Original Code is Mozilla Skywriter.
156
- *
157
- * The Initial Developer of the Original Code is
158
- * Mozilla.
159
- * Portions created by the Initial Developer are Copyright (C) 2009
160
- * the Initial Developer. All Rights Reserved.
161
- *
162
- * Contributor(s):
163
- * Kevin Dangoor (kdangoor@mozilla.com)
164
- *
165
- * Alternatively, the contents of this file may be used under the terms of
166
- * either the GNU General Public License Version 2 or later (the "GPL"), or
167
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
168
- * in which case the provisions of the GPL or the LGPL are applicable instead
169
- * of those above. If you wish to allow use of your version of this file only
170
- * under the terms of either the GPL or the LGPL, and not to allow others to
171
- * use your version of this file under the terms of the MPL, indicate your
172
- * decision by deleting the provisions above and replace them with the notice
173
- * and other provisions required by the GPL or the LGPL. If you do not delete
174
- * the provisions above, a recipient may use your version of this file under
175
- * the terms of any one of the MPL, the GPL or the LGPL.
176
- *
177
- * ***** END LICENSE BLOCK ***** */
178
-
179
- define('cockpit/index', ['require', 'exports', 'module' , 'pilot/index', 'cockpit/cli', 'cockpit/ui/settings', 'cockpit/ui/cli_view', 'cockpit/commands/basic'], function(require, exports, module) {
180
-
181
-
182
- exports.startup = function(data, reason) {
183
- require('pilot/index');
184
- require('cockpit/cli').startup(data, reason);
185
- // window.testCli = require('cockpit/test/testCli');
186
-
187
- require('cockpit/ui/settings').startup(data, reason);
188
- require('cockpit/ui/cli_view').startup(data, reason);
189
- require('cockpit/commands/basic').startup(data, reason);
190
- };
191
-
192
- /*
193
- exports.shutdown(data, reason) {
194
- };
195
- */
196
-
197
-
198
- });
199
- /* ***** BEGIN LICENSE BLOCK *****
200
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
201
- *
202
- * The contents of this file are subject to the Mozilla Public License Version
203
- * 1.1 (the "License"); you may not use this file except in compliance with
204
- * the License. You may obtain a copy of the License at
205
- * http://www.mozilla.org/MPL/
206
- *
207
- * Software distributed under the License is distributed on an "AS IS" basis,
208
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
209
- * for the specific language governing rights and limitations under the
210
- * License.
211
- *
212
- * The Original Code is Mozilla Skywriter.
213
- *
214
- * The Initial Developer of the Original Code is
215
- * Mozilla.
216
- * Portions created by the Initial Developer are Copyright (C) 2009
217
- * the Initial Developer. All Rights Reserved.
218
- *
219
- * Contributor(s):
220
- * Kevin Dangoor (kdangoor@mozilla.com)
221
- *
222
- * Alternatively, the contents of this file may be used under the terms of
223
- * either the GNU General Public License Version 2 or later (the "GPL"), or
224
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
225
- * in which case the provisions of the GPL or the LGPL are applicable instead
226
- * of those above. If you wish to allow use of your version of this file only
227
- * under the terms of either the GPL or the LGPL, and not to allow others to
228
- * use your version of this file under the terms of the MPL, indicate your
229
- * decision by deleting the provisions above and replace them with the notice
230
- * and other provisions required by the GPL or the LGPL. If you do not delete
231
- * the provisions above, a recipient may use your version of this file under
232
- * the terms of any one of the MPL, the GPL or the LGPL.
233
- *
234
- * ***** END LICENSE BLOCK ***** */
235
-
236
- define('pilot/index', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/types/basic', 'pilot/types/command', 'pilot/types/settings', 'pilot/commands/settings', 'pilot/commands/basic', 'pilot/settings/canon', 'pilot/canon'], function(require, exports, module) {
237
-
238
- exports.startup = function(data, reason) {
239
- require('pilot/fixoldbrowsers');
240
-
241
- require('pilot/types/basic').startup(data, reason);
242
- require('pilot/types/command').startup(data, reason);
243
- require('pilot/types/settings').startup(data, reason);
244
- require('pilot/commands/settings').startup(data, reason);
245
- require('pilot/commands/basic').startup(data, reason);
246
- // require('pilot/commands/history').startup(data, reason);
247
- require('pilot/settings/canon').startup(data, reason);
248
- require('pilot/canon').startup(data, reason);
249
- };
250
-
251
- exports.shutdown = function(data, reason) {
252
- require('pilot/types/basic').shutdown(data, reason);
253
- require('pilot/types/command').shutdown(data, reason);
254
- require('pilot/types/settings').shutdown(data, reason);
255
- require('pilot/commands/settings').shutdown(data, reason);
256
- require('pilot/commands/basic').shutdown(data, reason);
257
- // require('pilot/commands/history').shutdown(data, reason);
258
- require('pilot/settings/canon').shutdown(data, reason);
259
- require('pilot/canon').shutdown(data, reason);
260
- };
261
-
262
-
263
- });
264
- // vim:set ts=4 sts=4 sw=4 st:
265
- // -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
266
- // -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
267
- // -- dantman Daniel Friesen Copyright(C) 2010 XXX No License Specified
268
- // -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
269
- // -- Irakli Gozalishvili Copyright (C) 2010 MIT License
270
-
271
- /*!
272
- Copyright (c) 2009, 280 North Inc. http://280north.com/
273
- MIT License. http://github.com/280north/narwhal/blob/master/README.md
274
- */
275
-
276
- define('pilot/fixoldbrowsers', ['require', 'exports', 'module' ], function(require, exports, module) {
277
-
278
- /**
279
- * Brings an environment as close to ECMAScript 5 compliance
280
- * as is possible with the facilities of erstwhile engines.
281
- *
282
- * ES5 Draft
283
- * http://www.ecma-international.org/publications/files/drafts/tc39-2009-050.pdf
284
- *
285
- * NOTE: this is a draft, and as such, the URL is subject to change. If the
286
- * link is broken, check in the parent directory for the latest TC39 PDF.
287
- * http://www.ecma-international.org/publications/files/drafts/
288
- *
289
- * Previous ES5 Draft
290
- * http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
291
- * This is a broken link to the previous draft of ES5 on which most of the
292
- * numbered specification references and quotes herein were taken. Updating
293
- * these references and quotes to reflect the new document would be a welcome
294
- * volunteer project.
295
- *
296
- * @module
297
- */
298
-
299
- /*whatsupdoc*/
300
-
301
- //
302
- // Function
303
- // ========
304
- //
305
-
306
- // ES-5 15.3.4.5
307
- // http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf
308
-
309
- if (!Function.prototype.bind) {
310
- var slice = Array.prototype.slice;
311
- Function.prototype.bind = function bind(that) { // .length is 1
312
- // 1. Let Target be the this value.
313
- var target = this;
314
- // 2. If IsCallable(Target) is false, throw a TypeError exception.
315
- // XXX this gets pretty close, for all intents and purposes, letting
316
- // some duck-types slide
317
- if (typeof target.apply !== "function" || typeof target.call !== "function")
318
- return new TypeError();
319
- // 3. Let A be a new (possibly empty) internal list of all of the
320
- // argument values provided after thisArg (arg1, arg2 etc), in order.
321
- var args = slice.call(arguments);
322
- // 4. Let F be a new native ECMAScript object.
323
- // 9. Set the [[Prototype]] internal property of F to the standard
324
- // built-in Function prototype object as specified in 15.3.3.1.
325
- // 10. Set the [[Call]] internal property of F as described in
326
- // 15.3.4.5.1.
327
- // 11. Set the [[Construct]] internal property of F as described in
328
- // 15.3.4.5.2.
329
- // 12. Set the [[HasInstance]] internal property of F as described in
330
- // 15.3.4.5.3.
331
- // 13. The [[Scope]] internal property of F is unused and need not
332
- // exist.
333
- var bound = function bound() {
334
-
335
- if (this instanceof bound) {
336
- // 15.3.4.5.2 [[Construct]]
337
- // When the [[Construct]] internal method of a function object,
338
- // F that was created using the bind function is called with a
339
- // list of arguments ExtraArgs the following steps are taken:
340
- // 1. Let target be the value of F's [[TargetFunction]]
341
- // internal property.
342
- // 2. If target has no [[Construct]] internal method, a
343
- // TypeError exception is thrown.
344
- // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
345
- // property.
346
- // 4. Let args be a new list containing the same values as the
347
- // list boundArgs in the same order followed by the same
348
- // values as the list ExtraArgs in the same order.
349
-
350
- var self = Object.create(target.prototype);
351
- target.apply(self, args.concat(slice.call(arguments)));
352
- return self;
353
-
354
- } else {
355
- // 15.3.4.5.1 [[Call]]
356
- // When the [[Call]] internal method of a function object, F,
357
- // which was created using the bind function is called with a
358
- // this value and a list of arguments ExtraArgs the following
359
- // steps are taken:
360
- // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
361
- // property.
362
- // 2. Let boundThis be the value of F's [[BoundThis]] internal
363
- // property.
364
- // 3. Let target be the value of F's [[TargetFunction]] internal
365
- // property.
366
- // 4. Let args be a new list containing the same values as the list
367
- // boundArgs in the same order followed by the same values as
368
- // the list ExtraArgs in the same order. 5. Return the
369
- // result of calling the [[Call]] internal method of target
370
- // providing boundThis as the this value and providing args
371
- // as the arguments.
372
-
373
- // equiv: target.call(this, ...boundArgs, ...args)
374
- return target.call.apply(
375
- target,
376
- args.concat(slice.call(arguments))
377
- );
378
-
379
- }
380
-
381
- };
382
- bound.length = (
383
- // 14. If the [[Class]] internal property of Target is "Function", then
384
- typeof target === "function" ?
385
- // a. Let L be the length property of Target minus the length of A.
386
- // b. Set the length own property of F to either 0 or L, whichever is larger.
387
- Math.max(target.length - args.length, 0) :
388
- // 15. Else set the length own property of F to 0.
389
- 0
390
- )
391
- // 16. The length own property of F is given attributes as specified in
392
- // 15.3.5.1.
393
- // TODO
394
- // 17. Set the [[Extensible]] internal property of F to true.
395
- // TODO
396
- // 18. Call the [[DefineOwnProperty]] internal method of F with
397
- // arguments "caller", PropertyDescriptor {[[Value]]: null,
398
- // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
399
- // false}, and false.
400
- // TODO
401
- // 19. Call the [[DefineOwnProperty]] internal method of F with
402
- // arguments "arguments", PropertyDescriptor {[[Value]]: null,
403
- // [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
404
- // false}, and false.
405
- // TODO
406
- // NOTE Function objects created using Function.prototype.bind do not
407
- // have a prototype property.
408
- // XXX can't delete it in pure-js.
409
- return bound;
410
- };
411
- }
412
-
413
- // Shortcut to an often accessed properties, in order to avoid multiple
414
- // dereference that costs universally.
415
- // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
416
- // us it in defining shortcuts.
417
- var call = Function.prototype.call;
418
- var prototypeOfArray = Array.prototype;
419
- var prototypeOfObject = Object.prototype;
420
- var owns = call.bind(prototypeOfObject.hasOwnProperty);
421
-
422
- var defineGetter, defineSetter, lookupGetter, lookupSetter, supportsAccessors;
423
- // If JS engine supports accessors creating shortcuts.
424
- if ((supportsAccessors = owns(prototypeOfObject, '__defineGetter__'))) {
425
- defineGetter = call.bind(prototypeOfObject.__defineGetter__);
426
- defineSetter = call.bind(prototypeOfObject.__defineSetter__);
427
- lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
428
- lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
429
- }
430
-
431
-
432
- //
433
- // Array
434
- // =====
435
- //
436
-
437
- // ES5 15.4.3.2
438
- if (!Array.isArray) {
439
- Array.isArray = function isArray(obj) {
440
- return Object.prototype.toString.call(obj) === "[object Array]";
441
- };
442
- }
443
-
444
- // ES5 15.4.4.18
445
- if (!Array.prototype.forEach) {
446
- Array.prototype.forEach = function forEach(block, thisObject) {
447
- var len = +this.length;
448
- for (var i = 0; i < len; i++) {
449
- if (i in this) {
450
- block.call(thisObject, this[i], i, this);
451
- }
452
- }
453
- };
454
- }
455
-
456
- // ES5 15.4.4.19
457
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
458
- if (!Array.prototype.map) {
459
- Array.prototype.map = function map(fun /*, thisp*/) {
460
- var len = +this.length;
461
- if (typeof fun !== "function")
462
- throw new TypeError();
463
-
464
- var res = new Array(len);
465
- var thisp = arguments[1];
466
- for (var i = 0; i < len; i++) {
467
- if (i in this)
468
- res[i] = fun.call(thisp, this[i], i, this);
469
- }
470
-
471
- return res;
472
- };
473
- }
474
-
475
- // ES5 15.4.4.20
476
- if (!Array.prototype.filter) {
477
- Array.prototype.filter = function filter(block /*, thisp */) {
478
- var values = [];
479
- var thisp = arguments[1];
480
- for (var i = 0; i < this.length; i++)
481
- if (block.call(thisp, this[i]))
482
- values.push(this[i]);
483
- return values;
484
- };
485
- }
486
-
487
- // ES5 15.4.4.16
488
- if (!Array.prototype.every) {
489
- Array.prototype.every = function every(block /*, thisp */) {
490
- var thisp = arguments[1];
491
- for (var i = 0; i < this.length; i++)
492
- if (!block.call(thisp, this[i]))
493
- return false;
494
- return true;
495
- };
496
- }
497
-
498
- // ES5 15.4.4.17
499
- if (!Array.prototype.some) {
500
- Array.prototype.some = function some(block /*, thisp */) {
501
- var thisp = arguments[1];
502
- for (var i = 0; i < this.length; i++)
503
- if (block.call(thisp, this[i]))
504
- return true;
505
- return false;
506
- };
507
- }
508
-
509
- // ES5 15.4.4.21
510
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
511
- if (!Array.prototype.reduce) {
512
- Array.prototype.reduce = function reduce(fun /*, initial*/) {
513
- var len = +this.length;
514
- if (typeof fun !== "function")
515
- throw new TypeError();
516
-
517
- // no value to return if no initial value and an empty array
518
- if (len === 0 && arguments.length === 1)
519
- throw new TypeError();
520
-
521
- var i = 0;
522
- if (arguments.length >= 2) {
523
- var rv = arguments[1];
524
- } else {
525
- do {
526
- if (i in this) {
527
- rv = this[i++];
528
- break;
529
- }
530
-
531
- // if array contains no values, no initial value to return
532
- if (++i >= len)
533
- throw new TypeError();
534
- } while (true);
535
- }
536
-
537
- for (; i < len; i++) {
538
- if (i in this)
539
- rv = fun.call(null, rv, this[i], i, this);
540
- }
541
-
542
- return rv;
543
- };
544
- }
545
-
546
- // ES5 15.4.4.22
547
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
548
- if (!Array.prototype.reduceRight) {
549
- Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
550
- var len = +this.length;
551
- if (typeof fun !== "function")
552
- throw new TypeError();
553
-
554
- // no value to return if no initial value, empty array
555
- if (len === 0 && arguments.length === 1)
556
- throw new TypeError();
557
-
558
- var i = len - 1;
559
- if (arguments.length >= 2) {
560
- var rv = arguments[1];
561
- } else {
562
- do {
563
- if (i in this) {
564
- rv = this[i--];
565
- break;
566
- }
567
-
568
- // if array contains no values, no initial value to return
569
- if (--i < 0)
570
- throw new TypeError();
571
- } while (true);
572
- }
573
-
574
- for (; i >= 0; i--) {
575
- if (i in this)
576
- rv = fun.call(null, rv, this[i], i, this);
577
- }
578
-
579
- return rv;
580
- };
581
- }
582
-
583
- // ES5 15.4.4.14
584
- if (!Array.prototype.indexOf) {
585
- Array.prototype.indexOf = function indexOf(value /*, fromIndex */ ) {
586
- var length = this.length;
587
- if (!length)
588
- return -1;
589
- var i = arguments[1] || 0;
590
- if (i >= length)
591
- return -1;
592
- if (i < 0)
593
- i += length;
594
- for (; i < length; i++) {
595
- if (!owns(this, i))
596
- continue;
597
- if (value === this[i])
598
- return i;
599
- }
600
- return -1;
601
- };
602
- }
603
-
604
- // ES5 15.4.4.15
605
- if (!Array.prototype.lastIndexOf) {
606
- Array.prototype.lastIndexOf = function lastIndexOf(value /*, fromIndex */) {
607
- var length = this.length;
608
- if (!length)
609
- return -1;
610
- var i = arguments[1] || length;
611
- if (i < 0)
612
- i += length;
613
- i = Math.min(i, length - 1);
614
- for (; i >= 0; i--) {
615
- if (!owns(this, i))
616
- continue;
617
- if (value === this[i])
618
- return i;
619
- }
620
- return -1;
621
- };
622
- }
623
-
624
- //
625
- // Object
626
- // ======
627
- //
628
-
629
- // ES5 15.2.3.2
630
- if (!Object.getPrototypeOf) {
631
- // https://github.com/kriskowal/es5-shim/issues#issue/2
632
- // http://ejohn.org/blog/objectgetprototypeof/
633
- // recommended by fschaefer on github
634
- Object.getPrototypeOf = function getPrototypeOf(object) {
635
- return object.__proto__ || object.constructor.prototype;
636
- // or undefined if not available in this engine
637
- };
638
- }
639
-
640
- // ES5 15.2.3.3
641
- if (!Object.getOwnPropertyDescriptor) {
642
- var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
643
- "non-object: ";
644
- Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
645
- if ((typeof object !== "object" && typeof object !== "function") || object === null)
646
- throw new TypeError(ERR_NON_OBJECT + object);
647
- // If object does not owns property return undefined immediately.
648
- if (!owns(object, property))
649
- return undefined;
650
-
651
- var despriptor, getter, setter;
652
-
653
- // If object has a property then it's for sure both `enumerable` and
654
- // `configurable`.
655
- despriptor = { enumerable: true, configurable: true };
656
-
657
- // If JS engine supports accessor properties then property may be a
658
- // getter or setter.
659
- if (supportsAccessors) {
660
- // Unfortunately `__lookupGetter__` will return a getter even
661
- // if object has own non getter property along with a same named
662
- // inherited getter. To avoid misbehavior we temporary remove
663
- // `__proto__` so that `__lookupGetter__` will return getter only
664
- // if it's owned by an object.
665
- var prototype = object.__proto__;
666
- object.__proto__ = prototypeOfObject;
667
-
668
- var getter = lookupGetter(object, property);
669
- var setter = lookupSetter(object, property);
670
-
671
- // Once we have getter and setter we can put values back.
672
- object.__proto__ = prototype;
673
-
674
- if (getter || setter) {
675
- if (getter) descriptor.get = getter;
676
- if (setter) descriptor.set = setter;
677
-
678
- // If it was accessor property we're done and return here
679
- // in order to avoid adding `value` to the descriptor.
680
- return descriptor;
681
- }
682
- }
683
-
684
- // If we got this far we know that object has an own property that is
685
- // not an accessor so we set it as a value and return descriptor.
686
- descriptor.value = object[property];
687
- return descriptor;
688
- };
689
- }
690
-
691
- // ES5 15.2.3.4
692
- if (!Object.getOwnPropertyNames) {
693
- Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
694
- return Object.keys(object);
695
- };
696
- }
697
-
698
- // ES5 15.2.3.5
699
- if (!Object.create) {
700
- Object.create = function create(prototype, properties) {
701
- var object;
702
- if (prototype === null) {
703
- object = { "__proto__": null };
704
- } else {
705
- if (typeof prototype !== "object")
706
- throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
707
- var Type = function () {};
708
- Type.prototype = prototype;
709
- object = new Type();
710
- // IE has no built-in implementation of `Object.getPrototypeOf`
711
- // neither `__proto__`, but this manually setting `__proto__` will
712
- // guarantee that `Object.getPrototypeOf` will work as expected with
713
- // objects created using `Object.create`
714
- object.__proto__ = prototype;
715
- }
716
- if (typeof properties !== "undefined")
717
- Object.defineProperties(object, properties);
718
- return object;
719
- };
720
- }
721
-
722
- // ES5 15.2.3.6
723
- if (!Object.defineProperty) {
724
- var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
725
- var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
726
- var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
727
- "on this javascript engine";
728
-
729
- Object.defineProperty = function defineProperty(object, property, descriptor) {
730
- if (typeof object !== "object" && typeof object !== "function")
731
- throw new TypeError(ERR_NON_OBJECT_TARGET + object);
732
- if (typeof object !== "object" || object === null)
733
- throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
734
-
735
- // If it's a data property.
736
- if (owns(descriptor, "value")) {
737
- // fail silently if "writable", "enumerable", or "configurable"
738
- // are requested but not supported
739
- /*
740
- // alternate approach:
741
- if ( // can't implement these features; allow false but not true
742
- !(owns(descriptor, "writable") ? descriptor.writable : true) ||
743
- !(owns(descriptor, "enumerable") ? descriptor.enumerable : true) ||
744
- !(owns(descriptor, "configurable") ? descriptor.configurable : true)
745
- )
746
- throw new RangeError(
747
- "This implementation of Object.defineProperty does not " +
748
- "support configurable, enumerable, or writable."
749
- );
750
- */
751
-
752
- if (supportsAccessors && (lookupGetter(object, property) ||
753
- lookupSetter(object, property)))
754
- {
755
- // As accessors are supported only on engines implementing
756
- // `__proto__` we can safely override `__proto__` while defining
757
- // a property to make sure that we don't hit an inherited
758
- // accessor.
759
- var prototype = object.__proto__;
760
- object.__proto__ = prototypeOfObject;
761
- // Deleting a property anyway since getter / setter may be
762
- // defined on object itself.
763
- delete object[property];
764
- object[property] = descriptor.value;
765
- // Setting original `__proto__` back now.
766
- object.prototype;
767
- } else {
768
- object[property] = descriptor.value;
769
- }
770
- } else {
771
- if (!supportsAccessors)
772
- throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
773
- // If we got that far then getters and setters can be defined !!
774
- if (owns(descriptor, "get"))
775
- defineGetter(object, property, descriptor.get);
776
- if (owns(descriptor, "set"))
777
- defineSetter(object, property, descriptor.set);
778
- }
779
-
780
- return object;
781
- };
782
- }
783
-
784
- // ES5 15.2.3.7
785
- if (!Object.defineProperties) {
786
- Object.defineProperties = function defineProperties(object, properties) {
787
- for (var property in properties) {
788
- if (owns(properties, property))
789
- Object.defineProperty(object, property, properties[property]);
790
- }
791
- return object;
792
- };
793
- }
794
-
795
- // ES5 15.2.3.8
796
- if (!Object.seal) {
797
- Object.seal = function seal(object) {
798
- // this is misleading and breaks feature-detection, but
799
- // allows "securable" code to "gracefully" degrade to working
800
- // but insecure code.
801
- return object;
802
- };
803
- }
804
-
805
- // ES5 15.2.3.9
806
- if (!Object.freeze) {
807
- Object.freeze = function freeze(object) {
808
- // this is misleading and breaks feature-detection, but
809
- // allows "securable" code to "gracefully" degrade to working
810
- // but insecure code.
811
- return object;
812
- };
813
- }
814
-
815
- // detect a Rhino bug and patch it
816
- try {
817
- Object.freeze(function () {});
818
- } catch (exception) {
819
- Object.freeze = (function freeze(freezeObject) {
820
- return function freeze(object) {
821
- if (typeof object === "function") {
822
- return object;
823
- } else {
824
- return freezeObject(object);
825
- }
826
- };
827
- })(Object.freeze);
828
- }
829
-
830
- // ES5 15.2.3.10
831
- if (!Object.preventExtensions) {
832
- Object.preventExtensions = function preventExtensions(object) {
833
- // this is misleading and breaks feature-detection, but
834
- // allows "securable" code to "gracefully" degrade to working
835
- // but insecure code.
836
- return object;
837
- };
838
- }
839
-
840
- // ES5 15.2.3.11
841
- if (!Object.isSealed) {
842
- Object.isSealed = function isSealed(object) {
843
- return false;
844
- };
845
- }
846
-
847
- // ES5 15.2.3.12
848
- if (!Object.isFrozen) {
849
- Object.isFrozen = function isFrozen(object) {
850
- return false;
851
- };
852
- }
853
-
854
- // ES5 15.2.3.13
855
- if (!Object.isExtensible) {
856
- Object.isExtensible = function isExtensible(object) {
857
- return true;
858
- };
859
- }
860
-
861
- // ES5 15.2.3.14
862
- // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
863
- if (!Object.keys) {
864
-
865
- var hasDontEnumBug = true,
866
- dontEnums = [
867
- 'toString',
868
- 'toLocaleString',
869
- 'valueOf',
870
- 'hasOwnProperty',
871
- 'isPrototypeOf',
872
- 'propertyIsEnumerable',
873
- 'constructor'
874
- ],
875
- dontEnumsLength = dontEnums.length;
876
-
877
- for (var key in {"toString": null})
878
- hasDontEnumBug = false;
879
-
880
- Object.keys = function keys(object) {
881
-
882
- if (
883
- typeof object !== "object" && typeof object !== "function"
884
- || object === null
885
- )
886
- throw new TypeError("Object.keys called on a non-object");
887
-
888
- var keys = [];
889
- for (var name in object) {
890
- if (owns(object, name)) {
891
- keys.push(name);
892
- }
893
- }
894
-
895
- if (hasDontEnumBug) {
896
- for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
897
- var dontEnum = dontEnums[i];
898
- if (owns(object, dontEnum)) {
899
- keys.push(dontEnum);
900
- }
901
- }
902
- }
903
-
904
- return keys;
905
- };
906
-
907
- }
908
-
909
- //
910
- // Date
911
- // ====
912
- //
913
-
914
- // ES5 15.9.5.43
915
- // Format a Date object as a string according to a subset of the ISO-8601 standard.
916
- // Useful in Atom, among other things.
917
- if (!Date.prototype.toISOString) {
918
- Date.prototype.toISOString = function toISOString() {
919
- return (
920
- this.getUTCFullYear() + "-" +
921
- (this.getUTCMonth() + 1) + "-" +
922
- this.getUTCDate() + "T" +
923
- this.getUTCHours() + ":" +
924
- this.getUTCMinutes() + ":" +
925
- this.getUTCSeconds() + "Z"
926
- );
927
- }
928
- }
929
-
930
- // ES5 15.9.4.4
931
- if (!Date.now) {
932
- Date.now = function now() {
933
- return new Date().getTime();
934
- };
935
- }
936
-
937
- // ES5 15.9.5.44
938
- if (!Date.prototype.toJSON) {
939
- Date.prototype.toJSON = function toJSON(key) {
940
- // This function provides a String representation of a Date object for
941
- // use by JSON.stringify (15.12.3). When the toJSON method is called
942
- // with argument key, the following steps are taken:
943
-
944
- // 1. Let O be the result of calling ToObject, giving it the this
945
- // value as its argument.
946
- // 2. Let tv be ToPrimitive(O, hint Number).
947
- // 3. If tv is a Number and is not finite, return null.
948
- // XXX
949
- // 4. Let toISO be the result of calling the [[Get]] internal method of
950
- // O with argument "toISOString".
951
- // 5. If IsCallable(toISO) is false, throw a TypeError exception.
952
- if (typeof this.toISOString !== "function")
953
- throw new TypeError();
954
- // 6. Return the result of calling the [[Call]] internal method of
955
- // toISO with O as the this value and an empty argument list.
956
- return this.toISOString();
957
-
958
- // NOTE 1 The argument is ignored.
959
-
960
- // NOTE 2 The toJSON function is intentionally generic; it does not
961
- // require that its this value be a Date object. Therefore, it can be
962
- // transferred to other kinds of objects for use as a method. However,
963
- // it does require that any such object have a toISOString method. An
964
- // object is free to use the argument key to filter its
965
- // stringification.
966
- };
967
- }
968
-
969
- // 15.9.4.2 Date.parse (string)
970
- // 15.9.1.15 Date Time String Format
971
- // Date.parse
972
- // based on work shared by Daniel Friesen (dantman)
973
- // http://gist.github.com/303249
974
- if (isNaN(Date.parse("T00:00"))) {
975
- // XXX global assignment won't work in embeddings that use
976
- // an alternate object for the context.
977
- Date = (function(NativeDate) {
978
-
979
- // Date.length === 7
980
- var Date = function(Y, M, D, h, m, s, ms) {
981
- var length = arguments.length;
982
- if (this instanceof NativeDate) {
983
- var date = length === 1 && String(Y) === Y ? // isString(Y)
984
- // We explicitly pass it through parse:
985
- new NativeDate(Date.parse(Y)) :
986
- // We have to manually make calls depending on argument
987
- // length here
988
- length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :
989
- length >= 6 ? new NativeDate(Y, M, D, h, m, s) :
990
- length >= 5 ? new NativeDate(Y, M, D, h, m) :
991
- length >= 4 ? new NativeDate(Y, M, D, h) :
992
- length >= 3 ? new NativeDate(Y, M, D) :
993
- length >= 2 ? new NativeDate(Y, M) :
994
- length >= 1 ? new NativeDate(Y) :
995
- new NativeDate();
996
- // Prevent mixups with unfixed Date object
997
- date.constructor = Date;
998
- return date;
999
- }
1000
- return NativeDate.apply(this, arguments);
1001
- };
1002
-
1003
- // 15.9.1.15 Date Time String Format
1004
- var isoDateExpression = new RegExp("^" +
1005
- "(?:" + // optional year-month-day
1006
- "(" + // year capture
1007
- "(?:[+-]\\d\\d)?" + // 15.9.1.15.1 Extended years
1008
- "\\d\\d\\d\\d" + // four-digit year
1009
- ")" +
1010
- "(?:-" + // optional month-day
1011
- "(\\d\\d)" + // month capture
1012
- "(?:-" + // optional day
1013
- "(\\d\\d)" + // day capture
1014
- ")?" +
1015
- ")?" +
1016
- ")?" +
1017
- "(?:T" + // hour:minute:second.subsecond
1018
- "(\\d\\d)" + // hour capture
1019
- ":(\\d\\d)" + // minute capture
1020
- "(?::" + // optional :second.subsecond
1021
- "(\\d\\d)" + // second capture
1022
- "(?:\\.(\\d\\d\\d))?" + // milisecond capture
1023
- ")?" +
1024
- ")?" +
1025
- "(?:" + // time zone
1026
- "Z|" + // UTC capture
1027
- "([+-])(\\d\\d):(\\d\\d)" + // timezone offset
1028
- // capture sign, hour, minute
1029
- ")?" +
1030
- "$");
1031
-
1032
- // Copy any custom methods a 3rd party library may have added
1033
- for (var key in NativeDate)
1034
- Date[key] = NativeDate[key];
1035
-
1036
- // Copy "native" methods explicitly; they may be non-enumerable
1037
- Date.now = NativeDate.now;
1038
- Date.UTC = NativeDate.UTC;
1039
- Date.prototype = NativeDate.prototype;
1040
- Date.prototype.constructor = Date;
1041
-
1042
- // Upgrade Date.parse to handle the ISO dates we use
1043
- // TODO review specification to ascertain whether it is
1044
- // necessary to implement partial ISO date strings.
1045
- Date.parse = function parse(string) {
1046
- var match = isoDateExpression.exec(string);
1047
- if (match) {
1048
- match.shift(); // kill match[0], the full match
1049
- // recognize times without dates before normalizing the
1050
- // numeric values, for later use
1051
- var timeOnly = match[0] === undefined;
1052
- // parse numerics
1053
- for (var i = 0; i < 10; i++) {
1054
- // skip + or - for the timezone offset
1055
- if (i === 7)
1056
- continue;
1057
- // Note: parseInt would read 0-prefix numbers as
1058
- // octal. Number constructor or unary + work better
1059
- // here:
1060
- match[i] = +(match[i] || (i < 3 ? 1 : 0));
1061
- // match[1] is the month. Months are 0-11 in JavaScript
1062
- // Date objects, but 1-12 in ISO notation, so we
1063
- // decrement.
1064
- if (i === 1)
1065
- match[i]--;
1066
- }
1067
- // if no year-month-date is provided, return a milisecond
1068
- // quantity instead of a UTC date number value.
1069
- if (timeOnly)
1070
- return ((match[3] * 60 + match[4]) * 60 + match[5]) * 1000 + match[6];
1071
-
1072
- // account for an explicit time zone offset if provided
1073
- var offset = (match[8] * 60 + match[9]) * 60 * 1000;
1074
- if (match[6] === "-")
1075
- offset = -offset;
1076
-
1077
- return NativeDate.UTC.apply(this, match.slice(0, 7)) + offset;
1078
- }
1079
- return NativeDate.parse.apply(this, arguments);
1080
- };
1081
-
1082
- return Date;
1083
- })(Date);
1084
- }
1085
-
1086
- //
1087
- // String
1088
- // ======
1089
- //
1090
-
1091
- // ES5 15.5.4.20
1092
- if (!String.prototype.trim) {
1093
- // http://blog.stevenlevithan.com/archives/faster-trim-javascript
1094
- var trimBeginRegexp = /^\s\s*/;
1095
- var trimEndRegexp = /\s\s*$/;
1096
- String.prototype.trim = function trim() {
1097
- return String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, '');
1098
- };
1099
- }
1100
-
1101
- });/* ***** BEGIN LICENSE BLOCK *****
1102
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1103
- *
1104
- * The contents of this file are subject to the Mozilla Public License Version
1105
- * 1.1 (the "License"); you may not use this file except in compliance with
1106
- * the License. You may obtain a copy of the License at
1107
- * http://www.mozilla.org/MPL/
1108
- *
1109
- * Software distributed under the License is distributed on an "AS IS" basis,
1110
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1111
- * for the specific language governing rights and limitations under the
1112
- * License.
1113
- *
1114
- * The Original Code is Mozilla Skywriter.
1115
- *
1116
- * The Initial Developer of the Original Code is
1117
- * Mozilla.
1118
- * Portions created by the Initial Developer are Copyright (C) 2009
1119
- * the Initial Developer. All Rights Reserved.
1120
- *
1121
- * Contributor(s):
1122
- * Joe Walker (jwalker@mozilla.com)
1123
- * Kevin Dangoor (kdangoor@mozilla.com)
1124
- *
1125
- * Alternatively, the contents of this file may be used under the terms of
1126
- * either the GNU General Public License Version 2 or later (the "GPL"), or
1127
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1128
- * in which case the provisions of the GPL or the LGPL are applicable instead
1129
- * of those above. If you wish to allow use of your version of this file only
1130
- * under the terms of either the GPL or the LGPL, and not to allow others to
1131
- * use your version of this file under the terms of the MPL, indicate your
1132
- * decision by deleting the provisions above and replace them with the notice
1133
- * and other provisions required by the GPL or the LGPL. If you do not delete
1134
- * the provisions above, a recipient may use your version of this file under
1135
- * the terms of any one of the MPL, the GPL or the LGPL.
1136
- *
1137
- * ***** END LICENSE BLOCK ***** */
1138
-
1139
- define('pilot/types/basic', ['require', 'exports', 'module' , 'pilot/types'], function(require, exports, module) {
1140
-
1141
- var types = require("pilot/types");
1142
- var Type = types.Type;
1143
- var Conversion = types.Conversion;
1144
- var Status = types.Status;
1145
-
1146
- /**
1147
- * These are the basic types that we accept. They are vaguely based on the
1148
- * Jetpack settings system (https://wiki.mozilla.org/Labs/Jetpack/JEP/24)
1149
- * although clearly more restricted.
1150
- *
1151
- * <p>In addition to these types, Jetpack also accepts range, member, password
1152
- * that we are thinking of adding.
1153
- *
1154
- * <p>This module probably should not be accessed directly, but instead used
1155
- * through types.js
1156
- */
1157
-
1158
- /**
1159
- * 'text' is the default if no type is given.
1160
- */
1161
- var text = new Type();
1162
-
1163
- text.stringify = function(value) {
1164
- return value;
1165
- };
1166
-
1167
- text.parse = function(value) {
1168
- if (typeof value != 'string') {
1169
- throw new Error('non-string passed to text.parse()');
1170
- }
1171
- return new Conversion(value);
1172
- };
1173
-
1174
- text.name = 'text';
1175
-
1176
- /**
1177
- * We don't currently plan to distinguish between integers and floats
1178
- */
1179
- var number = new Type();
1180
-
1181
- number.stringify = function(value) {
1182
- if (!value) {
1183
- return null;
1184
- }
1185
- return '' + value;
1186
- };
1187
-
1188
- number.parse = function(value) {
1189
- if (typeof value != 'string') {
1190
- throw new Error('non-string passed to number.parse()');
1191
- }
1192
-
1193
- if (value.replace(/\s/g, '').length === 0) {
1194
- return new Conversion(null, Status.INCOMPLETE, '');
1195
- }
1196
-
1197
- var reply = new Conversion(parseInt(value, 10));
1198
- if (isNaN(reply.value)) {
1199
- reply.status = Status.INVALID;
1200
- reply.message = 'Can\'t convert "' + value + '" to a number.';
1201
- }
1202
-
1203
- return reply;
1204
- };
1205
-
1206
- number.decrement = function(value) {
1207
- return value - 1;
1208
- };
1209
-
1210
- number.increment = function(value) {
1211
- return value + 1;
1212
- };
1213
-
1214
- number.name = 'number';
1215
-
1216
- /**
1217
- * One of a known set of options
1218
- */
1219
- function SelectionType(typeSpec) {
1220
- if (!Array.isArray(typeSpec.data) && typeof typeSpec.data !== 'function') {
1221
- throw new Error('instances of SelectionType need typeSpec.data to be an array or function that returns an array:' + JSON.stringify(typeSpec));
1222
- }
1223
- Object.keys(typeSpec).forEach(function(key) {
1224
- this[key] = typeSpec[key];
1225
- }, this);
1226
- };
1227
-
1228
- SelectionType.prototype = new Type();
1229
-
1230
- SelectionType.prototype.stringify = function(value) {
1231
- return value;
1232
- };
1233
-
1234
- SelectionType.prototype.parse = function(str) {
1235
- if (typeof str != 'string') {
1236
- throw new Error('non-string passed to parse()');
1237
- }
1238
- if (!this.data) {
1239
- throw new Error('Missing data on selection type extension.');
1240
- }
1241
- var data = (typeof(this.data) === 'function') ? this.data() : this.data;
1242
-
1243
- // The matchedValue could be the boolean value false
1244
- var hasMatched = false;
1245
- var matchedValue;
1246
- var completions = [];
1247
- data.forEach(function(option) {
1248
- if (str == option) {
1249
- matchedValue = this.fromString(option);
1250
- hasMatched = true;
1251
- }
1252
- else if (option.indexOf(str) === 0) {
1253
- completions.push(this.fromString(option));
1254
- }
1255
- }, this);
1256
-
1257
- if (hasMatched) {
1258
- return new Conversion(matchedValue);
1259
- }
1260
- else {
1261
- // This is something of a hack it basically allows us to tell the
1262
- // setting type to forget its last setting hack.
1263
- if (this.noMatch) {
1264
- this.noMatch();
1265
- }
1266
-
1267
- if (completions.length > 0) {
1268
- var msg = 'Possibilities' +
1269
- (str.length === 0 ? '' : ' for \'' + str + '\'');
1270
- return new Conversion(null, Status.INCOMPLETE, msg, completions);
1271
- }
1272
- else {
1273
- var msg = 'Can\'t use \'' + str + '\'.';
1274
- return new Conversion(null, Status.INVALID, msg, completions);
1275
- }
1276
- }
1277
- };
1278
-
1279
- SelectionType.prototype.fromString = function(str) {
1280
- return str;
1281
- };
1282
-
1283
- SelectionType.prototype.decrement = function(value) {
1284
- var data = (typeof this.data === 'function') ? this.data() : this.data;
1285
- var index;
1286
- if (value == null) {
1287
- index = data.length - 1;
1288
- }
1289
- else {
1290
- var name = this.stringify(value);
1291
- var index = data.indexOf(name);
1292
- index = (index === 0 ? data.length - 1 : index - 1);
1293
- }
1294
- return this.fromString(data[index]);
1295
- };
1296
-
1297
- SelectionType.prototype.increment = function(value) {
1298
- var data = (typeof this.data === 'function') ? this.data() : this.data;
1299
- var index;
1300
- if (value == null) {
1301
- index = 0;
1302
- }
1303
- else {
1304
- var name = this.stringify(value);
1305
- var index = data.indexOf(name);
1306
- index = (index === data.length - 1 ? 0 : index + 1);
1307
- }
1308
- return this.fromString(data[index]);
1309
- };
1310
-
1311
- SelectionType.prototype.name = 'selection';
1312
-
1313
- /**
1314
- * SelectionType is a base class for other types
1315
- */
1316
- exports.SelectionType = SelectionType;
1317
-
1318
- /**
1319
- * true/false values
1320
- */
1321
- var bool = new SelectionType({
1322
- name: 'bool',
1323
- data: [ 'true', 'false' ],
1324
- stringify: function(value) {
1325
- return '' + value;
1326
- },
1327
- fromString: function(str) {
1328
- return str === 'true' ? true : false;
1329
- }
1330
- });
1331
-
1332
-
1333
- /**
1334
- * A we don't know right now, but hope to soon.
1335
- */
1336
- function DeferredType(typeSpec) {
1337
- if (typeof typeSpec.defer !== 'function') {
1338
- throw new Error('Instances of DeferredType need typeSpec.defer to be a function that returns a type');
1339
- }
1340
- Object.keys(typeSpec).forEach(function(key) {
1341
- this[key] = typeSpec[key];
1342
- }, this);
1343
- };
1344
-
1345
- DeferredType.prototype = new Type();
1346
-
1347
- DeferredType.prototype.stringify = function(value) {
1348
- return this.defer().stringify(value);
1349
- };
1350
-
1351
- DeferredType.prototype.parse = function(value) {
1352
- return this.defer().parse(value);
1353
- };
1354
-
1355
- DeferredType.prototype.decrement = function(value) {
1356
- var deferred = this.defer();
1357
- return (deferred.decrement ? deferred.decrement(value) : undefined);
1358
- };
1359
-
1360
- DeferredType.prototype.increment = function(value) {
1361
- var deferred = this.defer();
1362
- return (deferred.increment ? deferred.increment(value) : undefined);
1363
- };
1364
-
1365
- DeferredType.prototype.name = 'deferred';
1366
-
1367
- /**
1368
- * DeferredType is a base class for other types
1369
- */
1370
- exports.DeferredType = DeferredType;
1371
-
1372
-
1373
- /**
1374
- * A set of objects of the same type
1375
- */
1376
- function ArrayType(typeSpec) {
1377
- if (typeSpec instanceof Type) {
1378
- this.subtype = typeSpec;
1379
- }
1380
- else if (typeof typeSpec === 'string') {
1381
- this.subtype = types.getType(typeSpec);
1382
- if (this.subtype == null) {
1383
- throw new Error('Unknown array subtype: ' + typeSpec);
1384
- }
1385
- }
1386
- else {
1387
- throw new Error('Can\' handle array subtype');
1388
- }
1389
- };
1390
-
1391
- ArrayType.prototype = new Type();
1392
-
1393
- ArrayType.prototype.stringify = function(values) {
1394
- // TODO: Check for strings with spaces and add quotes
1395
- return values.join(' ');
1396
- };
1397
-
1398
- ArrayType.prototype.parse = function(value) {
1399
- return this.defer().parse(value);
1400
- };
1401
-
1402
- ArrayType.prototype.name = 'array';
1403
-
1404
- /**
1405
- * Registration and de-registration.
1406
- */
1407
- var isStarted = false;
1408
- exports.startup = function() {
1409
- if (isStarted) {
1410
- return;
1411
- }
1412
- isStarted = true;
1413
- types.registerType(text);
1414
- types.registerType(number);
1415
- types.registerType(bool);
1416
- types.registerType(SelectionType);
1417
- types.registerType(DeferredType);
1418
- types.registerType(ArrayType);
1419
- };
1420
-
1421
- exports.shutdown = function() {
1422
- isStarted = false;
1423
- types.unregisterType(text);
1424
- types.unregisterType(number);
1425
- types.unregisterType(bool);
1426
- types.unregisterType(SelectionType);
1427
- types.unregisterType(DeferredType);
1428
- types.unregisterType(ArrayType);
1429
- };
1430
-
1431
-
1432
- });
1433
- /* ***** BEGIN LICENSE BLOCK *****
1434
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1435
- *
1436
- * The contents of this file are subject to the Mozilla Public License Version
1437
- * 1.1 (the "License"); you may not use this file except in compliance with
1438
- * the License. You may obtain a copy of the License at
1439
- * http://www.mozilla.org/MPL/
1440
- *
1441
- * Software distributed under the License is distributed on an "AS IS" basis,
1442
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1443
- * for the specific language governing rights and limitations under the
1444
- * License.
1445
- *
1446
- * The Original Code is Skywriter.
1447
- *
1448
- * The Initial Developer of the Original Code is
1449
- * Mozilla.
1450
- * Portions created by the Initial Developer are Copyright (C) 2009
1451
- * the Initial Developer. All Rights Reserved.
1452
- *
1453
- * Contributor(s):
1454
- * Joe Walker (jwalker@mozilla.com)
1455
- *
1456
- * Alternatively, the contents of this file may be used under the terms of
1457
- * either the GNU General Public License Version 2 or later (the "GPL"), or
1458
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1459
- * in which case the provisions of the GPL or the LGPL are applicable instead
1460
- * of those above. If you wish to allow use of your version of this file only
1461
- * under the terms of either the GPL or the LGPL, and not to allow others to
1462
- * use your version of this file under the terms of the MPL, indicate your
1463
- * decision by deleting the provisions above and replace them with the notice
1464
- * and other provisions required by the GPL or the LGPL. If you do not delete
1465
- * the provisions above, a recipient may use your version of this file under
1466
- * the terms of any one of the MPL, the GPL or the LGPL.
1467
- *
1468
- * ***** END LICENSE BLOCK ***** */
1469
-
1470
- define('pilot/types', ['require', 'exports', 'module' ], function(require, exports, module) {
1471
-
1472
- /**
1473
- * Some types can detect validity, that is to say they can distinguish between
1474
- * valid and invalid values.
1475
- * TODO: Change these constants to be numbers for more performance?
1476
- */
1477
- var Status = {
1478
- /**
1479
- * The conversion process worked without any problem, and the value is
1480
- * valid. There are a number of failure states, so the best way to check
1481
- * for failure is (x !== Status.VALID)
1482
- */
1483
- VALID: {
1484
- toString: function() { return 'VALID'; },
1485
- valueOf: function() { return 0; }
1486
- },
1487
-
1488
- /**
1489
- * A conversion process failed, however it was noted that the string
1490
- * provided to 'parse()' could be VALID by the addition of more characters,
1491
- * so the typing may not be actually incorrect yet, just unfinished.
1492
- * @see Status.INVALID
1493
- */
1494
- INCOMPLETE: {
1495
- toString: function() { return 'INCOMPLETE'; },
1496
- valueOf: function() { return 1; }
1497
- },
1498
-
1499
- /**
1500
- * The conversion process did not work, the value should be null and a
1501
- * reason for failure should have been provided. In addition some completion
1502
- * values may be available.
1503
- * @see Status.INCOMPLETE
1504
- */
1505
- INVALID: {
1506
- toString: function() { return 'INVALID'; },
1507
- valueOf: function() { return 2; }
1508
- },
1509
-
1510
- /**
1511
- * A combined status is the worser of the provided statuses
1512
- */
1513
- combine: function(statuses) {
1514
- var combined = Status.VALID;
1515
- for (var i = 0; i < statuses.length; i++) {
1516
- if (statuses[i].valueOf() > combined.valueOf()) {
1517
- combined = statuses[i];
1518
- }
1519
- }
1520
- return combined;
1521
- }
1522
- };
1523
- exports.Status = Status;
1524
-
1525
- /**
1526
- * The type.parse() method returns a Conversion to inform the user about not
1527
- * only the result of a Conversion but also about what went wrong.
1528
- * We could use an exception, and throw if the conversion failed, but that
1529
- * seems to violate the idea that exceptions should be exceptional. Typos are
1530
- * not. Also in order to store both a status and a message we'd still need
1531
- * some sort of exception type...
1532
- */
1533
- function Conversion(value, status, message, predictions) {
1534
- /**
1535
- * The result of the conversion process. Will be null if status != VALID
1536
- */
1537
- this.value = value;
1538
-
1539
- /**
1540
- * The status of the conversion.
1541
- * @see Status
1542
- */
1543
- this.status = status || Status.VALID;
1544
-
1545
- /**
1546
- * A message to go with the conversion. This could be present for any status
1547
- * including VALID in the case where we want to note a warning for example.
1548
- * I18N: On the one hand this nasty and un-internationalized, however with
1549
- * a command line it is hard to know where to start.
1550
- */
1551
- this.message = message;
1552
-
1553
- /**
1554
- * A array of strings which are the systems best guess at better inputs than
1555
- * the one presented.
1556
- * We generally expect there to be about 7 predictions (to match human list
1557
- * comprehension ability) however it is valid to provide up to about 20,
1558
- * or less. It is the job of the predictor to decide a smart cut-off.
1559
- * For example if there are 4 very good matches and 4 very poor ones,
1560
- * probably only the 4 very good matches should be presented.
1561
- */
1562
- this.predictions = predictions || [];
1563
- }
1564
- exports.Conversion = Conversion;
1565
-
1566
- /**
1567
- * Most of our types are 'static' e.g. there is only one type of 'text', however
1568
- * some types like 'selection' and 'deferred' are customizable. The basic
1569
- * Type type isn't useful, but does provide documentation about what types do.
1570
- */
1571
- function Type() {
1572
- };
1573
- Type.prototype = {
1574
- /**
1575
- * Convert the given <tt>value</tt> to a string representation.
1576
- * Where possible, there should be round-tripping between values and their
1577
- * string representations.
1578
- */
1579
- stringify: function(value) { throw new Error("not implemented"); },
1580
-
1581
- /**
1582
- * Convert the given <tt>str</tt> to an instance of this type.
1583
- * Where possible, there should be round-tripping between values and their
1584
- * string representations.
1585
- * @return Conversion
1586
- */
1587
- parse: function(str) { throw new Error("not implemented"); },
1588
-
1589
- /**
1590
- * The plug-in system, and other things need to know what this type is
1591
- * called. The name alone is not enough to fully specify a type. Types like
1592
- * 'selection' and 'deferred' need extra data, however this function returns
1593
- * only the name, not the extra data.
1594
- * <p>In old bespin, equality was based on the name. This may turn out to be
1595
- * important in Ace too.
1596
- */
1597
- name: undefined,
1598
-
1599
- /**
1600
- * If there is some concept of a higher value, return it,
1601
- * otherwise return undefined.
1602
- */
1603
- increment: function(value) {
1604
- return undefined;
1605
- },
1606
-
1607
- /**
1608
- * If there is some concept of a lower value, return it,
1609
- * otherwise return undefined.
1610
- */
1611
- decrement: function(value) {
1612
- return undefined;
1613
- },
1614
-
1615
- /**
1616
- * There is interesting information (like predictions) in a conversion of
1617
- * nothing, the output of this can sometimes be customized.
1618
- * @return Conversion
1619
- */
1620
- getDefault: function() {
1621
- return this.parse('');
1622
- }
1623
- };
1624
- exports.Type = Type;
1625
-
1626
- /**
1627
- * Private registry of types
1628
- * Invariant: types[name] = type.name
1629
- */
1630
- var types = {};
1631
-
1632
- /**
1633
- * Add a new type to the list available to the system.
1634
- * You can pass 2 things to this function - either an instance of Type, in
1635
- * which case we return this instance when #getType() is called with a 'name'
1636
- * that matches type.name.
1637
- * Also you can pass in a constructor (i.e. function) in which case when
1638
- * #getType() is called with a 'name' that matches Type.prototype.name we will
1639
- * pass the typeSpec into this constructor. See #reconstituteType().
1640
- */
1641
- exports.registerType = function(type) {
1642
- if (typeof type === 'object') {
1643
- if (type instanceof Type) {
1644
- if (!type.name) {
1645
- throw new Error('All registered types must have a name');
1646
- }
1647
- types[type.name] = type;
1648
- }
1649
- else {
1650
- throw new Error('Can\'t registerType using: ' + type);
1651
- }
1652
- }
1653
- else if (typeof type === 'function') {
1654
- if (!type.prototype.name) {
1655
- throw new Error('All registered types must have a name');
1656
- }
1657
- types[type.prototype.name] = type;
1658
- }
1659
- else {
1660
- throw new Error('Unknown type: ' + type);
1661
- }
1662
- };
1663
-
1664
- exports.registerTypes = function registerTypes(types) {
1665
- Object.keys(types).forEach(function (name) {
1666
- var type = types[name];
1667
- type.name = name;
1668
- exports.registerType(type);
1669
- });
1670
- };
1671
-
1672
- /**
1673
- * Remove a type from the list available to the system
1674
- */
1675
- exports.deregisterType = function(type) {
1676
- delete types[type.name];
1677
- };
1678
-
1679
- /**
1680
- * See description of #exports.registerType()
1681
- */
1682
- function reconstituteType(name, typeSpec) {
1683
- if (name.substr(-2) === '[]') { // i.e. endsWith('[]')
1684
- var subtypeName = name.slice(0, -2);
1685
- return new types['array'](subtypeName);
1686
- }
1687
-
1688
- var type = types[name];
1689
- if (typeof type === 'function') {
1690
- type = new type(typeSpec);
1691
- }
1692
- return type;
1693
- }
1694
-
1695
- /**
1696
- * Find a type, previously registered using #registerType()
1697
- */
1698
- exports.getType = function(typeSpec) {
1699
- if (typeof typeSpec === 'string') {
1700
- return reconstituteType(typeSpec);
1701
- }
1702
-
1703
- if (typeof typeSpec === 'object') {
1704
- if (!typeSpec.name) {
1705
- throw new Error('Missing \'name\' member to typeSpec');
1706
- }
1707
- return reconstituteType(typeSpec.name, typeSpec);
1708
- }
1709
-
1710
- throw new Error('Can\'t extract type from ' + typeSpec);
1711
- };
1712
-
1713
-
1714
- });
1715
- /* ***** BEGIN LICENSE BLOCK *****
1716
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1717
- *
1718
- * The contents of this file are subject to the Mozilla Public License Version
1719
- * 1.1 (the "License"); you may not use this file except in compliance with
1720
- * the License. You may obtain a copy of the License at
1721
- * http://www.mozilla.org/MPL/
1722
- *
1723
- * Software distributed under the License is distributed on an "AS IS" basis,
1724
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1725
- * for the specific language governing rights and limitations under the
1726
- * License.
1727
- *
1728
- * The Original Code is Mozilla Skywriter.
1729
- *
1730
- * The Initial Developer of the Original Code is
1731
- * Mozilla.
1732
- * Portions created by the Initial Developer are Copyright (C) 2009
1733
- * the Initial Developer. All Rights Reserved.
1734
- *
1735
- * Contributor(s):
1736
- * Joe Walker (jwalker@mozilla.com)
1737
- * Kevin Dangoor (kdangoor@mozilla.com)
1738
- *
1739
- * Alternatively, the contents of this file may be used under the terms of
1740
- * either the GNU General Public License Version 2 or later (the "GPL"), or
1741
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1742
- * in which case the provisions of the GPL or the LGPL are applicable instead
1743
- * of those above. If you wish to allow use of your version of this file only
1744
- * under the terms of either the GPL or the LGPL, and not to allow others to
1745
- * use your version of this file under the terms of the MPL, indicate your
1746
- * decision by deleting the provisions above and replace them with the notice
1747
- * and other provisions required by the GPL or the LGPL. If you do not delete
1748
- * the provisions above, a recipient may use your version of this file under
1749
- * the terms of any one of the MPL, the GPL or the LGPL.
1750
- *
1751
- * ***** END LICENSE BLOCK ***** */
1752
-
1753
- define('pilot/types/command', ['require', 'exports', 'module' , 'pilot/canon', 'pilot/types/basic', 'pilot/types'], function(require, exports, module) {
1754
-
1755
- var canon = require("pilot/canon");
1756
- var SelectionType = require("pilot/types/basic").SelectionType;
1757
- var types = require("pilot/types");
1758
-
1759
-
1760
- /**
1761
- * Select from the available commands
1762
- */
1763
- var command = new SelectionType({
1764
- name: 'command',
1765
- data: function() {
1766
- return canon.getCommandNames();
1767
- },
1768
- stringify: function(command) {
1769
- return command.name;
1770
- },
1771
- fromString: function(str) {
1772
- return canon.getCommand(str);
1773
- }
1774
- });
1775
-
1776
-
1777
- /**
1778
- * Registration and de-registration.
1779
- */
1780
- exports.startup = function() {
1781
- types.registerType(command);
1782
- };
1783
-
1784
- exports.shutdown = function() {
1785
- types.unregisterType(command);
1786
- };
1787
-
1788
-
1789
- });
1790
- /* ***** BEGIN LICENSE BLOCK *****
1791
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1792
- *
1793
- * The contents of this file are subject to the Mozilla Public License Version
1794
- * 1.1 (the "License"); you may not use this file except in compliance with
1795
- * the License. You may obtain a copy of the License at
1796
- * http://www.mozilla.org/MPL/
1797
- *
1798
- * Software distributed under the License is distributed on an "AS IS" basis,
1799
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1800
- * for the specific language governing rights and limitations under the
1801
- * License.
1802
- *
1803
- * The Original Code is Mozilla Skywriter.
1804
- *
1805
- * The Initial Developer of the Original Code is
1806
- * Mozilla.
1807
- * Portions created by the Initial Developer are Copyright (C) 2009
1808
- * the Initial Developer. All Rights Reserved.
1809
- *
1810
- * Contributor(s):
1811
- * Joe Walker (jwalker@mozilla.com)
1812
- *
1813
- * Alternatively, the contents of this file may be used under the terms of
1814
- * either the GNU General Public License Version 2 or later (the "GPL"), or
1815
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1816
- * in which case the provisions of the GPL or the LGPL are applicable instead
1817
- * of those above. If you wish to allow use of your version of this file only
1818
- * under the terms of either the GPL or the LGPL, and not to allow others to
1819
- * use your version of this file under the terms of the MPL, indicate your
1820
- * decision by deleting the provisions above and replace them with the notice
1821
- * and other provisions required by the GPL or the LGPL. If you do not delete
1822
- * the provisions above, a recipient may use your version of this file under
1823
- * the terms of any one of the MPL, the GPL or the LGPL.
1824
- *
1825
- * ***** END LICENSE BLOCK ***** */
1826
-
1827
- define('pilot/canon', ['require', 'exports', 'module' , 'pilot/console', 'pilot/stacktrace', 'pilot/oop', 'pilot/useragent', 'pilot/keys', 'pilot/event_emitter', 'pilot/typecheck', 'pilot/catalog', 'pilot/types', 'pilot/lang'], function(require, exports, module) {
1828
-
1829
- var console = require('pilot/console');
1830
- var Trace = require('pilot/stacktrace').Trace;
1831
- var oop = require('pilot/oop');
1832
- var useragent = require('pilot/useragent');
1833
- var keyUtil = require('pilot/keys');
1834
- var EventEmitter = require('pilot/event_emitter').EventEmitter;
1835
- var typecheck = require('pilot/typecheck');
1836
- var catalog = require('pilot/catalog');
1837
- var Status = require('pilot/types').Status;
1838
- var types = require('pilot/types');
1839
- var lang = require('pilot/lang');
1840
-
1841
- /*
1842
- // TODO: this doesn't belong here - or maybe anywhere?
1843
- var dimensionsChangedExtensionSpec = {
1844
- name: 'dimensionsChanged',
1845
- description: 'A dimensionsChanged is a way to be notified of ' +
1846
- 'changes to the dimension of Skywriter'
1847
- };
1848
- exports.startup = function(data, reason) {
1849
- catalog.addExtensionSpec(commandExtensionSpec);
1850
- };
1851
- exports.shutdown = function(data, reason) {
1852
- catalog.removeExtensionSpec(commandExtensionSpec);
1853
- };
1854
- */
1855
-
1856
- var commandExtensionSpec = {
1857
- name: 'command',
1858
- description: 'A command is a bit of functionality with optional ' +
1859
- 'typed arguments which can do something small like moving ' +
1860
- 'the cursor around the screen, or large like cloning a ' +
1861
- 'project from VCS.',
1862
- indexOn: 'name'
1863
- };
1864
-
1865
- exports.startup = function(data, reason) {
1866
- // TODO: this is probably all kinds of evil, but we need something working
1867
- catalog.addExtensionSpec(commandExtensionSpec);
1868
- };
1869
-
1870
- exports.shutdown = function(data, reason) {
1871
- catalog.removeExtensionSpec(commandExtensionSpec);
1872
- };
1873
-
1874
- /**
1875
- * Manage a list of commands in the current canon
1876
- */
1877
-
1878
- /**
1879
- * A Command is a discrete action optionally with a set of ways to customize
1880
- * how it happens. This is here for documentation purposes.
1881
- * TODO: Document better
1882
- */
1883
- var thingCommand = {
1884
- name: 'thing',
1885
- description: 'thing is an example command',
1886
- params: [{
1887
- name: 'param1',
1888
- description: 'an example parameter',
1889
- type: 'text',
1890
- defaultValue: null
1891
- }],
1892
- exec: function(env, args, request) {
1893
- thing();
1894
- }
1895
- };
1896
-
1897
- /**
1898
- * A lookup hash of our registered commands
1899
- */
1900
- var commands = {};
1901
-
1902
- /**
1903
- * A lookup has for command key bindings that use a string as sender.
1904
- */
1905
- var commmandKeyBinding = {};
1906
-
1907
- /**
1908
- * Array with command key bindings that use a function to determ the sender.
1909
- */
1910
- var commandKeyBindingFunc = { };
1911
-
1912
- function splitSafe(s, separator, limit, bLowerCase) {
1913
- return (bLowerCase && s.toLowerCase() || s)
1914
- .replace(/(?:^\s+|\n|\s+$)/g, "")
1915
- .split(new RegExp("[\\s ]*" + separator + "[\\s ]*", "g"), limit || 999);
1916
- }
1917
-
1918
- function parseKeys(keys, val, ret) {
1919
- var key,
1920
- hashId = 0,
1921
- parts = splitSafe(keys, "\\-", null, true),
1922
- i = 0,
1923
- l = parts.length;
1924
-
1925
- for (; i < l; ++i) {
1926
- if (keyUtil.KEY_MODS[parts[i]])
1927
- hashId = hashId | keyUtil.KEY_MODS[parts[i]];
1928
- else
1929
- key = parts[i] || "-"; //when empty, the splitSafe removed a '-'
1930
- }
1931
-
1932
- if (ret == null) {
1933
- return {
1934
- key: key,
1935
- hashId: hashId
1936
- }
1937
- } else {
1938
- (ret[hashId] || (ret[hashId] = {}))[key] = val;
1939
- }
1940
- }
1941
-
1942
- var platform = useragent.isMac ? "mac" : "win";
1943
- function buildKeyHash(command) {
1944
- var binding = command.bindKey,
1945
- key = binding[platform],
1946
- ckb = commmandKeyBinding,
1947
- ckbf = commandKeyBindingFunc
1948
-
1949
- if (!binding.sender) {
1950
- throw new Error('All key bindings must have a sender');
1951
- }
1952
- if (!binding.mac && binding.mac !== null) {
1953
- throw new Error('All key bindings must have a mac key binding');
1954
- }
1955
- if (!binding.win && binding.win !== null) {
1956
- throw new Error('All key bindings must have a windows key binding');
1957
- }
1958
- if(!binding[platform]) {
1959
- // No keymapping for this platform.
1960
- return;
1961
- }
1962
- if (typeof binding.sender == 'string') {
1963
- var targets = splitSafe(binding.sender, "\\|", null, true);
1964
- targets.forEach(function(target) {
1965
- if (!ckb[target]) {
1966
- ckb[target] = { };
1967
- }
1968
- key.split("|").forEach(function(keyPart) {
1969
- parseKeys(keyPart, command, ckb[target]);
1970
- });
1971
- });
1972
- } else if (typecheck.isFunction(binding.sender)) {
1973
- var val = {
1974
- command: command,
1975
- sender: binding.sender
1976
- };
1977
-
1978
- keyData = parseKeys(key);
1979
- if (!ckbf[keyData.hashId]) {
1980
- ckbf[keyData.hashId] = { };
1981
- }
1982
- if (!ckbf[keyData.hashId][keyData.key]) {
1983
- ckbf[keyData.hashId][keyData.key] = [ val ];
1984
- } else {
1985
- ckbf[keyData.hashId][keyData.key].push(val);
1986
- }
1987
- } else {
1988
- throw new Error('Key binding must have a sender that is a string or function');
1989
- }
1990
- }
1991
-
1992
- function findKeyCommand(env, sender, hashId, textOrKey) {
1993
- // Convert keyCode to the string representation.
1994
- if (typecheck.isNumber(textOrKey)) {
1995
- textOrKey = keyUtil.keyCodeToString(textOrKey);
1996
- }
1997
-
1998
- // Check bindings with functions as sender first.
1999
- var bindFuncs = (commandKeyBindingFunc[hashId] || {})[textOrKey] || [];
2000
- for (var i = 0; i < bindFuncs.length; i++) {
2001
- if (bindFuncs[i].sender(env, sender, hashId, textOrKey)) {
2002
- return bindFuncs[i].command;
2003
- }
2004
- }
2005
-
2006
- var ckbr = commmandKeyBinding[sender];
2007
- return ckbr && ckbr[hashId] && ckbr[hashId][textOrKey];
2008
- }
2009
-
2010
- function execKeyCommand(env, sender, hashId, textOrKey) {
2011
- var command = findKeyCommand(env, sender, hashId, textOrKey);
2012
- if (command) {
2013
- return exec(command, env, sender, { });
2014
- } else {
2015
- return false;
2016
- }
2017
- }
2018
-
2019
- /**
2020
- * A sorted list of command names, we regularly want them in order, so pre-sort
2021
- */
2022
- var commandNames = [];
2023
-
2024
- /**
2025
- * This registration method isn't like other Ace registration methods because
2026
- * it doesn't return a decorated command because there is no functional
2027
- * decoration to be done.
2028
- * TODO: Are we sure that in the future there will be no such decoration?
2029
- */
2030
- function addCommand(command) {
2031
- if (!command.name) {
2032
- throw new Error('All registered commands must have a name');
2033
- }
2034
- if (command.params == null) {
2035
- command.params = [];
2036
- }
2037
- if (!Array.isArray(command.params)) {
2038
- throw new Error('command.params must be an array in ' + command.name);
2039
- }
2040
- // Replace the type
2041
- command.params.forEach(function(param) {
2042
- if (!param.name) {
2043
- throw new Error('In ' + command.name + ': all params must have a name');
2044
- }
2045
- upgradeType(command.name, param);
2046
- }, this);
2047
- commands[command.name] = command;
2048
-
2049
- if (command.bindKey) {
2050
- buildKeyHash(command);
2051
- }
2052
-
2053
- commandNames.push(command.name);
2054
- commandNames.sort();
2055
- };
2056
-
2057
- function upgradeType(name, param) {
2058
- var lookup = param.type;
2059
- param.type = types.getType(lookup);
2060
- if (param.type == null) {
2061
- throw new Error('In ' + name + '/' + param.name +
2062
- ': can\'t find type for: ' + JSON.stringify(lookup));
2063
- }
2064
- }
2065
-
2066
- function removeCommand(command) {
2067
- var name = (typeof command === 'string' ? command : command.name);
2068
- command = commands[name];
2069
- delete commands[name];
2070
- lang.arrayRemove(commandNames, name);
2071
-
2072
- // exaustive search is a little bit brute force but since removeCommand is
2073
- // not a performance critical operation this should be OK
2074
- var ckb = commmandKeyBinding;
2075
- for (var k1 in ckb) {
2076
- for (var k2 in ckb[k1]) {
2077
- for (var k3 in ckb[k1][k2]) {
2078
- if (ckb[k1][k2][k3] == command)
2079
- delete ckb[k1][k2][k3];
2080
- }
2081
- }
2082
- }
2083
-
2084
- var ckbf = commandKeyBindingFunc;
2085
- for (var k1 in ckbf) {
2086
- for (var k2 in ckbf[k1]) {
2087
- ckbf[k1][k2].forEach(function(cmd, i) {
2088
- if (cmd.command == command) {
2089
- ckbf[k1][k2].splice(i, 1);
2090
- }
2091
- })
2092
- }
2093
- }
2094
- };
2095
-
2096
- function getCommand(name) {
2097
- return commands[name];
2098
- };
2099
-
2100
- function getCommandNames() {
2101
- return commandNames;
2102
- };
2103
-
2104
- /**
2105
- * Default ArgumentProvider that is used if no ArgumentProvider is provided
2106
- * by the command's sender.
2107
- */
2108
- function defaultArgsProvider(request, callback) {
2109
- var args = request.args,
2110
- params = request.command.params;
2111
-
2112
- for (var i = 0; i < params.length; i++) {
2113
- var param = params[i];
2114
-
2115
- // If the parameter is already valid, then don't ask for it anymore.
2116
- if (request.getParamStatus(param) != Status.VALID ||
2117
- // Ask for optional parameters as well.
2118
- param.defaultValue === null)
2119
- {
2120
- var paramPrompt = param.description;
2121
- if (param.defaultValue === null) {
2122
- paramPrompt += " (optional)";
2123
- }
2124
- var value = prompt(paramPrompt, param.defaultValue || "");
2125
- // No value but required -> nope.
2126
- if (!value) {
2127
- callback();
2128
- return;
2129
- } else {
2130
- args[param.name] = value;
2131
- }
2132
- }
2133
- }
2134
- callback();
2135
- }
2136
-
2137
- /**
2138
- * Entry point for keyboard accelerators or anything else that wants to execute
2139
- * a command. A new request object is created and a check performed, if the
2140
- * passed in arguments are VALID/INVALID or INCOMPLETE. If they are INCOMPLETE
2141
- * the ArgumentProvider on the sender is called or otherwise the default
2142
- * ArgumentProvider to get the still required arguments.
2143
- * If they are valid (or valid after the ArgumentProvider is done), the command
2144
- * is executed.
2145
- *
2146
- * @param command Either a command, or the name of one
2147
- * @param env Current environment to execute the command in
2148
- * @param sender String that should be the same as the senderObject stored on
2149
- * the environment in env[sender]
2150
- * @param args Arguments for the command
2151
- * @param typed (Optional)
2152
- */
2153
- function exec(command, env, sender, args, typed) {
2154
- if (typeof command === 'string') {
2155
- command = commands[command];
2156
- }
2157
- if (!command) {
2158
- // TODO: Should we complain more than returning false?
2159
- return false;
2160
- }
2161
-
2162
- var request = new Request({
2163
- sender: sender,
2164
- command: command,
2165
- args: args || {},
2166
- typed: typed
2167
- });
2168
-
2169
- /**
2170
- * Executes the command and ensures request.done is called on the request in
2171
- * case it's not marked to be done already or async.
2172
- */
2173
- function execute() {
2174
- command.exec(env, request.args, request);
2175
-
2176
- // If the request isn't asnync and isn't done, then make it done.
2177
- if (!request.isAsync && !request.isDone) {
2178
- request.done();
2179
- }
2180
- }
2181
-
2182
-
2183
- if (request.getStatus() == Status.INVALID) {
2184
- console.error("Canon.exec: Invalid parameter(s) passed to " +
2185
- command.name);
2186
- return false;
2187
- }
2188
- // If the request isn't complete yet, try to complete it.
2189
- else if (request.getStatus() == Status.INCOMPLETE) {
2190
- // Check if the sender has a ArgsProvider, otherwise use the default
2191
- // build in one.
2192
- var argsProvider;
2193
- var senderObj = env[sender];
2194
- if (!senderObj || !senderObj.getArgsProvider ||
2195
- !(argsProvider = senderObj.getArgsProvider()))
2196
- {
2197
- argsProvider = defaultArgsProvider;
2198
- }
2199
-
2200
- // Ask the paramProvider to complete the request.
2201
- argsProvider(request, function() {
2202
- if (request.getStatus() == Status.VALID) {
2203
- execute();
2204
- }
2205
- });
2206
- return true;
2207
- } else {
2208
- execute();
2209
- return true;
2210
- }
2211
- };
2212
-
2213
- exports.removeCommand = removeCommand;
2214
- exports.addCommand = addCommand;
2215
- exports.getCommand = getCommand;
2216
- exports.getCommandNames = getCommandNames;
2217
- exports.findKeyCommand = findKeyCommand;
2218
- exports.exec = exec;
2219
- exports.execKeyCommand = execKeyCommand;
2220
- exports.upgradeType = upgradeType;
2221
-
2222
-
2223
- /**
2224
- * We publish a 'output' event whenever new command begins output
2225
- * TODO: make this more obvious
2226
- */
2227
- oop.implement(exports, EventEmitter);
2228
-
2229
-
2230
- /**
2231
- * Current requirements are around displaying the command line, and provision
2232
- * of a 'history' command and cursor up|down navigation of history.
2233
- * <p>Future requirements could include:
2234
- * <ul>
2235
- * <li>Multiple command lines
2236
- * <li>The ability to recall key presses (i.e. requests with no output) which
2237
- * will likely be needed for macro recording or similar
2238
- * <li>The ability to store the command history either on the server or in the
2239
- * browser local storage.
2240
- * </ul>
2241
- * <p>The execute() command doesn't really live here, except as part of that
2242
- * last future requirement, and because it doesn't really have anywhere else to
2243
- * live.
2244
- */
2245
-
2246
- /**
2247
- * The array of requests that wish to announce their presence
2248
- */
2249
- var requests = [];
2250
-
2251
- /**
2252
- * How many requests do we store?
2253
- */
2254
- var maxRequestLength = 100;
2255
-
2256
- /**
2257
- * To create an invocation, you need to do something like this (all the ctor
2258
- * args are optional):
2259
- * <pre>
2260
- * var request = new Request({
2261
- * command: command,
2262
- * args: args,
2263
- * typed: typed
2264
- * });
2265
- * </pre>
2266
- * @constructor
2267
- */
2268
- function Request(options) {
2269
- options = options || {};
2270
-
2271
- // Will be used in the keyboard case and the cli case
2272
- this.command = options.command;
2273
-
2274
- // Will be used only in the cli case
2275
- this.args = options.args;
2276
- this.typed = options.typed;
2277
-
2278
- // Have we been initialized?
2279
- this._begunOutput = false;
2280
-
2281
- this.start = new Date();
2282
- this.end = null;
2283
- this.completed = false;
2284
- this.error = false;
2285
- };
2286
-
2287
- oop.implement(Request.prototype, EventEmitter);
2288
-
2289
- /**
2290
- * Return the status of a parameter on the request object.
2291
- */
2292
- Request.prototype.getParamStatus = function(param) {
2293
- var args = this.args || {};
2294
-
2295
- // Check if there is already a value for this parameter.
2296
- if (param.name in args) {
2297
- // If there is no value set and then the value is VALID if it's not
2298
- // required or INCOMPLETE if not set yet.
2299
- if (args[param.name] == null) {
2300
- if (param.defaultValue === null) {
2301
- return Status.VALID;
2302
- } else {
2303
- return Status.INCOMPLETE;
2304
- }
2305
- }
2306
-
2307
- // Check if the parameter value is valid.
2308
- var reply,
2309
- // The passed in value when parsing a type is a string.
2310
- argsValue = args[param.name].toString();
2311
-
2312
- // Type.parse can throw errors.
2313
- try {
2314
- reply = param.type.parse(argsValue);
2315
- } catch (e) {
2316
- return Status.INVALID;
2317
- }
2318
-
2319
- if (reply.status != Status.VALID) {
2320
- return reply.status;
2321
- }
2322
- }
2323
- // Check if the param is marked as required.
2324
- else if (param.defaultValue === undefined) {
2325
- // The parameter is not set on the args object but it's required,
2326
- // which means, things are invalid.
2327
- return Status.INCOMPLETE;
2328
- }
2329
-
2330
- return Status.VALID;
2331
- }
2332
-
2333
- /**
2334
- * Return the status of a parameter name on the request object.
2335
- */
2336
- Request.prototype.getParamNameStatus = function(paramName) {
2337
- var params = this.command.params || [];
2338
-
2339
- for (var i = 0; i < params.length; i++) {
2340
- if (params[i].name == paramName) {
2341
- return this.getParamStatus(params[i]);
2342
- }
2343
- }
2344
-
2345
- throw "Parameter '" + paramName +
2346
- "' not defined on command '" + this.command.name + "'";
2347
- }
2348
-
2349
- /**
2350
- * Checks if all required arguments are set on the request such that it can
2351
- * get executed.
2352
- */
2353
- Request.prototype.getStatus = function() {
2354
- var args = this.args || {},
2355
- params = this.command.params;
2356
-
2357
- // If there are not parameters, then it's valid.
2358
- if (!params || params.length == 0) {
2359
- return Status.VALID;
2360
- }
2361
-
2362
- var status = [];
2363
- for (var i = 0; i < params.length; i++) {
2364
- status.push(this.getParamStatus(params[i]));
2365
- }
2366
-
2367
- return Status.combine(status);
2368
- }
2369
-
2370
- /**
2371
- * Lazy init to register with the history should only be done on output.
2372
- * init() is expensive, and won't be used in the majority of cases
2373
- */
2374
- Request.prototype._beginOutput = function() {
2375
- this._begunOutput = true;
2376
- this.outputs = [];
2377
-
2378
- requests.push(this);
2379
- // This could probably be optimized with some maths, but 99.99% of the
2380
- // time we will only be off by one, and I'm feeling lazy.
2381
- while (requests.length > maxRequestLength) {
2382
- requests.shiftObject();
2383
- }
2384
-
2385
- exports._dispatchEvent('output', { requests: requests, request: this });
2386
- };
2387
-
2388
- /**
2389
- * Sugar for:
2390
- * <pre>request.error = true; request.done(output);</pre>
2391
- */
2392
- Request.prototype.doneWithError = function(content) {
2393
- this.error = true;
2394
- this.done(content);
2395
- };
2396
-
2397
- /**
2398
- * Declares that this function will not be automatically done when
2399
- * the command exits
2400
- */
2401
- Request.prototype.async = function() {
2402
- this.isAsync = true;
2403
- if (!this._begunOutput) {
2404
- this._beginOutput();
2405
- }
2406
- };
2407
-
2408
- /**
2409
- * Complete the currently executing command with successful output.
2410
- * @param output Either DOM node, an SproutCore element or something that
2411
- * can be used in the content of a DIV to create a DOM node.
2412
- */
2413
- Request.prototype.output = function(content) {
2414
- if (!this._begunOutput) {
2415
- this._beginOutput();
2416
- }
2417
-
2418
- if (typeof content !== 'string' && !(content instanceof Node)) {
2419
- content = content.toString();
2420
- }
2421
-
2422
- this.outputs.push(content);
2423
- this.isDone = true;
2424
- this._dispatchEvent('output', {});
2425
-
2426
- return this;
2427
- };
2428
-
2429
- /**
2430
- * All commands that do output must call this to indicate that the command
2431
- * has finished execution.
2432
- */
2433
- Request.prototype.done = function(content) {
2434
- this.completed = true;
2435
- this.end = new Date();
2436
- this.duration = this.end.getTime() - this.start.getTime();
2437
-
2438
- if (content) {
2439
- this.output(content);
2440
- }
2441
-
2442
- // Ensure to finish the request only once.
2443
- if (!this.isDone) {
2444
- this.isDone = true;
2445
- this._dispatchEvent('output', {});
2446
- }
2447
- };
2448
- exports.Request = Request;
2449
-
2450
-
2451
- });
2452
- /* ***** BEGIN LICENSE BLOCK *****
2453
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2454
- *
2455
- * The contents of this file are subject to the Mozilla Public License Version
2456
- * 1.1 (the "License"); you may not use this file except in compliance with
2457
- * the License. You may obtain a copy of the License at
2458
- * http://www.mozilla.org/MPL/
2459
- *
2460
- * Software distributed under the License is distributed on an "AS IS" basis,
2461
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2462
- * for the specific language governing rights and limitations under the
2463
- * License.
2464
- *
2465
- * The Original Code is Mozilla Skywriter.
2466
- *
2467
- * The Initial Developer of the Original Code is
2468
- * Mozilla.
2469
- * Portions created by the Initial Developer are Copyright (C) 2009
2470
- * the Initial Developer. All Rights Reserved.
2471
- *
2472
- * Contributor(s):
2473
- * Joe Walker (jwalker@mozilla.com)
2474
- * Patrick Walton (pwalton@mozilla.com)
2475
- * Julian Viereck (jviereck@mozilla.com)
2476
- *
2477
- * Alternatively, the contents of this file may be used under the terms of
2478
- * either the GNU General Public License Version 2 or later (the "GPL"), or
2479
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2480
- * in which case the provisions of the GPL or the LGPL are applicable instead
2481
- * of those above. If you wish to allow use of your version of this file only
2482
- * under the terms of either the GPL or the LGPL, and not to allow others to
2483
- * use your version of this file under the terms of the MPL, indicate your
2484
- * decision by deleting the provisions above and replace them with the notice
2485
- * and other provisions required by the GPL or the LGPL. If you do not delete
2486
- * the provisions above, a recipient may use your version of this file under
2487
- * the terms of any one of the MPL, the GPL or the LGPL.
2488
- *
2489
- * ***** END LICENSE BLOCK ***** */
2490
- define('pilot/console', ['require', 'exports', 'module' ], function(require, exports, module) {
2491
-
2492
- /**
2493
- * This object represents a "safe console" object that forwards debugging
2494
- * messages appropriately without creating a dependency on Firebug in Firefox.
2495
- */
2496
-
2497
- var noop = function() {};
2498
-
2499
- // These are the functions that are available in Chrome 4/5, Safari 4
2500
- // and Firefox 3.6. Don't add to this list without checking browser support
2501
- var NAMES = [
2502
- "assert", "count", "debug", "dir", "dirxml", "error", "group", "groupEnd",
2503
- "info", "log", "profile", "profileEnd", "time", "timeEnd", "trace", "warn"
2504
- ];
2505
-
2506
- if (typeof(window) === 'undefined') {
2507
- // We're in a web worker. Forward to the main thread so the messages
2508
- // will show up.
2509
- NAMES.forEach(function(name) {
2510
- exports[name] = function() {
2511
- var args = Array.prototype.slice.call(arguments);
2512
- var msg = { op: 'log', method: name, args: args };
2513
- postMessage(JSON.stringify(msg));
2514
- };
2515
- });
2516
- } else {
2517
- // For each of the console functions, copy them if they exist, stub if not
2518
- NAMES.forEach(function(name) {
2519
- if (window.console && window.console[name]) {
2520
- exports[name] = Function.prototype.bind.call(window.console[name], window.console);
2521
- } else {
2522
- exports[name] = noop;
2523
- }
2524
- });
2525
- }
2526
-
2527
- });
2528
- define('pilot/stacktrace', ['require', 'exports', 'module' , 'pilot/useragent', 'pilot/console'], function(require, exports, module) {
2529
-
2530
- var ua = require("pilot/useragent");
2531
- var console = require('pilot/console');
2532
-
2533
- // Changed to suit the specific needs of running within Skywriter
2534
-
2535
- // Domain Public by Eric Wendelin http://eriwen.com/ (2008)
2536
- // Luke Smith http://lucassmith.name/ (2008)
2537
- // Loic Dachary <loic@dachary.org> (2008)
2538
- // Johan Euphrosine <proppy@aminche.com> (2008)
2539
- // Øyvind Sean Kinsey http://kinsey.no/blog
2540
- //
2541
- // Information and discussions
2542
- // http://jspoker.pokersource.info/skin/test-printstacktrace.html
2543
- // http://eriwen.com/javascript/js-stack-trace/
2544
- // http://eriwen.com/javascript/stacktrace-update/
2545
- // http://pastie.org/253058
2546
- // http://browsershots.org/http://jspoker.pokersource.info/skin/test-printstacktrace.html
2547
- //
2548
-
2549
- //
2550
- // guessFunctionNameFromLines comes from firebug
2551
- //
2552
- // Software License Agreement (BSD License)
2553
- //
2554
- // Copyright (c) 2007, Parakey Inc.
2555
- // All rights reserved.
2556
- //
2557
- // Redistribution and use of this software in source and binary forms, with or without modification,
2558
- // are permitted provided that the following conditions are met:
2559
- //
2560
- // * Redistributions of source code must retain the above
2561
- // copyright notice, this list of conditions and the
2562
- // following disclaimer.
2563
- //
2564
- // * Redistributions in binary form must reproduce the above
2565
- // copyright notice, this list of conditions and the
2566
- // following disclaimer in the documentation and/or other
2567
- // materials provided with the distribution.
2568
- //
2569
- // * Neither the name of Parakey Inc. nor the names of its
2570
- // contributors may be used to endorse or promote products
2571
- // derived from this software without specific prior
2572
- // written permission of Parakey Inc.
2573
- //
2574
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
2575
- // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2576
- // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
2577
- // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2578
- // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2579
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
2580
- // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2581
- // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2582
-
2583
-
2584
-
2585
- /**
2586
- * Different browsers create stack traces in different ways.
2587
- * <strike>Feature</strike> Browser detection baby ;).
2588
- */
2589
- var mode = (function() {
2590
-
2591
- // We use SC's browser detection here to avoid the "break on error"
2592
- // functionality provided by Firebug. Firebug tries to do the right
2593
- // thing here and break, but it happens every time you load the page.
2594
- // bug 554105
2595
- if (ua.isGecko) {
2596
- return 'firefox';
2597
- } else if (ua.isOpera) {
2598
- return 'opera';
2599
- } else {
2600
- return 'other';
2601
- }
2602
-
2603
- // SC doesn't do any detection of Chrome at this time.
2604
-
2605
- // this is the original feature detection code that is used as a
2606
- // fallback.
2607
- try {
2608
- (0)();
2609
- } catch (e) {
2610
- if (e.arguments) {
2611
- return 'chrome';
2612
- }
2613
- if (e.stack) {
2614
- return 'firefox';
2615
- }
2616
- if (window.opera && !('stacktrace' in e)) { //Opera 9-
2617
- return 'opera';
2618
- }
2619
- }
2620
- return 'other';
2621
- })();
2622
-
2623
- /**
2624
- *
2625
- */
2626
- function stringifyArguments(args) {
2627
- for (var i = 0; i < args.length; ++i) {
2628
- var argument = args[i];
2629
- if (typeof argument == 'object') {
2630
- args[i] = '#object';
2631
- } else if (typeof argument == 'function') {
2632
- args[i] = '#function';
2633
- } else if (typeof argument == 'string') {
2634
- args[i] = '"' + argument + '"';
2635
- }
2636
- }
2637
- return args.join(',');
2638
- }
2639
-
2640
- /**
2641
- * Extract a stack trace from the format emitted by each browser.
2642
- */
2643
- var decoders = {
2644
- chrome: function(e) {
2645
- var stack = e.stack;
2646
- if (!stack) {
2647
- console.log(e);
2648
- return [];
2649
- }
2650
- return stack.replace(/^.*?\n/, '').
2651
- replace(/^.*?\n/, '').
2652
- replace(/^.*?\n/, '').
2653
- replace(/^[^\(]+?[\n$]/gm, '').
2654
- replace(/^\s+at\s+/gm, '').
2655
- replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@').
2656
- split('\n');
2657
- },
2658
-
2659
- firefox: function(e) {
2660
- var stack = e.stack;
2661
- if (!stack) {
2662
- console.log(e);
2663
- return [];
2664
- }
2665
- // stack = stack.replace(/^.*?\n/, '');
2666
- stack = stack.replace(/(?:\n@:0)?\s+$/m, '');
2667
- stack = stack.replace(/^\(/gm, '{anonymous}(');
2668
- return stack.split('\n');
2669
- },
2670
-
2671
- // Opera 7.x and 8.x only!
2672
- opera: function(e) {
2673
- var lines = e.message.split('\n'), ANON = '{anonymous}',
2674
- lineRE = /Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i, i, j, len;
2675
-
2676
- for (i = 4, j = 0, len = lines.length; i < len; i += 2) {
2677
- if (lineRE.test(lines[i])) {
2678
- lines[j++] = (RegExp.$3 ? RegExp.$3 + '()@' + RegExp.$2 + RegExp.$1 : ANON + '()@' + RegExp.$2 + ':' + RegExp.$1) +
2679
- ' -- ' +
2680
- lines[i + 1].replace(/^\s+/, '');
2681
- }
2682
- }
2683
-
2684
- lines.splice(j, lines.length - j);
2685
- return lines;
2686
- },
2687
-
2688
- // Safari, Opera 9+, IE, and others
2689
- other: function(curr) {
2690
- var ANON = '{anonymous}', fnRE = /function\s*([\w\-$]+)?\s*\(/i, stack = [], j = 0, fn, args;
2691
-
2692
- var maxStackSize = 10;
2693
- while (curr && stack.length < maxStackSize) {
2694
- fn = fnRE.test(curr.toString()) ? RegExp.$1 || ANON : ANON;
2695
- args = Array.prototype.slice.call(curr['arguments']);
2696
- stack[j++] = fn + '(' + stringifyArguments(args) + ')';
2697
-
2698
- //Opera bug: if curr.caller does not exist, Opera returns curr (WTF)
2699
- if (curr === curr.caller && window.opera) {
2700
- //TODO: check for same arguments if possible
2701
- break;
2702
- }
2703
- curr = curr.caller;
2704
- }
2705
- return stack;
2706
- }
2707
- };
2708
-
2709
- /**
2710
- *
2711
- */
2712
- function NameGuesser() {
2713
- }
2714
-
2715
- NameGuesser.prototype = {
2716
-
2717
- sourceCache: {},
2718
-
2719
- ajax: function(url) {
2720
- var req = this.createXMLHTTPObject();
2721
- if (!req) {
2722
- return;
2723
- }
2724
- req.open('GET', url, false);
2725
- req.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
2726
- req.send('');
2727
- return req.responseText;
2728
- },
2729
-
2730
- createXMLHTTPObject: function() {
2731
- // Try XHR methods in order and store XHR factory
2732
- var xmlhttp, XMLHttpFactories = [
2733
- function() {
2734
- return new XMLHttpRequest();
2735
- }, function() {
2736
- return new ActiveXObject('Msxml2.XMLHTTP');
2737
- }, function() {
2738
- return new ActiveXObject('Msxml3.XMLHTTP');
2739
- }, function() {
2740
- return new ActiveXObject('Microsoft.XMLHTTP');
2741
- }
2742
- ];
2743
- for (var i = 0; i < XMLHttpFactories.length; i++) {
2744
- try {
2745
- xmlhttp = XMLHttpFactories[i]();
2746
- // Use memoization to cache the factory
2747
- this.createXMLHTTPObject = XMLHttpFactories[i];
2748
- return xmlhttp;
2749
- } catch (e) {}
2750
- }
2751
- },
2752
-
2753
- getSource: function(url) {
2754
- if (!(url in this.sourceCache)) {
2755
- this.sourceCache[url] = this.ajax(url).split('\n');
2756
- }
2757
- return this.sourceCache[url];
2758
- },
2759
-
2760
- guessFunctions: function(stack) {
2761
- for (var i = 0; i < stack.length; ++i) {
2762
- var reStack = /{anonymous}\(.*\)@(\w+:\/\/([-\w\.]+)+(:\d+)?[^:]+):(\d+):?(\d+)?/;
2763
- var frame = stack[i], m = reStack.exec(frame);
2764
- if (m) {
2765
- var file = m[1], lineno = m[4]; //m[7] is character position in Chrome
2766
- if (file && lineno) {
2767
- var functionName = this.guessFunctionName(file, lineno);
2768
- stack[i] = frame.replace('{anonymous}', functionName);
2769
- }
2770
- }
2771
- }
2772
- return stack;
2773
- },
2774
-
2775
- guessFunctionName: function(url, lineNo) {
2776
- try {
2777
- return this.guessFunctionNameFromLines(lineNo, this.getSource(url));
2778
- } catch (e) {
2779
- return 'getSource failed with url: ' + url + ', exception: ' + e.toString();
2780
- }
2781
- },
2782
-
2783
- guessFunctionNameFromLines: function(lineNo, source) {
2784
- var reFunctionArgNames = /function ([^(]*)\(([^)]*)\)/;
2785
- var reGuessFunction = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(function|eval|new Function)/;
2786
- // Walk backwards from the first line in the function until we find the line which
2787
- // matches the pattern above, which is the function definition
2788
- var line = '', maxLines = 10;
2789
- for (var i = 0; i < maxLines; ++i) {
2790
- line = source[lineNo - i] + line;
2791
- if (line !== undefined) {
2792
- var m = reGuessFunction.exec(line);
2793
- if (m) {
2794
- return m[1];
2795
- }
2796
- else {
2797
- m = reFunctionArgNames.exec(line);
2798
- }
2799
- if (m && m[1]) {
2800
- return m[1];
2801
- }
2802
- }
2803
- }
2804
- return '(?)';
2805
- }
2806
- };
2807
-
2808
- var guesser = new NameGuesser();
2809
-
2810
- var frameIgnorePatterns = [
2811
- /http:\/\/localhost:4020\/sproutcore.js:/
2812
- ];
2813
-
2814
- exports.ignoreFramesMatching = function(regex) {
2815
- frameIgnorePatterns.push(regex);
2816
- };
2817
-
2818
- /**
2819
- * Create a stack trace from an exception
2820
- * @param ex {Error} The error to create a stacktrace from (optional)
2821
- * @param guess {Boolean} If we should try to resolve the names of anonymous functions
2822
- */
2823
- exports.Trace = function Trace(ex, guess) {
2824
- this._ex = ex;
2825
- this._stack = decoders[mode](ex);
2826
-
2827
- if (guess) {
2828
- this._stack = guesser.guessFunctions(this._stack);
2829
- }
2830
- };
2831
-
2832
- /**
2833
- * Log to the console a number of lines (default all of them)
2834
- * @param lines {number} Maximum number of lines to wrote to console
2835
- */
2836
- exports.Trace.prototype.log = function(lines) {
2837
- if (lines <= 0) {
2838
- // You aren't going to have more lines in your stack trace than this
2839
- // and it still fits in a 32bit integer
2840
- lines = 999999999;
2841
- }
2842
-
2843
- var printed = 0;
2844
- for (var i = 0; i < this._stack.length && printed < lines; i++) {
2845
- var frame = this._stack[i];
2846
- var display = true;
2847
- frameIgnorePatterns.forEach(function(regex) {
2848
- if (regex.test(frame)) {
2849
- display = false;
2850
- }
2851
- });
2852
- if (display) {
2853
- console.debug(frame);
2854
- printed++;
2855
- }
2856
- }
2857
- };
2858
-
2859
- });
2860
- /* ***** BEGIN LICENSE BLOCK *****
2861
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2862
- *
2863
- * The contents of this file are subject to the Mozilla Public License Version
2864
- * 1.1 (the "License"); you may not use this file except in compliance with
2865
- * the License. You may obtain a copy of the License at
2866
- * http://www.mozilla.org/MPL/
2867
- *
2868
- * Software distributed under the License is distributed on an "AS IS" basis,
2869
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2870
- * for the specific language governing rights and limitations under the
2871
- * License.
2872
- *
2873
- * The Original Code is Ajax.org Code Editor (ACE).
2874
- *
2875
- * The Initial Developer of the Original Code is
2876
- * Ajax.org B.V.
2877
- * Portions created by the Initial Developer are Copyright (C) 2010
2878
- * the Initial Developer. All Rights Reserved.
2879
- *
2880
- * Contributor(s):
2881
- * Fabian Jakobs <fabian AT ajax DOT org>
2882
- *
2883
- * Alternatively, the contents of this file may be used under the terms of
2884
- * either the GNU General Public License Version 2 or later (the "GPL"), or
2885
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2886
- * in which case the provisions of the GPL or the LGPL are applicable instead
2887
- * of those above. If you wish to allow use of your version of this file only
2888
- * under the terms of either the GPL or the LGPL, and not to allow others to
2889
- * use your version of this file under the terms of the MPL, indicate your
2890
- * decision by deleting the provisions above and replace them with the notice
2891
- * and other provisions required by the GPL or the LGPL. If you do not delete
2892
- * the provisions above, a recipient may use your version of this file under
2893
- * the terms of any one of the MPL, the GPL or the LGPL.
2894
- *
2895
- * ***** END LICENSE BLOCK ***** */
2896
-
2897
- define('pilot/useragent', ['require', 'exports', 'module' ], function(require, exports, module) {
2898
-
2899
- var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
2900
- var ua = navigator.userAgent;
2901
- var av = navigator.appVersion;
2902
-
2903
- /** Is the user using a browser that identifies itself as Windows */
2904
- exports.isWin = (os == "win");
2905
-
2906
- /** Is the user using a browser that identifies itself as Mac OS */
2907
- exports.isMac = (os == "mac");
2908
-
2909
- /** Is the user using a browser that identifies itself as Linux */
2910
- exports.isLinux = (os == "linux");
2911
-
2912
- exports.isIE = ! + "\v1";
2913
-
2914
- /** Is this Firefox or related? */
2915
- exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
2916
-
2917
- /** oldGecko == rev < 2.0 **/
2918
- exports.isOldGecko = exports.isGecko && /rv\:1/.test(navigator.userAgent);
2919
-
2920
- /** Is this Opera */
2921
- exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
2922
-
2923
- /** Is the user using a browser that identifies itself as WebKit */
2924
- exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
2925
-
2926
- exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
2927
-
2928
- exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
2929
-
2930
- exports.isIPad = ua.indexOf("iPad") >= 0;
2931
-
2932
- /**
2933
- * I hate doing this, but we need some way to determine if the user is on a Mac
2934
- * The reason is that users have different expectations of their key combinations.
2935
- *
2936
- * Take copy as an example, Mac people expect to use CMD or APPLE + C
2937
- * Windows folks expect to use CTRL + C
2938
- */
2939
- exports.OS = {
2940
- LINUX: 'LINUX',
2941
- MAC: 'MAC',
2942
- WINDOWS: 'WINDOWS'
2943
- };
2944
-
2945
- /**
2946
- * Return an exports.OS constant
2947
- */
2948
- exports.getOS = function() {
2949
- if (exports.isMac) {
2950
- return exports.OS['MAC'];
2951
- } else if (exports.isLinux) {
2952
- return exports.OS['LINUX'];
2953
- } else {
2954
- return exports.OS['WINDOWS'];
2955
- }
2956
- };
2957
-
2958
- });
2959
- /* ***** BEGIN LICENSE BLOCK *****
2960
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2961
- *
2962
- * The contents of this file are subject to the Mozilla Public License Version
2963
- * 1.1 (the "License"); you may not use this file except in compliance with
2964
- * the License. You may obtain a copy of the License at
2965
- * http://www.mozilla.org/MPL/
2966
- *
2967
- * Software distributed under the License is distributed on an "AS IS" basis,
2968
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
2969
- * for the specific language governing rights and limitations under the
2970
- * License.
2971
- *
2972
- * The Original Code is Ajax.org Code Editor (ACE).
2973
- *
2974
- * The Initial Developer of the Original Code is
2975
- * Ajax.org B.V.
2976
- * Portions created by the Initial Developer are Copyright (C) 2010
2977
- * the Initial Developer. All Rights Reserved.
2978
- *
2979
- * Contributor(s):
2980
- * Fabian Jakobs <fabian AT ajax DOT org>
2981
- *
2982
- * Alternatively, the contents of this file may be used under the terms of
2983
- * either the GNU General Public License Version 2 or later (the "GPL"), or
2984
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
2985
- * in which case the provisions of the GPL or the LGPL are applicable instead
2986
- * of those above. If you wish to allow use of your version of this file only
2987
- * under the terms of either the GPL or the LGPL, and not to allow others to
2988
- * use your version of this file under the terms of the MPL, indicate your
2989
- * decision by deleting the provisions above and replace them with the notice
2990
- * and other provisions required by the GPL or the LGPL. If you do not delete
2991
- * the provisions above, a recipient may use your version of this file under
2992
- * the terms of any one of the MPL, the GPL or the LGPL.
2993
- *
2994
- * ***** END LICENSE BLOCK ***** */
2995
-
2996
- define('pilot/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
2997
-
2998
- exports.inherits = (function() {
2999
- var tempCtor = function() {};
3000
- return function(ctor, superCtor) {
3001
- tempCtor.prototype = superCtor.prototype;
3002
- ctor.super_ = superCtor.prototype;
3003
- ctor.prototype = new tempCtor();
3004
- ctor.prototype.constructor = ctor;
3005
- }
3006
- }());
3007
-
3008
- exports.mixin = function(obj, mixin) {
3009
- for (var key in mixin) {
3010
- obj[key] = mixin[key];
3011
- }
3012
- };
3013
-
3014
- exports.implement = function(proto, mixin) {
3015
- exports.mixin(proto, mixin);
3016
- };
3017
-
3018
- });
3019
- /*! @license
3020
- ==========================================================================
3021
- SproutCore -- JavaScript Application Framework
3022
- copyright 2006-2009, Sprout Systems Inc., Apple Inc. and contributors.
3023
-
3024
- Permission is hereby granted, free of charge, to any person obtaining a
3025
- copy of this software and associated documentation files (the "Software"),
3026
- to deal in the Software without restriction, including without limitation
3027
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
3028
- and/or sell copies of the Software, and to permit persons to whom the
3029
- Software is furnished to do so, subject to the following conditions:
3030
-
3031
- The above copyright notice and this permission notice shall be included in
3032
- all copies or substantial portions of the Software.
3033
-
3034
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3035
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3036
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3037
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3038
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3039
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3040
- DEALINGS IN THE SOFTWARE.
3041
-
3042
- SproutCore and the SproutCore logo are trademarks of Sprout Systems, Inc.
3043
-
3044
- For more information about SproutCore, visit http://www.sproutcore.com
3045
-
3046
-
3047
- ==========================================================================
3048
- @license */
3049
-
3050
- // Most of the following code is taken from SproutCore with a few changes.
3051
-
3052
- define('pilot/keys', ['require', 'exports', 'module' , 'pilot/oop'], function(require, exports, module) {
3053
-
3054
- var oop = require("pilot/oop");
3055
-
3056
- /**
3057
- * Helper functions and hashes for key handling.
3058
- */
3059
- var Keys = (function() {
3060
- var ret = {
3061
- MODIFIER_KEYS: {
3062
- 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
3063
- },
3064
-
3065
- KEY_MODS: {
3066
- "ctrl": 1, "alt": 2, "option" : 2,
3067
- "shift": 4, "meta": 8, "command": 8
3068
- },
3069
-
3070
- FUNCTION_KEYS : {
3071
- 8 : "Backspace",
3072
- 9 : "Tab",
3073
- 13 : "Return",
3074
- 19 : "Pause",
3075
- 27 : "Esc",
3076
- 32 : "Space",
3077
- 33 : "PageUp",
3078
- 34 : "PageDown",
3079
- 35 : "End",
3080
- 36 : "Home",
3081
- 37 : "Left",
3082
- 38 : "Up",
3083
- 39 : "Right",
3084
- 40 : "Down",
3085
- 44 : "Print",
3086
- 45 : "Insert",
3087
- 46 : "Delete",
3088
- 112: "F1",
3089
- 113: "F2",
3090
- 114: "F3",
3091
- 115: "F4",
3092
- 116: "F5",
3093
- 117: "F6",
3094
- 118: "F7",
3095
- 119: "F8",
3096
- 120: "F9",
3097
- 121: "F10",
3098
- 122: "F11",
3099
- 123: "F12",
3100
- 144: "Numlock",
3101
- 145: "Scrolllock"
3102
- },
3103
-
3104
- PRINTABLE_KEYS: {
3105
- 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
3106
- 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
3107
- 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
3108
- 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
3109
- 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
3110
- 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
3111
- 188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\',
3112
- 221: ']', 222: '\"'
3113
- }
3114
- };
3115
-
3116
- // A reverse map of FUNCTION_KEYS
3117
- for (i in ret.FUNCTION_KEYS) {
3118
- var name = ret.FUNCTION_KEYS[i].toUpperCase();
3119
- ret[name] = parseInt(i, 10);
3120
- }
3121
-
3122
- // Add the MODIFIER_KEYS, FUNCTION_KEYS and PRINTABLE_KEYS to the KEY
3123
- // variables as well.
3124
- oop.mixin(ret, ret.MODIFIER_KEYS);
3125
- oop.mixin(ret, ret.PRINTABLE_KEYS);
3126
- oop.mixin(ret, ret.FUNCTION_KEYS);
3127
-
3128
- return ret;
3129
- })();
3130
- oop.mixin(exports, Keys);
3131
-
3132
- exports.keyCodeToString = function(keyCode) {
3133
- return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
3134
- }
3135
-
3136
- });
3137
- /* vim:ts=4:sts=4:sw=4:
3138
- * ***** BEGIN LICENSE BLOCK *****
3139
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3140
- *
3141
- * The contents of this file are subject to the Mozilla Public License Version
3142
- * 1.1 (the "License"); you may not use this file except in compliance with
3143
- * the License. You may obtain a copy of the License at
3144
- * http://www.mozilla.org/MPL/
3145
- *
3146
- * Software distributed under the License is distributed on an "AS IS" basis,
3147
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
3148
- * for the specific language governing rights and limitations under the
3149
- * License.
3150
- *
3151
- * The Original Code is Ajax.org Code Editor (ACE).
3152
- *
3153
- * The Initial Developer of the Original Code is
3154
- * Ajax.org B.V.
3155
- * Portions created by the Initial Developer are Copyright (C) 2010
3156
- * the Initial Developer. All Rights Reserved.
3157
- *
3158
- * Contributor(s):
3159
- * Fabian Jakobs <fabian AT ajax DOT org>
3160
- * Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
3161
- *
3162
- * Alternatively, the contents of this file may be used under the terms of
3163
- * either the GNU General Public License Version 2 or later (the "GPL"), or
3164
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
3165
- * in which case the provisions of the GPL or the LGPL are applicable instead
3166
- * of those above. If you wish to allow use of your version of this file only
3167
- * under the terms of either the GPL or the LGPL, and not to allow others to
3168
- * use your version of this file under the terms of the MPL, indicate your
3169
- * decision by deleting the provisions above and replace them with the notice
3170
- * and other provisions required by the GPL or the LGPL. If you do not delete
3171
- * the provisions above, a recipient may use your version of this file under
3172
- * the terms of any one of the MPL, the GPL or the LGPL.
3173
- *
3174
- * ***** END LICENSE BLOCK ***** */
3175
-
3176
- define('pilot/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
3177
-
3178
- var EventEmitter = {};
3179
-
3180
- EventEmitter._emit =
3181
- EventEmitter._dispatchEvent = function(eventName, e) {
3182
- this._eventRegistry = this._eventRegistry || {};
3183
-
3184
- var listeners = this._eventRegistry[eventName];
3185
- if (!listeners || !listeners.length) return;
3186
-
3187
- var e = e || {};
3188
- e.type = eventName;
3189
-
3190
- for (var i=0; i<listeners.length; i++) {
3191
- listeners[i](e);
3192
- }
3193
- };
3194
-
3195
- EventEmitter.on =
3196
- EventEmitter.addEventListener = function(eventName, callback) {
3197
- this._eventRegistry = this._eventRegistry || {};
3198
-
3199
- var listeners = this._eventRegistry[eventName];
3200
- if (!listeners) {
3201
- var listeners = this._eventRegistry[eventName] = [];
3202
- }
3203
- if (listeners.indexOf(callback) == -1) {
3204
- listeners.push(callback);
3205
- }
3206
- };
3207
-
3208
- EventEmitter.removeListener =
3209
- EventEmitter.removeEventListener = function(eventName, callback) {
3210
- this._eventRegistry = this._eventRegistry || {};
3211
-
3212
- var listeners = this._eventRegistry[eventName];
3213
- if (!listeners) {
3214
- return;
3215
- }
3216
- var index = listeners.indexOf(callback);
3217
- if (index !== -1) {
3218
- listeners.splice(index, 1);
3219
- }
3220
- };
3221
-
3222
- EventEmitter.removeAllListeners = function(eventName) {
3223
- if (this._eventRegistry) this._eventRegistry[eventName] = [];
3224
- }
3225
-
3226
- exports.EventEmitter = EventEmitter;
3227
-
3228
- });
3229
- /* ***** BEGIN LICENSE BLOCK *****
3230
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3231
- *
3232
- * The contents of this file are subject to the Mozilla Public License Version
3233
- * 1.1 (the "License"); you may not use this file except in compliance with
3234
- * the License. You may obtain a copy of the License at
3235
- * http://www.mozilla.org/MPL/
3236
- *
3237
- * Software distributed under the License is distributed on an "AS IS" basis,
3238
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
3239
- * for the specific language governing rights and limitations under the
3240
- * License.
3241
- *
3242
- * The Original Code is Skywriter.
3243
- *
3244
- * The Initial Developer of the Original Code is
3245
- * Mozilla.
3246
- * Portions created by the Initial Developer are Copyright (C) 2009
3247
- * the Initial Developer. All Rights Reserved.
3248
- *
3249
- * Contributor(s):
3250
- * Joe Walker (jwalker@mozilla.com)
3251
- *
3252
- * Alternatively, the contents of this file may be used under the terms of
3253
- * either the GNU General Public License Version 2 or later (the "GPL"), or
3254
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
3255
- * in which case the provisions of the GPL or the LGPL are applicable instead
3256
- * of those above. If you wish to allow use of your version of this file only
3257
- * under the terms of either the GPL or the LGPL, and not to allow others to
3258
- * use your version of this file under the terms of the MPL, indicate your
3259
- * decision by deleting the provisions above and replace them with the notice
3260
- * and other provisions required by the GPL or the LGPL. If you do not delete
3261
- * the provisions above, a recipient may use your version of this file under
3262
- * the terms of any one of the MPL, the GPL or the LGPL.
3263
- *
3264
- * ***** END LICENSE BLOCK ***** */
3265
-
3266
- define('pilot/typecheck', ['require', 'exports', 'module' ], function(require, exports, module) {
3267
-
3268
- var objectToString = Object.prototype.toString;
3269
-
3270
- /**
3271
- * Return true if it is a String
3272
- */
3273
- exports.isString = function(it) {
3274
- return it && objectToString.call(it) === "[object String]";
3275
- };
3276
-
3277
- /**
3278
- * Returns true if it is a Boolean.
3279
- */
3280
- exports.isBoolean = function(it) {
3281
- return it && objectToString.call(it) === "[object Boolean]";
3282
- };
3283
-
3284
- /**
3285
- * Returns true if it is a Number.
3286
- */
3287
- exports.isNumber = function(it) {
3288
- return it && objectToString.call(it) === "[object Number]" && isFinite(it);
3289
- };
3290
-
3291
- /**
3292
- * Hack copied from dojo.
3293
- */
3294
- exports.isObject = function(it) {
3295
- return it !== undefined &&
3296
- (it === null || typeof it == "object" ||
3297
- Array.isArray(it) || exports.isFunction(it));
3298
- };
3299
-
3300
- /**
3301
- * Is the passed object a function?
3302
- * From dojo.isFunction()
3303
- */
3304
- exports.isFunction = function(it) {
3305
- return it && objectToString.call(it) === "[object Function]";
3306
- };
3307
-
3308
- });/* ***** BEGIN LICENSE BLOCK *****
3309
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3310
- *
3311
- * The contents of this file are subject to the Mozilla Public License Version
3312
- * 1.1 (the "License"); you may not use this file except in compliance with
3313
- * the License. You may obtain a copy of the License at
3314
- * http://www.mozilla.org/MPL/
3315
- *
3316
- * Software distributed under the License is distributed on an "AS IS" basis,
3317
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
3318
- * for the specific language governing rights and limitations under the
3319
- * License.
3320
- *
3321
- * The Original Code is Mozilla Skywriter.
3322
- *
3323
- * The Initial Developer of the Original Code is
3324
- * Mozilla.
3325
- * Portions created by the Initial Developer are Copyright (C) 2009
3326
- * the Initial Developer. All Rights Reserved.
3327
- *
3328
- * Contributor(s):
3329
- * Julian Viereck (jviereck@mozilla.com)
3330
- *
3331
- * Alternatively, the contents of this file may be used under the terms of
3332
- * either the GNU General Public License Version 2 or later (the "GPL"), or
3333
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
3334
- * in which case the provisions of the GPL or the LGPL are applicable instead
3335
- * of those above. If you wish to allow use of your version of this file only
3336
- * under the terms of either the GPL or the LGPL, and not to allow others to
3337
- * use your version of this file under the terms of the MPL, indicate your
3338
- * decision by deleting the provisions above and replace them with the notice
3339
- * and other provisions required by the GPL or the LGPL. If you do not delete
3340
- * the provisions above, a recipient may use your version of this file under
3341
- * the terms of any one of the MPL, the GPL or the LGPL.
3342
- *
3343
- * ***** END LICENSE BLOCK ***** */
3344
-
3345
- define('pilot/catalog', ['require', 'exports', 'module' ], function(require, exports, module) {
3346
-
3347
-
3348
- var extensionSpecs = {};
3349
-
3350
- exports.addExtensionSpec = function(extensionSpec) {
3351
- extensionSpecs[extensionSpec.name] = extensionSpec;
3352
- };
3353
-
3354
- exports.removeExtensionSpec = function(extensionSpec) {
3355
- if (typeof extensionSpec === "string") {
3356
- delete extensionSpecs[extensionSpec];
3357
- }
3358
- else {
3359
- delete extensionSpecs[extensionSpec.name];
3360
- }
3361
- };
3362
-
3363
- exports.getExtensionSpec = function(name) {
3364
- return extensionSpecs[name];
3365
- };
3366
-
3367
- exports.getExtensionSpecs = function() {
3368
- return Object.keys(extensionSpecs);
3369
- };
3370
-
3371
-
3372
- });
3373
- /* ***** BEGIN LICENSE BLOCK *****
3374
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3375
- *
3376
- * The contents of this file are subject to the Mozilla Public License Version
3377
- * 1.1 (the "License"); you may not use this file except in compliance with
3378
- * the License. You may obtain a copy of the License at
3379
- * http://www.mozilla.org/MPL/
3380
- *
3381
- * Software distributed under the License is distributed on an "AS IS" basis,
3382
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
3383
- * for the specific language governing rights and limitations under the
3384
- * License.
3385
- *
3386
- * The Original Code is Ajax.org Code Editor (ACE).
3387
- *
3388
- * The Initial Developer of the Original Code is
3389
- * Ajax.org B.V.
3390
- * Portions created by the Initial Developer are Copyright (C) 2010
3391
- * the Initial Developer. All Rights Reserved.
3392
- *
3393
- * Contributor(s):
3394
- * Fabian Jakobs <fabian AT ajax DOT org>
3395
- *
3396
- * Alternatively, the contents of this file may be used under the terms of
3397
- * either the GNU General Public License Version 2 or later (the "GPL"), or
3398
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
3399
- * in which case the provisions of the GPL or the LGPL are applicable instead
3400
- * of those above. If you wish to allow use of your version of this file only
3401
- * under the terms of either the GPL or the LGPL, and not to allow others to
3402
- * use your version of this file under the terms of the MPL, indicate your
3403
- * decision by deleting the provisions above and replace them with the notice
3404
- * and other provisions required by the GPL or the LGPL. If you do not delete
3405
- * the provisions above, a recipient may use your version of this file under
3406
- * the terms of any one of the MPL, the GPL or the LGPL.
3407
- *
3408
- * ***** END LICENSE BLOCK ***** */
3409
-
3410
- define('pilot/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
3411
-
3412
- exports.stringReverse = function(string) {
3413
- return string.split("").reverse().join("");
3414
- };
3415
-
3416
- exports.stringRepeat = function (string, count) {
3417
- return new Array(count + 1).join(string);
3418
- };
3419
-
3420
- var trimBeginRegexp = /^\s\s*/;
3421
- var trimEndRegexp = /\s\s*$/;
3422
-
3423
- exports.stringTrimLeft = function (string) {
3424
- return string.replace(trimBeginRegexp, '')
3425
- };
3426
-
3427
- exports.stringTrimRight = function (string) {
3428
- return string.replace(trimEndRegexp, '');
3429
- };
3430
-
3431
- exports.copyObject = function(obj) {
3432
- var copy = {};
3433
- for (var key in obj) {
3434
- copy[key] = obj[key];
3435
- }
3436
- return copy;
3437
- };
3438
-
3439
- exports.copyArray = function(array){
3440
- var copy = [];
3441
- for (i=0, l=array.length; i<l; i++) {
3442
- if (array[i] && typeof array[i] == "object")
3443
- copy[i] = this.copyObject( array[i] );
3444
- else
3445
- copy[i] = array[i]
3446
- }
3447
- return copy;
3448
- };
3449
-
3450
- exports.deepCopy = function (obj) {
3451
- if (typeof obj != "object") {
3452
- return obj;
3453
- }
3454
-
3455
- var copy = obj.constructor();
3456
- for (var key in obj) {
3457
- if (typeof obj[key] == "object") {
3458
- copy[key] = this.deepCopy(obj[key]);
3459
- } else {
3460
- copy[key] = obj[key];
3461
- }
3462
- }
3463
- return copy;
3464
- }
3465
-
3466
- exports.arrayToMap = function(arr) {
3467
- var map = {};
3468
- for (var i=0; i<arr.length; i++) {
3469
- map[arr[i]] = 1;
3470
- }
3471
- return map;
3472
-
3473
- };
3474
-
3475
- /**
3476
- * splice out of 'array' anything that === 'value'
3477
- */
3478
- exports.arrayRemove = function(array, value) {
3479
- for (var i = 0; i <= array.length; i++) {
3480
- if (value === array[i]) {
3481
- array.splice(i, 1);
3482
- }
3483
- }
3484
- };
3485
-
3486
- exports.escapeRegExp = function(str) {
3487
- return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
3488
- };
3489
-
3490
- exports.deferredCall = function(fcn) {
3491
-
3492
- var timer = null;
3493
- var callback = function() {
3494
- timer = null;
3495
- fcn();
3496
- };
3497
-
3498
- var deferred = function(timeout) {
3499
- if (!timer) {
3500
- timer = setTimeout(callback, timeout || 0);
3501
- }
3502
- return deferred;
3503
- }
3504
-
3505
- deferred.schedule = deferred;
3506
-
3507
- deferred.call = function() {
3508
- this.cancel();
3509
- fcn();
3510
- return deferred;
3511
- };
3512
-
3513
- deferred.cancel = function() {
3514
- clearTimeout(timer);
3515
- timer = null;
3516
- return deferred;
3517
- };
3518
-
3519
- return deferred;
3520
- };
3521
-
3522
- });
3523
- /* ***** BEGIN LICENSE BLOCK *****
3524
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3525
- *
3526
- * The contents of this file are subject to the Mozilla Public License Version
3527
- * 1.1 (the "License"); you may not use this file except in compliance with
3528
- * the License. You may obtain a copy of the License at
3529
- * http://www.mozilla.org/MPL/
3530
- *
3531
- * Software distributed under the License is distributed on an "AS IS" basis,
3532
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
3533
- * for the specific language governing rights and limitations under the
3534
- * License.
3535
- *
3536
- * The Original Code is Mozilla Skywriter.
3537
- *
3538
- * The Initial Developer of the Original Code is
3539
- * Mozilla.
3540
- * Portions created by the Initial Developer are Copyright (C) 2009
3541
- * the Initial Developer. All Rights Reserved.
3542
- *
3543
- * Contributor(s):
3544
- * Joe Walker (jwalker@mozilla.com)
3545
- * Kevin Dangoor (kdangoor@mozilla.com)
3546
- *
3547
- * Alternatively, the contents of this file may be used under the terms of
3548
- * either the GNU General Public License Version 2 or later (the "GPL"), or
3549
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
3550
- * in which case the provisions of the GPL or the LGPL are applicable instead
3551
- * of those above. If you wish to allow use of your version of this file only
3552
- * under the terms of either the GPL or the LGPL, and not to allow others to
3553
- * use your version of this file under the terms of the MPL, indicate your
3554
- * decision by deleting the provisions above and replace them with the notice
3555
- * and other provisions required by the GPL or the LGPL. If you do not delete
3556
- * the provisions above, a recipient may use your version of this file under
3557
- * the terms of any one of the MPL, the GPL or the LGPL.
3558
- *
3559
- * ***** END LICENSE BLOCK ***** */
3560
-
3561
- define('pilot/types/settings', ['require', 'exports', 'module' , 'pilot/types/basic', 'pilot/types', 'pilot/settings'], function(require, exports, module) {
3562
-
3563
- var SelectionType = require('pilot/types/basic').SelectionType;
3564
- var DeferredType = require('pilot/types/basic').DeferredType;
3565
- var types = require('pilot/types');
3566
- var settings = require('pilot/settings').settings;
3567
-
3568
-
3569
- /**
3570
- * EVIL: This relies on us using settingValue in the same event as setting
3571
- * The alternative is to have some central place where we store the current
3572
- * command line, but this might be a lesser evil for now.
3573
- */
3574
- var lastSetting;
3575
-
3576
- /**
3577
- * Select from the available settings
3578
- */
3579
- var setting = new SelectionType({
3580
- name: 'setting',
3581
- data: function() {
3582
- return env.settings.getSettingNames();
3583
- },
3584
- stringify: function(setting) {
3585
- lastSetting = setting;
3586
- return setting.name;
3587
- },
3588
- fromString: function(str) {
3589
- lastSetting = settings.getSetting(str);
3590
- return lastSetting;
3591
- },
3592
- noMatch: function() {
3593
- lastSetting = null;
3594
- }
3595
- });
3596
-
3597
- /**
3598
- * Something of a hack to allow the set command to give a clearer definition
3599
- * of the type to the command line.
3600
- */
3601
- var settingValue = new DeferredType({
3602
- name: 'settingValue',
3603
- defer: function() {
3604
- if (lastSetting) {
3605
- return lastSetting.type;
3606
- }
3607
- else {
3608
- return types.getType('text');
3609
- }
3610
- },
3611
- /**
3612
- * Promote the current value in any list of predictions, and add it if
3613
- * there are none.
3614
- */
3615
- getDefault: function() {
3616
- var conversion = this.parse('');
3617
- if (lastSetting) {
3618
- var current = lastSetting.get();
3619
- if (conversion.predictions.length === 0) {
3620
- conversion.predictions.push(current);
3621
- }
3622
- else {
3623
- // Remove current from predictions
3624
- var removed = false;
3625
- while (true) {
3626
- var index = conversion.predictions.indexOf(current);
3627
- if (index === -1) {
3628
- break;
3629
- }
3630
- conversion.predictions.splice(index, 1);
3631
- removed = true;
3632
- }
3633
- // If the current value wasn't something we would predict, leave it
3634
- if (removed) {
3635
- conversion.predictions.push(current);
3636
- }
3637
- }
3638
- }
3639
- return conversion;
3640
- }
3641
- });
3642
-
3643
- var env;
3644
-
3645
- /**
3646
- * Registration and de-registration.
3647
- */
3648
- exports.startup = function(data, reason) {
3649
- // TODO: this is probably all kinds of evil, but we need something working
3650
- env = data.env;
3651
- types.registerType(setting);
3652
- types.registerType(settingValue);
3653
- };
3654
-
3655
- exports.shutdown = function(data, reason) {
3656
- types.unregisterType(setting);
3657
- types.unregisterType(settingValue);
3658
- };
3659
-
3660
-
3661
- });
3662
- /* vim:ts=4:sts=4:sw=4:
3663
- * ***** BEGIN LICENSE BLOCK *****
3664
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3665
- *
3666
- * The contents of this file are subject to the Mozilla Public License Version
3667
- * 1.1 (the "License"); you may not use this file except in compliance with
3668
- * the License. You may obtain a copy of the License at
3669
- * http://www.mozilla.org/MPL/
3670
- *
3671
- * Software distributed under the License is distributed on an "AS IS" basis,
3672
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
3673
- * for the specific language governing rights and limitations under the
3674
- * License.
3675
- *
3676
- * The Original Code is Mozilla Skywriter.
3677
- *
3678
- * The Initial Developer of the Original Code is
3679
- * Mozilla.
3680
- * Portions created by the Initial Developer are Copyright (C) 2009
3681
- * the Initial Developer. All Rights Reserved.
3682
- *
3683
- * Contributor(s):
3684
- * Joe Walker (jwalker@mozilla.com)
3685
- * Julian Viereck (jviereck@mozilla.com)
3686
- * Kevin Dangoor (kdangoor@mozilla.com)
3687
- * Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
3688
- *
3689
- * Alternatively, the contents of this file may be used under the terms of
3690
- * either the GNU General Public License Version 2 or later (the "GPL"), or
3691
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
3692
- * in which case the provisions of the GPL or the LGPL are applicable instead
3693
- * of those above. If you wish to allow use of your version of this file only
3694
- * under the terms of either the GPL or the LGPL, and not to allow others to
3695
- * use your version of this file under the terms of the MPL, indicate your
3696
- * decision by deleting the provisions above and replace them with the notice
3697
- * and other provisions required by the GPL or the LGPL. If you do not delete
3698
- * the provisions above, a recipient may use your version of this file under
3699
- * the terms of any one of the MPL, the GPL or the LGPL.
3700
- *
3701
- * ***** END LICENSE BLOCK ***** */
3702
-
3703
- define('pilot/settings', ['require', 'exports', 'module' , 'pilot/console', 'pilot/oop', 'pilot/types', 'pilot/event_emitter', 'pilot/catalog'], function(require, exports, module) {
3704
-
3705
- /**
3706
- * This plug-in manages settings.
3707
- */
3708
-
3709
- var console = require('pilot/console');
3710
- var oop = require('pilot/oop');
3711
- var types = require('pilot/types');
3712
- var EventEmitter = require('pilot/event_emitter').EventEmitter;
3713
- var catalog = require('pilot/catalog');
3714
-
3715
- var settingExtensionSpec = {
3716
- name: 'setting',
3717
- description: 'A setting is something that the application offers as a ' +
3718
- 'way to customize how it works',
3719
- register: 'env.settings.addSetting',
3720
- indexOn: 'name'
3721
- };
3722
-
3723
- exports.startup = function(data, reason) {
3724
- catalog.addExtensionSpec(settingExtensionSpec);
3725
- };
3726
-
3727
- exports.shutdown = function(data, reason) {
3728
- catalog.removeExtensionSpec(settingExtensionSpec);
3729
- };
3730
-
3731
-
3732
- /**
3733
- * Create a new setting.
3734
- * @param settingSpec An object literal that looks like this:
3735
- * {
3736
- * name: 'thing',
3737
- * description: 'Thing is an example setting',
3738
- * type: 'string',
3739
- * defaultValue: 'something'
3740
- * }
3741
- */
3742
- function Setting(settingSpec, settings) {
3743
- this._settings = settings;
3744
-
3745
- Object.keys(settingSpec).forEach(function(key) {
3746
- this[key] = settingSpec[key];
3747
- }, this);
3748
-
3749
- this.type = types.getType(this.type);
3750
- if (this.type == null) {
3751
- throw new Error('In ' + this.name +
3752
- ': can\'t find type for: ' + JSON.stringify(settingSpec.type));
3753
- }
3754
-
3755
- if (!this.name) {
3756
- throw new Error('Setting.name == undefined. Ignoring.', this);
3757
- }
3758
-
3759
- if (!this.defaultValue === undefined) {
3760
- throw new Error('Setting.defaultValue == undefined', this);
3761
- }
3762
-
3763
- if (this.onChange) {
3764
- this.on('change', this.onChange.bind(this))
3765
- }
3766
-
3767
- this.set(this.defaultValue);
3768
- }
3769
- Setting.prototype = {
3770
- get: function() {
3771
- return this.value;
3772
- },
3773
-
3774
- set: function(value) {
3775
- if (this.value === value) {
3776
- return;
3777
- }
3778
-
3779
- this.value = value;
3780
- if (this._settings.persister) {
3781
- this._settings.persister.persistValue(this._settings, this.name, value);
3782
- }
3783
-
3784
- this._dispatchEvent('change', { setting: this, value: value });
3785
- },
3786
-
3787
- /**
3788
- * Reset the value of the <code>key</code> setting to it's default
3789
- */
3790
- resetValue: function() {
3791
- this.set(this.defaultValue);
3792
- },
3793
- toString: function () {
3794
- return this.name;
3795
- }
3796
- };
3797
- oop.implement(Setting.prototype, EventEmitter);
3798
-
3799
-
3800
- /**
3801
- * A base class for all the various methods of storing settings.
3802
- * <p>Usage:
3803
- * <pre>
3804
- * // Create manually, or require 'settings' from the container.
3805
- * // This is the manual version:
3806
- * var settings = plugins.catalog.getObject('settings');
3807
- * // Add a new setting
3808
- * settings.addSetting({ name:'foo', ... });
3809
- * // Display the default value
3810
- * alert(settings.get('foo'));
3811
- * // Alter the value, which also publishes the change etc.
3812
- * settings.set('foo', 'bar');
3813
- * // Reset the value to the default
3814
- * settings.resetValue('foo');
3815
- * </pre>
3816
- * @constructor
3817
- */
3818
- function Settings(persister) {
3819
- // Storage for deactivated values
3820
- this._deactivated = {};
3821
-
3822
- // Storage for the active settings
3823
- this._settings = {};
3824
- // We often want sorted setting names. Cache
3825
- this._settingNames = [];
3826
-
3827
- if (persister) {
3828
- this.setPersister(persister);
3829
- }
3830
- };
3831
-
3832
- Settings.prototype = {
3833
- /**
3834
- * Function to add to the list of available settings.
3835
- * <p>Example usage:
3836
- * <pre>
3837
- * var settings = plugins.catalog.getObject('settings');
3838
- * settings.addSetting({
3839
- * name: 'tabsize', // For use in settings.get('X')
3840
- * type: 'number', // To allow value checking.
3841
- * defaultValue: 4 // Default value for use when none is directly set
3842
- * });
3843
- * </pre>
3844
- * @param {object} settingSpec Object containing name/type/defaultValue members.
3845
- */
3846
- addSetting: function(settingSpec) {
3847
- var setting = new Setting(settingSpec, this);
3848
- this._settings[setting.name] = setting;
3849
- this._settingNames.push(setting.name);
3850
- this._settingNames.sort();
3851
- },
3852
-
3853
- addSettings: function addSettings(settings) {
3854
- Object.keys(settings).forEach(function (name) {
3855
- var setting = settings[name];
3856
- if (!('name' in setting)) setting.name = name;
3857
- this.addSetting(setting);
3858
- }, this);
3859
- },
3860
-
3861
- removeSetting: function(setting) {
3862
- var name = (typeof setting === 'string' ? setting : setting.name);
3863
- setting = this._settings[name];
3864
- delete this._settings[name];
3865
- util.arrayRemove(this._settingNames, name);
3866
- settings.removeAllListeners('change');
3867
- },
3868
-
3869
- removeSettings: function removeSettings(settings) {
3870
- Object.keys(settings).forEach(function(name) {
3871
- var setting = settings[name];
3872
- if (!('name' in setting)) setting.name = name;
3873
- this.removeSettings(setting);
3874
- }, this);
3875
- },
3876
-
3877
- getSettingNames: function() {
3878
- return this._settingNames;
3879
- },
3880
-
3881
- getSetting: function(name) {
3882
- return this._settings[name];
3883
- },
3884
-
3885
- /**
3886
- * A Persister is able to store settings. It is an object that defines
3887
- * two functions:
3888
- * loadInitialValues(settings) and persistValue(settings, key, value).
3889
- */
3890
- setPersister: function(persister) {
3891
- this._persister = persister;
3892
- if (persister) {
3893
- persister.loadInitialValues(this);
3894
- }
3895
- },
3896
-
3897
- resetAll: function() {
3898
- this.getSettingNames().forEach(function(key) {
3899
- this.resetValue(key);
3900
- }, this);
3901
- },
3902
-
3903
- /**
3904
- * Retrieve a list of the known settings and their values
3905
- */
3906
- _list: function() {
3907
- var reply = [];
3908
- this.getSettingNames().forEach(function(setting) {
3909
- reply.push({
3910
- 'key': setting,
3911
- 'value': this.getSetting(setting).get()
3912
- });
3913
- }, this);
3914
- return reply;
3915
- },
3916
-
3917
- /**
3918
- * Prime the local cache with the defaults.
3919
- */
3920
- _loadDefaultValues: function() {
3921
- this._loadFromObject(this._getDefaultValues());
3922
- },
3923
-
3924
- /**
3925
- * Utility to load settings from an object
3926
- */
3927
- _loadFromObject: function(data) {
3928
- // We iterate over data rather than keys so we don't forget values
3929
- // which don't have a setting yet.
3930
- for (var key in data) {
3931
- if (data.hasOwnProperty(key)) {
3932
- var setting = this._settings[key];
3933
- if (setting) {
3934
- var value = setting.type.parse(data[key]);
3935
- this.set(key, value);
3936
- } else {
3937
- this.set(key, data[key]);
3938
- }
3939
- }
3940
- }
3941
- },
3942
-
3943
- /**
3944
- * Utility to grab all the settings and export them into an object
3945
- */
3946
- _saveToObject: function() {
3947
- return this.getSettingNames().map(function(key) {
3948
- return this._settings[key].type.stringify(this.get(key));
3949
- }.bind(this));
3950
- },
3951
-
3952
- /**
3953
- * The default initial settings
3954
- */
3955
- _getDefaultValues: function() {
3956
- return this.getSettingNames().map(function(key) {
3957
- return this._settings[key].spec.defaultValue;
3958
- }.bind(this));
3959
- }
3960
- };
3961
- exports.settings = new Settings();
3962
-
3963
- /**
3964
- * Save the settings in a cookie
3965
- * This code has not been tested since reboot
3966
- * @constructor
3967
- */
3968
- function CookiePersister() {
3969
- };
3970
-
3971
- CookiePersister.prototype = {
3972
- loadInitialValues: function(settings) {
3973
- settings._loadDefaultValues();
3974
- var data = cookie.get('settings');
3975
- settings._loadFromObject(JSON.parse(data));
3976
- },
3977
-
3978
- persistValue: function(settings, key, value) {
3979
- try {
3980
- var stringData = JSON.stringify(settings._saveToObject());
3981
- cookie.set('settings', stringData);
3982
- } catch (ex) {
3983
- console.error('Unable to JSONify the settings! ' + ex);
3984
- return;
3985
- }
3986
- }
3987
- };
3988
-
3989
- exports.CookiePersister = CookiePersister;
3990
-
3991
- });
3992
- /* ***** BEGIN LICENSE BLOCK *****
3993
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3994
- *
3995
- * The contents of this file are subject to the Mozilla Public License Version
3996
- * 1.1 (the "License"); you may not use this file except in compliance with
3997
- * the License. You may obtain a copy of the License at
3998
- * http://www.mozilla.org/MPL/
3999
- *
4000
- * Software distributed under the License is distributed on an "AS IS" basis,
4001
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
4002
- * for the specific language governing rights and limitations under the
4003
- * License.
4004
- *
4005
- * The Original Code is Skywriter.
4006
- *
4007
- * The Initial Developer of the Original Code is
4008
- * Mozilla.
4009
- * Portions created by the Initial Developer are Copyright (C) 2009
4010
- * the Initial Developer. All Rights Reserved.
4011
- *
4012
- * Contributor(s):
4013
- * Skywriter Team (skywriter@mozilla.com)
4014
- *
4015
- * Alternatively, the contents of this file may be used under the terms of
4016
- * either the GNU General Public License Version 2 or later (the "GPL"), or
4017
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
4018
- * in which case the provisions of the GPL or the LGPL are applicable instead
4019
- * of those above. If you wish to allow use of your version of this file only
4020
- * under the terms of either the GPL or the LGPL, and not to allow others to
4021
- * use your version of this file under the terms of the MPL, indicate your
4022
- * decision by deleting the provisions above and replace them with the notice
4023
- * and other provisions required by the GPL or the LGPL. If you do not delete
4024
- * the provisions above, a recipient may use your version of this file under
4025
- * the terms of any one of the MPL, the GPL or the LGPL.
4026
- *
4027
- * ***** END LICENSE BLOCK ***** */
4028
-
4029
- define('pilot/commands/settings', ['require', 'exports', 'module' , 'pilot/canon'], function(require, exports, module) {
4030
-
4031
-
4032
- var setCommandSpec = {
4033
- name: 'set',
4034
- params: [
4035
- {
4036
- name: 'setting',
4037
- type: 'setting',
4038
- description: 'The name of the setting to display or alter',
4039
- defaultValue: null
4040
- },
4041
- {
4042
- name: 'value',
4043
- type: 'settingValue',
4044
- description: 'The new value for the chosen setting',
4045
- defaultValue: null
4046
- }
4047
- ],
4048
- description: 'define and show settings',
4049
- exec: function(env, args, request) {
4050
- var html;
4051
- if (!args.setting) {
4052
- // 'set' by itself lists all the settings
4053
- var names = env.settings.getSettingNames();
4054
- html = '';
4055
- // first sort the settingsList based on the name
4056
- names.sort(function(name1, name2) {
4057
- return name1.localeCompare(name2);
4058
- });
4059
-
4060
- names.forEach(function(name) {
4061
- var setting = env.settings.getSetting(name);
4062
- var url = 'https://wiki.mozilla.org/Labs/Skywriter/Settings#' +
4063
- setting.name;
4064
- html += '<a class="setting" href="' + url +
4065
- '" title="View external documentation on setting: ' +
4066
- setting.name +
4067
- '" target="_blank">' +
4068
- setting.name +
4069
- '</a> = ' +
4070
- setting.value +
4071
- '<br/>';
4072
- });
4073
- } else {
4074
- // set with only a setting, shows the value for that setting
4075
- if (args.value === undefined) {
4076
- html = '<strong>' + setting.name + '</strong> = ' +
4077
- setting.get();
4078
- } else {
4079
- // Actually change the setting
4080
- args.setting.set(args.value);
4081
- html = 'Setting: <strong>' + args.setting.name + '</strong> = ' +
4082
- args.setting.get();
4083
- }
4084
- }
4085
- request.done(html);
4086
- }
4087
- };
4088
-
4089
- var unsetCommandSpec = {
4090
- name: 'unset',
4091
- params: [
4092
- {
4093
- name: 'setting',
4094
- type: 'setting',
4095
- description: 'The name of the setting to return to defaults'
4096
- }
4097
- ],
4098
- description: 'unset a setting entirely',
4099
- exec: function(env, args, request) {
4100
- var setting = env.settings.get(args.setting);
4101
- if (!setting) {
4102
- request.doneWithError('No setting with the name <strong>' +
4103
- args.setting + '</strong>.');
4104
- return;
4105
- }
4106
-
4107
- setting.reset();
4108
- request.done('Reset ' + setting.name + ' to default: ' +
4109
- env.settings.get(args.setting));
4110
- }
4111
- };
4112
-
4113
- var canon = require('pilot/canon');
4114
-
4115
- exports.startup = function(data, reason) {
4116
- canon.addCommand(setCommandSpec);
4117
- canon.addCommand(unsetCommandSpec);
4118
- };
4119
-
4120
- exports.shutdown = function(data, reason) {
4121
- canon.removeCommand(setCommandSpec);
4122
- canon.removeCommand(unsetCommandSpec);
4123
- };
4124
-
4125
-
4126
- });
4127
- /* ***** BEGIN LICENSE BLOCK *****
4128
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4129
- *
4130
- * The contents of this file are subject to the Mozilla Public License Version
4131
- * 1.1 (the "License"); you may not use this file except in compliance with
4132
- * the License. You may obtain a copy of the License at
4133
- * http://www.mozilla.org/MPL/
4134
- *
4135
- * Software distributed under the License is distributed on an "AS IS" basis,
4136
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
4137
- * for the specific language governing rights and limitations under the
4138
- * License.
4139
- *
4140
- * The Original Code is Skywriter.
4141
- *
4142
- * The Initial Developer of the Original Code is
4143
- * Mozilla.
4144
- * Portions created by the Initial Developer are Copyright (C) 2009
4145
- * the Initial Developer. All Rights Reserved.
4146
- *
4147
- * Contributor(s):
4148
- * Skywriter Team (skywriter@mozilla.com)
4149
- *
4150
- * Alternatively, the contents of this file may be used under the terms of
4151
- * either the GNU General Public License Version 2 or later (the "GPL"), or
4152
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
4153
- * in which case the provisions of the GPL or the LGPL are applicable instead
4154
- * of those above. If you wish to allow use of your version of this file only
4155
- * under the terms of either the GPL or the LGPL, and not to allow others to
4156
- * use your version of this file under the terms of the MPL, indicate your
4157
- * decision by deleting the provisions above and replace them with the notice
4158
- * and other provisions required by the GPL or the LGPL. If you do not delete
4159
- * the provisions above, a recipient may use your version of this file under
4160
- * the terms of any one of the MPL, the GPL or the LGPL.
4161
- *
4162
- * ***** END LICENSE BLOCK ***** */
4163
-
4164
- define('pilot/commands/basic', ['require', 'exports', 'module' , 'pilot/typecheck', 'pilot/canon'], function(require, exports, module) {
4165
-
4166
-
4167
- var checks = require("pilot/typecheck");
4168
- var canon = require('pilot/canon');
4169
-
4170
- /**
4171
- * 'help' command
4172
- */
4173
- var helpCommandSpec = {
4174
- name: 'help',
4175
- params: [
4176
- {
4177
- name: 'search',
4178
- type: 'text',
4179
- description: 'Search string to narrow the output.',
4180
- defaultValue: null
4181
- }
4182
- ],
4183
- description: 'Get help on the available commands.',
4184
- exec: function(env, args, request) {
4185
- var output = [];
4186
-
4187
- var command = canon.getCommand(args.search);
4188
- if (command && command.exec) {
4189
- // caught a real command
4190
- output.push(command.description ?
4191
- command.description :
4192
- 'No description for ' + args.search);
4193
- } else {
4194
- var showHidden = false;
4195
-
4196
- if (command) {
4197
- // We must be looking at sub-commands
4198
- output.push('<h2>Sub-Commands of ' + command.name + '</h2>');
4199
- output.push('<p>' + command.description + '</p>');
4200
- }
4201
- else if (args.search) {
4202
- if (args.search == 'hidden') { // sneaky, sneaky.
4203
- args.search = '';
4204
- showHidden = true;
4205
- }
4206
- output.push('<h2>Commands starting with \'' + args.search + '\':</h2>');
4207
- }
4208
- else {
4209
- output.push('<h2>Available Commands:</h2>');
4210
- }
4211
-
4212
- var commandNames = canon.getCommandNames();
4213
- commandNames.sort();
4214
-
4215
- output.push('<table>');
4216
- for (var i = 0; i < commandNames.length; i++) {
4217
- command = canon.getCommand(commandNames[i]);
4218
- if (!showHidden && command.hidden) {
4219
- continue;
4220
- }
4221
- if (command.description === undefined) {
4222
- // Ignore editor actions
4223
- continue;
4224
- }
4225
- if (args.search && command.name.indexOf(args.search) !== 0) {
4226
- // Filtered out by the user
4227
- continue;
4228
- }
4229
- if (!args.search && command.name.indexOf(' ') != -1) {
4230
- // sub command
4231
- continue;
4232
- }
4233
- if (command && command.name == args.search) {
4234
- // sub command, and we've already given that help
4235
- continue;
4236
- }
4237
-
4238
- // todo add back a column with parameter information, perhaps?
4239
-
4240
- output.push('<tr>');
4241
- output.push('<th class="right">' + command.name + '</th>');
4242
- output.push('<td>' + command.description + '</td>');
4243
- output.push('</tr>');
4244
- }
4245
- output.push('</table>');
4246
- }
4247
-
4248
- request.done(output.join(''));
4249
- }
4250
- };
4251
-
4252
- /**
4253
- * 'eval' command
4254
- */
4255
- var evalCommandSpec = {
4256
- name: 'eval',
4257
- params: [
4258
- {
4259
- name: 'javascript',
4260
- type: 'text',
4261
- description: 'The JavaScript to evaluate'
4262
- }
4263
- ],
4264
- description: 'evals given js code and show the result',
4265
- hidden: true,
4266
- exec: function(env, args, request) {
4267
- var result;
4268
- var javascript = args.javascript;
4269
- try {
4270
- result = eval(javascript);
4271
- } catch (e) {
4272
- result = '<b>Error: ' + e.message + '</b>';
4273
- }
4274
-
4275
- var msg = '';
4276
- var type = '';
4277
- var x;
4278
-
4279
- if (checks.isFunction(result)) {
4280
- // converts the function to a well formated string
4281
- msg = (result + '').replace(/\n/g, '<br>').replace(/ /g, '&#160');
4282
- type = 'function';
4283
- } else if (checks.isObject(result)) {
4284
- if (Array.isArray(result)) {
4285
- type = 'array';
4286
- } else {
4287
- type = 'object';
4288
- }
4289
-
4290
- var items = [];
4291
- var value;
4292
-
4293
- for (x in result) {
4294
- if (result.hasOwnProperty(x)) {
4295
- if (checks.isFunction(result[x])) {
4296
- value = '[function]';
4297
- } else if (checks.isObject(result[x])) {
4298
- value = '[object]';
4299
- } else {
4300
- value = result[x];
4301
- }
4302
-
4303
- items.push({name: x, value: value});
4304
- }
4305
- }
4306
-
4307
- items.sort(function(a,b) {
4308
- return (a.name.toLowerCase() < b.name.toLowerCase()) ? -1 : 1;
4309
- });
4310
-
4311
- for (x = 0; x < items.length; x++) {
4312
- msg += '<b>' + items[x].name + '</b>: ' + items[x].value + '<br>';
4313
- }
4314
-
4315
- } else {
4316
- msg = result;
4317
- type = typeof result;
4318
- }
4319
-
4320
- request.done('Result for eval <b>\'' + javascript + '\'</b>' +
4321
- ' (type: '+ type+'): <br><br>'+ msg);
4322
- }
4323
- };
4324
-
4325
- var canon = require('pilot/canon');
4326
-
4327
- exports.startup = function(data, reason) {
4328
- canon.addCommand(helpCommandSpec);
4329
- canon.addCommand(evalCommandSpec);
4330
- };
4331
-
4332
- exports.shutdown = function(data, reason) {
4333
- canon.removeCommand(helpCommandSpec);
4334
- canon.removeCommand(evalCommandSpec);
4335
- };
4336
-
4337
-
4338
- });
4339
- /* ***** BEGIN LICENSE BLOCK *****
4340
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4341
- *
4342
- * The contents of this file are subject to the Mozilla Public License Version
4343
- * 1.1 (the "License"); you may not use this file except in compliance with
4344
- * the License. You may obtain a copy of the License at
4345
- * http://www.mozilla.org/MPL/
4346
- *
4347
- * Software distributed under the License is distributed on an "AS IS" basis,
4348
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
4349
- * for the specific language governing rights and limitations under the
4350
- * License.
4351
- *
4352
- * The Original Code is Mozilla Skywriter.
4353
- *
4354
- * The Initial Developer of the Original Code is
4355
- * Mozilla.
4356
- * Portions created by the Initial Developer are Copyright (C) 2009
4357
- * the Initial Developer. All Rights Reserved.
4358
- *
4359
- * Contributor(s):
4360
- * Joe Walker (jwalker@mozilla.com)
4361
- *
4362
- * Alternatively, the contents of this file may be used under the terms of
4363
- * either the GNU General Public License Version 2 or later (the "GPL"), or
4364
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
4365
- * in which case the provisions of the GPL or the LGPL are applicable instead
4366
- * of those above. If you wish to allow use of your version of this file only
4367
- * under the terms of either the GPL or the LGPL, and not to allow others to
4368
- * use your version of this file under the terms of the MPL, indicate your
4369
- * decision by deleting the provisions above and replace them with the notice
4370
- * and other provisions required by the GPL or the LGPL. If you do not delete
4371
- * the provisions above, a recipient may use your version of this file under
4372
- * the terms of any one of the MPL, the GPL or the LGPL.
4373
- *
4374
- * ***** END LICENSE BLOCK ***** */
4375
-
4376
- define('pilot/settings/canon', ['require', 'exports', 'module' ], function(require, exports, module) {
4377
-
4378
-
4379
- var historyLengthSetting = {
4380
- name: "historyLength",
4381
- description: "How many typed commands do we recall for reference?",
4382
- type: "number",
4383
- defaultValue: 50
4384
- };
4385
-
4386
- exports.startup = function(data, reason) {
4387
- data.env.settings.addSetting(historyLengthSetting);
4388
- };
4389
-
4390
- exports.shutdown = function(data, reason) {
4391
- data.env.settings.removeSetting(historyLengthSetting);
4392
- };
4393
-
4394
-
4395
- });
4396
- /* ***** BEGIN LICENSE BLOCK *****
4397
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4398
- *
4399
- * The contents of this file are subject to the Mozilla Public License Version
4400
- * 1.1 (the "License"); you may not use this file except in compliance with
4401
- * the License. You may obtain a copy of the License at
4402
- * http://www.mozilla.org/MPL/
4403
- *
4404
- * Software distributed under the License is distributed on an "AS IS" basis,
4405
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
4406
- * for the specific language governing rights and limitations under the
4407
- * License.
4408
- *
4409
- * The Original Code is Skywriter.
4410
- *
4411
- * The Initial Developer of the Original Code is
4412
- * Mozilla.
4413
- * Portions created by the Initial Developer are Copyright (C) 2009
4414
- * the Initial Developer. All Rights Reserved.
4415
- *
4416
- * Contributor(s):
4417
- * Joe Walker (jwalker@mozilla.com)
4418
- *
4419
- * Alternatively, the contents of this file may be used under the terms of
4420
- * either the GNU General Public License Version 2 or later (the "GPL"), or
4421
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
4422
- * in which case the provisions of the GPL or the LGPL are applicable instead
4423
- * of those above. If you wish to allow use of your version of this file only
4424
- * under the terms of either the GPL or the LGPL, and not to allow others to
4425
- * use your version of this file under the terms of the MPL, indicate your
4426
- * decision by deleting the provisions above and replace them with the notice
4427
- * and other provisions required by the GPL or the LGPL. If you do not delete
4428
- * the provisions above, a recipient may use your version of this file under
4429
- * the terms of any one of the MPL, the GPL or the LGPL.
4430
- *
4431
- * ***** END LICENSE BLOCK ***** */
4432
-
4433
- define('cockpit/cli', ['require', 'exports', 'module' , 'pilot/console', 'pilot/lang', 'pilot/oop', 'pilot/event_emitter', 'pilot/types', 'pilot/canon'], function(require, exports, module) {
4434
-
4435
-
4436
- var console = require('pilot/console');
4437
- var lang = require('pilot/lang');
4438
- var oop = require('pilot/oop');
4439
- var EventEmitter = require('pilot/event_emitter').EventEmitter;
4440
-
4441
- //var keyboard = require('keyboard/keyboard');
4442
- var types = require('pilot/types');
4443
- var Status = require('pilot/types').Status;
4444
- var Conversion = require('pilot/types').Conversion;
4445
- var canon = require('pilot/canon');
4446
-
4447
- /**
4448
- * Normally type upgrade is done when the owning command is registered, but
4449
- * out commandParam isn't part of a command, so it misses out.
4450
- */
4451
- exports.startup = function(data, reason) {
4452
- canon.upgradeType('command', commandParam);
4453
- };
4454
-
4455
- /**
4456
- * The information required to tell the user there is a problem with their
4457
- * input.
4458
- * TODO: There a several places where {start,end} crop up. Perhaps we should
4459
- * have a Cursor object.
4460
- */
4461
- function Hint(status, message, start, end, predictions) {
4462
- this.status = status;
4463
- this.message = message;
4464
-
4465
- if (typeof start === 'number') {
4466
- this.start = start;
4467
- this.end = end;
4468
- this.predictions = predictions;
4469
- }
4470
- else {
4471
- var arg = start;
4472
- this.start = arg.start;
4473
- this.end = arg.end;
4474
- this.predictions = arg.predictions;
4475
- }
4476
- }
4477
- Hint.prototype = {
4478
- };
4479
- /**
4480
- * Loop over the array of hints finding the one we should display.
4481
- * @param hints array of hints
4482
- */
4483
- Hint.sort = function(hints, cursor) {
4484
- // Calculate 'distance from cursor'
4485
- if (cursor !== undefined) {
4486
- hints.forEach(function(hint) {
4487
- if (hint.start === Argument.AT_CURSOR) {
4488
- hint.distance = 0;
4489
- }
4490
- else if (cursor < hint.start) {
4491
- hint.distance = hint.start - cursor;
4492
- }
4493
- else if (cursor > hint.end) {
4494
- hint.distance = cursor - hint.end;
4495
- }
4496
- else {
4497
- hint.distance = 0;
4498
- }
4499
- }, this);
4500
- }
4501
- // Sort
4502
- hints.sort(function(hint1, hint2) {
4503
- // Compare first based on distance from cursor
4504
- if (cursor !== undefined) {
4505
- var diff = hint1.distance - hint2.distance;
4506
- if (diff != 0) {
4507
- return diff;
4508
- }
4509
- }
4510
- // otherwise go with hint severity
4511
- return hint2.status - hint1.status;
4512
- });
4513
- // tidy-up
4514
- if (cursor !== undefined) {
4515
- hints.forEach(function(hint) {
4516
- delete hint.distance;
4517
- }, this);
4518
- }
4519
- return hints;
4520
- };
4521
- exports.Hint = Hint;
4522
-
4523
- /**
4524
- * A Hint that arose as a result of a Conversion
4525
- */
4526
- function ConversionHint(conversion, arg) {
4527
- this.status = conversion.status;
4528
- this.message = conversion.message;
4529
- if (arg) {
4530
- this.start = arg.start;
4531
- this.end = arg.end;
4532
- }
4533
- else {
4534
- this.start = 0;
4535
- this.end = 0;
4536
- }
4537
- this.predictions = conversion.predictions;
4538
- };
4539
- oop.inherits(ConversionHint, Hint);
4540
-
4541
-
4542
- /**
4543
- * We record where in the input string an argument comes so we can report errors
4544
- * against those string positions.
4545
- * We publish a 'change' event when-ever the text changes
4546
- * @param emitter Arguments use something else to pass on change events.
4547
- * Currently this will be the creating Requisition. This prevents dependency
4548
- * loops and prevents us from needing to merge listener lists.
4549
- * @param text The string (trimmed) that contains the argument
4550
- * @param start The position of the text in the original input string
4551
- * @param end See start
4552
- * @param prefix Knowledge of quotation marks and whitespace used prior to the
4553
- * text in the input string allows us to re-generate the original input from
4554
- * the arguments.
4555
- * @param suffix Any quotation marks and whitespace used after the text.
4556
- * Whitespace is normally placed in the prefix to the succeeding argument, but
4557
- * can be used here when this is the last argument.
4558
- * @constructor
4559
- */
4560
- function Argument(emitter, text, start, end, prefix, suffix) {
4561
- this.emitter = emitter;
4562
- this.setText(text);
4563
- this.start = start;
4564
- this.end = end;
4565
- this.prefix = prefix;
4566
- this.suffix = suffix;
4567
- }
4568
- Argument.prototype = {
4569
- /**
4570
- * Return the result of merging these arguments.
4571
- * TODO: What happens when we're merging arguments for the single string
4572
- * case and some of the arguments are in quotation marks?
4573
- */
4574
- merge: function(following) {
4575
- if (following.emitter != this.emitter) {
4576
- throw new Error('Can\'t merge Arguments from different EventEmitters');
4577
- }
4578
- return new Argument(
4579
- this.emitter,
4580
- this.text + this.suffix + following.prefix + following.text,
4581
- this.start, following.end,
4582
- this.prefix,
4583
- following.suffix);
4584
- },
4585
-
4586
- /**
4587
- * See notes on events in Assignment. We might need to hook changes here
4588
- * into a CliRequisition so they appear of the command line.
4589
- */
4590
- setText: function(text) {
4591
- if (text == null) {
4592
- throw new Error('Illegal text for Argument: ' + text);
4593
- }
4594
- var ev = { argument: this, oldText: this.text, text: text };
4595
- this.text = text;
4596
- this.emitter._dispatchEvent('argumentChange', ev);
4597
- },
4598
-
4599
- /**
4600
- * Helper when we're putting arguments back together
4601
- */
4602
- toString: function() {
4603
- // TODO: There is a bug here - we should re-escape escaped characters
4604
- // But can we do that reliably?
4605
- return this.prefix + this.text + this.suffix;
4606
- }
4607
- };
4608
-
4609
- /**
4610
- * Merge an array of arguments into a single argument.
4611
- * All Arguments in the array are expected to have the same emitter
4612
- */
4613
- Argument.merge = function(argArray, start, end) {
4614
- start = (start === undefined) ? 0 : start;
4615
- end = (end === undefined) ? argArray.length : end;
4616
-
4617
- var joined;
4618
- for (var i = start; i < end; i++) {
4619
- var arg = argArray[i];
4620
- if (!joined) {
4621
- joined = arg;
4622
- }
4623
- else {
4624
- joined = joined.merge(arg);
4625
- }
4626
- }
4627
- return joined;
4628
- };
4629
-
4630
- /**
4631
- * We sometimes need a way to say 'this error occurs where ever the cursor is'
4632
- */
4633
- Argument.AT_CURSOR = -1;
4634
-
4635
-
4636
- /**
4637
- * A link between a parameter and the data for that parameter.
4638
- * The data for the parameter is available as in the preferred type and as
4639
- * an Argument for the CLI.
4640
- * <p>We also record validity information where applicable.
4641
- * <p>For values, null and undefined have distinct definitions. null means
4642
- * that a value has been provided, undefined means that it has not.
4643
- * Thus, null is a valid default value, and common because it identifies an
4644
- * parameter that is optional. undefined means there is no value from
4645
- * the command line.
4646
- * @constructor
4647
- */
4648
- function Assignment(param, requisition) {
4649
- this.param = param;
4650
- this.requisition = requisition;
4651
- this.setValue(param.defaultValue);
4652
- };
4653
- Assignment.prototype = {
4654
- /**
4655
- * The parameter that we are assigning to
4656
- * @readonly
4657
- */
4658
- param: undefined,
4659
-
4660
- /**
4661
- * Report on the status of the last parse() conversion.
4662
- * @see types.Conversion
4663
- */
4664
- conversion: undefined,
4665
-
4666
- /**
4667
- * The current value in a type as specified by param.type
4668
- */
4669
- value: undefined,
4670
-
4671
- /**
4672
- * The string version of the current value
4673
- */
4674
- arg: undefined,
4675
-
4676
- /**
4677
- * The current value (i.e. not the string representation)
4678
- * Use setValue() to mutate
4679
- */
4680
- value: undefined,
4681
- setValue: function(value) {
4682
- if (this.value === value) {
4683
- return;
4684
- }
4685
-
4686
- if (value === undefined) {
4687
- this.value = this.param.defaultValue;
4688
- this.conversion = this.param.getDefault ?
4689
- this.param.getDefault() :
4690
- this.param.type.getDefault();
4691
- this.arg = undefined;
4692
- } else {
4693
- this.value = value;
4694
- this.conversion = undefined;
4695
- var text = (value == null) ? '' : this.param.type.stringify(value);
4696
- if (this.arg) {
4697
- this.arg.setText(text);
4698
- }
4699
- }
4700
-
4701
- this.requisition._assignmentChanged(this);
4702
- },
4703
-
4704
- /**
4705
- * The textual representation of the current value
4706
- * Use setValue() to mutate
4707
- */
4708
- arg: undefined,
4709
- setArgument: function(arg) {
4710
- if (this.arg === arg) {
4711
- return;
4712
- }
4713
- this.arg = arg;
4714
- this.conversion = this.param.type.parse(arg.text);
4715
- this.conversion.arg = arg; // TODO: make this automatic?
4716
- this.value = this.conversion.value;
4717
- this.requisition._assignmentChanged(this);
4718
- },
4719
-
4720
- /**
4721
- * Create a list of the hints associated with this parameter assignment.
4722
- * Generally there will be only one hint generated because we're currently
4723
- * only displaying one hint at a time, ordering by distance from cursor
4724
- * and severity. Since distance from cursor will be the same for all hints
4725
- * from this assignment all but the most severe will ever be used. It might
4726
- * make sense with more experience to alter this to function to be getHint()
4727
- */
4728
- getHint: function() {
4729
- // Allow the parameter to provide documentation
4730
- if (this.param.getCustomHint && this.value && this.arg) {
4731
- var hint = this.param.getCustomHint(this.value, this.arg);
4732
- if (hint) {
4733
- return hint;
4734
- }
4735
- }
4736
-
4737
- // If there is no argument, use the cursor position
4738
- var message = '<strong>' + this.param.name + '</strong>: ';
4739
- if (this.param.description) {
4740
- // TODO: This should be a short description - do we need to trim?
4741
- message += this.param.description.trim();
4742
-
4743
- // Ensure the help text ends with '. '
4744
- if (message.charAt(message.length - 1) !== '.') {
4745
- message += '.';
4746
- }
4747
- if (message.charAt(message.length - 1) !== ' ') {
4748
- message += ' ';
4749
- }
4750
- }
4751
- var status = Status.VALID;
4752
- var start = this.arg ? this.arg.start : Argument.AT_CURSOR;
4753
- var end = this.arg ? this.arg.end : Argument.AT_CURSOR;
4754
- var predictions;
4755
-
4756
- // Non-valid conversions will have useful information to pass on
4757
- if (this.conversion) {
4758
- status = this.conversion.status;
4759
- if (this.conversion.message) {
4760
- message += this.conversion.message;
4761
- }
4762
- predictions = this.conversion.predictions;
4763
- }
4764
-
4765
- // Hint if the param is required, but not provided
4766
- var argProvided = this.arg && this.arg.text !== '';
4767
- var dataProvided = this.value !== undefined || argProvided;
4768
- if (this.param.defaultValue === undefined && !dataProvided) {
4769
- status = Status.INVALID;
4770
- message += '<strong>Required<\strong>';
4771
- }
4772
-
4773
- return new Hint(status, message, start, end, predictions);
4774
- },
4775
-
4776
- /**
4777
- * Basically <tt>setValue(conversion.predictions[0])</tt> done in a safe
4778
- * way.
4779
- */
4780
- complete: function() {
4781
- if (this.conversion && this.conversion.predictions &&
4782
- this.conversion.predictions.length > 0) {
4783
- this.setValue(this.conversion.predictions[0]);
4784
- }
4785
- },
4786
-
4787
- /**
4788
- * If the cursor is at 'position', do we have sufficient data to start
4789
- * displaying the next hint. This is both complex and important.
4790
- * For example, if the user has just typed:<ul>
4791
- * <li>'set tabstop ' then they clearly want to know about the valid
4792
- * values for the tabstop setting, so the hint is based on the next
4793
- * parameter.
4794
- * <li>'set tabstop' (without trailing space) - they will probably still
4795
- * want to know about the valid values for the tabstop setting because
4796
- * there is no confusion about the setting in question.
4797
- * <li>'set tabsto' they've not finished typing a setting name so the hint
4798
- * should be based on the current parameter.
4799
- * <li>'set tabstop' (when there is an additional tabstopstyle setting) we
4800
- * can't make assumptions about the setting - we're not finished.
4801
- * </ul>
4802
- * <p>Note that the input for 2 and 4 is identical, only the configuration
4803
- * has changed, so hint display is environmental.
4804
- *
4805
- * <p>This function works out if the cursor is before the end of this
4806
- * assignment (assuming that we've asked the same thing of the previous
4807
- * assignment) and then attempts to work out if we should use the hint from
4808
- * the next assignment even though technically the cursor is still inside
4809
- * this one due to the rules above.
4810
- */
4811
- isPositionCaptured: function(position) {
4812
- if (!this.arg) {
4813
- return false;
4814
- }
4815
-
4816
- // Note we don't check if position >= this.arg.start because that's
4817
- // implied by the fact that we're asking the assignments in turn, and
4818
- // we want to avoid thing falling between the cracks, but we do need
4819
- // to check that the argument does have a position
4820
- if (this.arg.start === -1) {
4821
- return false;
4822
- }
4823
-
4824
- // We're clearly done if the position is past the end of the text
4825
- if (position > this.arg.end) {
4826
- return false;
4827
- }
4828
-
4829
- // If we're AT the end, the position is captured if either the status
4830
- // is not valid or if there are other valid options including current
4831
- if (position === this.arg.end) {
4832
- return this.conversion.status !== Status.VALID ||
4833
- this.conversion.predictions.length !== 0;
4834
- }
4835
-
4836
- // Otherwise we're clearly inside
4837
- return true;
4838
- },
4839
-
4840
- /**
4841
- * Replace the current value with the lower value if such a concept
4842
- * exists.
4843
- */
4844
- decrement: function() {
4845
- var replacement = this.param.type.decrement(this.value);
4846
- if (replacement != null) {
4847
- this.setValue(replacement);
4848
- }
4849
- },
4850
-
4851
- /**
4852
- * Replace the current value with the higher value if such a concept
4853
- * exists.
4854
- */
4855
- increment: function() {
4856
- var replacement = this.param.type.increment(this.value);
4857
- if (replacement != null) {
4858
- this.setValue(replacement);
4859
- }
4860
- },
4861
-
4862
- /**
4863
- * Helper when we're rebuilding command lines.
4864
- */
4865
- toString: function() {
4866
- return this.arg ? this.arg.toString() : '';
4867
- }
4868
- };
4869
- exports.Assignment = Assignment;
4870
-
4871
-
4872
- /**
4873
- * This is a special parameter to reflect the command itself.
4874
- */
4875
- var commandParam = {
4876
- name: '__command',
4877
- type: 'command',
4878
- description: 'The command to execute',
4879
-
4880
- /**
4881
- * Provide some documentation for a command.
4882
- */
4883
- getCustomHint: function(command, arg) {
4884
- var docs = [];
4885
- docs.push('<strong><tt> &gt; ');
4886
- docs.push(command.name);
4887
- if (command.params && command.params.length > 0) {
4888
- command.params.forEach(function(param) {
4889
- if (param.defaultValue === undefined) {
4890
- docs.push(' [' + param.name + ']');
4891
- }
4892
- else {
4893
- docs.push(' <em>[' + param.name + ']</em>');
4894
- }
4895
- }, this);
4896
- }
4897
- docs.push('</tt></strong><br/>');
4898
-
4899
- docs.push(command.description ? command.description : '(No description)');
4900
- docs.push('<br/>');
4901
-
4902
- if (command.params && command.params.length > 0) {
4903
- docs.push('<ul>');
4904
- command.params.forEach(function(param) {
4905
- docs.push('<li>');
4906
- docs.push('<strong><tt>' + param.name + '</tt></strong>: ');
4907
- docs.push(param.description ? param.description : '(No description)');
4908
- if (param.defaultValue === undefined) {
4909
- docs.push(' <em>[Required]</em>');
4910
- }
4911
- else if (param.defaultValue === null) {
4912
- docs.push(' <em>[Optional]</em>');
4913
- }
4914
- else {
4915
- docs.push(' <em>[Default: ' + param.defaultValue + ']</em>');
4916
- }
4917
- docs.push('</li>');
4918
- }, this);
4919
- docs.push('</ul>');
4920
- }
4921
-
4922
- return new Hint(Status.VALID, docs.join(''), arg);
4923
- }
4924
- };
4925
-
4926
- /**
4927
- * A Requisition collects the information needed to execute a command.
4928
- * There is no point in a requisition for parameter-less commands because there
4929
- * is no information to collect. A Requisition is a collection of assignments
4930
- * of values to parameters, each handled by an instance of Assignment.
4931
- * CliRequisition adds functions for parsing input from a command line to this
4932
- * class.
4933
- * <h2>Events<h2>
4934
- * We publish the following events:<ul>
4935
- * <li>argumentChange: The text of some argument has changed. It is likely that
4936
- * any UI component displaying this argument will need to be updated. (Note that
4937
- * this event is actually published by the Argument itself - see the docs for
4938
- * Argument for more details)
4939
- * The event object looks like: { argument: A, oldText: B, text: B }
4940
- * <li>commandChange: The command has changed. It is likely that a UI
4941
- * structure will need updating to match the parameters of the new command.
4942
- * The event object looks like { command: A }
4943
- * @constructor
4944
- */
4945
- function Requisition(env) {
4946
- this.env = env;
4947
- this.commandAssignment = new Assignment(commandParam, this);
4948
- }
4949
-
4950
- Requisition.prototype = {
4951
- /**
4952
- * The command that we are about to execute.
4953
- * @see setCommandConversion()
4954
- * @readonly
4955
- */
4956
- commandAssignment: undefined,
4957
-
4958
- /**
4959
- * The count of assignments. Excludes the commandAssignment
4960
- * @readonly
4961
- */
4962
- assignmentCount: undefined,
4963
-
4964
- /**
4965
- * The object that stores of Assignment objects that we are filling out.
4966
- * The Assignment objects are stored under their param.name for named
4967
- * lookup. Note: We make use of the property of Javascript objects that
4968
- * they are not just hashmaps, but linked-list hashmaps which iterate in
4969
- * insertion order.
4970
- * Excludes the commandAssignment.
4971
- */
4972
- _assignments: undefined,
4973
-
4974
- /**
4975
- * The store of hints generated by the assignments. We are trying to prevent
4976
- * the UI from needing to access this in broad form, but instead use
4977
- * methods that query part of this structure.
4978
- */
4979
- _hints: undefined,
4980
-
4981
- /**
4982
- * When the command changes, we need to keep a bunch of stuff in sync
4983
- */
4984
- _assignmentChanged: function(assignment) {
4985
- // This is all about re-creating Assignments
4986
- if (assignment.param.name !== '__command') {
4987
- return;
4988
- }
4989
-
4990
- this._assignments = {};
4991
-
4992
- if (assignment.value) {
4993
- assignment.value.params.forEach(function(param) {
4994
- this._assignments[param.name] = new Assignment(param, this);
4995
- }, this);
4996
- }
4997
-
4998
- this.assignmentCount = Object.keys(this._assignments).length;
4999
- this._dispatchEvent('commandChange', { command: assignment.value });
5000
- },
5001
-
5002
- /**
5003
- * Assignments have an order, so we need to store them in an array.
5004
- * But we also need named access ...
5005
- */
5006
- getAssignment: function(nameOrNumber) {
5007
- var name = (typeof nameOrNumber === 'string') ?
5008
- nameOrNumber :
5009
- Object.keys(this._assignments)[nameOrNumber];
5010
- return this._assignments[name];
5011
- },
5012
-
5013
- /**
5014
- * Where parameter name == assignment names - they are the same.
5015
- */
5016
- getParameterNames: function() {
5017
- return Object.keys(this._assignments);
5018
- },
5019
-
5020
- /**
5021
- * A *shallow* clone of the assignments.
5022
- * This is useful for systems that wish to go over all the assignments
5023
- * finding values one way or another and wish to trim an array as they go.
5024
- */
5025
- cloneAssignments: function() {
5026
- return Object.keys(this._assignments).map(function(name) {
5027
- return this._assignments[name];
5028
- }, this);
5029
- },
5030
-
5031
- /**
5032
- * Collect the statuses from the Assignments.
5033
- * The hints returned are sorted by severity
5034
- */
5035
- _updateHints: function() {
5036
- // TODO: work out when to clear this out for the plain Requisition case
5037
- // this._hints = [];
5038
- this.getAssignments(true).forEach(function(assignment) {
5039
- this._hints.push(assignment.getHint());
5040
- }, this);
5041
- Hint.sort(this._hints);
5042
-
5043
- // We would like to put some initial help here, but for anyone but
5044
- // a complete novice a 'type help' message is very annoying, so we
5045
- // need to find a way to only display this message once, or for
5046
- // until the user click a 'close' button or similar
5047
- // TODO: Add special case for '' input
5048
- },
5049
-
5050
- /**
5051
- * Returns the most severe status
5052
- */
5053
- getWorstHint: function() {
5054
- return this._hints[0];
5055
- },
5056
-
5057
- /**
5058
- * Extract the names and values of all the assignments, and return as
5059
- * an object.
5060
- */
5061
- getArgsObject: function() {
5062
- var args = {};
5063
- this.getAssignments().forEach(function(assignment) {
5064
- args[assignment.param.name] = assignment.value;
5065
- }, this);
5066
- return args;
5067
- },
5068
-
5069
- /**
5070
- * Access the arguments as an array.
5071
- * @param includeCommand By default only the parameter arguments are
5072
- * returned unless (includeCommand === true), in which case the list is
5073
- * prepended with commandAssignment.arg
5074
- */
5075
- getAssignments: function(includeCommand) {
5076
- var args = [];
5077
- if (includeCommand === true) {
5078
- args.push(this.commandAssignment);
5079
- }
5080
- Object.keys(this._assignments).forEach(function(name) {
5081
- args.push(this.getAssignment(name));
5082
- }, this);
5083
- return args;
5084
- },
5085
-
5086
- /**
5087
- * Reset all the assignments to their default values
5088
- */
5089
- setDefaultValues: function() {
5090
- this.getAssignments().forEach(function(assignment) {
5091
- assignment.setValue(undefined);
5092
- }, this);
5093
- },
5094
-
5095
- /**
5096
- * Helper to call canon.exec
5097
- */
5098
- exec: function() {
5099
- canon.exec(this.commandAssignment.value,
5100
- this.env,
5101
- "cli",
5102
- this.getArgsObject(),
5103
- this.toCanonicalString());
5104
- },
5105
-
5106
- /**
5107
- * Extract a canonical version of the input
5108
- */
5109
- toCanonicalString: function() {
5110
- var line = [];
5111
- line.push(this.commandAssignment.value.name);
5112
- Object.keys(this._assignments).forEach(function(name) {
5113
- var assignment = this._assignments[name];
5114
- var type = assignment.param.type;
5115
- // TODO: This will cause problems if there is a non-default value
5116
- // after a default value. Also we need to decide when to use
5117
- // named parameters in place of positional params. Both can wait.
5118
- if (assignment.value !== assignment.param.defaultValue) {
5119
- line.push(' ');
5120
- line.push(type.stringify(assignment.value));
5121
- }
5122
- }, this);
5123
- return line.join('');
5124
- }
5125
- };
5126
- oop.implement(Requisition.prototype, EventEmitter);
5127
- exports.Requisition = Requisition;
5128
-
5129
-
5130
- /**
5131
- * An object used during command line parsing to hold the various intermediate
5132
- * data steps.
5133
- * <p>The 'output' of the update is held in 2 objects: input.hints which is an
5134
- * array of hints to display to the user. In the future this will become a
5135
- * single value.
5136
- * <p>The other output value is input.requisition which gives access to an
5137
- * args object for use in executing the final command.
5138
- *
5139
- * <p>The majority of the functions in this class are called in sequence by the
5140
- * constructor. Their task is to add to <tt>hints</tt> fill out the requisition.
5141
- * <p>The general sequence is:<ul>
5142
- * <li>_tokenize(): convert _typed into _parts
5143
- * <li>_split(): convert _parts into _command and _unparsedArgs
5144
- * <li>_assign(): convert _unparsedArgs into requisition
5145
- * </ul>
5146
- *
5147
- * @param typed {string} The instruction as typed by the user so far
5148
- * @param options {object} A list of optional named parameters. Can be any of:
5149
- * <b>flags</b>: Flags for us to check against the predicates specified with the
5150
- * commands. Defaulted to <tt>keyboard.buildFlags({ });</tt>
5151
- * if not specified.
5152
- * @constructor
5153
- */
5154
- function CliRequisition(env, options) {
5155
- Requisition.call(this, env);
5156
-
5157
- if (options && options.flags) {
5158
- /**
5159
- * TODO: We were using a default of keyboard.buildFlags({ });
5160
- * This allowed us to have commands that only existed in certain contexts
5161
- * - i.e. Javascript specific commands.
5162
- */
5163
- this.flags = options.flags;
5164
- }
5165
- }
5166
- oop.inherits(CliRequisition, Requisition);
5167
- (function() {
5168
- /**
5169
- * Called by the UI when ever the user interacts with a command line input
5170
- * @param input A structure that details the state of the input field.
5171
- * It should look something like: { typed:a, cursor: { start:b, end:c } }
5172
- * Where a is the contents of the input field, and b and c are the start
5173
- * and end of the cursor/selection respectively.
5174
- */
5175
- CliRequisition.prototype.update = function(input) {
5176
- this.input = input;
5177
- this._hints = [];
5178
-
5179
- var args = this._tokenize(input.typed);
5180
- this._split(args);
5181
-
5182
- if (this.commandAssignment.value) {
5183
- this._assign(args);
5184
- }
5185
-
5186
- this._updateHints();
5187
- };
5188
-
5189
- /**
5190
- * Return an array of Status scores so we can create a marked up
5191
- * version of the command line input.
5192
- */
5193
- CliRequisition.prototype.getInputStatusMarkup = function() {
5194
- // 'scores' is an array which tells us what chars are errors
5195
- // Initialize with everything VALID
5196
- var scores = this.toString().split('').map(function(ch) {
5197
- return Status.VALID;
5198
- });
5199
- // For all chars in all hints, check and upgrade the score
5200
- this._hints.forEach(function(hint) {
5201
- for (var i = hint.start; i <= hint.end; i++) {
5202
- if (hint.status > scores[i]) {
5203
- scores[i] = hint.status;
5204
- }
5205
- }
5206
- }, this);
5207
- return scores;
5208
- };
5209
-
5210
- /**
5211
- * Reconstitute the input from the args
5212
- */
5213
- CliRequisition.prototype.toString = function() {
5214
- return this.getAssignments(true).map(function(assignment) {
5215
- return assignment.toString();
5216
- }, this).join('');
5217
- };
5218
-
5219
- var superUpdateHints = CliRequisition.prototype._updateHints;
5220
- /**
5221
- * Marks up hints in a number of ways:
5222
- * - Makes INCOMPLETE hints that are not near the cursor INVALID since
5223
- * they can't be completed by typing
5224
- * - Finds the most severe hint, and annotates the array with it
5225
- * - Finds the hint to display, and also annotates the array with it
5226
- * TODO: I'm wondering if array annotation is evil and we should replace
5227
- * this with an object. Need to find out more.
5228
- */
5229
- CliRequisition.prototype._updateHints = function() {
5230
- superUpdateHints.call(this);
5231
-
5232
- // Not knowing about cursor positioning, the requisition and assignments
5233
- // can't know this, but anything they mark as INCOMPLETE is actually
5234
- // INVALID unless the cursor is actually inside that argument.
5235
- var c = this.input.cursor;
5236
- this._hints.forEach(function(hint) {
5237
- var startInHint = c.start >= hint.start && c.start <= hint.end;
5238
- var endInHint = c.end >= hint.start && c.end <= hint.end;
5239
- var inHint = startInHint || endInHint;
5240
- if (!inHint && hint.status === Status.INCOMPLETE) {
5241
- hint.status = Status.INVALID;
5242
- }
5243
- }, this);
5244
-
5245
- Hint.sort(this._hints);
5246
- };
5247
-
5248
- /**
5249
- * Accessor for the hints array.
5250
- * While we could just use the hints property, using getHints() is
5251
- * preferred for symmetry with Requisition where it needs a function due to
5252
- * lack of an atomic update system.
5253
- */
5254
- CliRequisition.prototype.getHints = function() {
5255
- return this._hints;
5256
- };
5257
-
5258
- /**
5259
- * Look through the arguments attached to our assignments for the assignment
5260
- * at the given position.
5261
- */
5262
- CliRequisition.prototype.getAssignmentAt = function(position) {
5263
- var assignments = this.getAssignments(true);
5264
- for (var i = 0; i < assignments.length; i++) {
5265
- var assignment = assignments[i];
5266
- if (!assignment.arg) {
5267
- // There is no argument in this assignment, we've fallen off
5268
- // the end of the obvious answers - it must be this one.
5269
- return assignment;
5270
- }
5271
- if (assignment.isPositionCaptured(position)) {
5272
- return assignment;
5273
- }
5274
- }
5275
-
5276
- return assignment;
5277
- };
5278
-
5279
- /**
5280
- * Split up the input taking into account ' and "
5281
- */
5282
- CliRequisition.prototype._tokenize = function(typed) {
5283
- // For blank input, place a dummy empty argument into the list
5284
- if (typed == null || typed.length === 0) {
5285
- return [ new Argument(this, '', 0, 0, '', '') ];
5286
- }
5287
-
5288
- var OUTSIDE = 1; // The last character was whitespace
5289
- var IN_SIMPLE = 2; // The last character was part of a parameter
5290
- var IN_SINGLE_Q = 3; // We're inside a single quote: '
5291
- var IN_DOUBLE_Q = 4; // We're inside double quotes: "
5292
-
5293
- var mode = OUTSIDE;
5294
-
5295
- // First we un-escape. This list was taken from:
5296
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Unicode
5297
- // We are generally converting to their real values except for \', \"
5298
- // and '\ ' which we are converting to unicode private characters so we
5299
- // can distinguish them from ', " and ' ', which have special meaning.
5300
- // They need swapping back post-split - see unescape2()
5301
- typed = typed
5302
- .replace(/\\\\/g, '\\')
5303
- .replace(/\\b/g, '\b')
5304
- .replace(/\\f/g, '\f')
5305
- .replace(/\\n/g, '\n')
5306
- .replace(/\\r/g, '\r')
5307
- .replace(/\\t/g, '\t')
5308
- .replace(/\\v/g, '\v')
5309
- .replace(/\\n/g, '\n')
5310
- .replace(/\\r/g, '\r')
5311
- .replace(/\\ /g, '\uF000')
5312
- .replace(/\\'/g, '\uF001')
5313
- .replace(/\\"/g, '\uF002');
5314
-
5315
- function unescape2(str) {
5316
- return str
5317
- .replace(/\uF000/g, ' ')
5318
- .replace(/\uF001/g, '\'')
5319
- .replace(/\uF002/g, '"');
5320
- }
5321
-
5322
- var i = 0;
5323
- var start = 0; // Where did this section start?
5324
- var prefix = '';
5325
- var args = [];
5326
-
5327
- while (true) {
5328
- if (i >= typed.length) {
5329
- // There is nothing else to read - tidy up
5330
- if (mode !== OUTSIDE) {
5331
- var str = unescape2(typed.substring(start, i));
5332
- args.push(new Argument(this, str, start, i, prefix, ''));
5333
- }
5334
- else {
5335
- if (i !== start) {
5336
- // There's a bunch of whitespace at the end of the
5337
- // command add it to the last argument's suffix,
5338
- // creating an empty argument if needed.
5339
- var extra = typed.substring(start, i);
5340
- var lastArg = args[args.length - 1];
5341
- if (!lastArg) {
5342
- lastArg = new Argument(this, '', i, i, extra, '');
5343
- args.push(lastArg);
5344
- }
5345
- else {
5346
- lastArg.suffix += extra;
5347
- }
5348
- }
5349
- }
5350
- break;
5351
- }
5352
-
5353
- var c = typed[i];
5354
- switch (mode) {
5355
- case OUTSIDE:
5356
- if (c === '\'') {
5357
- prefix = typed.substring(start, i + 1);
5358
- mode = IN_SINGLE_Q;
5359
- start = i + 1;
5360
- }
5361
- else if (c === '"') {
5362
- prefix = typed.substring(start, i + 1);
5363
- mode = IN_DOUBLE_Q;
5364
- start = i + 1;
5365
- }
5366
- else if (/ /.test(c)) {
5367
- // Still whitespace, do nothing
5368
- }
5369
- else {
5370
- prefix = typed.substring(start, i);
5371
- mode = IN_SIMPLE;
5372
- start = i;
5373
- }
5374
- break;
5375
-
5376
- case IN_SIMPLE:
5377
- // There is an edge case of xx'xx which we are assuming to
5378
- // be a single parameter (and same with ")
5379
- if (c === ' ') {
5380
- var str = unescape2(typed.substring(start, i));
5381
- args.push(new Argument(this, str,
5382
- start, i, prefix, ''));
5383
- mode = OUTSIDE;
5384
- start = i;
5385
- prefix = '';
5386
- }
5387
- break;
5388
-
5389
- case IN_SINGLE_Q:
5390
- if (c === '\'') {
5391
- var str = unescape2(typed.substring(start, i));
5392
- args.push(new Argument(this, str,
5393
- start - 1, i + 1, prefix, c));
5394
- mode = OUTSIDE;
5395
- start = i + 1;
5396
- prefix = '';
5397
- }
5398
- break;
5399
-
5400
- case IN_DOUBLE_Q:
5401
- if (c === '"') {
5402
- var str = unescape2(typed.substring(start, i));
5403
- args.push(new Argument(this, str,
5404
- start - 1, i + 1, prefix, c));
5405
- mode = OUTSIDE;
5406
- start = i + 1;
5407
- prefix = '';
5408
- }
5409
- break;
5410
- }
5411
-
5412
- i++;
5413
- }
5414
-
5415
- return args;
5416
- };
5417
-
5418
- /**
5419
- * Looks in the canon for a command extension that matches what has been
5420
- * typed at the command line.
5421
- */
5422
- CliRequisition.prototype._split = function(args) {
5423
- var argsUsed = 1;
5424
- var arg;
5425
-
5426
- while (argsUsed <= args.length) {
5427
- var arg = Argument.merge(args, 0, argsUsed);
5428
- this.commandAssignment.setArgument(arg);
5429
-
5430
- if (!this.commandAssignment.value) {
5431
- // Not found. break with value == null
5432
- break;
5433
- }
5434
-
5435
- /*
5436
- // Previously we needed a way to hide commands depending context.
5437
- // We have not resurrected that feature yet.
5438
- if (!keyboard.flagsMatch(command.predicates, this.flags)) {
5439
- // If the predicates say 'no match' then go LA LA LA
5440
- command = null;
5441
- break;
5442
- }
5443
- */
5444
-
5445
- if (this.commandAssignment.value.exec) {
5446
- // Valid command, break with command valid
5447
- for (var i = 0; i < argsUsed; i++) {
5448
- args.shift();
5449
- }
5450
- break;
5451
- }
5452
-
5453
- argsUsed++;
5454
- }
5455
- };
5456
-
5457
- /**
5458
- * Work out which arguments are applicable to which parameters.
5459
- * <p>This takes #_command.params and #_unparsedArgs and creates a map of
5460
- * param names to 'assignment' objects, which have the following properties:
5461
- * <ul>
5462
- * <li>param - The matching parameter.
5463
- * <li>index - Zero based index into where the match came from on the input
5464
- * <li>value - The matching input
5465
- * </ul>
5466
- */
5467
- CliRequisition.prototype._assign = function(args) {
5468
- if (args.length === 0) {
5469
- this.setDefaultValues();
5470
- return;
5471
- }
5472
-
5473
- // Create an error if the command does not take parameters, but we have
5474
- // been given them ...
5475
- if (this.assignmentCount === 0) {
5476
- // TODO: previously we were doing some extra work to avoid this if
5477
- // we determined that we had args that were all whitespace, but
5478
- // probably given our tighter tokenize() this won't be an issue?
5479
- this._hints.push(new Hint(Status.INVALID,
5480
- this.commandAssignment.value.name +
5481
- ' does not take any parameters',
5482
- Argument.merge(args)));
5483
- return;
5484
- }
5485
-
5486
- // Special case: if there is only 1 parameter, and that's of type
5487
- // text we put all the params into the first param
5488
- if (this.assignmentCount === 1) {
5489
- var assignment = this.getAssignment(0);
5490
- if (assignment.param.type.name === 'text') {
5491
- assignment.setArgument(Argument.merge(args));
5492
- return;
5493
- }
5494
- }
5495
-
5496
- var assignments = this.cloneAssignments();
5497
- var names = this.getParameterNames();
5498
-
5499
- // Extract all the named parameters
5500
- var used = [];
5501
- assignments.forEach(function(assignment) {
5502
- var namedArgText = '--' + assignment.name;
5503
-
5504
- var i = 0;
5505
- while (true) {
5506
- var arg = args[i];
5507
- if (namedArgText !== arg.text) {
5508
- i++;
5509
- if (i >= args.length) {
5510
- break;
5511
- }
5512
- continue;
5513
- }
5514
-
5515
- // boolean parameters don't have values, default to false
5516
- if (assignment.param.type.name === 'boolean') {
5517
- assignment.setValue(true);
5518
- }
5519
- else {
5520
- if (i + 1 < args.length) {
5521
- // Missing value portion of this named param
5522
- this._hints.push(new Hint(Status.INCOMPLETE,
5523
- 'Missing value for: ' + namedArgText,
5524
- args[i]));
5525
- }
5526
- else {
5527
- args.splice(i + 1, 1);
5528
- assignment.setArgument(args[i + 1]);
5529
- }
5530
- }
5531
-
5532
- lang.arrayRemove(names, assignment.name);
5533
- args.splice(i, 1);
5534
- // We don't need to i++ if we splice
5535
- }
5536
- }, this);
5537
-
5538
- // What's left are positional parameters assign in order
5539
- names.forEach(function(name) {
5540
- var assignment = this.getAssignment(name);
5541
- if (args.length === 0) {
5542
- // No more values
5543
- assignment.setValue(undefined); // i.e. default
5544
- }
5545
- else {
5546
- var arg = args[0];
5547
- args.splice(0, 1);
5548
- assignment.setArgument(arg);
5549
- }
5550
- }, this);
5551
-
5552
- if (args.length > 0) {
5553
- var remaining = Argument.merge(args);
5554
- this._hints.push(new Hint(Status.INVALID,
5555
- 'Input \'' + remaining.text + '\' makes no sense.',
5556
- remaining));
5557
- }
5558
- };
5559
-
5560
- })();
5561
- exports.CliRequisition = CliRequisition;
5562
-
5563
-
5564
- });
5565
- /* ***** BEGIN LICENSE BLOCK *****
5566
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5567
- *
5568
- * The contents of this file are subject to the Mozilla Public License Version
5569
- * 1.1 (the "License"); you may not use this file except in compliance with
5570
- * the License. You may obtain a copy of the License at
5571
- * http://www.mozilla.org/MPL/
5572
- *
5573
- * Software distributed under the License is distributed on an "AS IS" basis,
5574
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
5575
- * for the specific language governing rights and limitations under the
5576
- * License.
5577
- *
5578
- * The Original Code is Mozilla Skywriter.
5579
- *
5580
- * The Initial Developer of the Original Code is
5581
- * Mozilla.
5582
- * Portions created by the Initial Developer are Copyright (C) 2009
5583
- * the Initial Developer. All Rights Reserved.
5584
- *
5585
- * Contributor(s):
5586
- * Joe Walker (jwalker@mozilla.com)
5587
- *
5588
- * Alternatively, the contents of this file may be used under the terms of
5589
- * either the GNU General Public License Version 2 or later (the "GPL"), or
5590
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
5591
- * in which case the provisions of the GPL or the LGPL are applicable instead
5592
- * of those above. If you wish to allow use of your version of this file only
5593
- * under the terms of either the GPL or the LGPL, and not to allow others to
5594
- * use your version of this file under the terms of the MPL, indicate your
5595
- * decision by deleting the provisions above and replace them with the notice
5596
- * and other provisions required by the GPL or the LGPL. If you do not delete
5597
- * the provisions above, a recipient may use your version of this file under
5598
- * the terms of any one of the MPL, the GPL or the LGPL.
5599
- *
5600
- * ***** END LICENSE BLOCK ***** */
5601
-
5602
- define('cockpit/ui/settings', ['require', 'exports', 'module' , 'pilot/types', 'pilot/types/basic'], function(require, exports, module) {
5603
-
5604
-
5605
- var types = require("pilot/types");
5606
- var SelectionType = require('pilot/types/basic').SelectionType;
5607
-
5608
- var direction = new SelectionType({
5609
- name: 'direction',
5610
- data: [ 'above', 'below' ]
5611
- });
5612
-
5613
- var hintDirectionSetting = {
5614
- name: "hintDirection",
5615
- description: "Are hints shown above or below the command line?",
5616
- type: "direction",
5617
- defaultValue: "above"
5618
- };
5619
-
5620
- var outputDirectionSetting = {
5621
- name: "outputDirection",
5622
- description: "Is the output window shown above or below the command line?",
5623
- type: "direction",
5624
- defaultValue: "above"
5625
- };
5626
-
5627
- var outputHeightSetting = {
5628
- name: "outputHeight",
5629
- description: "What height should the output panel be?",
5630
- type: "number",
5631
- defaultValue: 300
5632
- };
5633
-
5634
- exports.startup = function(data, reason) {
5635
- types.registerType(direction);
5636
- data.env.settings.addSetting(hintDirectionSetting);
5637
- data.env.settings.addSetting(outputDirectionSetting);
5638
- data.env.settings.addSetting(outputHeightSetting);
5639
- };
5640
-
5641
- exports.shutdown = function(data, reason) {
5642
- types.unregisterType(direction);
5643
- data.env.settings.removeSetting(hintDirectionSetting);
5644
- data.env.settings.removeSetting(outputDirectionSetting);
5645
- data.env.settings.removeSetting(outputHeightSetting);
5646
- };
5647
-
5648
-
5649
- });
5650
- /* ***** BEGIN LICENSE BLOCK *****
5651
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5652
- *
5653
- * The contents of this file are subject to the Mozilla Public License Version
5654
- * 1.1 (the "License"); you may not use this file except in compliance with
5655
- * the License. You may obtain a copy of the License at
5656
- * http://www.mozilla.org/MPL/
5657
- *
5658
- * Software distributed under the License is distributed on an "AS IS" basis,
5659
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
5660
- * for the specific language governing rights and limitations under the
5661
- * License.
5662
- *
5663
- * The Original Code is Skywriter.
5664
- *
5665
- * The Initial Developer of the Original Code is
5666
- * Mozilla.
5667
- * Portions created by the Initial Developer are Copyright (C) 2009
5668
- * the Initial Developer. All Rights Reserved.
5669
- *
5670
- * Contributor(s):
5671
- * Joe Walker (jwalker@mozilla.com)
5672
- *
5673
- * Alternatively, the contents of this file may be used under the terms of
5674
- * either the GNU General Public License Version 2 or later (the "GPL"), or
5675
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
5676
- * in which case the provisions of the GPL or the LGPL are applicable instead
5677
- * of those above. If you wish to allow use of your version of this file only
5678
- * under the terms of either the GPL or the LGPL, and not to allow others to
5679
- * use your version of this file under the terms of the MPL, indicate your
5680
- * decision by deleting the provisions above and replace them with the notice
5681
- * and other provisions required by the GPL or the LGPL. If you do not delete
5682
- * the provisions above, a recipient may use your version of this file under
5683
- * the terms of any one of the MPL, the GPL or the LGPL.
5684
- *
5685
- * ***** END LICENSE BLOCK ***** */
5686
-
5687
- define('cockpit/ui/cli_view', ['require', 'exports', 'module' , 'text!cockpit/ui/cli_view.css', 'pilot/event', 'pilot/dom', 'pilot/keys', 'pilot/canon', 'pilot/types', 'cockpit/cli', 'cockpit/ui/request_view'], function(require, exports, module) {
5688
-
5689
-
5690
- var editorCss = require("text!cockpit/ui/cli_view.css");
5691
- var event = require("pilot/event");
5692
- var dom = require("pilot/dom");
5693
-
5694
- dom.importCssString(editorCss);
5695
-
5696
- var event = require("pilot/event");
5697
- var keys = require("pilot/keys");
5698
- var canon = require("pilot/canon");
5699
- var Status = require('pilot/types').Status;
5700
-
5701
- var CliRequisition = require('cockpit/cli').CliRequisition;
5702
- var Hint = require('cockpit/cli').Hint;
5703
- var RequestView = require('cockpit/ui/request_view').RequestView;
5704
-
5705
- var NO_HINT = new Hint(Status.VALID, '', 0, 0);
5706
-
5707
- /**
5708
- * On startup we need to:
5709
- * 1. Add 3 sets of elements to the DOM for:
5710
- * - command line output
5711
- * - input hints
5712
- * - completion
5713
- * 2. Attach a set of events so the command line works
5714
- */
5715
- exports.startup = function(data, reason) {
5716
- var cli = new CliRequisition(data.env);
5717
- var cliView = new CliView(cli, data.env);
5718
- data.env.cli = cli;
5719
- };
5720
-
5721
- /**
5722
- * A class to handle the simplest UI implementation
5723
- */
5724
- function CliView(cli, env) {
5725
- cli.cliView = this;
5726
- this.cli = cli;
5727
- this.doc = document;
5728
- this.win = dom.getParentWindow(this.doc);
5729
- this.env = env;
5730
-
5731
- // TODO: we should have a better way to specify command lines???
5732
- this.element = this.doc.getElementById('cockpitInput');
5733
- if (!this.element) {
5734
- // console.log('No element with an id of cockpit. Bailing on cli');
5735
- return;
5736
- }
5737
-
5738
- this.settings = env.settings;
5739
- this.hintDirection = this.settings.getSetting('hintDirection');
5740
- this.outputDirection = this.settings.getSetting('outputDirection');
5741
- this.outputHeight = this.settings.getSetting('outputHeight');
5742
-
5743
- // If the requisition tells us something has changed, we use this to know
5744
- // if we should ignore it
5745
- this.isUpdating = false;
5746
-
5747
- this.createElements();
5748
- this.update();
5749
- }
5750
- CliView.prototype = {
5751
- /**
5752
- * Create divs for completion, hints and output
5753
- */
5754
- createElements: function() {
5755
- var input = this.element;
5756
-
5757
- this.element.spellcheck = false;
5758
-
5759
- this.output = this.doc.getElementById('cockpitOutput');
5760
- this.popupOutput = (this.output == null);
5761
- if (!this.output) {
5762
- this.output = this.doc.createElement('div');
5763
- this.output.id = 'cockpitOutput';
5764
- this.output.className = 'cptOutput';
5765
- input.parentNode.insertBefore(this.output, input.nextSibling);
5766
-
5767
- var setMaxOutputHeight = function() {
5768
- this.output.style.maxHeight = this.outputHeight.get() + 'px';
5769
- }.bind(this);
5770
- this.outputHeight.addEventListener('change', setMaxOutputHeight);
5771
- setMaxOutputHeight();
5772
- }
5773
-
5774
- this.completer = this.doc.createElement('div');
5775
- this.completer.className = 'cptCompletion VALID';
5776
-
5777
- this.completer.style.color = dom.computedStyle(input, "color");
5778
- this.completer.style.fontSize = dom.computedStyle(input, "fontSize");
5779
- this.completer.style.fontFamily = dom.computedStyle(input, "fontFamily");
5780
- this.completer.style.fontWeight = dom.computedStyle(input, "fontWeight");
5781
- this.completer.style.fontStyle = dom.computedStyle(input, "fontStyle");
5782
- input.parentNode.insertBefore(this.completer, input.nextSibling);
5783
-
5784
- // Transfer background styling to the completer.
5785
- this.completer.style.backgroundColor = input.style.backgroundColor;
5786
- input.style.backgroundColor = 'transparent';
5787
-
5788
- this.hinter = this.doc.createElement('div');
5789
- this.hinter.className = 'cptHints';
5790
- input.parentNode.insertBefore(this.hinter, input.nextSibling);
5791
-
5792
- var resizer = this.resizer.bind(this);
5793
- event.addListener(this.win, 'resize', resizer);
5794
- this.hintDirection.addEventListener('change', resizer);
5795
- this.outputDirection.addEventListener('change', resizer);
5796
- resizer();
5797
-
5798
- canon.addEventListener('output', function(ev) {
5799
- new RequestView(ev.request, this);
5800
- }.bind(this));
5801
- event.addCommandKeyListener(input, this.onCommandKey.bind(this));
5802
- event.addListener(input, 'keyup', this.onKeyUp.bind(this));
5803
-
5804
- // cursor position affects hint severity. TODO: shortcuts for speed
5805
- event.addListener(input, 'mouseup', function(ev) {
5806
- this.isUpdating = true;
5807
- this.update();
5808
- this.isUpdating = false;
5809
- }.bind(this));
5810
-
5811
- this.cli.addEventListener('argumentChange', this.onArgChange.bind(this));
5812
-
5813
- event.addListener(input, "focus", function() {
5814
- dom.addCssClass(this.output, "cptFocusPopup");
5815
- dom.addCssClass(this.hinter, "cptFocusPopup");
5816
- }.bind(this));
5817
-
5818
- function hideOutput() {
5819
- dom.removeCssClass(this.output, "cptFocusPopup");
5820
- dom.removeCssClass(this.hinter, "cptFocusPopup");
5821
- };
5822
- event.addListener(input, "blur", hideOutput.bind(this));
5823
- hideOutput.call(this);
5824
- },
5825
-
5826
- /**
5827
- * We need to see the output of the latest command entered
5828
- */
5829
- scrollOutputToBottom: function() {
5830
- // Certain browsers have a bug such that scrollHeight is too small
5831
- // when content does not fill the client area of the element
5832
- var scrollHeight = Math.max(this.output.scrollHeight, this.output.clientHeight);
5833
- this.output.scrollTop = scrollHeight - this.output.clientHeight;
5834
- },
5835
-
5836
- /**
5837
- * To be called on window resize or any time we want to align the elements
5838
- * with the input box.
5839
- */
5840
- resizer: function() {
5841
- var rect = this.element.getClientRects()[0];
5842
-
5843
- this.completer.style.top = rect.top + 'px';
5844
- var height = rect.bottom - rect.top;
5845
- this.completer.style.height = height + 'px';
5846
- this.completer.style.lineHeight = height + 'px';
5847
- this.completer.style.left = rect.left + 'px';
5848
- var width = rect.right - rect.left;
5849
- this.completer.style.width = width + 'px';
5850
-
5851
- if (this.hintDirection.get() === 'below') {
5852
- this.hinter.style.top = rect.bottom + 'px';
5853
- this.hinter.style.bottom = 'auto';
5854
- }
5855
- else {
5856
- this.hinter.style.top = 'auto';
5857
- this.hinter.style.bottom = (this.doc.documentElement.clientHeight - rect.top) + 'px';
5858
- }
5859
- this.hinter.style.left = (rect.left + 30) + 'px';
5860
- this.hinter.style.maxWidth = (width - 110) + 'px';
5861
-
5862
- if (this.popupOutput) {
5863
- if (this.outputDirection.get() === 'below') {
5864
- this.output.style.top = rect.bottom + 'px';
5865
- this.output.style.bottom = 'auto';
5866
- }
5867
- else {
5868
- this.output.style.top = 'auto';
5869
- this.output.style.bottom = (this.doc.documentElement.clientHeight - rect.top) + 'px';
5870
- }
5871
- this.output.style.left = rect.left + 'px';
5872
- this.output.style.width = (width - 80) + 'px';
5873
- }
5874
- },
5875
-
5876
- /**
5877
- * Ensure that TAB isn't handled by the browser
5878
- */
5879
- onCommandKey: function(ev, hashId, keyCode) {
5880
- var stopEvent;
5881
- if (keyCode === keys.TAB ||
5882
- keyCode === keys.UP ||
5883
- keyCode === keys.DOWN) {
5884
- stopEvent = true;
5885
- } else if (hashId != 0 || keyCode != 0) {
5886
- stopEvent = canon.execKeyCommand(this.env, 'cli', hashId, keyCode);
5887
- }
5888
- stopEvent && event.stopEvent(ev);
5889
- },
5890
-
5891
- /**
5892
- * The main keyboard processing loop
5893
- */
5894
- onKeyUp: function(ev) {
5895
- var handled;
5896
- /*
5897
- var handled = keyboardManager.processKeyEvent(ev, this, {
5898
- isCommandLine: true, isKeyUp: true
5899
- });
5900
- */
5901
-
5902
- // RETURN does a special exec/highlight thing
5903
- if (ev.keyCode === keys.RETURN) {
5904
- var worst = this.cli.getWorstHint();
5905
- // Deny RETURN unless the command might work
5906
- if (worst.status === Status.VALID) {
5907
- this.cli.exec();
5908
- this.element.value = '';
5909
- }
5910
- else {
5911
- // If we've denied RETURN because the command was not VALID,
5912
- // select the part of the command line that is causing problems
5913
- // TODO: if there are 2 errors are we picking the right one?
5914
- dom.setSelectionStart(this.element, worst.start);
5915
- dom.setSelectionEnd(this.element, worst.end);
5916
- }
5917
- }
5918
-
5919
- this.update();
5920
-
5921
- // Special actions which delegate to the assignment
5922
- var current = this.cli.getAssignmentAt(dom.getSelectionStart(this.element));
5923
- if (current) {
5924
- // TAB does a special complete thing
5925
- if (ev.keyCode === keys.TAB) {
5926
- current.complete();
5927
- this.update();
5928
- }
5929
-
5930
- // UP/DOWN look for some history
5931
- if (ev.keyCode === keys.UP) {
5932
- current.increment();
5933
- this.update();
5934
- }
5935
- if (ev.keyCode === keys.DOWN) {
5936
- current.decrement();
5937
- this.update();
5938
- }
5939
- }
5940
-
5941
- return handled;
5942
- },
5943
-
5944
- /**
5945
- * Actually parse the input and make sure we're all up to date
5946
- */
5947
- update: function() {
5948
- this.isUpdating = true;
5949
- var input = {
5950
- typed: this.element.value,
5951
- cursor: {
5952
- start: dom.getSelectionStart(this.element),
5953
- end: dom.getSelectionEnd(this.element.selectionEnd)
5954
- }
5955
- };
5956
- this.cli.update(input);
5957
-
5958
- var display = this.cli.getAssignmentAt(input.cursor.start).getHint();
5959
-
5960
- // 1. Update the completer with prompt/error marker/TAB info
5961
- dom.removeCssClass(this.completer, Status.VALID.toString());
5962
- dom.removeCssClass(this.completer, Status.INCOMPLETE.toString());
5963
- dom.removeCssClass(this.completer, Status.INVALID.toString());
5964
-
5965
- var completion = '<span class="cptPrompt">&gt;</span> ';
5966
- if (this.element.value.length > 0) {
5967
- var scores = this.cli.getInputStatusMarkup();
5968
- completion += this.markupStatusScore(scores);
5969
- }
5970
-
5971
- // Display the "-> prediction" at the end of the completer
5972
- if (this.element.value.length > 0 &&
5973
- display.predictions && display.predictions.length > 0) {
5974
- var tab = display.predictions[0];
5975
- completion += ' &nbsp;&#x21E5; ' + (tab.name ? tab.name : tab);
5976
- }
5977
- this.completer.innerHTML = completion;
5978
- dom.addCssClass(this.completer, this.cli.getWorstHint().status.toString());
5979
-
5980
- // 2. Update the hint element
5981
- var hint = '';
5982
- if (this.element.value.length !== 0) {
5983
- hint += display.message;
5984
- if (display.predictions && display.predictions.length > 0) {
5985
- hint += ': [ ';
5986
- display.predictions.forEach(function(prediction) {
5987
- hint += (prediction.name ? prediction.name : prediction);
5988
- hint += ' | ';
5989
- }, this);
5990
- hint = hint.replace(/\| $/, ']');
5991
- }
5992
- }
5993
-
5994
- this.hinter.innerHTML = hint;
5995
- if (hint.length === 0) {
5996
- dom.addCssClass(this.hinter, 'cptNoPopup');
5997
- }
5998
- else {
5999
- dom.removeCssClass(this.hinter, 'cptNoPopup');
6000
- }
6001
-
6002
- this.isUpdating = false;
6003
- },
6004
-
6005
- /**
6006
- * Markup an array of Status values with spans
6007
- */
6008
- markupStatusScore: function(scores) {
6009
- var completion = '';
6010
- // Create mark-up
6011
- var i = 0;
6012
- var lastStatus = -1;
6013
- while (true) {
6014
- if (lastStatus !== scores[i]) {
6015
- completion += '<span class=' + scores[i].toString() + '>';
6016
- lastStatus = scores[i];
6017
- }
6018
- completion += this.element.value[i];
6019
- i++;
6020
- if (i === this.element.value.length) {
6021
- completion += '</span>';
6022
- break;
6023
- }
6024
- if (lastStatus !== scores[i]) {
6025
- completion += '</span>';
6026
- }
6027
- }
6028
-
6029
- return completion;
6030
- },
6031
-
6032
- /**
6033
- * Update the input element to reflect the changed argument
6034
- */
6035
- onArgChange: function(ev) {
6036
- if (this.isUpdating) {
6037
- return;
6038
- }
6039
-
6040
- var prefix = this.element.value.substring(0, ev.argument.start);
6041
- var suffix = this.element.value.substring(ev.argument.end);
6042
- var insert = typeof ev.text === 'string' ? ev.text : ev.text.name;
6043
- this.element.value = prefix + insert + suffix;
6044
- // Fix the cursor.
6045
- var insertEnd = (prefix + insert).length;
6046
- this.element.selectionStart = insertEnd;
6047
- this.element.selectionEnd = insertEnd;
6048
- }
6049
- };
6050
- exports.CliView = CliView;
6051
-
6052
-
6053
- });
6054
- /* ***** BEGIN LICENSE BLOCK *****
6055
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6056
- *
6057
- * The contents of this file are subject to the Mozilla Public License Version
6058
- * 1.1 (the "License"); you may not use this file except in compliance with
6059
- * the License. You may obtain a copy of the License at
6060
- * http://www.mozilla.org/MPL/
6061
- *
6062
- * Software distributed under the License is distributed on an "AS IS" basis,
6063
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
6064
- * for the specific language governing rights and limitations under the
6065
- * License.
6066
- *
6067
- * The Original Code is Ajax.org Code Editor (ACE).
6068
- *
6069
- * The Initial Developer of the Original Code is
6070
- * Ajax.org B.V.
6071
- * Portions created by the Initial Developer are Copyright (C) 2010
6072
- * the Initial Developer. All Rights Reserved.
6073
- *
6074
- * Contributor(s):
6075
- * Fabian Jakobs <fabian AT ajax DOT org>
6076
- *
6077
- * Alternatively, the contents of this file may be used under the terms of
6078
- * either the GNU General Public License Version 2 or later (the "GPL"), or
6079
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
6080
- * in which case the provisions of the GPL or the LGPL are applicable instead
6081
- * of those above. If you wish to allow use of your version of this file only
6082
- * under the terms of either the GPL or the LGPL, and not to allow others to
6083
- * use your version of this file under the terms of the MPL, indicate your
6084
- * decision by deleting the provisions above and replace them with the notice
6085
- * and other provisions required by the GPL or the LGPL. If you do not delete
6086
- * the provisions above, a recipient may use your version of this file under
6087
- * the terms of any one of the MPL, the GPL or the LGPL.
6088
- *
6089
- * ***** END LICENSE BLOCK ***** */
6090
-
6091
- define('pilot/event', ['require', 'exports', 'module' , 'pilot/keys', 'pilot/useragent', 'pilot/dom'], function(require, exports, module) {
6092
-
6093
- var keys = require("pilot/keys");
6094
- var useragent = require("pilot/useragent");
6095
- var dom = require("pilot/dom");
6096
-
6097
- exports.addListener = function(elem, type, callback) {
6098
- if (elem.addEventListener) {
6099
- return elem.addEventListener(type, callback, false);
6100
- }
6101
- if (elem.attachEvent) {
6102
- var wrapper = function() {
6103
- callback(window.event);
6104
- };
6105
- callback._wrapper = wrapper;
6106
- elem.attachEvent("on" + type, wrapper);
6107
- }
6108
- };
6109
-
6110
- exports.removeListener = function(elem, type, callback) {
6111
- if (elem.removeEventListener) {
6112
- return elem.removeEventListener(type, callback, false);
6113
- }
6114
- if (elem.detachEvent) {
6115
- elem.detachEvent("on" + type, callback._wrapper || callback);
6116
- }
6117
- };
6118
-
6119
- /**
6120
- * Prevents propagation and clobbers the default action of the passed event
6121
- */
6122
- exports.stopEvent = function(e) {
6123
- exports.stopPropagation(e);
6124
- exports.preventDefault(e);
6125
- return false;
6126
- };
6127
-
6128
- exports.stopPropagation = function(e) {
6129
- if (e.stopPropagation)
6130
- e.stopPropagation();
6131
- else
6132
- e.cancelBubble = true;
6133
- };
6134
-
6135
- exports.preventDefault = function(e) {
6136
- if (e.preventDefault)
6137
- e.preventDefault();
6138
- else
6139
- e.returnValue = false;
6140
- };
6141
-
6142
- exports.getDocumentX = function(e) {
6143
- if (e.clientX) {
6144
- return e.clientX + dom.getPageScrollLeft();
6145
- } else {
6146
- return e.pageX;
6147
- }
6148
- };
6149
-
6150
- exports.getDocumentY = function(e) {
6151
- if (e.clientY) {
6152
- return e.clientY + dom.getPageScrollTop();
6153
- } else {
6154
- return e.pageY;
6155
- }
6156
- };
6157
-
6158
- /**
6159
- * @return {Number} 0 for left button, 1 for middle button, 2 for right button
6160
- */
6161
- exports.getButton = function(e) {
6162
- if (e.type == "dblclick")
6163
- return 0;
6164
- else if (e.type == "contextmenu")
6165
- return 2;
6166
-
6167
- // DOM Event
6168
- if (e.preventDefault) {
6169
- return e.button;
6170
- }
6171
- // old IE
6172
- else {
6173
- return {1:0, 2:2, 4:1}[e.button];
6174
- }
6175
- };
6176
-
6177
- if (document.documentElement.setCapture) {
6178
- exports.capture = function(el, eventHandler, releaseCaptureHandler) {
6179
- function onMouseMove(e) {
6180
- eventHandler(e);
6181
- return exports.stopPropagation(e);
6182
- }
6183
-
6184
- function onReleaseCapture(e) {
6185
- eventHandler && eventHandler(e);
6186
- releaseCaptureHandler && releaseCaptureHandler();
6187
-
6188
- exports.removeListener(el, "mousemove", eventHandler);
6189
- exports.removeListener(el, "mouseup", onReleaseCapture);
6190
- exports.removeListener(el, "losecapture", onReleaseCapture);
6191
-
6192
- el.releaseCapture();
6193
- }
6194
-
6195
- exports.addListener(el, "mousemove", eventHandler);
6196
- exports.addListener(el, "mouseup", onReleaseCapture);
6197
- exports.addListener(el, "losecapture", onReleaseCapture);
6198
- el.setCapture();
6199
- };
6200
- }
6201
- else {
6202
- exports.capture = function(el, eventHandler, releaseCaptureHandler) {
6203
- function onMouseMove(e) {
6204
- eventHandler(e);
6205
- e.stopPropagation();
6206
- }
6207
-
6208
- function onMouseUp(e) {
6209
- eventHandler && eventHandler(e);
6210
- releaseCaptureHandler && releaseCaptureHandler();
6211
-
6212
- document.removeEventListener("mousemove", onMouseMove, true);
6213
- document.removeEventListener("mouseup", onMouseUp, true);
6214
-
6215
- e.stopPropagation();
6216
- }
6217
-
6218
- document.addEventListener("mousemove", onMouseMove, true);
6219
- document.addEventListener("mouseup", onMouseUp, true);
6220
- };
6221
- }
6222
-
6223
- exports.addMouseWheelListener = function(el, callback) {
6224
- var listener = function(e) {
6225
- if (e.wheelDelta !== undefined) {
6226
- if (e.wheelDeltaX !== undefined) {
6227
- e.wheelX = -e.wheelDeltaX / 8;
6228
- e.wheelY = -e.wheelDeltaY / 8;
6229
- } else {
6230
- e.wheelX = 0;
6231
- e.wheelY = -e.wheelDelta / 8;
6232
- }
6233
- }
6234
- else {
6235
- if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
6236
- e.wheelX = (e.detail || 0) * 5;
6237
- e.wheelY = 0;
6238
- } else {
6239
- e.wheelX = 0;
6240
- e.wheelY = (e.detail || 0) * 5;
6241
- }
6242
- }
6243
- callback(e);
6244
- };
6245
- exports.addListener(el, "DOMMouseScroll", listener);
6246
- exports.addListener(el, "mousewheel", listener);
6247
- };
6248
-
6249
- exports.addMultiMouseDownListener = function(el, button, count, timeout, callback) {
6250
- var clicks = 0;
6251
- var startX, startY;
6252
-
6253
- var listener = function(e) {
6254
- clicks += 1;
6255
- if (clicks == 1) {
6256
- startX = e.clientX;
6257
- startY = e.clientY;
6258
-
6259
- setTimeout(function() {
6260
- clicks = 0;
6261
- }, timeout || 600);
6262
- }
6263
-
6264
- var isButton = exports.getButton(e) == button;
6265
- if (!isButton || Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5)
6266
- clicks = 0;
6267
-
6268
- if (clicks == count) {
6269
- clicks = 0;
6270
- callback(e);
6271
- }
6272
-
6273
- if (isButton)
6274
- return exports.preventDefault(e);
6275
- };
6276
-
6277
- exports.addListener(el, "mousedown", listener);
6278
- useragent.isIE && exports.addListener(el, "dblclick", listener);
6279
- };
6280
-
6281
- function normalizeCommandKeys(callback, e, keyCode) {
6282
- var hashId = 0;
6283
- if (useragent.isOpera && useragent.isMac) {
6284
- hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
6285
- | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
6286
- } else {
6287
- hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
6288
- | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
6289
- }
6290
-
6291
- if (keyCode in keys.MODIFIER_KEYS) {
6292
- switch (keys.MODIFIER_KEYS[keyCode]) {
6293
- case "Alt":
6294
- hashId = 2;
6295
- break;
6296
- case "Shift":
6297
- hashId = 4;
6298
- break
6299
- case "Ctrl":
6300
- hashId = 1;
6301
- break;
6302
- default:
6303
- hashId = 8;
6304
- break;
6305
- }
6306
- keyCode = 0;
6307
- }
6308
-
6309
- if (hashId & 8 && (keyCode == 91 || keyCode == 93)) {
6310
- keyCode = 0;
6311
- }
6312
-
6313
- // If there is no hashID and the keyCode is not a function key, then
6314
- // we don't call the callback as we don't handle a command key here
6315
- // (it's a normal key/character input).
6316
- if (hashId == 0 && !(keyCode in keys.FUNCTION_KEYS)) {
6317
- return false;
6318
- }
6319
-
6320
- return callback(e, hashId, keyCode);
6321
- }
6322
-
6323
- exports.addCommandKeyListener = function(el, callback) {
6324
- var addListener = exports.addListener;
6325
- if (useragent.isOldGecko) {
6326
- // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
6327
- // event if the user pressed the key for a longer time. Instead, the
6328
- // keydown event was fired once and later on only the keypress event.
6329
- // To emulate the 'right' keydown behavior, the keyCode of the initial
6330
- // keyDown event is stored and in the following keypress events the
6331
- // stores keyCode is used to emulate a keyDown event.
6332
- var lastKeyDownKeyCode = null;
6333
- addListener(el, "keydown", function(e) {
6334
- lastKeyDownKeyCode = e.keyCode;
6335
- });
6336
- addListener(el, "keypress", function(e) {
6337
- return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
6338
- });
6339
- } else {
6340
- var lastDown = null;
6341
-
6342
- addListener(el, "keydown", function(e) {
6343
- lastDown = e.keyIdentifier || e.keyCode;
6344
- return normalizeCommandKeys(callback, e, e.keyCode);
6345
- });
6346
-
6347
- // repeated keys are fired as keypress and not keydown events
6348
- if (useragent.isMac && useragent.isOpera) {
6349
- addListener(el, "keypress", function(e) {
6350
- var keyId = e.keyIdentifier || e.keyCode;
6351
- if (lastDown !== keyId) {
6352
- return normalizeCommandKeys(callback, e, e.keyCode);
6353
- } else {
6354
- lastDown = null;
6355
- }
6356
- });
6357
- }
6358
- }
6359
- };
6360
-
6361
- });
6362
- /* vim:ts=4:sts=4:sw=4:
6363
- * ***** BEGIN LICENSE BLOCK *****
6364
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6365
- *
6366
- * The contents of this file are subject to the Mozilla Public License Version
6367
- * 1.1 (the "License"); you may not use this file except in compliance with
6368
- * the License. You may obtain a copy of the License at
6369
- * http://www.mozilla.org/MPL/
6370
- *
6371
- * Software distributed under the License is distributed on an "AS IS" basis,
6372
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
6373
- * for the specific language governing rights and limitations under the
6374
- * License.
6375
- *
6376
- * The Original Code is Ajax.org Code Editor (ACE).
6377
- *
6378
- * The Initial Developer of the Original Code is
6379
- * Ajax.org B.V.
6380
- * Portions created by the Initial Developer are Copyright (C) 2010
6381
- * the Initial Developer. All Rights Reserved.
6382
- *
6383
- * Contributor(s):
6384
- * Fabian Jakobs <fabian AT ajax DOT org>
6385
- * Mihai Sucan <mihai AT sucan AT gmail ODT com>
6386
- *
6387
- * Alternatively, the contents of this file may be used under the terms of
6388
- * either the GNU General Public License Version 2 or later (the "GPL"), or
6389
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
6390
- * in which case the provisions of the GPL or the LGPL are applicable instead
6391
- * of those above. If you wish to allow use of your version of this file only
6392
- * under the terms of either the GPL or the LGPL, and not to allow others to
6393
- * use your version of this file under the terms of the MPL, indicate your
6394
- * decision by deleting the provisions above and replace them with the notice
6395
- * and other provisions required by the GPL or the LGPL. If you do not delete
6396
- * the provisions above, a recipient may use your version of this file under
6397
- * the terms of any one of the MPL, the GPL or the LGPL.
6398
- *
6399
- * ***** END LICENSE BLOCK ***** */
6400
-
6401
- define('pilot/dom', ['require', 'exports', 'module' ], function(require, exports, module) {
6402
-
6403
- var XHTML_NS = "http://www.w3.org/1999/xhtml";
6404
-
6405
- exports.createElement = function(tag, ns) {
6406
- return document.createElementNS ?
6407
- document.createElementNS(ns || XHTML_NS, tag) :
6408
- document.createElement(tag);
6409
- };
6410
-
6411
- exports.setText = function(elem, text) {
6412
- if (elem.innerText !== undefined) {
6413
- elem.innerText = text;
6414
- }
6415
- if (elem.textContent !== undefined) {
6416
- elem.textContent = text;
6417
- }
6418
- };
6419
-
6420
- if (!document.documentElement.classList) {
6421
- exports.hasCssClass = function(el, name) {
6422
- var classes = el.className.split(/\s+/g);
6423
- return classes.indexOf(name) !== -1;
6424
- };
6425
-
6426
- /**
6427
- * Add a CSS class to the list of classes on the given node
6428
- */
6429
- exports.addCssClass = function(el, name) {
6430
- if (!exports.hasCssClass(el, name)) {
6431
- el.className += " " + name;
6432
- }
6433
- };
6434
-
6435
- /**
6436
- * Remove a CSS class from the list of classes on the given node
6437
- */
6438
- exports.removeCssClass = function(el, name) {
6439
- var classes = el.className.split(/\s+/g);
6440
- while (true) {
6441
- var index = classes.indexOf(name);
6442
- if (index == -1) {
6443
- break;
6444
- }
6445
- classes.splice(index, 1);
6446
- }
6447
- el.className = classes.join(" ");
6448
- };
6449
-
6450
- exports.toggleCssClass = function(el, name) {
6451
- var classes = el.className.split(/\s+/g), add = true;
6452
- while (true) {
6453
- var index = classes.indexOf(name);
6454
- if (index == -1) {
6455
- break;
6456
- }
6457
- add = false;
6458
- classes.splice(index, 1);
6459
- }
6460
- if(add)
6461
- classes.push(name);
6462
-
6463
- el.className = classes.join(" ");
6464
- return add;
6465
- };
6466
- } else {
6467
- exports.hasCssClass = function(el, name) {
6468
- return el.classList.contains(name);
6469
- };
6470
-
6471
- exports.addCssClass = function(el, name) {
6472
- el.classList.add(name);
6473
- };
6474
-
6475
- exports.removeCssClass = function(el, name) {
6476
- el.classList.remove(name);
6477
- };
6478
-
6479
- exports.toggleCssClass = function(el, name) {
6480
- return el.classList.toggle(name);
6481
- };
6482
- }
6483
-
6484
- /**
6485
- * Add or remove a CSS class from the list of classes on the given node
6486
- * depending on the value of <tt>include</tt>
6487
- */
6488
- exports.setCssClass = function(node, className, include) {
6489
- if (include) {
6490
- exports.addCssClass(node, className);
6491
- } else {
6492
- exports.removeCssClass(node, className);
6493
- }
6494
- };
6495
-
6496
- exports.importCssString = function(cssText, doc){
6497
- doc = doc || document;
6498
-
6499
- if (doc.createStyleSheet) {
6500
- var sheet = doc.createStyleSheet();
6501
- sheet.cssText = cssText;
6502
- }
6503
- else {
6504
- var style = doc.createElementNS ?
6505
- doc.createElementNS(XHTML_NS, "style") :
6506
- doc.createElement("style");
6507
-
6508
- style.appendChild(doc.createTextNode(cssText));
6509
-
6510
- var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
6511
- head.appendChild(style);
6512
- }
6513
- };
6514
-
6515
- exports.getInnerWidth = function(element) {
6516
- return (parseInt(exports.computedStyle(element, "paddingLeft"))
6517
- + parseInt(exports.computedStyle(element, "paddingRight")) + element.clientWidth);
6518
- };
6519
-
6520
- exports.getInnerHeight = function(element) {
6521
- return (parseInt(exports.computedStyle(element, "paddingTop"))
6522
- + parseInt(exports.computedStyle(element, "paddingBottom")) + element.clientHeight);
6523
- };
6524
-
6525
- if (window.pageYOffset !== undefined) {
6526
- exports.getPageScrollTop = function() {
6527
- return window.pageYOffset;
6528
- };
6529
-
6530
- exports.getPageScrollLeft = function() {
6531
- return window.pageXOffset;
6532
- };
6533
- }
6534
- else {
6535
- exports.getPageScrollTop = function() {
6536
- return document.body.scrollTop;
6537
- };
6538
-
6539
- exports.getPageScrollLeft = function() {
6540
- return document.body.scrollLeft;
6541
- };
6542
- }
6543
-
6544
- if (window.getComputedStyle)
6545
- exports.computedStyle = function(element, style) {
6546
- if (style)
6547
- return (window.getComputedStyle(element, "") || {})[style] || "";
6548
- return window.getComputedStyle(element, "") || {}
6549
- };
6550
- else
6551
- exports.computedStyle = function(element, style) {
6552
- if (style)
6553
- return element.currentStyle[style];
6554
- return element.currentStyle
6555
- };
6556
-
6557
- exports.scrollbarWidth = function() {
6558
-
6559
- var inner = exports.createElement("p");
6560
- inner.style.width = "100%";
6561
- inner.style.minWidth = "0px";
6562
- inner.style.height = "200px";
6563
-
6564
- var outer = exports.createElement("div");
6565
- var style = outer.style;
6566
-
6567
- style.position = "absolute";
6568
- style.left = "-10000px";
6569
- style.overflow = "hidden";
6570
- style.width = "200px";
6571
- style.minWidth = "0px";
6572
- style.height = "150px";
6573
-
6574
- outer.appendChild(inner);
6575
-
6576
- var body = document.body || document.documentElement;
6577
- body.appendChild(outer);
6578
-
6579
- var noScrollbar = inner.offsetWidth;
6580
-
6581
- style.overflow = "scroll";
6582
- var withScrollbar = inner.offsetWidth;
6583
-
6584
- if (noScrollbar == withScrollbar) {
6585
- withScrollbar = outer.clientWidth;
6586
- }
6587
-
6588
- body.removeChild(outer);
6589
-
6590
- return noScrollbar-withScrollbar;
6591
- };
6592
-
6593
- /**
6594
- * Optimized set innerHTML. This is faster than plain innerHTML if the element
6595
- * already contains a lot of child elements.
6596
- *
6597
- * See http://blog.stevenlevithan.com/archives/faster-than-innerhtml for details
6598
- */
6599
- exports.setInnerHtml = function(el, innerHtml) {
6600
- var element = el.cloneNode(false);//document.createElement("div");
6601
- element.innerHTML = innerHtml;
6602
- el.parentNode.replaceChild(element, el);
6603
- return element;
6604
- };
6605
-
6606
- exports.setInnerText = function(el, innerText) {
6607
- if (document.body && "textContent" in document.body)
6608
- el.textContent = innerText;
6609
- else
6610
- el.innerText = innerText;
6611
-
6612
- };
6613
-
6614
- exports.getInnerText = function(el) {
6615
- if (document.body && "textContent" in document.body)
6616
- return el.textContent;
6617
- else
6618
- return el.innerText || el.textContent || "";
6619
- };
6620
-
6621
- exports.getParentWindow = function(document) {
6622
- return document.defaultView || document.parentWindow;
6623
- };
6624
-
6625
- exports.getSelectionStart = function(textarea) {
6626
- // TODO IE
6627
- var start;
6628
- try {
6629
- start = textarea.selectionStart || 0;
6630
- } catch (e) {
6631
- start = 0;
6632
- }
6633
- return start;
6634
- };
6635
-
6636
- exports.setSelectionStart = function(textarea, start) {
6637
- // TODO IE
6638
- return textarea.selectionStart = start;
6639
- };
6640
-
6641
- exports.getSelectionEnd = function(textarea) {
6642
- // TODO IE
6643
- var end;
6644
- try {
6645
- end = textarea.selectionEnd || 0;
6646
- } catch (e) {
6647
- end = 0;
6648
- }
6649
- return end;
6650
- };
6651
-
6652
- exports.setSelectionEnd = function(textarea, end) {
6653
- // TODO IE
6654
- return textarea.selectionEnd = end;
6655
- };
6656
-
6657
- });
6658
- /* ***** BEGIN LICENSE BLOCK *****
6659
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6660
- *
6661
- * The contents of this file are subject to the Mozilla Public License Version
6662
- * 1.1 (the "License"); you may not use this file except in compliance with
6663
- * the License. You may obtain a copy of the License at
6664
- * http://www.mozilla.org/MPL/
6665
- *
6666
- * Software distributed under the License is distributed on an "AS IS" basis,
6667
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
6668
- * for the specific language governing rights and limitations under the
6669
- * License.
6670
- *
6671
- * The Original Code is Skywriter.
6672
- *
6673
- * The Initial Developer of the Original Code is
6674
- * Mozilla.
6675
- * Portions created by the Initial Developer are Copyright (C) 2009
6676
- * the Initial Developer. All Rights Reserved.
6677
- *
6678
- * Contributor(s):
6679
- * Joe Walker (jwalker@mozilla.com)
6680
- *
6681
- * Alternatively, the contents of this file may be used under the terms of
6682
- * either the GNU General Public License Version 2 or later (the "GPL"), or
6683
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
6684
- * in which case the provisions of the GPL or the LGPL are applicable instead
6685
- * of those above. If you wish to allow use of your version of this file only
6686
- * under the terms of either the GPL or the LGPL, and not to allow others to
6687
- * use your version of this file under the terms of the MPL, indicate your
6688
- * decision by deleting the provisions above and replace them with the notice
6689
- * and other provisions required by the GPL or the LGPL. If you do not delete
6690
- * the provisions above, a recipient may use your version of this file under
6691
- * the terms of any one of the MPL, the GPL or the LGPL.
6692
- *
6693
- * ***** END LICENSE BLOCK ***** */
6694
-
6695
- define('cockpit/ui/request_view', ['require', 'exports', 'module' , 'pilot/dom', 'pilot/event', 'text!cockpit/ui/request_view.html', 'pilot/domtemplate', 'text!cockpit/ui/request_view.css'], function(require, exports, module) {
6696
-
6697
- var dom = require("pilot/dom");
6698
- var event = require("pilot/event");
6699
- var requestViewHtml = require("text!cockpit/ui/request_view.html");
6700
- var Templater = require("pilot/domtemplate").Templater;
6701
-
6702
- var requestViewCss = require("text!cockpit/ui/request_view.css");
6703
- dom.importCssString(requestViewCss);
6704
-
6705
- /**
6706
- * Pull the HTML into the DOM, but don't add it to the document
6707
- */
6708
- var templates = document.createElement('div');
6709
- templates.innerHTML = requestViewHtml;
6710
- var row = templates.querySelector('.cptRow');
6711
-
6712
- /**
6713
- * Work out the path for images.
6714
- * TODO: This should probably live in some utility area somewhere
6715
- */
6716
- function imageUrl(path) {
6717
- var dataUrl;
6718
- try {
6719
- dataUrl = require('text!cockpit/ui/' + path);
6720
- } catch (e) { }
6721
- if (dataUrl) {
6722
- return dataUrl;
6723
- }
6724
-
6725
- var filename = module.id.split('/').pop() + '.js';
6726
- var imagePath;
6727
-
6728
- if (module.uri.substr(-filename.length) !== filename) {
6729
- console.error('Can\'t work out path from module.uri/module.id');
6730
- return path;
6731
- }
6732
-
6733
- if (module.uri) {
6734
- var end = module.uri.length - filename.length - 1;
6735
- return module.uri.substr(0, end) + "/" + path;
6736
- }
6737
-
6738
- return filename + path;
6739
- }
6740
-
6741
-
6742
- /**
6743
- * Adds a row to the CLI output display
6744
- */
6745
- function RequestView(request, cliView) {
6746
- this.request = request;
6747
- this.cliView = cliView;
6748
- this.imageUrl = imageUrl;
6749
-
6750
- // Elements attached to this by the templater. For info only
6751
- this.rowin = null;
6752
- this.rowout = null;
6753
- this.output = null;
6754
- this.hide = null;
6755
- this.show = null;
6756
- this.duration = null;
6757
- this.throb = null;
6758
-
6759
- new Templater().processNode(row.cloneNode(true), this);
6760
-
6761
- this.cliView.output.appendChild(this.rowin);
6762
- this.cliView.output.appendChild(this.rowout);
6763
-
6764
- this.request.addEventListener('output', this.onRequestChange.bind(this));
6765
- };
6766
-
6767
- RequestView.prototype = {
6768
- /**
6769
- * A single click on an invocation line in the console copies the command to
6770
- * the command line
6771
- */
6772
- copyToInput: function() {
6773
- this.cliView.element.value = this.request.typed;
6774
- },
6775
-
6776
- /**
6777
- * A double click on an invocation line in the console executes the command
6778
- */
6779
- executeRequest: function(ev) {
6780
- this.cliView.cli.update({
6781
- typed: this.request.typed,
6782
- cursor: { start:0, end:0 }
6783
- });
6784
- this.cliView.cli.exec();
6785
- },
6786
-
6787
- hideOutput: function(ev) {
6788
- this.output.style.display = 'none';
6789
- dom.addCssClass(this.hide, 'cmd_hidden');
6790
- dom.removeCssClass(this.show, 'cmd_hidden');
6791
-
6792
- event.stopPropagation(ev);
6793
- },
6794
-
6795
- showOutput: function(ev) {
6796
- this.output.style.display = 'block';
6797
- dom.removeCssClass(this.hide, 'cmd_hidden');
6798
- dom.addCssClass(this.show, 'cmd_hidden');
6799
-
6800
- event.stopPropagation(ev);
6801
- },
6802
-
6803
- remove: function(ev) {
6804
- this.cliView.output.removeChild(this.rowin);
6805
- this.cliView.output.removeChild(this.rowout);
6806
- event.stopPropagation(ev);
6807
- },
6808
-
6809
- onRequestChange: function(ev) {
6810
- this.duration.innerHTML = this.request.duration ?
6811
- 'completed in ' + (this.request.duration / 1000) + ' sec ' :
6812
- '';
6813
-
6814
- this.output.innerHTML = '';
6815
- this.request.outputs.forEach(function(output) {
6816
- var node;
6817
- if (typeof output == 'string') {
6818
- node = document.createElement('p');
6819
- node.innerHTML = output;
6820
- } else {
6821
- node = output;
6822
- }
6823
- this.output.appendChild(node);
6824
- }, this);
6825
- this.cliView.scrollOutputToBottom();
6826
-
6827
- dom.setCssClass(this.output, 'cmd_error', this.request.error);
6828
-
6829
- this.throb.style.display = this.request.completed ? 'none' : 'block';
6830
- }
6831
- };
6832
- exports.RequestView = RequestView;
6833
-
6834
-
6835
- });
6836
- /* ***** BEGIN LICENSE BLOCK *****
6837
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6838
- *
6839
- * The contents of this file are subject to the Mozilla Public License Version
6840
- * 1.1 (the "License"); you may not use this file except in compliance with
6841
- * the License. You may obtain a copy of the License at
6842
- * http://www.mozilla.org/MPL/
6843
- *
6844
- * Software distributed under the License is distributed on an "AS IS" basis,
6845
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
6846
- * for the specific language governing rights and limitations under the
6847
- * License.
6848
- *
6849
- * The Original Code is DomTemplate.
6850
- *
6851
- * The Initial Developer of the Original Code is Mozilla.
6852
- * Portions created by the Initial Developer are Copyright (C) 2009
6853
- * the Initial Developer. All Rights Reserved.
6854
- *
6855
- * Contributor(s):
6856
- * Joe Walker (jwalker@mozilla.com) (original author)
6857
- *
6858
- * Alternatively, the contents of this file may be used under the terms of
6859
- * either the GNU General Public License Version 2 or later (the "GPL"), or
6860
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
6861
- * in which case the provisions of the GPL or the LGPL are applicable instead
6862
- * of those above. If you wish to allow use of your version of this file only
6863
- * under the terms of either the GPL or the LGPL, and not to allow others to
6864
- * use your version of this file under the terms of the MPL, indicate your
6865
- * decision by deleting the provisions above and replace them with the notice
6866
- * and other provisions required by the GPL or the LGPL. If you do not delete
6867
- * the provisions above, a recipient may use your version of this file under
6868
- * the terms of any one of the MPL, the GPL or the LGPL.
6869
- *
6870
- * ***** END LICENSE BLOCK ***** */
6871
-
6872
- define('pilot/domtemplate', ['require', 'exports', 'module' ], function(require, exports, module) {
6873
-
6874
-
6875
- // WARNING: do not 'use_strict' without reading the notes in envEval;
6876
-
6877
- /**
6878
- * A templater that allows one to quickly template DOM nodes.
6879
- */
6880
- function Templater() {
6881
- this.scope = [];
6882
- };
6883
-
6884
- /**
6885
- * Recursive function to walk the tree processing the attributes as it goes.
6886
- * @param node the node to process. If you pass a string in instead of a DOM
6887
- * element, it is assumed to be an id for use with document.getElementById()
6888
- * @param data the data to use for node processing.
6889
- */
6890
- Templater.prototype.processNode = function(node, data) {
6891
- if (typeof node === 'string') {
6892
- node = document.getElementById(node);
6893
- }
6894
- if (data === null || data === undefined) {
6895
- data = {};
6896
- }
6897
- this.scope.push(node.nodeName + (node.id ? '#' + node.id : ''));
6898
- try {
6899
- // Process attributes
6900
- if (node.attributes && node.attributes.length) {
6901
- // We need to handle 'foreach' and 'if' first because they might stop
6902
- // some types of processing from happening, and foreach must come first
6903
- // because it defines new data on which 'if' might depend.
6904
- if (node.hasAttribute('foreach')) {
6905
- this.processForEach(node, data);
6906
- return;
6907
- }
6908
- if (node.hasAttribute('if')) {
6909
- if (!this.processIf(node, data)) {
6910
- return;
6911
- }
6912
- }
6913
- // Only make the node available once we know it's not going away
6914
- data.__element = node;
6915
- // It's good to clean up the attributes when we've processed them,
6916
- // but if we do it straight away, we mess up the array index
6917
- var attrs = Array.prototype.slice.call(node.attributes);
6918
- for (var i = 0; i < attrs.length; i++) {
6919
- var value = attrs[i].value;
6920
- var name = attrs[i].name;
6921
- this.scope.push(name);
6922
- try {
6923
- if (name === 'save') {
6924
- // Save attributes are a setter using the node
6925
- value = this.stripBraces(value);
6926
- this.property(value, data, node);
6927
- node.removeAttribute('save');
6928
- } else if (name.substring(0, 2) === 'on') {
6929
- // Event registration relies on property doing a bind
6930
- value = this.stripBraces(value);
6931
- var func = this.property(value, data);
6932
- if (typeof func !== 'function') {
6933
- this.handleError('Expected ' + value +
6934
- ' to resolve to a function, but got ' + typeof func);
6935
- }
6936
- node.removeAttribute(name);
6937
- var capture = node.hasAttribute('capture' + name.substring(2));
6938
- node.addEventListener(name.substring(2), func, capture);
6939
- if (capture) {
6940
- node.removeAttribute('capture' + name.substring(2));
6941
- }
6942
- } else {
6943
- // Replace references in all other attributes
6944
- var self = this;
6945
- var newValue = value.replace(/\$\{[^}]*\}/g, function(path) {
6946
- return self.envEval(path.slice(2, -1), data, value);
6947
- });
6948
- // Remove '_' prefix of attribute names so the DOM won't try
6949
- // to use them before we've processed the template
6950
- if (name.charAt(0) === '_') {
6951
- node.removeAttribute(name);
6952
- node.setAttribute(name.substring(1), newValue);
6953
- } else if (value !== newValue) {
6954
- attrs[i].value = newValue;
6955
- }
6956
- }
6957
- } finally {
6958
- this.scope.pop();
6959
- }
6960
- }
6961
- }
6962
-
6963
- // Loop through our children calling processNode. First clone them, so the
6964
- // set of nodes that we visit will be unaffected by additions or removals.
6965
- var childNodes = Array.prototype.slice.call(node.childNodes);
6966
- for (var j = 0; j < childNodes.length; j++) {
6967
- this.processNode(childNodes[j], data);
6968
- }
6969
-
6970
- if (node.nodeType === Node.TEXT_NODE) {
6971
- this.processTextNode(node, data);
6972
- }
6973
- } finally {
6974
- this.scope.pop();
6975
- }
6976
- };
6977
-
6978
- /**
6979
- * Handle <x if="${...}">
6980
- * @param node An element with an 'if' attribute
6981
- * @param data The data to use with envEval
6982
- * @returns true if processing should continue, false otherwise
6983
- */
6984
- Templater.prototype.processIf = function(node, data) {
6985
- this.scope.push('if');
6986
- try {
6987
- var originalValue = node.getAttribute('if');
6988
- var value = this.stripBraces(originalValue);
6989
- var recurse = true;
6990
- try {
6991
- var reply = this.envEval(value, data, originalValue);
6992
- recurse = !!reply;
6993
- } catch (ex) {
6994
- this.handleError('Error with \'' + value + '\'', ex);
6995
- recurse = false;
6996
- }
6997
- if (!recurse) {
6998
- node.parentNode.removeChild(node);
6999
- }
7000
- node.removeAttribute('if');
7001
- return recurse;
7002
- } finally {
7003
- this.scope.pop();
7004
- }
7005
- };
7006
-
7007
- /**
7008
- * Handle <x foreach="param in ${array}"> and the special case of
7009
- * <loop foreach="param in ${array}">
7010
- * @param node An element with a 'foreach' attribute
7011
- * @param data The data to use with envEval
7012
- */
7013
- Templater.prototype.processForEach = function(node, data) {
7014
- this.scope.push('foreach');
7015
- try {
7016
- var originalValue = node.getAttribute('foreach');
7017
- var value = originalValue;
7018
-
7019
- var paramName = 'param';
7020
- if (value.charAt(0) === '$') {
7021
- // No custom loop variable name. Use the default: 'param'
7022
- value = this.stripBraces(value);
7023
- } else {
7024
- // Extract the loop variable name from 'NAME in ${ARRAY}'
7025
- var nameArr = value.split(' in ');
7026
- paramName = nameArr[0].trim();
7027
- value = this.stripBraces(nameArr[1].trim());
7028
- }
7029
- node.removeAttribute('foreach');
7030
- try {
7031
- var self = this;
7032
- // Process a single iteration of a loop
7033
- var processSingle = function(member, clone, ref) {
7034
- ref.parentNode.insertBefore(clone, ref);
7035
- data[paramName] = member;
7036
- self.processNode(clone, data);
7037
- delete data[paramName];
7038
- };
7039
-
7040
- // processSingle is no good for <loop> nodes where we want to work on
7041
- // the childNodes rather than the node itself
7042
- var processAll = function(scope, member) {
7043
- self.scope.push(scope);
7044
- try {
7045
- if (node.nodeName === 'LOOP') {
7046
- for (var i = 0; i < node.childNodes.length; i++) {
7047
- var clone = node.childNodes[i].cloneNode(true);
7048
- processSingle(member, clone, node);
7049
- }
7050
- } else {
7051
- var clone = node.cloneNode(true);
7052
- clone.removeAttribute('foreach');
7053
- processSingle(member, clone, node);
7054
- }
7055
- } finally {
7056
- self.scope.pop();
7057
- }
7058
- };
7059
-
7060
- var reply = this.envEval(value, data, originalValue);
7061
- if (Array.isArray(reply)) {
7062
- reply.forEach(function(data, i) {
7063
- processAll('' + i, data);
7064
- }, this);
7065
- } else {
7066
- for (var param in reply) {
7067
- if (reply.hasOwnProperty(param)) {
7068
- processAll(param, param);
7069
- }
7070
- }
7071
- }
7072
- node.parentNode.removeChild(node);
7073
- } catch (ex) {
7074
- this.handleError('Error with \'' + value + '\'', ex);
7075
- }
7076
- } finally {
7077
- this.scope.pop();
7078
- }
7079
- };
7080
-
7081
- /**
7082
- * Take a text node and replace it with another text node with the ${...}
7083
- * sections parsed out. We replace the node by altering node.parentNode but
7084
- * we could probably use a DOM Text API to achieve the same thing.
7085
- * @param node The Text node to work on
7086
- * @param data The data to use in calls to envEval
7087
- */
7088
- Templater.prototype.processTextNode = function(node, data) {
7089
- // Replace references in other attributes
7090
- var value = node.data;
7091
- // We can't use the string.replace() with function trick (see generic
7092
- // attribute processing in processNode()) because we need to support
7093
- // functions that return DOM nodes, so we can't have the conversion to a
7094
- // string.
7095
- // Instead we process the string as an array of parts. In order to split
7096
- // the string up, we first replace '${' with '\uF001$' and '}' with '\uF002'
7097
- // We can then split using \uF001 or \uF002 to get an array of strings
7098
- // where scripts are prefixed with $.
7099
- // \uF001 and \uF002 are just unicode chars reserved for private use.
7100
- value = value.replace(/\$\{([^}]*)\}/g, '\uF001$$$1\uF002');
7101
- var parts = value.split(/\uF001|\uF002/);
7102
- if (parts.length > 1) {
7103
- parts.forEach(function(part) {
7104
- if (part === null || part === undefined || part === '') {
7105
- return;
7106
- }
7107
- if (part.charAt(0) === '$') {
7108
- part = this.envEval(part.slice(1), data, node.data);
7109
- }
7110
- // It looks like this was done a few lines above but see envEval
7111
- if (part === null) {
7112
- part = "null";
7113
- }
7114
- if (part === undefined) {
7115
- part = "undefined";
7116
- }
7117
- // if (isDOMElement(part)) { ... }
7118
- if (typeof part.cloneNode !== 'function') {
7119
- part = node.ownerDocument.createTextNode(part.toString());
7120
- }
7121
- node.parentNode.insertBefore(part, node);
7122
- }, this);
7123
- node.parentNode.removeChild(node);
7124
- }
7125
- };
7126
-
7127
- /**
7128
- * Warn of string does not begin '${' and end '}'
7129
- * @param str the string to check.
7130
- * @return The string stripped of ${ and }, or untouched if it does not match
7131
- */
7132
- Templater.prototype.stripBraces = function(str) {
7133
- if (!str.match(/\$\{.*\}/g)) {
7134
- this.handleError('Expected ' + str + ' to match ${...}');
7135
- return str;
7136
- }
7137
- return str.slice(2, -1);
7138
- };
7139
-
7140
- /**
7141
- * Combined getter and setter that works with a path through some data set.
7142
- * For example:
7143
- * <ul>
7144
- * <li>property('a.b', { a: { b: 99 }}); // returns 99
7145
- * <li>property('a', { a: { b: 99 }}); // returns { b: 99 }
7146
- * <li>property('a', { a: { b: 99 }}, 42); // returns 99 and alters the
7147
- * input data to be { a: { b: 42 }}
7148
- * </ul>
7149
- * @param path An array of strings indicating the path through the data, or
7150
- * a string to be cut into an array using <tt>split('.')</tt>
7151
- * @param data An object to look in for the <tt>path</tt> argument
7152
- * @param newValue (optional) If defined, this value will replace the
7153
- * original value for the data at the path specified.
7154
- * @return The value pointed to by <tt>path</tt> before any
7155
- * <tt>newValue</tt> is applied.
7156
- */
7157
- Templater.prototype.property = function(path, data, newValue) {
7158
- this.scope.push(path);
7159
- try {
7160
- if (typeof path === 'string') {
7161
- path = path.split('.');
7162
- }
7163
- var value = data[path[0]];
7164
- if (path.length === 1) {
7165
- if (newValue !== undefined) {
7166
- data[path[0]] = newValue;
7167
- }
7168
- if (typeof value === 'function') {
7169
- return function() {
7170
- return value.apply(data, arguments);
7171
- };
7172
- }
7173
- return value;
7174
- }
7175
- if (!value) {
7176
- this.handleError('Can\'t find path=' + path);
7177
- return null;
7178
- }
7179
- return this.property(path.slice(1), value, newValue);
7180
- } finally {
7181
- this.scope.pop();
7182
- }
7183
- };
7184
-
7185
- /**
7186
- * Like eval, but that creates a context of the variables in <tt>env</tt> in
7187
- * which the script is evaluated.
7188
- * WARNING: This script uses 'with' which is generally regarded to be evil.
7189
- * The alternative is to create a Function at runtime that takes X parameters
7190
- * according to the X keys in the env object, and then call that function using
7191
- * the values in the env object. This is likely to be slow, but workable.
7192
- * @param script The string to be evaluated.
7193
- * @param env The environment in which to eval the script.
7194
- * @param context Optional debugging string in case of failure
7195
- * @return The return value of the script, or the error message if the script
7196
- * execution failed.
7197
- */
7198
- Templater.prototype.envEval = function(script, env, context) {
7199
- with (env) {
7200
- try {
7201
- this.scope.push(context);
7202
- return eval(script);
7203
- } catch (ex) {
7204
- this.handleError('Template error evaluating \'' + script + '\'', ex);
7205
- return script;
7206
- } finally {
7207
- this.scope.pop();
7208
- }
7209
- }
7210
- };
7211
-
7212
- /**
7213
- * A generic way of reporting errors, for easy overloading in different
7214
- * environments.
7215
- * @param message the error message to report.
7216
- * @param ex optional associated exception.
7217
- */
7218
- Templater.prototype.handleError = function(message, ex) {
7219
- this.logError(message);
7220
- this.logError('In: ' + this.scope.join(' > '));
7221
- if (ex) {
7222
- this.logError(ex);
7223
- }
7224
- };
7225
-
7226
-
7227
- /**
7228
- * A generic way of reporting errors, for easy overloading in different
7229
- * environments.
7230
- * @param message the error message to report.
7231
- */
7232
- Templater.prototype.logError = function(message) {
7233
- window.console && window.console.log && console.log(message);
7234
- };
7235
-
7236
- exports.Templater = Templater;
7237
-
7238
-
7239
- });
7240
- /* ***** BEGIN LICENSE BLOCK *****
7241
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7242
- *
7243
- * The contents of this file are subject to the Mozilla Public License Version
7244
- * 1.1 (the "License"); you may not use this file except in compliance with
7245
- * the License. You may obtain a copy of the License at
7246
- * http://www.mozilla.org/MPL/
7247
- *
7248
- * Software distributed under the License is distributed on an "AS IS" basis,
7249
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7250
- * for the specific language governing rights and limitations under the
7251
- * License.
7252
- *
7253
- * The Original Code is Skywriter.
7254
- *
7255
- * The Initial Developer of the Original Code is
7256
- * Mozilla.
7257
- * Portions created by the Initial Developer are Copyright (C) 2009
7258
- * the Initial Developer. All Rights Reserved.
7259
- *
7260
- * Contributor(s):
7261
- * Skywriter Team (skywriter@mozilla.com)
7262
- *
7263
- * Alternatively, the contents of this file may be used under the terms of
7264
- * either the GNU General Public License Version 2 or later (the "GPL"), or
7265
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
7266
- * in which case the provisions of the GPL or the LGPL are applicable instead
7267
- * of those above. If you wish to allow use of your version of this file only
7268
- * under the terms of either the GPL or the LGPL, and not to allow others to
7269
- * use your version of this file under the terms of the MPL, indicate your
7270
- * decision by deleting the provisions above and replace them with the notice
7271
- * and other provisions required by the GPL or the LGPL. If you do not delete
7272
- * the provisions above, a recipient may use your version of this file under
7273
- * the terms of any one of the MPL, the GPL or the LGPL.
7274
- *
7275
- * ***** END LICENSE BLOCK ***** */
7276
-
7277
- define('cockpit/commands/basic', ['require', 'exports', 'module' , 'pilot/canon'], function(require, exports, module) {
7278
-
7279
-
7280
- var canon = require('pilot/canon');
7281
-
7282
- /**
7283
- * '!' command
7284
- */
7285
- var bangCommandSpec = {
7286
- name: 'sh',
7287
- description: 'Execute a system command (requires server support)',
7288
- params: [
7289
- {
7290
- name: 'command',
7291
- type: 'text',
7292
- description: 'The string to send to the os shell.'
7293
- }
7294
- ],
7295
- exec: function(env, args, request) {
7296
- var req = new XMLHttpRequest();
7297
- req.open('GET', '/exec?args=' + args.command, true);
7298
- req.onreadystatechange = function(ev) {
7299
- if (req.readyState == 4) {
7300
- if (req.status == 200) {
7301
- request.done('<pre>' + req.responseText + '</pre>');
7302
- }
7303
- }
7304
- };
7305
- req.send(null);
7306
- }
7307
- };
7308
-
7309
- var canon = require('pilot/canon');
7310
-
7311
- exports.startup = function(data, reason) {
7312
- canon.addCommand(bangCommandSpec);
7313
- };
7314
-
7315
- exports.shutdown = function(data, reason) {
7316
- canon.removeCommand(bangCommandSpec);
7317
- };
7318
-
7319
-
7320
- });
7321
- /* vim:ts=4:sts=4:sw=4:
7322
- * ***** BEGIN LICENSE BLOCK *****
7323
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7324
- *
7325
- * The contents of this file are subject to the Mozilla Public License Version
7326
- * 1.1 (the "License"); you may not use this file except in compliance with
7327
- * the License. You may obtain a copy of the License at
7328
- * http://www.mozilla.org/MPL/
7329
- *
7330
- * Software distributed under the License is distributed on an "AS IS" basis,
7331
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7332
- * for the specific language governing rights and limitations under the
7333
- * License.
7334
- *
7335
- * The Original Code is Ajax.org Code Editor (ACE).
7336
- *
7337
- * The Initial Developer of the Original Code is
7338
- * Ajax.org B.V.
7339
- * Portions created by the Initial Developer are Copyright (C) 2010
7340
- * the Initial Developer. All Rights Reserved.
7341
- *
7342
- * Contributor(s):
7343
- * Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
7344
- *
7345
- * Alternatively, the contents of this file may be used under the terms of
7346
- * either the GNU General Public License Version 2 or later (the "GPL"), or
7347
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
7348
- * in which case the provisions of the GPL or the LGPL are applicable instead
7349
- * of those above. If you wish to allow use of your version of this file only
7350
- * under the terms of either the GPL or the LGPL, and not to allow others to
7351
- * use your version of this file under the terms of the MPL, indicate your
7352
- * decision by deleting the provisions above and replace them with the notice
7353
- * and other provisions required by the GPL or the LGPL. If you do not delete
7354
- * the provisions above, a recipient may use your version of this file under
7355
- * the terms of any one of the MPL, the GPL or the LGPL.
7356
- *
7357
- * ***** END LICENSE BLOCK ***** */
7358
-
7359
- define('ace/defaults', ['require', 'exports', 'module' , 'ace/settings/default-settings'], function(require, exports, module) {
7360
-
7361
- var settings = require("ace/settings/default-settings")
7362
-
7363
- exports.startup = function startup(data, reason) {
7364
- settings.startup(data, reason)
7365
- }
7366
-
7367
- exports.shutdown = function shutdown(data, reason) {
7368
- settings.shutdown(data, reason)
7369
- }
7370
-
7371
- })
7372
- /* vim:ts=4:sts=4:sw=4:
7373
- * ***** BEGIN LICENSE BLOCK *****
7374
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7375
- *
7376
- * The contents of this file are subject to the Mozilla Public License Version
7377
- * 1.1 (the "License"); you may not use this file except in compliance with
7378
- * the License. You may obtain a copy of the License at
7379
- * http://www.mozilla.org/MPL/
7380
- *
7381
- * Software distributed under the License is distributed on an "AS IS" basis,
7382
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7383
- * for the specific language governing rights and limitations under the
7384
- * License.
7385
- *
7386
- * The Original Code is Ajax.org Code Editor (ACE).
7387
- *
7388
- * The Initial Developer of the Original Code is
7389
- * Ajax.org B.V.
7390
- * Portions created by the Initial Developer are Copyright (C) 2010
7391
- * the Initial Developer. All Rights Reserved.
7392
- *
7393
- * Contributor(s):
7394
- * Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
7395
- *
7396
- * Alternatively, the contents of this file may be used under the terms of
7397
- * either the GNU General Public License Version 2 or later (the "GPL"), or
7398
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
7399
- * in which case the provisions of the GPL or the LGPL are applicable instead
7400
- * of those above. If you wish to allow use of your version of this file only
7401
- * under the terms of either the GPL or the LGPL, and not to allow others to
7402
- * use your version of this file under the terms of the MPL, indicate your
7403
- * decision by deleting the provisions above and replace them with the notice
7404
- * and other provisions required by the GPL or the LGPL. If you do not delete
7405
- * the provisions above, a recipient may use your version of this file under
7406
- * the terms of any one of the MPL, the GPL or the LGPL.
7407
- *
7408
- * ***** END LICENSE BLOCK ***** */
7409
-
7410
- define('ace/settings/default-settings', ['require', 'exports', 'module' , 'pilot/types', 'pilot/types/basic'], function(require, exports, module) {
7411
-
7412
- var types = require('pilot/types')
7413
- var SelectionType = require('pilot/types/basic').SelectionType
7414
-
7415
- var env
7416
-
7417
- var settingTypes = {
7418
- selectionStyle: new SelectionType({
7419
- data: [ 'line', 'text' ]
7420
- })
7421
- }
7422
-
7423
- var settings = {
7424
- printMargin: {
7425
- description: 'Position of the print margin column.',
7426
- type: 'number',
7427
- defaultValue: 80,
7428
- onChange: function onChange(event) {
7429
- if (env.editor) env.editor.setPrintMarginColumn(event.value)
7430
- }
7431
- },
7432
- showIvisibles: {
7433
- description: 'Whether or not to show invisible characters.',
7434
- type: 'bool',
7435
- defaultValue: false,
7436
- onChange: function onChange(event) {
7437
- if (env.editor) env.editor.setShowInvisibles(event.value)
7438
- }
7439
- },
7440
- highlightActiveLine: {
7441
- description: 'Whether or not highlight active line.',
7442
- type: 'bool',
7443
- defaultValue: true,
7444
- onChange: function onChange(event) {
7445
- if (env.editor) env.editor.setHighlightActiveLine(event.value)
7446
- }
7447
- },
7448
- selectionStyle: {
7449
- description: 'Type of text selection.',
7450
- type: 'selectionStyle',
7451
- defaultValue: 'line',
7452
- onChange: function onChange(event) {
7453
- if (env.editor) env.editor.setSelectionStyle(event.value)
7454
- }
7455
- }
7456
- }
7457
-
7458
- exports.startup = function startup(data, reason) {
7459
- env = data.env
7460
- types.registerTypes(settingTypes)
7461
- data.env.settings.addSettings(settings)
7462
- }
7463
-
7464
- exports.shutdown = function shutdown(data, reason) {
7465
- data.env.settings.removeSettings(settings)
7466
- }
7467
-
7468
- })
7469
- /* ***** BEGIN LICENSE BLOCK *****
7470
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7471
- *
7472
- * The contents of this file are subject to the Mozilla Public License Version
7473
- * 1.1 (the "License"); you may not use this file except in compliance with
7474
- * the License. You may obtain a copy of the License at
7475
- * http://www.mozilla.org/MPL/
7476
- *
7477
- * Software distributed under the License is distributed on an "AS IS" basis,
7478
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7479
- * for the specific language governing rights and limitations under the
7480
- * License.
7481
- *
7482
- * The Original Code is Mozilla Skywriter.
7483
- *
7484
- * The Initial Developer of the Original Code is
7485
- * Mozilla.
7486
- * Portions created by the Initial Developer are Copyright (C) 2009
7487
- * the Initial Developer. All Rights Reserved.
7488
- *
7489
- * Contributor(s):
7490
- * Kevin Dangoor (kdangoor@mozilla.com)
7491
- *
7492
- * Alternatively, the contents of this file may be used under the terms of
7493
- * either the GNU General Public License Version 2 or later (the "GPL"), or
7494
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
7495
- * in which case the provisions of the GPL or the LGPL are applicable instead
7496
- * of those above. If you wish to allow use of your version of this file only
7497
- * under the terms of either the GPL or the LGPL, and not to allow others to
7498
- * use your version of this file under the terms of the MPL, indicate your
7499
- * decision by deleting the provisions above and replace them with the notice
7500
- * and other provisions required by the GPL or the LGPL. If you do not delete
7501
- * the provisions above, a recipient may use your version of this file under
7502
- * the terms of any one of the MPL, the GPL or the LGPL.
7503
- *
7504
- * ***** END LICENSE BLOCK ***** */
7505
-
7506
- define('demo/boot', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/plugin_manager', 'pilot/settings', 'pilot/environment', 'demo/demo', 'pilot/index', 'cockpit/index', 'ace/defaults'], function(require, exports, module) {
7507
-
7508
- require("pilot/fixoldbrowsers");
7509
- require("pilot/plugin_manager");
7510
- require("pilot/settings");
7511
- require("pilot/environment");
7512
- require("demo/demo");
7513
-
7514
- require("pilot/index");
7515
- require("cockpit/index");
7516
- require("ace/defaults");
7517
-
7518
- var plugins = [ "pilot/index", "cockpit/index", "ace/defaults" ];
7519
- var catalog = require("pilot/plugin_manager").catalog;
7520
- catalog.registerPlugins(plugins).then(function() {
7521
- var env = require("pilot/environment").create();
7522
- catalog.startupPlugins({ env: env }).then(function() {
7523
- require("demo/demo").launch(env);
7524
- });
7525
- });
7526
-
7527
- });/* ***** BEGIN LICENSE BLOCK *****
7528
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7529
- *
7530
- * The contents of this file are subject to the Mozilla Public License Version
7531
- * 1.1 (the "License"); you may not use this file except in compliance with
7532
- * the License. You may obtain a copy of the License at
7533
- * http://www.mozilla.org/MPL/
7534
- *
7535
- * Software distributed under the License is distributed on an "AS IS" basis,
7536
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7537
- * for the specific language governing rights and limitations under the
7538
- * License.
7539
- *
7540
- * The Original Code is Skywriter.
7541
- *
7542
- * The Initial Developer of the Original Code is
7543
- * Mozilla.
7544
- * Portions created by the Initial Developer are Copyright (C) 2009
7545
- * the Initial Developer. All Rights Reserved.
7546
- *
7547
- * Contributor(s):
7548
- * Kevin Dangoor (kdangoor@mozilla.com)
7549
- *
7550
- * Alternatively, the contents of this file may be used under the terms of
7551
- * either the GNU General Public License Version 2 or later (the "GPL"), or
7552
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
7553
- * in which case the provisions of the GPL or the LGPL are applicable instead
7554
- * of those above. If you wish to allow use of your version of this file only
7555
- * under the terms of either the GPL or the LGPL, and not to allow others to
7556
- * use your version of this file under the terms of the MPL, indicate your
7557
- * decision by deleting the provisions above and replace them with the notice
7558
- * and other provisions required by the GPL or the LGPL. If you do not delete
7559
- * the provisions above, a recipient may use your version of this file under
7560
- * the terms of any one of the MPL, the GPL or the LGPL.
7561
- *
7562
- * ***** END LICENSE BLOCK ***** */
7563
-
7564
- define('pilot/plugin_manager', ['require', 'exports', 'module' , 'pilot/promise'], function(require, exports, module) {
7565
-
7566
- var Promise = require("pilot/promise").Promise;
7567
-
7568
- exports.REASONS = {
7569
- APP_STARTUP: 1,
7570
- APP_SHUTDOWN: 2,
7571
- PLUGIN_ENABLE: 3,
7572
- PLUGIN_DISABLE: 4,
7573
- PLUGIN_INSTALL: 5,
7574
- PLUGIN_UNINSTALL: 6,
7575
- PLUGIN_UPGRADE: 7,
7576
- PLUGIN_DOWNGRADE: 8
7577
- };
7578
-
7579
- exports.Plugin = function(name) {
7580
- this.name = name;
7581
- this.status = this.INSTALLED;
7582
- };
7583
-
7584
- exports.Plugin.prototype = {
7585
- /**
7586
- * constants for the state
7587
- */
7588
- NEW: 0,
7589
- INSTALLED: 1,
7590
- REGISTERED: 2,
7591
- STARTED: 3,
7592
- UNREGISTERED: 4,
7593
- SHUTDOWN: 5,
7594
-
7595
- install: function(data, reason) {
7596
- var pr = new Promise();
7597
- if (this.status > this.NEW) {
7598
- pr.resolve(this);
7599
- return pr;
7600
- }
7601
- require([this.name], function(pluginModule) {
7602
- if (pluginModule.install) {
7603
- pluginModule.install(data, reason);
7604
- }
7605
- this.status = this.INSTALLED;
7606
- pr.resolve(this);
7607
- }.bind(this));
7608
- return pr;
7609
- },
7610
-
7611
- register: function(data, reason) {
7612
- var pr = new Promise();
7613
- if (this.status != this.INSTALLED) {
7614
- pr.resolve(this);
7615
- return pr;
7616
- }
7617
- require([this.name], function(pluginModule) {
7618
- if (pluginModule.register) {
7619
- pluginModule.register(data, reason);
7620
- }
7621
- this.status = this.REGISTERED;
7622
- pr.resolve(this);
7623
- }.bind(this));
7624
- return pr;
7625
- },
7626
-
7627
- startup: function(data, reason) {
7628
- reason = reason || exports.REASONS.APP_STARTUP;
7629
- var pr = new Promise();
7630
- if (this.status != this.REGISTERED) {
7631
- pr.resolve(this);
7632
- return pr;
7633
- }
7634
- require([this.name], function(pluginModule) {
7635
- if (pluginModule.startup) {
7636
- pluginModule.startup(data, reason);
7637
- }
7638
- this.status = this.STARTED;
7639
- pr.resolve(this);
7640
- }.bind(this));
7641
- return pr;
7642
- },
7643
-
7644
- shutdown: function(data, reason) {
7645
- if (this.status != this.STARTED) {
7646
- return;
7647
- }
7648
- pluginModule = require(this.name);
7649
- if (pluginModule.shutdown) {
7650
- pluginModule.shutdown(data, reason);
7651
- }
7652
- }
7653
- };
7654
-
7655
- exports.PluginCatalog = function() {
7656
- this.plugins = {};
7657
- };
7658
-
7659
- exports.PluginCatalog.prototype = {
7660
- registerPlugins: function(pluginList, data, reason) {
7661
- var registrationPromises = [];
7662
- pluginList.forEach(function(pluginName) {
7663
- var plugin = this.plugins[pluginName];
7664
- if (plugin === undefined) {
7665
- plugin = new exports.Plugin(pluginName);
7666
- this.plugins[pluginName] = plugin;
7667
- registrationPromises.push(plugin.register(data, reason));
7668
- }
7669
- }.bind(this));
7670
- return Promise.group(registrationPromises);
7671
- },
7672
-
7673
- startupPlugins: function(data, reason) {
7674
- var startupPromises = [];
7675
- for (var pluginName in this.plugins) {
7676
- var plugin = this.plugins[pluginName];
7677
- startupPromises.push(plugin.startup(data, reason));
7678
- }
7679
- return Promise.group(startupPromises);
7680
- }
7681
- };
7682
-
7683
- exports.catalog = new exports.PluginCatalog();
7684
-
7685
- });
7686
- /* ***** BEGIN LICENSE BLOCK *****
7687
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7688
- *
7689
- * The contents of this file are subject to the Mozilla Public License Version
7690
- * 1.1 (the "License"); you may not use this file except in compliance with
7691
- * the License. You may obtain a copy of the License at
7692
- * http://www.mozilla.org/MPL/
7693
- *
7694
- * Software distributed under the License is distributed on an "AS IS" basis,
7695
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7696
- * for the specific language governing rights and limitations under the
7697
- * License.
7698
- *
7699
- * The Original Code is Mozilla Skywriter.
7700
- *
7701
- * The Initial Developer of the Original Code is
7702
- * Mozilla.
7703
- * Portions created by the Initial Developer are Copyright (C) 2009
7704
- * the Initial Developer. All Rights Reserved.
7705
- *
7706
- * Contributor(s):
7707
- * Joe Walker (jwalker@mozilla.com)
7708
- *
7709
- * Alternatively, the contents of this file may be used under the terms of
7710
- * either the GNU General Public License Version 2 or later (the "GPL"), or
7711
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
7712
- * in which case the provisions of the GPL or the LGPL are applicable instead
7713
- * of those above. If you wish to allow use of your version of this file only
7714
- * under the terms of either the GPL or the LGPL, and not to allow others to
7715
- * use your version of this file under the terms of the MPL, indicate your
7716
- * decision by deleting the provisions above and replace them with the notice
7717
- * and other provisions required by the GPL or the LGPL. If you do not delete
7718
- * the provisions above, a recipient may use your version of this file under
7719
- * the terms of any one of the MPL, the GPL or the LGPL.
7720
- *
7721
- * ***** END LICENSE BLOCK ***** */
7722
-
7723
- define('pilot/promise', ['require', 'exports', 'module' , 'pilot/console', 'pilot/stacktrace'], function(require, exports, module) {
7724
-
7725
- var console = require("pilot/console");
7726
- var Trace = require('pilot/stacktrace').Trace;
7727
-
7728
- /**
7729
- * A promise can be in one of 2 states.
7730
- * The ERROR and SUCCESS states are terminal, the PENDING state is the only
7731
- * start state.
7732
- */
7733
- var ERROR = -1;
7734
- var PENDING = 0;
7735
- var SUCCESS = 1;
7736
-
7737
- /**
7738
- * We give promises and ID so we can track which are outstanding
7739
- */
7740
- var _nextId = 0;
7741
-
7742
- /**
7743
- * Debugging help if 2 things try to complete the same promise.
7744
- * This can be slow (especially on chrome due to the stack trace unwinding) so
7745
- * we should leave this turned off in normal use.
7746
- */
7747
- var _traceCompletion = false;
7748
-
7749
- /**
7750
- * Outstanding promises. Handy list for debugging only.
7751
- */
7752
- var _outstanding = [];
7753
-
7754
- /**
7755
- * Recently resolved promises. Also for debugging only.
7756
- */
7757
- var _recent = [];
7758
-
7759
- /**
7760
- * Create an unfulfilled promise
7761
- */
7762
- Promise = function () {
7763
- this._status = PENDING;
7764
- this._value = undefined;
7765
- this._onSuccessHandlers = [];
7766
- this._onErrorHandlers = [];
7767
-
7768
- // Debugging help
7769
- this._id = _nextId++;
7770
- //this._createTrace = new Trace(new Error());
7771
- _outstanding[this._id] = this;
7772
- };
7773
-
7774
- /**
7775
- * Yeay for RTTI.
7776
- */
7777
- Promise.prototype.isPromise = true;
7778
-
7779
- /**
7780
- * Have we either been resolve()ed or reject()ed?
7781
- */
7782
- Promise.prototype.isComplete = function() {
7783
- return this._status != PENDING;
7784
- };
7785
-
7786
- /**
7787
- * Have we resolve()ed?
7788
- */
7789
- Promise.prototype.isResolved = function() {
7790
- return this._status == SUCCESS;
7791
- };
7792
-
7793
- /**
7794
- * Have we reject()ed?
7795
- */
7796
- Promise.prototype.isRejected = function() {
7797
- return this._status == ERROR;
7798
- };
7799
-
7800
- /**
7801
- * Take the specified action of fulfillment of a promise, and (optionally)
7802
- * a different action on promise rejection.
7803
- */
7804
- Promise.prototype.then = function(onSuccess, onError) {
7805
- if (typeof onSuccess === 'function') {
7806
- if (this._status === SUCCESS) {
7807
- onSuccess.call(null, this._value);
7808
- } else if (this._status === PENDING) {
7809
- this._onSuccessHandlers.push(onSuccess);
7810
- }
7811
- }
7812
-
7813
- if (typeof onError === 'function') {
7814
- if (this._status === ERROR) {
7815
- onError.call(null, this._value);
7816
- } else if (this._status === PENDING) {
7817
- this._onErrorHandlers.push(onError);
7818
- }
7819
- }
7820
-
7821
- return this;
7822
- };
7823
-
7824
- /**
7825
- * Like then() except that rather than returning <tt>this</tt> we return
7826
- * a promise which
7827
- */
7828
- Promise.prototype.chainPromise = function(onSuccess) {
7829
- var chain = new Promise();
7830
- chain._chainedFrom = this;
7831
- this.then(function(data) {
7832
- try {
7833
- chain.resolve(onSuccess(data));
7834
- } catch (ex) {
7835
- chain.reject(ex);
7836
- }
7837
- }, function(ex) {
7838
- chain.reject(ex);
7839
- });
7840
- return chain;
7841
- };
7842
-
7843
- /**
7844
- * Supply the fulfillment of a promise
7845
- */
7846
- Promise.prototype.resolve = function(data) {
7847
- return this._complete(this._onSuccessHandlers, SUCCESS, data, 'resolve');
7848
- };
7849
-
7850
- /**
7851
- * Renege on a promise
7852
- */
7853
- Promise.prototype.reject = function(data) {
7854
- return this._complete(this._onErrorHandlers, ERROR, data, 'reject');
7855
- };
7856
-
7857
- /**
7858
- * Internal method to be called on resolve() or reject().
7859
- * @private
7860
- */
7861
- Promise.prototype._complete = function(list, status, data, name) {
7862
- // Complain if we've already been completed
7863
- if (this._status != PENDING) {
7864
- console.group('Promise already closed');
7865
- console.error('Attempted ' + name + '() with ', data);
7866
- console.error('Previous status = ', this._status,
7867
- ', previous value = ', this._value);
7868
- console.trace();
7869
-
7870
- if (this._completeTrace) {
7871
- console.error('Trace of previous completion:');
7872
- this._completeTrace.log(5);
7873
- }
7874
- console.groupEnd();
7875
- return this;
7876
- }
7877
-
7878
- if (_traceCompletion) {
7879
- this._completeTrace = new Trace(new Error());
7880
- }
7881
-
7882
- this._status = status;
7883
- this._value = data;
7884
-
7885
- // Call all the handlers, and then delete them
7886
- list.forEach(function(handler) {
7887
- handler.call(null, this._value);
7888
- }, this);
7889
- this._onSuccessHandlers.length = 0;
7890
- this._onErrorHandlers.length = 0;
7891
-
7892
- // Remove the given {promise} from the _outstanding list, and add it to the
7893
- // _recent list, pruning more than 20 recent promises from that list.
7894
- delete _outstanding[this._id];
7895
- _recent.push(this);
7896
- while (_recent.length > 20) {
7897
- _recent.shift();
7898
- }
7899
-
7900
- return this;
7901
- };
7902
-
7903
- /**
7904
- * Takes an array of promises and returns a promise that that is fulfilled once
7905
- * all the promises in the array are fulfilled
7906
- * @param group The array of promises
7907
- * @return the promise that is fulfilled when all the array is fulfilled
7908
- */
7909
- Promise.group = function(promiseList) {
7910
- if (!(promiseList instanceof Array)) {
7911
- promiseList = Array.prototype.slice.call(arguments);
7912
- }
7913
-
7914
- // If the original array has nothing in it, return now to avoid waiting
7915
- if (promiseList.length === 0) {
7916
- return new Promise().resolve([]);
7917
- }
7918
-
7919
- var groupPromise = new Promise();
7920
- var results = [];
7921
- var fulfilled = 0;
7922
-
7923
- var onSuccessFactory = function(index) {
7924
- return function(data) {
7925
- results[index] = data;
7926
- fulfilled++;
7927
- // If the group has already failed, silently drop extra results
7928
- if (groupPromise._status !== ERROR) {
7929
- if (fulfilled === promiseList.length) {
7930
- groupPromise.resolve(results);
7931
- }
7932
- }
7933
- };
7934
- };
7935
-
7936
- promiseList.forEach(function(promise, index) {
7937
- var onSuccess = onSuccessFactory(index);
7938
- var onError = groupPromise.reject.bind(groupPromise);
7939
- promise.then(onSuccess, onError);
7940
- });
7941
-
7942
- return groupPromise;
7943
- };
7944
-
7945
- exports.Promise = Promise;
7946
- exports._outstanding = _outstanding;
7947
- exports._recent = _recent;
7948
-
7949
- });
7950
- /* ***** BEGIN LICENSE BLOCK *****
7951
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7952
- *
7953
- * The contents of this file are subject to the Mozilla Public License Version
7954
- * 1.1 (the "License"); you may not use this file except in compliance with
7955
- * the License. You may obtain a copy of the License at
7956
- * http://www.mozilla.org/MPL/
7957
- *
7958
- * Software distributed under the License is distributed on an "AS IS" basis,
7959
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7960
- * for the specific language governing rights and limitations under the
7961
- * License.
7962
- *
7963
- * The Original Code is DomTemplate.
7964
- *
7965
- * The Initial Developer of the Original Code is Mozilla.
7966
- * Portions created by the Initial Developer are Copyright (C) 2009
7967
- * the Initial Developer. All Rights Reserved.
7968
- *
7969
- * Contributor(s):
7970
- * Joe Walker (jwalker@mozilla.com) (original author)
7971
- *
7972
- * Alternatively, the contents of this file may be used under the terms of
7973
- * either the GNU General Public License Version 2 or later (the "GPL"), or
7974
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
7975
- * in which case the provisions of the GPL or the LGPL are applicable instead
7976
- * of those above. If you wish to allow use of your version of this file only
7977
- * under the terms of either the GPL or the LGPL, and not to allow others to
7978
- * use your version of this file under the terms of the MPL, indicate your
7979
- * decision by deleting the provisions above and replace them with the notice
7980
- * and other provisions required by the GPL or the LGPL. If you do not delete
7981
- * the provisions above, a recipient may use your version of this file under
7982
- * the terms of any one of the MPL, the GPL or the LGPL.
7983
- *
7984
- * ***** END LICENSE BLOCK ***** */
7985
-
7986
- define('pilot/environment', ['require', 'exports', 'module' , 'pilot/settings'], function(require, exports, module) {
7987
-
7988
-
7989
- var settings = require("pilot/settings").settings;
7990
-
7991
- /**
7992
- * Create an environment object
7993
- */
7994
- function create() {
7995
- return {
7996
- settings: settings
7997
- };
7998
- };
7999
-
8000
- exports.create = create;
8001
-
8002
-
8003
- });
8004
- /* ***** BEGIN LICENSE BLOCK *****
8005
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
8006
- *
8007
- * The contents of this file are subject to the Mozilla Public License Version
8008
- * 1.1 (the "License"); you may not use this file except in compliance with
8009
- * the License. You may obtain a copy of the License at
8010
- * http://www.mozilla.org/MPL/
8011
- *
8012
- * Software distributed under the License is distributed on an "AS IS" basis,
8013
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8014
- * for the specific language governing rights and limitations under the
8015
- * License.
8016
- *
8017
- * The Original Code is Mozilla Skywriter.
8018
- *
8019
- * The Initial Developer of the Original Code is
8020
- * Mozilla.
8021
- * Portions created by the Initial Developer are Copyright (C) 2009
8022
- * the Initial Developer. All Rights Reserved.
8023
- *
8024
- * Contributor(s):
8025
- * Fabian Jakobs <fabian AT ajax DOT org>
8026
- * Kevin Dangoor (kdangoor@mozilla.com)
8027
- * Julian Viereck <julian DOT viereck AT gmail DOT com>
8028
- *
8029
- * Alternatively, the contents of this file may be used under the terms of
8030
- * either the GNU General Public License Version 2 or later (the "GPL"), or
8031
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
8032
- * in which case the provisions of the GPL or the LGPL are applicable instead
8033
- * of those above. If you wish to allow use of your version of this file only
8034
- * under the terms of either the GPL or the LGPL, and not to allow others to
8035
- * use your version of this file under the terms of the MPL, indicate your
8036
- * decision by deleting the provisions above and replace them with the notice
8037
- * and other provisions required by the GPL or the LGPL. If you do not delete
8038
- * the provisions above, a recipient may use your version of this file under
8039
- * the terms of any one of the MPL, the GPL or the LGPL.
8040
- *
8041
- * ***** END LICENSE BLOCK ***** */
8042
-
8043
-
8044
- define('demo/demo', ['require', 'exports', 'module' , 'pilot/canon', 'pilot/event', 'ace/range', 'ace/editor', 'ace/virtual_renderer', 'ace/theme/textmate', 'ace/edit_session', 'ace/mode/javascript', 'ace/mode/css', 'ace/mode/scss', 'ace/mode/html', 'ace/mode/xml', 'ace/mode/python', 'ace/mode/php', 'ace/mode/java', 'ace/mode/csharp', 'ace/mode/ruby', 'ace/mode/c_cpp', 'ace/mode/coffee', 'ace/mode/json', 'ace/mode/perl', 'ace/mode/clojure', 'ace/mode/ocaml', 'ace/mode/svg', 'ace/mode/textile', 'ace/mode/text', 'ace/mode/groovy', 'ace/mode/scala', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'ace/split'], function(require, exports, module) {
8045
-
8046
- exports.launch = function(env) {
8047
- var canon = require("pilot/canon");
8048
- var event = require("pilot/event");
8049
- var Range = require("ace/range").Range;
8050
- var Editor = require("ace/editor").Editor;
8051
- var Renderer = require("ace/virtual_renderer").VirtualRenderer;
8052
- var theme = require("ace/theme/textmate");
8053
- var EditSession = require("ace/edit_session").EditSession;
8054
-
8055
- var JavaScriptMode = require("ace/mode/javascript").Mode;
8056
- var CssMode = require("ace/mode/css").Mode;
8057
- var ScssMode = require("ace/mode/scss").Mode;
8058
- var HtmlMode = require("ace/mode/html").Mode;
8059
- var XmlMode = require("ace/mode/xml").Mode;
8060
- var PythonMode = require("ace/mode/python").Mode;
8061
- var PhpMode = require("ace/mode/php").Mode;
8062
- var JavaMode = require("ace/mode/java").Mode;
8063
- var CSharpMode = require("ace/mode/csharp").Mode;
8064
- var RubyMode = require("ace/mode/ruby").Mode;
8065
- var CCPPMode = require("ace/mode/c_cpp").Mode;
8066
- var CoffeeMode = require("ace/mode/coffee").Mode;
8067
- var JsonMode = require("ace/mode/json").Mode;
8068
- var PerlMode = require("ace/mode/perl").Mode;
8069
- var ClojureMode = require("ace/mode/clojure").Mode;
8070
- var OcamlMode = require("ace/mode/ocaml").Mode;
8071
- var SvgMode = require("ace/mode/svg").Mode;
8072
- var TextileMode = require("ace/mode/textile").Mode;
8073
- var TextMode = require("ace/mode/text").Mode;
8074
- var GroovyMode = require("ace/mode/groovy").Mode;
8075
- var ScalaMode = require("ace/mode/scala").Mode;
8076
-
8077
- var UndoManager = require("ace/undomanager").UndoManager;
8078
-
8079
- var vim = require("ace/keyboard/keybinding/vim").Vim;
8080
- var emacs = require("ace/keyboard/keybinding/emacs").Emacs;
8081
- var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
8082
-
8083
- var keybindings = {
8084
- // Null = use "default" keymapping
8085
- ace: null,
8086
- vim: vim,
8087
- emacs: emacs,
8088
- // This is a way to define simple keyboard remappings
8089
- custom: new HashHandler({
8090
- "gotoright": "Tab",
8091
- "indent": "]",
8092
- "outdent": "[",
8093
- "gotolinestart": "^",
8094
- "gotolineend": "$"
8095
- })
8096
- }
8097
-
8098
- var docs = {};
8099
-
8100
- // Make the lorem ipsum text a little bit longer.
8101
- var loreIpsum = document.getElementById("plaintext").innerHTML;
8102
- for (var i = 0; i < 5; i++) {
8103
- loreIpsum += loreIpsum;
8104
- }
8105
- docs.plain = new EditSession(loreIpsum);
8106
- docs.plain.setUseWrapMode(true);
8107
- docs.plain.setWrapLimitRange(80, 80)
8108
- docs.plain.setMode(new TextMode());
8109
- docs.plain.setUndoManager(new UndoManager());
8110
-
8111
- docs.js = new EditSession(document.getElementById("jstext").innerHTML);
8112
- docs.js.setMode(new JavaScriptMode());
8113
- docs.js.setUndoManager(new UndoManager());
8114
-
8115
- docs.css = new EditSession(document.getElementById("csstext").innerHTML);
8116
- docs.css.setMode(new CssMode());
8117
- docs.css.setUndoManager(new UndoManager());
8118
-
8119
- docs.scss = new EditSession(document.getElementById("scsstext").innerHTML);
8120
- docs.scss.setMode(new ScssMode());
8121
- docs.scss.setUndoManager(new UndoManager());
8122
-
8123
- docs.html = new EditSession(document.getElementById("htmltext").innerHTML);
8124
- docs.html.setMode(new HtmlMode());
8125
- docs.html.setUndoManager(new UndoManager());
8126
-
8127
- docs.python = new EditSession(document.getElementById("pythontext").innerHTML);
8128
- docs.python.setMode(new PythonMode());
8129
- docs.python.setUndoManager(new UndoManager());
8130
-
8131
- docs.php = new EditSession(document.getElementById("phptext").innerHTML);
8132
- docs.php.setMode(new PhpMode());
8133
- docs.php.setUndoManager(new UndoManager());
8134
-
8135
- docs.java = new EditSession(document.getElementById("javatext").innerHTML);
8136
- docs.java.setMode(new JavaMode());
8137
- docs.java.setUndoManager(new UndoManager());
8138
- docs.java.addFold("...", new Range(8, 44, 13, 4));
8139
-
8140
- docs.ruby = new EditSession(document.getElementById("rubytext").innerHTML);
8141
- docs.ruby.setMode(new RubyMode());
8142
- docs.ruby.setUndoManager(new UndoManager());
8143
-
8144
- docs.csharp = new EditSession(document.getElementById("csharptext").innerHTML);
8145
- docs.csharp.setMode(new CSharpMode());
8146
- docs.csharp.setUndoManager(new UndoManager());
8147
-
8148
- docs.c_cpp = new EditSession(document.getElementById("cpptext").innerHTML);
8149
- docs.c_cpp.setMode(new CCPPMode());
8150
- docs.c_cpp.setUndoManager(new UndoManager());
8151
-
8152
- docs.coffee = new EditSession(document.getElementById("coffeetext").innerHTML);
8153
- docs.coffee.setMode(new CoffeeMode());
8154
- docs.coffee.setUndoManager(new UndoManager());
8155
-
8156
- docs.json = new EditSession(document.getElementById("jsontext").innerHTML);
8157
- docs.json.setMode(new JsonMode());
8158
- docs.json.setUndoManager(new UndoManager());
8159
-
8160
- docs.perl = new EditSession(document.getElementById("perltext").innerHTML);
8161
- docs.perl.setMode(new PerlMode());
8162
- docs.perl.setUndoManager(new UndoManager());
8163
-
8164
- docs.clojure = new EditSession(document.getElementById("clojuretext").innerHTML);
8165
- docs.clojure.setMode(new ClojureMode());
8166
- docs.clojure.setUndoManager(new UndoManager());
8167
-
8168
- docs.ocaml = new EditSession(document.getElementById("ocamltext").innerHTML);
8169
- docs.ocaml.setMode(new OcamlMode());
8170
- docs.ocaml.setUndoManager(new UndoManager());
8171
-
8172
- docs.svg = new EditSession(document.getElementById("svgtext").innerHTML.replace("&lt;", "<"));
8173
- docs.svg.setMode(new SvgMode());
8174
- docs.svg.setUndoManager(new UndoManager());
8175
-
8176
- docs.textile = new EditSession(document.getElementById("textiletext").innerHTML);
8177
- docs.textile.setMode(new TextileMode());
8178
- docs.textile.setUndoManager(new UndoManager());
8179
-
8180
- docs.groovy = new EditSession(document.getElementById("groovy").innerHTML);
8181
- docs.groovy.setMode(new GroovyMode());
8182
- docs.groovy.setUndoManager(new UndoManager());
8183
-
8184
- docs.scala = new EditSession(document.getElementById("scala").innerHTML);
8185
- docs.scala.setMode(new ScalaMode());
8186
- docs.scala.setUndoManager(new UndoManager());
8187
-
8188
-
8189
-
8190
-
8191
- // Add a "name" property to all docs
8192
- for (doc in docs) {
8193
- docs[doc].name = doc;
8194
- }
8195
-
8196
- var container = document.getElementById("editor");
8197
- var cockpitInput = document.getElementById("cockpitInput");
8198
-
8199
- // Splitting.
8200
- var Split = require("ace/split").Split;
8201
- var split = new Split(container, theme, 1);
8202
- env.editor = split.getEditor(0);
8203
- split.on("focus", function(editor) {
8204
- env.editor = editor;
8205
- updateUIEditorOptions();
8206
- });
8207
- env.split = split;
8208
- window.env = env;
8209
- window.ace = env.editor;
8210
-
8211
- var modes = {
8212
- text: new TextMode(),
8213
- textile: new TextileMode(),
8214
- svg: new SvgMode(),
8215
- xml: new XmlMode(),
8216
- html: new HtmlMode(),
8217
- css: new CssMode(),
8218
- scss: new ScssMode(),
8219
- javascript: new JavaScriptMode(),
8220
- python: new PythonMode(),
8221
- php: new PhpMode(),
8222
- java: new JavaMode(),
8223
- ruby: new RubyMode(),
8224
- c_cpp: new CCPPMode(),
8225
- coffee: new CoffeeMode(),
8226
- json: new JsonMode(),
8227
- perl: new PerlMode(),
8228
- clojure: new ClojureMode(),
8229
- ocaml: new OcamlMode(),
8230
- csharp: new CSharpMode(),
8231
- groovy: new GroovyMode(),
8232
- scala: new ScalaMode()
8233
- };
8234
-
8235
- function getMode() {
8236
- return modes[modeEl.value];
8237
- }
8238
-
8239
- var docEl = document.getElementById("doc");
8240
- var modeEl = document.getElementById("mode");
8241
- var wrapModeEl = document.getElementById("soft_wrap");
8242
- var themeEl = document.getElementById("theme");
8243
- var selectStyleEl = document.getElementById("select_style");
8244
- var highlightActiveEl = document.getElementById("highlight_active");
8245
- var showHiddenEl = document.getElementById("show_hidden");
8246
- var showGutterEl = document.getElementById("show_gutter");
8247
- var showPrintMarginEl = document.getElementById("show_print_margin");
8248
- var highlightSelectedWordE = document.getElementById("highlight_selected_word");
8249
- var showHScrollEl = document.getElementById("show_hscroll");
8250
- var softTabEl = document.getElementById("soft_tab");
8251
- var behavioursEl = document.getElementById("enable_behaviours");
8252
-
8253
- bindDropdown("doc", function(value) {
8254
- var doc = docs[value];
8255
- var session = env.split.setSession(doc);
8256
- session.name = doc.name;
8257
-
8258
- updateUIEditorOptions();
8259
-
8260
- env.editor.focus();
8261
- });
8262
-
8263
- function updateUIEditorOptions() {
8264
- var editor = env.editor;
8265
- var session = editor.session;
8266
-
8267
- docEl.value = session.name;
8268
-
8269
- var mode = session.getMode();
8270
- if (mode instanceof JavaScriptMode) {
8271
- modeEl.value = "javascript";
8272
- }
8273
- else if (mode instanceof CssMode) {
8274
- modeEl.value = "css";
8275
- }
8276
- else if (mode instanceof ScssMode) {
8277
- modeEl.value = "scss";
8278
- }
8279
- else if (mode instanceof HtmlMode) {
8280
- modeEl.value = "html";
8281
- }
8282
- else if (mode instanceof XmlMode) {
8283
- modeEl.value = "xml";
8284
- }
8285
- else if (mode instanceof PythonMode) {
8286
- modeEl.value = "python";
8287
- }
8288
- else if (mode instanceof PhpMode) {
8289
- modeEl.value = "php";
8290
- }
8291
- else if (mode instanceof JavaMode) {
8292
- modeEl.value = "java";
8293
- }
8294
- else if (mode instanceof RubyMode) {
8295
- modeEl.value = "ruby";
8296
- }
8297
- else if (mode instanceof CCPPMode) {
8298
- modeEl.value = "c_cpp";
8299
- }
8300
- else if (mode instanceof CoffeeMode) {
8301
- modeEl.value = "coffee";
8302
- }
8303
- else if (mode instanceof JsonMode) {
8304
- modeEl.value = "json";
8305
- }
8306
- else if (mode instanceof PerlMode) {
8307
- modeEl.value = "perl";
8308
- }
8309
- else if (mode instanceof ClojureMode) {
8310
- modeEl.value = "clojure";
8311
- }
8312
- else if (mode instanceof OcamlMode) {
8313
- modeEl.value = "ocaml";
8314
- }
8315
- else if (mode instanceof CSharpMode) {
8316
- modeEl.value = "csharp";
8317
- }
8318
- else if (mode instanceof SvgMode) {
8319
- modeEl.value = "svg";
8320
- }
8321
- else if (mode instanceof TextileMode) {
8322
- modeEl.value = "textile";
8323
- }
8324
- else if (mode instanceof GroovyMode) {
8325
- modeEl.value = "groovy";
8326
- }
8327
- else if (mode instanceof ScalaMode) {
8328
- modeEl.value = "scala";
8329
- }
8330
- else {
8331
- modeEl.value = "text";
8332
- }
8333
-
8334
- if (!session.getUseWrapMode()) {
8335
- wrapModeEl.value = "off";
8336
- } else {
8337
- wrapModeEl.value = session.getWrapLimitRange().min || "free";
8338
- }
8339
-
8340
- selectStyleEl.checked = editor.getSelectionStyle() == "line"
8341
- themeEl.value = editor.getTheme();
8342
- highlightActiveEl.checked = editor.getHighlightActiveLine();
8343
- showHiddenEl.checked = editor.getShowInvisibles();
8344
- showGutterEl.checked = editor.renderer.getShowGutter();
8345
- showPrintMarginEl.checked = editor.renderer.getShowPrintMargin();
8346
- highlightSelectedWordE.checked = editor.getHighlightSelectedWord();
8347
- showHScrollEl.checked = editor.renderer.getHScrollBarAlwaysVisible();
8348
- softTabEl.checked = session.getUseSoftTabs();
8349
- behavioursEl.checked = editor.getBehavioursEnabled()
8350
- }
8351
-
8352
- bindDropdown("mode", function(value) {
8353
- env.editor.getSession().setMode(modes[value] || modes.text);
8354
- });
8355
-
8356
- bindDropdown("theme", function(value) {
8357
- if (require.packaged) {
8358
- loadTheme(value, function() {
8359
- env.editor.setTheme(value);
8360
- });
8361
- }
8362
- else {
8363
- env.editor.setTheme(value);
8364
- }
8365
- });
8366
-
8367
- bindDropdown("keybinding", function(value) {
8368
- env.editor.setKeyboardHandler(keybindings[value]);
8369
- });
8370
-
8371
- bindDropdown("fontsize", function(value) {
8372
- env.split.setFontSize(value);
8373
- });
8374
-
8375
- bindDropdown("soft_wrap", function(value) {
8376
- var session = env.editor.getSession();
8377
- var renderer = env.editor.renderer;
8378
- switch (value) {
8379
- case "off":
8380
- session.setUseWrapMode(false);
8381
- renderer.setPrintMarginColumn(80);
8382
- break;
8383
- case "40":
8384
- session.setUseWrapMode(true);
8385
- session.setWrapLimitRange(40, 40);
8386
- renderer.setPrintMarginColumn(40);
8387
- break;
8388
- case "80":
8389
- session.setUseWrapMode(true);
8390
- session.setWrapLimitRange(80, 80);
8391
- renderer.setPrintMarginColumn(80);
8392
- break;
8393
- case "free":
8394
- session.setUseWrapMode(true);
8395
- session.setWrapLimitRange(null, null);
8396
- renderer.setPrintMarginColumn(80);
8397
- break;
8398
- }
8399
- });
8400
-
8401
- bindCheckbox("select_style", function(checked) {
8402
- env.editor.setSelectionStyle(checked ? "line" : "text");
8403
- });
8404
-
8405
- bindCheckbox("highlight_active", function(checked) {
8406
- env.editor.setHighlightActiveLine(checked);
8407
- });
8408
-
8409
- bindCheckbox("show_hidden", function(checked) {
8410
- env.editor.setShowInvisibles(checked);
8411
- });
8412
-
8413
- bindCheckbox("show_gutter", function(checked) {
8414
- env.editor.renderer.setShowGutter(checked);
8415
- });
8416
-
8417
- bindCheckbox("show_print_margin", function(checked) {
8418
- env.editor.renderer.setShowPrintMargin(checked);
8419
- });
8420
-
8421
- bindCheckbox("highlight_selected_word", function(checked) {
8422
- env.editor.setHighlightSelectedWord(checked);
8423
- });
8424
-
8425
- bindCheckbox("show_hscroll", function(checked) {
8426
- env.editor.renderer.setHScrollBarAlwaysVisible(checked);
8427
- });
8428
-
8429
- bindCheckbox("soft_tab", function(checked) {
8430
- env.editor.getSession().setUseSoftTabs(checked);
8431
- });
8432
-
8433
- bindCheckbox("enable_behaviours", function(checked) {
8434
- env.editor.setBehavioursEnabled(checked);
8435
- });
8436
-
8437
- var secondSession = null;
8438
- bindDropdown("split", function(value) {
8439
- var sp = env.split;
8440
- if (value == "none") {
8441
- if (sp.getSplits() == 2) {
8442
- secondSession = sp.getEditor(1).session;
8443
- }
8444
- sp.setSplits(1);
8445
- } else {
8446
- var newEditor = (sp.getSplits() == 1);
8447
- if (value == "below") {
8448
- sp.setOriantation(sp.BELOW);
8449
- } else {
8450
- sp.setOriantation(sp.BESIDE);
8451
- }
8452
- sp.setSplits(2);
8453
-
8454
- if (newEditor) {
8455
- var session = secondSession || sp.getEditor(0).session;
8456
- var newSession = sp.setSession(session, 1);
8457
- newSession.name = session.name;
8458
- }
8459
- }
8460
- });
8461
-
8462
- function bindCheckbox(id, callback) {
8463
- var el = document.getElementById(id);
8464
- var onCheck = function() {
8465
- callback(!!el.checked);
8466
- };
8467
- el.onclick = onCheck;
8468
- onCheck();
8469
- }
8470
-
8471
- function bindDropdown(id, callback) {
8472
- var el = document.getElementById(id);
8473
- var onChange = function() {
8474
- callback(el.value);
8475
- };
8476
- el.onchange = onChange;
8477
- onChange();
8478
- }
8479
-
8480
- function onResize() {
8481
- var width = (document.documentElement.clientWidth - 280);
8482
- container.style.width = width + "px";
8483
- cockpitInput.style.width = width + "px";
8484
- container.style.height = (document.documentElement.clientHeight - 22) + "px";
8485
- env.split.resize();
8486
- // env.editor.resize();
8487
- };
8488
-
8489
- window.onresize = onResize;
8490
- onResize();
8491
-
8492
- // Call resize on the cli explizit. This is necessary for Firefox.
8493
- env.cli.cliView.resizer()
8494
-
8495
- event.addListener(container, "dragover", function(e) {
8496
- return event.preventDefault(e);
8497
- });
8498
-
8499
- event.addListener(container, "drop", function(e) {
8500
- var file
8501
- try {
8502
- file = e.dataTransfer.files[0];
8503
- } catch(e) {
8504
- return event.stopEvent();
8505
- }
8506
-
8507
- if (window.FileReader) {
8508
- var reader = new FileReader();
8509
- reader.onload = function(e) {
8510
- env.editor.getSelection().selectAll();
8511
-
8512
- var mode = "text";
8513
- if (/^.*\.js$/i.test(file.name)) {
8514
- mode = "javascript";
8515
- } else if (/^.*\.xml$/i.test(file.name)) {
8516
- mode = "xml";
8517
- } else if (/^.*\.html$/i.test(file.name)) {
8518
- mode = "html";
8519
- } else if (/^.*\.css$/i.test(file.name)) {
8520
- mode = "css";
8521
- } else if (/^.*\.scss$/i.test(file.name)) {
8522
- mode = "scss";
8523
- } else if (/^.*\.py$/i.test(file.name)) {
8524
- mode = "python";
8525
- } else if (/^.*\.php$/i.test(file.name)) {
8526
- mode = "php";
8527
- } else if (/^.*\.cs$/i.test(file.name)) {
8528
- mode = "csharp";
8529
- } else if (/^.*\.java$/i.test(file.name)) {
8530
- mode = "java";
8531
- } else if (/^.*\.rb$/i.test(file.name)) {
8532
- mode = "ruby";
8533
- } else if (/^.*\.(c|cpp|h|hpp|cxx)$/i.test(file.name)) {
8534
- mode = "c_cpp";
8535
- } else if (/^.*\.coffee$/i.test(file.name)) {
8536
- mode = "coffee";
8537
- } else if (/^.*\.json$/i.test(file.name)) {
8538
- mode = "json";
8539
- } else if (/^.*\.(pl|pm)$/i.test(file.name)) {
8540
- mode = "perl";
8541
- } else if (/^.*\.(ml|mli)$/i.test(file.name)) {
8542
- mode = "ocaml";
8543
- } else if (/^.*\.(groovy)$/i.test(file.name)) {
8544
- mode = "groovy";
8545
- } else if (/^.*\.(scala)$/i.test(file.name)) {
8546
- mode = "scala";
8547
- }
8548
-
8549
- env.editor.onTextInput(reader.result);
8550
-
8551
- modeEl.value = mode;
8552
- env.editor.getSession().setMode(modes[mode]);
8553
- };
8554
- reader.readAsText(file);
8555
- }
8556
-
8557
- return event.preventDefault(e);
8558
- });
8559
-
8560
- window.env = env;
8561
-
8562
- /**
8563
- * This demonstrates how you can define commands and bind shortcuts to them.
8564
- */
8565
-
8566
- // Command to focus the command line from the editor.
8567
- canon.addCommand({
8568
- name: "focuscli",
8569
- bindKey: {
8570
- win: "Ctrl-J",
8571
- mac: "Command-J",
8572
- sender: "editor"
8573
- },
8574
- exec: function() {
8575
- env.cli.cliView.element.focus();
8576
- }
8577
- });
8578
-
8579
- // Command to focus the editor line from the command line.
8580
- canon.addCommand({
8581
- name: "focuseditor",
8582
- bindKey: {
8583
- win: "Ctrl-J",
8584
- mac: "Command-J",
8585
- sender: "cli"
8586
- },
8587
- exec: function() {
8588
- env.editor.focus();
8589
- }
8590
- });
8591
-
8592
- // Fake-Save, works from the editor and the command line.
8593
- canon.addCommand({
8594
- name: "save",
8595
- bindKey: {
8596
- win: "Ctrl-S",
8597
- mac: "Command-S",
8598
- sender: "editor|cli"
8599
- },
8600
- exec: function() {
8601
- alert("Fake Save File");
8602
- }
8603
- });
8604
-
8605
- // Fake-Print with custom lookup-sender-match function.
8606
- canon.addCommand({
8607
- name: "print",
8608
- bindKey: {
8609
- win: "Ctrl-P",
8610
- mac: "Command-P",
8611
- sender: function(env, sender, hashId, keyString) {
8612
- if (sender == "editor") {
8613
- return true;
8614
- } else {
8615
- alert("Sorry, can only print from the editor");
8616
- }
8617
- }
8618
- },
8619
- exec: function() {
8620
- alert("Fake Print File");
8621
- }
8622
- });
8623
-
8624
- canon.addCommand({
8625
- name: "fold",
8626
- bindKey: {
8627
- win: "Alt-L",
8628
- mac: "Alt-L",
8629
- sender: "editor"
8630
- },
8631
- exec: function(env) {
8632
- toggleFold(env, false)
8633
- }
8634
- });
8635
-
8636
- canon.addCommand({
8637
- name: "unfold",
8638
- bindKey: {
8639
- win: "Alt-Shift-L",
8640
- mac: "Alt-Shift-L",
8641
- sender: "editor"
8642
- },
8643
- exec: function(env) {
8644
- toggleFold(env, true)
8645
- }
8646
- });
8647
-
8648
- function isCommentRow(row) {
8649
- var session = env.editor.session;
8650
- var token;
8651
- var tokens = session.getTokens(row, row)[0].tokens;
8652
- var c = 0;
8653
- for (var i = 0; i < tokens.length; i++) {
8654
- token = tokens[i];
8655
- if (/^comment/.test(token.type)) {
8656
- return c;
8657
- } else if (!/^text/.test(token.type)) {
8658
- return false;
8659
- }
8660
- c += token.value.length;
8661
- }
8662
- return false;
8663
- };
8664
-
8665
- function toggleFold(env, tryToUnfold) {
8666
- var session = env.editor.session;
8667
- var selection = env.editor.selection;
8668
- var range = selection.getRange();
8669
- var addFold;
8670
-
8671
- if(range.isEmpty()) {
8672
- var br = session.findMatchingBracket(range.start);
8673
- var fold = session.getFoldAt(range.start.row, range.start.column);
8674
- var column;
8675
-
8676
- if (fold) {
8677
- session.expandFold(fold);
8678
- selection.setSelectionRange(fold.range)
8679
- } else if (br) {
8680
- if (range.compare(br.row, br.column) == 1)
8681
- range.end = br;
8682
- else
8683
- range.start = br;
8684
- addFold = true;
8685
- } else if ((column = isCommentRow(range.start.row)) !== false) {
8686
- var firstCommentRow = range.start.row;
8687
- var lastCommentRow = range.start.row;
8688
- var t;
8689
- while ((t = isCommentRow(firstCommentRow - 1)) !== false) {
8690
- firstCommentRow --;
8691
- column = t;
8692
- }
8693
- while (isCommentRow(lastCommentRow + 1) !== false) {
8694
- lastCommentRow ++;
8695
- }
8696
- range.start.row = firstCommentRow;
8697
- range.start.column = column + 2;
8698
- range.end.row = lastCommentRow;
8699
- range.end.column = session.getLine(lastCommentRow).length - 1;
8700
- addFold = true;
8701
- }
8702
- } else {
8703
- addFold = true;
8704
- }
8705
- if (addFold) {
8706
- var placeHolder = session.getTextRange(range);
8707
- if(placeHolder.length < 3)
8708
- return;
8709
- placeHolder = placeHolder.trim().substring(0, 3).replace(' ','','g') + "...";
8710
- session.addFold(placeHolder, range);
8711
- }
8712
- }
8713
- };
8714
-
8715
- var themes = {};
8716
- function loadTheme(name, callback) {
8717
- if (themes[name])
8718
- return;
8719
-
8720
- themes[name] = 1;
8721
- var base = name.split("/").pop();
8722
- var fileName = "src/theme-" + base + ".js";
8723
- loadScriptFile(fileName, callback)
8724
- }
8725
-
8726
- function loadScriptFile(path, callback) {
8727
- var head = document.getElementsByTagName('head')[0];
8728
- var s = document.createElement('script');
8729
-
8730
- s.src = path;
8731
- head.appendChild(s);
8732
-
8733
- s.onload = callback;
8734
- }
8735
-
8736
- });
8737
- /* ***** BEGIN LICENSE BLOCK *****
8738
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
8739
- *
8740
- * The contents of this file are subject to the Mozilla Public License Version
8741
- * 1.1 (the "License"); you may not use this file except in compliance with
8742
- * the License. You may obtain a copy of the License at
8743
- * http://www.mozilla.org/MPL/
8744
- *
8745
- * Software distributed under the License is distributed on an "AS IS" basis,
8746
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8747
- * for the specific language governing rights and limitations under the
8748
- * License.
8749
- *
8750
- * The Original Code is Ajax.org Code Editor (ACE).
8751
- *
8752
- * The Initial Developer of the Original Code is
8753
- * Ajax.org B.V.
8754
- * Portions created by the Initial Developer are Copyright (C) 2010
8755
- * the Initial Developer. All Rights Reserved.
8756
- *
8757
- * Contributor(s):
8758
- * Fabian Jakobs <fabian AT ajax DOT org>
8759
- *
8760
- * Alternatively, the contents of this file may be used under the terms of
8761
- * either the GNU General Public License Version 2 or later (the "GPL"), or
8762
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
8763
- * in which case the provisions of the GPL or the LGPL are applicable instead
8764
- * of those above. If you wish to allow use of your version of this file only
8765
- * under the terms of either the GPL or the LGPL, and not to allow others to
8766
- * use your version of this file under the terms of the MPL, indicate your
8767
- * decision by deleting the provisions above and replace them with the notice
8768
- * and other provisions required by the GPL or the LGPL. If you do not delete
8769
- * the provisions above, a recipient may use your version of this file under
8770
- * the terms of any one of the MPL, the GPL or the LGPL.
8771
- *
8772
- * ***** END LICENSE BLOCK ***** */
8773
-
8774
- define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
8775
-
8776
- var Range = function(startRow, startColumn, endRow, endColumn) {
8777
- this.start = {
8778
- row: startRow,
8779
- column: startColumn
8780
- };
8781
-
8782
- this.end = {
8783
- row: endRow,
8784
- column: endColumn
8785
- };
8786
- };
8787
-
8788
- (function() {
8789
-
8790
- this.toString = function() {
8791
- return ("Range: [" + this.start.row + "/" + this.start.column +
8792
- "] -> [" + this.end.row + "/" + this.end.column + "]");
8793
- };
8794
-
8795
- this.contains = function(row, column) {
8796
- return this.compare(row, column) == 0;
8797
- };
8798
-
8799
- /**
8800
- * Compares this range (A) with another range (B), where B is the passed in
8801
- * range.
8802
- *
8803
- * Return values:
8804
- * -2: (B) is infront of (A) and doesn't intersect with (A)
8805
- * -1: (B) begins before (A) but ends inside of (A)
8806
- * 0: (B) is completly inside of (A) OR (A) is complety inside of (B)
8807
- * +1: (B) begins inside of (A) but ends outside of (A)
8808
- * +2: (B) is after (A) and doesn't intersect with (A)
8809
- *
8810
- * 42: FTW state: (B) ends in (A) but starts outside of (A)
8811
- */
8812
- this.compareRange = function(range) {
8813
- var cmp,
8814
- end = range.end,
8815
- start = range.start;
8816
-
8817
- cmp = this.compare(end.row, end.column);
8818
- if (cmp == 1) {
8819
- cmp = this.compare(start.row, start.column);
8820
- if (cmp == 1) {
8821
- return 2;
8822
- } else if (cmp == 0) {
8823
- return 1;
8824
- } else {
8825
- return 0;
8826
- }
8827
- } else if (cmp == -1) {
8828
- return -2;
8829
- } else {
8830
- cmp = this.compare(start.row, start.column);
8831
- if (cmp == -1) {
8832
- return -1;
8833
- } else if (cmp == 1) {
8834
- return 42;
8835
- } else {
8836
- return 0;
8837
- }
8838
- }
8839
- }
8840
-
8841
- this.containsRange = function(range) {
8842
- var cmp = this.compareRange(range);
8843
- return (cmp == -1 || cmp == 0 || cmp == 1);
8844
- }
8845
-
8846
- this.isEnd = function(row, column) {
8847
- return this.end.row == row && this.end.column == column;
8848
- }
8849
-
8850
- this.isStart = function(row, column) {
8851
- return this.start.row == row && this.start.column == column;
8852
- }
8853
-
8854
- this.setStart = function(row, column) {
8855
- if (typeof row == "object") {
8856
- this.start.column = row.column;
8857
- this.start.row = row.row;
8858
- } else {
8859
- this.start.row = row;
8860
- this.start.column = column;
8861
- }
8862
- }
8863
-
8864
- this.setEnd = function(row, column) {
8865
- if (typeof row == "object") {
8866
- this.end.column = row.column;
8867
- this.end.row = row.row;
8868
- } else {
8869
- this.end.row = row;
8870
- this.end.column = column;
8871
- }
8872
- }
8873
-
8874
- this.inside = function(row, column) {
8875
- if (this.compare(row, column) == 0) {
8876
- if (this.isEnd(row, column) || this.isStart(row, column)) {
8877
- return false;
8878
- } else {
8879
- return true;
8880
- }
8881
- }
8882
- return false;
8883
- }
8884
-
8885
- this.insideStart = function(row, column) {
8886
- if (this.compare(row, column) == 0) {
8887
- if (this.isEnd(row, column)) {
8888
- return false;
8889
- } else {
8890
- return true;
8891
- }
8892
- }
8893
- return false;
8894
- }
8895
-
8896
- this.insideEnd = function(row, column) {
8897
- if (this.compare(row, column) == 0) {
8898
- if (this.isStart(row, column)) {
8899
- return false;
8900
- } else {
8901
- return true;
8902
- }
8903
- }
8904
- return false;
8905
- }
8906
-
8907
- this.compare = function(row, column) {
8908
- if (!this.isMultiLine()) {
8909
- if (row === this.start.row) {
8910
- return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
8911
- };
8912
- }
8913
-
8914
- if (row < this.start.row)
8915
- return -1;
8916
-
8917
- if (row > this.end.row)
8918
- return 1;
8919
-
8920
- if (this.start.row === row)
8921
- return column >= this.start.column ? 0 : -1;
8922
-
8923
- if (this.end.row === row)
8924
- return column <= this.end.column ? 0 : 1;
8925
-
8926
- return 0;
8927
- };
8928
-
8929
- /**
8930
- * Like .compare(), but if isStart is true, return -1;
8931
- */
8932
- this.compareStart = function(row, column) {
8933
- if (this.start.row == row && this.start.column == column) {
8934
- return -1;
8935
- } else {
8936
- return this.compare(row, column);
8937
- }
8938
- }
8939
-
8940
- /**
8941
- * Like .compare(), but if isEnd is true, return 1;
8942
- */
8943
- this.compareEnd = function(row, column) {
8944
- if (this.end.row == row && this.end.column == column) {
8945
- return 1;
8946
- } else {
8947
- return this.compare(row, column);
8948
- }
8949
- }
8950
-
8951
- this.compareInside = function(row, column) {
8952
- if (this.end.row == row && this.end.column == column) {
8953
- return 1;
8954
- } else if (this.start.row == row && this.start.column == column) {
8955
- return -1;
8956
- } else {
8957
- return this.compare(row, column);
8958
- }
8959
- }
8960
-
8961
- this.clipRows = function(firstRow, lastRow) {
8962
- if (this.end.row > lastRow) {
8963
- var end = {
8964
- row: lastRow+1,
8965
- column: 0
8966
- };
8967
- }
8968
-
8969
- if (this.start.row > lastRow) {
8970
- var start = {
8971
- row: lastRow+1,
8972
- column: 0
8973
- };
8974
- }
8975
-
8976
- if (this.start.row < firstRow) {
8977
- var start = {
8978
- row: firstRow,
8979
- column: 0
8980
- };
8981
- }
8982
-
8983
- if (this.end.row < firstRow) {
8984
- var end = {
8985
- row: firstRow,
8986
- column: 0
8987
- };
8988
- }
8989
- return Range.fromPoints(start || this.start, end || this.end);
8990
- };
8991
-
8992
- this.extend = function(row, column) {
8993
- var cmp = this.compare(row, column);
8994
-
8995
- if (cmp == 0)
8996
- return this;
8997
- else if (cmp == -1)
8998
- var start = {row: row, column: column};
8999
- else
9000
- var end = {row: row, column: column};
9001
-
9002
- return Range.fromPoints(start || this.start, end || this.end);
9003
- };
9004
-
9005
- this.isEmpty = function() {
9006
- return (this.start.row == this.end.row && this.start.column == this.end.column);
9007
- };
9008
-
9009
- this.isMultiLine = function() {
9010
- return (this.start.row !== this.end.row);
9011
- };
9012
-
9013
- this.clone = function() {
9014
- return Range.fromPoints(this.start, this.end);
9015
- };
9016
-
9017
- this.collapseRows = function() {
9018
- if (this.end.column == 0)
9019
- return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
9020
- else
9021
- return new Range(this.start.row, 0, this.end.row, 0)
9022
- };
9023
-
9024
- this.toScreenRange = function(session) {
9025
- var screenPosStart =
9026
- session.documentToScreenPosition(this.start);
9027
- var screenPosEnd =
9028
- session.documentToScreenPosition(this.end);
9029
-
9030
- return new Range(
9031
- screenPosStart.row, screenPosStart.column,
9032
- screenPosEnd.row, screenPosEnd.column
9033
- );
9034
- };
9035
-
9036
- }).call(Range.prototype);
9037
-
9038
-
9039
- Range.fromPoints = function(start, end) {
9040
- return new Range(start.row, start.column, end.row, end.column);
9041
- };
9042
-
9043
- exports.Range = Range;
9044
- });
9045
- /* vim:ts=4:sts=4:sw=4:
9046
- * ***** BEGIN LICENSE BLOCK *****
9047
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9048
- *
9049
- * The contents of this file are subject to the Mozilla Public License Version
9050
- * 1.1 (the "License"); you may not use this file except in compliance with
9051
- * the License. You may obtain a copy of the License at
9052
- * http://www.mozilla.org/MPL/
9053
- *
9054
- * Software distributed under the License is distributed on an "AS IS" basis,
9055
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9056
- * for the specific language governing rights and limitations under the
9057
- * License.
9058
- *
9059
- * The Original Code is Ajax.org Code Editor (ACE).
9060
- *
9061
- * The Initial Developer of the Original Code is
9062
- * Ajax.org B.V.
9063
- * Portions created by the Initial Developer are Copyright (C) 2010
9064
- * the Initial Developer. All Rights Reserved.
9065
- *
9066
- * Contributor(s):
9067
- * Fabian Jakobs <fabian AT ajax DOT org>
9068
- * Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
9069
- * Julian Viereck <julian.viereck@gmail.com>
9070
- *
9071
- * Alternatively, the contents of this file may be used under the terms of
9072
- * either the GNU General Public License Version 2 or later (the "GPL"), or
9073
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
9074
- * in which case the provisions of the GPL or the LGPL are applicable instead
9075
- * of those above. If you wish to allow use of your version of this file only
9076
- * under the terms of either the GPL or the LGPL, and not to allow others to
9077
- * use your version of this file under the terms of the MPL, indicate your
9078
- * decision by deleting the provisions above and replace them with the notice
9079
- * and other provisions required by the GPL or the LGPL. If you do not delete
9080
- * the provisions above, a recipient may use your version of this file under
9081
- * the terms of any one of the MPL, the GPL or the LGPL.
9082
- *
9083
- * ***** END LICENSE BLOCK ***** */
9084
-
9085
- define('ace/editor', ['require', 'exports', 'module' , 'pilot/fixoldbrowsers', 'pilot/oop', 'pilot/event', 'pilot/lang', 'pilot/useragent', 'ace/keyboard/textinput', 'ace/mouse_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'pilot/event_emitter'], function(require, exports, module) {
9086
-
9087
- require("pilot/fixoldbrowsers");
9088
-
9089
- var oop = require("pilot/oop");
9090
- var event = require("pilot/event");
9091
- var lang = require("pilot/lang");
9092
- var useragent = require("pilot/useragent");
9093
- var TextInput = require("ace/keyboard/textinput").TextInput;
9094
- var MouseHandler = require("ace/mouse_handler").MouseHandler;
9095
- //var TouchHandler = require("ace/touch_handler").TouchHandler;
9096
- var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
9097
- var EditSession = require("ace/edit_session").EditSession;
9098
- var Search = require("ace/search").Search;
9099
- var Range = require("ace/range").Range;
9100
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
9101
-
9102
- var Editor =function(renderer, session) {
9103
- var container = renderer.getContainerElement();
9104
- this.container = container;
9105
- this.renderer = renderer;
9106
-
9107
- this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
9108
- this.keyBinding = new KeyBinding(this);
9109
-
9110
- // TODO detect touch event support
9111
- if (useragent.isIPad) {
9112
- //this.$mouseHandler = new TouchHandler(this);
9113
- } else {
9114
- this.$mouseHandler = new MouseHandler(this);
9115
- }
9116
-
9117
- this.$blockScrolling = 0;
9118
- this.$search = new Search().set({
9119
- wrap: true
9120
- });
9121
-
9122
- this.setSession(session || new EditSession(""));
9123
- };
9124
-
9125
- (function(){
9126
-
9127
- oop.implement(this, EventEmitter);
9128
-
9129
- this.$forwardEvents = {
9130
- gutterclick: 1,
9131
- gutterdblclick: 1
9132
- };
9133
-
9134
- this.$originalAddEventListener = this.addEventListener;
9135
- this.$originalRemoveEventListener = this.removeEventListener;
9136
-
9137
- this.addEventListener = function(eventName, callback) {
9138
- if (this.$forwardEvents[eventName]) {
9139
- return this.renderer.addEventListener(eventName, callback);
9140
- } else {
9141
- return this.$originalAddEventListener(eventName, callback);
9142
- }
9143
- };
9144
-
9145
- this.removeEventListener = function(eventName, callback) {
9146
- if (this.$forwardEvents[eventName]) {
9147
- return this.renderer.removeEventListener(eventName, callback);
9148
- } else {
9149
- return this.$originalRemoveEventListener(eventName, callback);
9150
- }
9151
- };
9152
-
9153
- this.setKeyboardHandler = function(keyboardHandler) {
9154
- this.keyBinding.setKeyboardHandler(keyboardHandler);
9155
- };
9156
-
9157
- this.getKeyboardHandler = function() {
9158
- return this.keyBinding.getKeyboardHandler();
9159
- };
9160
-
9161
- this.setSession = function(session) {
9162
- if (this.session == session)
9163
- return;
9164
-
9165
- if (this.session) {
9166
- var oldSession = this.session;
9167
- this.session.removeEventListener("change", this.$onDocumentChange);
9168
- this.session.removeEventListener("changeMode", this.$onChangeMode);
9169
- this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
9170
- this.session.removeEventListener("changeTabSize", this.$onChangeTabSize);
9171
- this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit);
9172
- this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode);
9173
- this.session.removeEventListener("onChangeFold", this.$onChangeFold);
9174
- this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
9175
- this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
9176
- this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
9177
- this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
9178
- this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
9179
-
9180
- var selection = this.session.getSelection();
9181
- selection.removeEventListener("changeCursor", this.$onCursorChange);
9182
- selection.removeEventListener("changeSelection", this.$onSelectionChange);
9183
-
9184
- this.session.setScrollTopRow(this.renderer.getScrollTopRow());
9185
- }
9186
-
9187
- this.session = session;
9188
-
9189
- this.$onDocumentChange = this.onDocumentChange.bind(this);
9190
- session.addEventListener("change", this.$onDocumentChange);
9191
- this.renderer.setSession(session);
9192
-
9193
- this.$onChangeMode = this.onChangeMode.bind(this);
9194
- session.addEventListener("changeMode", this.$onChangeMode);
9195
-
9196
- this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
9197
- session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
9198
-
9199
- this.$onChangeTabSize = this.renderer.updateText.bind(this.renderer);
9200
- session.addEventListener("changeTabSize", this.$onChangeTabSize);
9201
-
9202
- this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
9203
- session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
9204
-
9205
- this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
9206
- session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
9207
-
9208
- this.$onChangeFold = this.onChangeFold.bind(this);
9209
- session.addEventListener("changeFold", this.$onChangeFold);
9210
-
9211
- this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
9212
- this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
9213
-
9214
- this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
9215
- this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
9216
-
9217
- this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
9218
- this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
9219
-
9220
- this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
9221
- this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
9222
-
9223
- this.$onCursorChange = this.onCursorChange.bind(this);
9224
- this.session.addEventListener("changeOverwrite", this.$onCursorChange);
9225
-
9226
- this.selection = session.getSelection();
9227
- this.selection.addEventListener("changeCursor", this.$onCursorChange);
9228
-
9229
- this.$onSelectionChange = this.onSelectionChange.bind(this);
9230
- this.selection.addEventListener("changeSelection", this.$onSelectionChange);
9231
-
9232
- this.onChangeMode();
9233
-
9234
- this.onCursorChange();
9235
- this.onSelectionChange();
9236
- this.onChangeFrontMarker();
9237
- this.onChangeBackMarker();
9238
- this.onChangeBreakpoint();
9239
- this.onChangeAnnotation();
9240
- this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
9241
- this.renderer.scrollToRow(session.getScrollTopRow());
9242
- this.renderer.updateFull();
9243
-
9244
- this._dispatchEvent("changeSession", {
9245
- session: session,
9246
- oldSession: oldSession
9247
- });
9248
- };
9249
-
9250
- this.getSession = function() {
9251
- return this.session;
9252
- };
9253
-
9254
- this.getSelection = function() {
9255
- return this.selection;
9256
- };
9257
-
9258
- this.resize = function() {
9259
- this.renderer.onResize();
9260
- };
9261
-
9262
- this.setTheme = function(theme) {
9263
- this.renderer.setTheme(theme);
9264
- };
9265
-
9266
- this.getTheme = function() {
9267
- return this.renderer.getTheme();
9268
- };
9269
-
9270
- this.setStyle = function(style) {
9271
- this.renderer.setStyle(style);
9272
- };
9273
-
9274
- this.unsetStyle = function(style) {
9275
- this.renderer.unsetStyle(style);
9276
- };
9277
-
9278
- this.setFontSize = function(size) {
9279
- this.container.style.fontSize = size;
9280
- };
9281
-
9282
- this.$highlightBrackets = function() {
9283
- if (this.session.$bracketHighlight) {
9284
- this.session.removeMarker(this.session.$bracketHighlight);
9285
- this.session.$bracketHighlight = null;
9286
- }
9287
-
9288
- if (this.$highlightPending) {
9289
- return;
9290
- }
9291
-
9292
- // perform highlight async to not block the browser during navigation
9293
- var self = this;
9294
- this.$highlightPending = true;
9295
- setTimeout(function() {
9296
- self.$highlightPending = false;
9297
-
9298
- var pos = self.session.findMatchingBracket(self.getCursorPosition());
9299
- if (pos) {
9300
- var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
9301
- self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text");
9302
- }
9303
- }, 10);
9304
- };
9305
-
9306
- this.focus = function() {
9307
- // Safari needs the timeout
9308
- // iOS and Firefox need it called immediately
9309
- // to be on the save side we do both
9310
- // except for IE
9311
- var _self = this;
9312
- if (!useragent.isIE) {
9313
- setTimeout(function() {
9314
- _self.textInput.focus();
9315
- });
9316
- }
9317
- this.textInput.focus();
9318
- };
9319
-
9320
- this.isFocused = function() {
9321
- return this.textInput.isFocused();
9322
- };
9323
-
9324
- this.blur = function() {
9325
- this.textInput.blur();
9326
- };
9327
-
9328
- this.onFocus = function() {
9329
- this.renderer.showCursor();
9330
- this.renderer.visualizeFocus();
9331
- this._dispatchEvent("focus");
9332
- };
9333
-
9334
- this.onBlur = function() {
9335
- this.renderer.hideCursor();
9336
- this.renderer.visualizeBlur();
9337
- this._dispatchEvent("blur");
9338
- };
9339
-
9340
- this.onDocumentChange = function(e) {
9341
- var delta = e.data;
9342
- var range = delta.range;
9343
-
9344
- if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
9345
- var lastRow = range.end.row;
9346
- else
9347
- lastRow = Infinity;
9348
- this.renderer.updateLines(range.start.row, lastRow);
9349
-
9350
- // update cursor because tab characters can influence the cursor position
9351
- this.renderer.updateCursor();
9352
- };
9353
-
9354
- this.onTokenizerUpdate = function(e) {
9355
- var rows = e.data;
9356
- this.renderer.updateLines(rows.first, rows.last);
9357
- };
9358
-
9359
- this.onCursorChange = function(e) {
9360
- this.renderer.updateCursor();
9361
-
9362
- if (!this.$blockScrolling) {
9363
- this.renderer.scrollCursorIntoView();
9364
- }
9365
-
9366
- // move text input over the cursor
9367
- // this is required for iOS and IME
9368
- this.renderer.moveTextAreaToCursor(this.textInput.getElement());
9369
-
9370
- this.$highlightBrackets();
9371
- this.$updateHighlightActiveLine();
9372
- };
9373
-
9374
- this.$updateHighlightActiveLine = function() {
9375
- var session = this.getSession();
9376
-
9377
- if (session.$highlightLineMarker) {
9378
- session.removeMarker(session.$highlightLineMarker);
9379
- }
9380
- session.$highlightLineMarker = null;
9381
-
9382
- if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
9383
- var cursor = this.getCursorPosition(),
9384
- foldLine = this.session.getFoldLine(cursor.row);
9385
- var range;
9386
- if (foldLine) {
9387
- range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0);
9388
- } else {
9389
- range = new Range(cursor.row, 0, cursor.row+1, 0);
9390
- }
9391
- session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
9392
- }
9393
- };
9394
-
9395
- this.onSelectionChange = function(e) {
9396
- var session = this.getSession();
9397
-
9398
- if (session.$selectionMarker) {
9399
- session.removeMarker(session.$selectionMarker);
9400
- }
9401
- session.$selectionMarker = null;
9402
-
9403
- if (!this.selection.isEmpty()) {
9404
- var range = this.selection.getRange();
9405
- var style = this.getSelectionStyle();
9406
- session.$selectionMarker = session.addMarker(range, "ace_selection", style);
9407
- } else {
9408
- this.$updateHighlightActiveLine();
9409
- }
9410
-
9411
- if (this.$highlightSelectedWord)
9412
- this.session.getMode().highlightSelection(this);
9413
- };
9414
-
9415
- this.onChangeFrontMarker = function() {
9416
- this.renderer.updateFrontMarkers();
9417
- };
9418
-
9419
- this.onChangeBackMarker = function() {
9420
- this.renderer.updateBackMarkers();
9421
- };
9422
-
9423
- this.onChangeBreakpoint = function() {
9424
- this.renderer.setBreakpoints(this.session.getBreakpoints());
9425
- };
9426
-
9427
- this.onChangeAnnotation = function() {
9428
- this.renderer.setAnnotations(this.session.getAnnotations());
9429
- };
9430
-
9431
- this.onChangeMode = function() {
9432
- this.renderer.updateText()
9433
- };
9434
-
9435
- this.onChangeWrapLimit = function() {
9436
- this.renderer.updateFull();
9437
- };
9438
-
9439
- this.onChangeWrapMode = function() {
9440
- this.renderer.onResize(true);
9441
- };
9442
-
9443
- this.onChangeFold = function() {
9444
- // Update the active line marker as due to folding changes the current
9445
- // line range on the screen might have changed.
9446
- this.$updateHighlightActiveLine();
9447
- // TODO: This might be too much updating. Okay for now.
9448
- this.renderer.updateFull();
9449
- };
9450
-
9451
- this.getCopyText = function() {
9452
- if (!this.selection.isEmpty()) {
9453
- return this.session.getTextRange(this.getSelectionRange());
9454
- }
9455
- else {
9456
- return "";
9457
- }
9458
- };
9459
-
9460
- this.onCut = function() {
9461
- if (this.$readOnly)
9462
- return;
9463
-
9464
- if (!this.selection.isEmpty()) {
9465
- this.session.remove(this.getSelectionRange())
9466
- this.clearSelection();
9467
- }
9468
- };
9469
-
9470
- this.insert = function(text) {
9471
- if (this.$readOnly)
9472
- return;
9473
-
9474
- var session = this.session;
9475
- var mode = session.getMode();
9476
-
9477
- var cursor = this.getCursorPosition();
9478
-
9479
- if (this.getBehavioursEnabled()) {
9480
- // Get a transform if the current mode wants one.
9481
- var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
9482
- if (transform)
9483
- text = transform.text;
9484
- }
9485
-
9486
- text = text.replace("\t", this.session.getTabString());
9487
-
9488
- // remove selected text
9489
- if (!this.selection.isEmpty()) {
9490
- var cursor = this.session.remove(this.getSelectionRange());
9491
- this.clearSelection();
9492
- }
9493
- else if (this.session.getOverwrite()) {
9494
- var range = new Range.fromPoints(cursor, cursor);
9495
- range.end.column += text.length;
9496
- this.session.remove(range);
9497
- }
9498
-
9499
- this.clearSelection();
9500
-
9501
- var start = cursor.column;
9502
- var lineState = session.getState(cursor.row);
9503
- var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
9504
- var line = session.getLine(cursor.row);
9505
- var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
9506
- var end = session.insert(cursor, text);
9507
-
9508
- if (transform && transform.selection) {
9509
- if (transform.selection.length == 2) { // Transform relative to the current column
9510
- this.selection.setSelectionRange(
9511
- new Range(cursor.row, start + transform.selection[0],
9512
- cursor.row, start + transform.selection[1]));
9513
- } else { // Transform relative to the current row.
9514
- this.selection.setSelectionRange(
9515
- new Range(cursor.row + transform.selection[0],
9516
- transform.selection[1],
9517
- cursor.row + transform.selection[2],
9518
- transform.selection[3]));
9519
- }
9520
- }
9521
-
9522
- var lineState = session.getState(cursor.row);
9523
-
9524
- // TODO disabled multiline auto indent
9525
- // possibly doing the indent before inserting the text
9526
- // if (cursor.row !== end.row) {
9527
- if (session.getDocument().isNewLine(text)) {
9528
- this.moveCursorTo(cursor.row+1, 0);
9529
-
9530
- var size = session.getTabSize();
9531
- var minIndent = Number.MAX_VALUE;
9532
-
9533
- for (var row = cursor.row + 1; row <= end.row; ++row) {
9534
- var indent = 0;
9535
-
9536
- line = session.getLine(row);
9537
- for (var i = 0; i < line.length; ++i)
9538
- if (line.charAt(i) == '\t')
9539
- indent += size;
9540
- else if (line.charAt(i) == ' ')
9541
- indent += 1;
9542
- else
9543
- break;
9544
- if (/[^\s]/.test(line))
9545
- minIndent = Math.min(indent, minIndent);
9546
- }
9547
-
9548
- for (var row = cursor.row + 1; row <= end.row; ++row) {
9549
- var outdent = minIndent;
9550
-
9551
- line = session.getLine(row);
9552
- for (var i = 0; i < line.length && outdent > 0; ++i)
9553
- if (line.charAt(i) == '\t')
9554
- outdent -= size;
9555
- else if (line.charAt(i) == ' ')
9556
- outdent -= 1;
9557
- session.remove(new Range(row, 0, row, i));
9558
- }
9559
- session.indentRows(cursor.row + 1, end.row, lineIndent);
9560
- } else {
9561
- if (shouldOutdent) {
9562
- mode.autoOutdent(lineState, session, cursor.row);
9563
- }
9564
- }
9565
- };
9566
-
9567
- this.onTextInput = function(text, notPasted) {
9568
- // In case the text was not pasted and we got only one character, then
9569
- // handel it as a command key stroke.
9570
- if (notPasted && text.length == 1) {
9571
- // Note: The `null` as `keyCode` is important here, as there are
9572
- // some checks in the code for `keyCode == 0` meaning the text comes
9573
- // from the keyBinding.onTextInput code path.
9574
- var handled = this.keyBinding.onCommandKey({}, 0, null, text);
9575
-
9576
- // Check if the text was handled. If not, then handled it as "normal"
9577
- // text and insert it to the editor directly. This shouldn't be done
9578
- // using the this.keyBinding.onTextInput(text) function, as it would
9579
- // make the `text` get sent to the keyboardHandler twice, which might
9580
- // turn out to be a bad thing in case there is a custome keyboard
9581
- // handler like the StateHandler.
9582
- if (!handled) {
9583
- this.insert(text);
9584
- }
9585
- } else {
9586
- this.keyBinding.onTextInput(text);
9587
- }
9588
- };
9589
-
9590
- this.onCommandKey = function(e, hashId, keyCode) {
9591
- this.keyBinding.onCommandKey(e, hashId, keyCode);
9592
- };
9593
-
9594
- this.setOverwrite = function(overwrite) {
9595
- this.session.setOverwrite(overwrite);
9596
- };
9597
-
9598
- this.getOverwrite = function() {
9599
- return this.session.getOverwrite();
9600
- };
9601
-
9602
- this.toggleOverwrite = function() {
9603
- this.session.toggleOverwrite();
9604
- };
9605
-
9606
- this.setScrollSpeed = function(speed) {
9607
- this.$mouseHandler.setScrollSpeed(speed);
9608
- };
9609
-
9610
- this.getScrollSpeed = function() {
9611
- return this.$mouseHandler.getScrollSpeed()
9612
- };
9613
-
9614
- this.$selectionStyle = "line";
9615
- this.setSelectionStyle = function(style) {
9616
- if (this.$selectionStyle == style) return;
9617
-
9618
- this.$selectionStyle = style;
9619
- this.onSelectionChange();
9620
- this._dispatchEvent("changeSelectionStyle", {data: style});
9621
- };
9622
-
9623
- this.getSelectionStyle = function() {
9624
- return this.$selectionStyle;
9625
- };
9626
-
9627
- this.$highlightActiveLine = true;
9628
- this.setHighlightActiveLine = function(shouldHighlight) {
9629
- if (this.$highlightActiveLine == shouldHighlight) return;
9630
-
9631
- this.$highlightActiveLine = shouldHighlight;
9632
- this.$updateHighlightActiveLine();
9633
- };
9634
-
9635
- this.getHighlightActiveLine = function() {
9636
- return this.$highlightActiveLine;
9637
- };
9638
-
9639
- this.$highlightSelectedWord = true;
9640
- this.setHighlightSelectedWord = function(shouldHighlight) {
9641
- if (this.$highlightSelectedWord == shouldHighlight)
9642
- return;
9643
-
9644
- this.$highlightSelectedWord = shouldHighlight;
9645
- if (shouldHighlight)
9646
- this.session.getMode().highlightSelection(this);
9647
- else
9648
- this.session.getMode().clearSelectionHighlight(this);
9649
- };
9650
-
9651
- this.getHighlightSelectedWord = function() {
9652
- return this.$highlightSelectedWord;
9653
- };
9654
-
9655
- this.setShowInvisibles = function(showInvisibles) {
9656
- if (this.getShowInvisibles() == showInvisibles)
9657
- return;
9658
-
9659
- this.renderer.setShowInvisibles(showInvisibles);
9660
- };
9661
-
9662
- this.getShowInvisibles = function() {
9663
- return this.renderer.getShowInvisibles();
9664
- };
9665
-
9666
- this.setShowPrintMargin = function(showPrintMargin) {
9667
- this.renderer.setShowPrintMargin(showPrintMargin);
9668
- };
9669
-
9670
- this.getShowPrintMargin = function() {
9671
- return this.renderer.getShowPrintMargin();
9672
- };
9673
-
9674
- this.setPrintMarginColumn = function(showPrintMargin) {
9675
- this.renderer.setPrintMarginColumn(showPrintMargin);
9676
- };
9677
-
9678
- this.getPrintMarginColumn = function() {
9679
- return this.renderer.getPrintMarginColumn();
9680
- };
9681
-
9682
- this.$readOnly = false;
9683
- this.setReadOnly = function(readOnly) {
9684
- this.$readOnly = readOnly;
9685
- };
9686
-
9687
- this.getReadOnly = function() {
9688
- return this.$readOnly;
9689
- };
9690
-
9691
- this.$modeBehaviours = true;
9692
- this.setBehavioursEnabled = function (enabled) {
9693
- this.$modeBehaviours = enabled;
9694
- }
9695
-
9696
- this.getBehavioursEnabled = function () {
9697
- return this.$modeBehaviours;
9698
- }
9699
-
9700
- this.removeRight = function() {
9701
- if (this.$readOnly)
9702
- return;
9703
-
9704
- if (this.selection.isEmpty()) {
9705
- this.selection.selectRight();
9706
- }
9707
- this.session.remove(this.getSelectionRange())
9708
- this.clearSelection();
9709
- };
9710
-
9711
- this.removeLeft = function() {
9712
- if (this.$readOnly)
9713
- return;
9714
-
9715
- if (this.selection.isEmpty())
9716
- this.selection.selectLeft();
9717
-
9718
- var range = this.getSelectionRange();
9719
- if (this.getBehavioursEnabled()) {
9720
- var session = this.session;
9721
- var state = session.getState(range.start.row);
9722
- var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
9723
- if (new_range !== false) {
9724
- range = new_range;
9725
- }
9726
- }
9727
-
9728
- this.session.remove(range);
9729
- this.clearSelection();
9730
- };
9731
-
9732
- this.removeWordRight = function() {
9733
- if (this.$readOnly)
9734
- return;
9735
-
9736
- if (this.selection.isEmpty())
9737
- this.selection.selectWordRight();
9738
-
9739
- this.session.remove(this.getSelectionRange());
9740
- this.clearSelection();
9741
- };
9742
-
9743
- this.removeWordLeft = function() {
9744
- if (this.$readOnly)
9745
- return;
9746
-
9747
- if (this.selection.isEmpty())
9748
- this.selection.selectWordLeft();
9749
-
9750
- this.session.remove(this.getSelectionRange());
9751
- this.clearSelection();
9752
- };
9753
-
9754
- this.removeToLineStart = function() {
9755
- if (this.$readOnly)
9756
- return;
9757
-
9758
- if (this.selection.isEmpty())
9759
- this.selection.selectLineStart();
9760
-
9761
- this.session.remove(this.getSelectionRange());
9762
- this.clearSelection();
9763
- };
9764
-
9765
- this.removeToLineEnd = function() {
9766
- if (this.$readOnly)
9767
- return;
9768
-
9769
- if (this.selection.isEmpty())
9770
- this.selection.selectLineEnd();
9771
-
9772
- var range = this.getSelectionRange();
9773
- if (range.start.column == range.end.column && range.start.row == range.end.row) {
9774
- range.end.column = 0;
9775
- range.end.row++;
9776
- }
9777
-
9778
- this.session.remove(range);
9779
- this.clearSelection();
9780
- };
9781
-
9782
- this.splitLine = function() {
9783
- if (this.$readOnly)
9784
- return;
9785
-
9786
- if (!this.selection.isEmpty()) {
9787
- this.session.remove(this.getSelectionRange());
9788
- this.clearSelection();
9789
- }
9790
-
9791
- var cursor = this.getCursorPosition();
9792
- this.insert("\n");
9793
- this.moveCursorToPosition(cursor);
9794
- };
9795
-
9796
- this.transposeLetters = function() {
9797
- if (this.$readOnly)
9798
- return;
9799
-
9800
- if (!this.selection.isEmpty()) {
9801
- return;
9802
- }
9803
-
9804
- var cursor = this.getCursorPosition();
9805
- var column = cursor.column;
9806
- if (column == 0)
9807
- return;
9808
-
9809
- var line = this.session.getLine(cursor.row);
9810
- if (column < line.length) {
9811
- var swap = line.charAt(column) + line.charAt(column-1);
9812
- var range = new Range(cursor.row, column-1, cursor.row, column+1)
9813
- }
9814
- else {
9815
- var swap = line.charAt(column-1) + line.charAt(column-2);
9816
- var range = new Range(cursor.row, column-2, cursor.row, column)
9817
- }
9818
- this.session.replace(range, swap);
9819
- };
9820
-
9821
- this.indent = function() {
9822
- if (this.$readOnly)
9823
- return;
9824
-
9825
- var session = this.session;
9826
- var range = this.getSelectionRange();
9827
-
9828
- if (range.start.row < range.end.row || range.start.column < range.end.column) {
9829
- var rows = this.$getSelectedRows();
9830
- session.indentRows(rows.first, rows.last, "\t");
9831
- } else {
9832
- var indentString;
9833
-
9834
- if (this.session.getUseSoftTabs()) {
9835
- var size = session.getTabSize(),
9836
- position = this.getCursorPosition(),
9837
- column = session.documentToScreenColumn(position.row, position.column),
9838
- count = (size - column % size);
9839
-
9840
- indentString = lang.stringRepeat(" ", count);
9841
- } else
9842
- indentString = "\t";
9843
- return this.onTextInput(indentString);
9844
- }
9845
- };
9846
-
9847
- this.blockOutdent = function() {
9848
- if (this.$readOnly)
9849
- return;
9850
-
9851
- var selection = this.session.getSelection();
9852
- this.session.outdentRows(selection.getRange());
9853
- };
9854
-
9855
- this.toggleCommentLines = function() {
9856
- if (this.$readOnly)
9857
- return;
9858
-
9859
- var state = this.session.getState(this.getCursorPosition().row);
9860
- var rows = this.$getSelectedRows()
9861
- this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
9862
- };
9863
-
9864
- this.removeLines = function() {
9865
- if (this.$readOnly)
9866
- return;
9867
-
9868
- var rows = this.$getSelectedRows();
9869
- if (rows.last == 0 || rows.last+1 < this.session.getLength())
9870
- var range = new Range(rows.first, 0, rows.last+1, 0)
9871
- else
9872
- var range = new Range(
9873
- rows.first-1, this.session.getLine(rows.first).length,
9874
- rows.last, this.session.getLine(rows.last).length
9875
- );
9876
- this.session.remove(range);
9877
- this.clearSelection();
9878
- };
9879
-
9880
- this.moveLinesDown = function() {
9881
- if (this.$readOnly)
9882
- return;
9883
-
9884
- this.$moveLines(function(firstRow, lastRow) {
9885
- return this.session.moveLinesDown(firstRow, lastRow);
9886
- });
9887
- };
9888
-
9889
- this.moveLinesUp = function() {
9890
- if (this.$readOnly)
9891
- return;
9892
-
9893
- this.$moveLines(function(firstRow, lastRow) {
9894
- return this.session.moveLinesUp(firstRow, lastRow);
9895
- });
9896
- };
9897
-
9898
- this.moveText = function(range, toPosition) {
9899
- if (this.$readOnly)
9900
- return null;
9901
-
9902
- return this.session.moveText(range, toPosition);
9903
- };
9904
-
9905
- this.copyLinesUp = function() {
9906
- if (this.$readOnly)
9907
- return;
9908
-
9909
- this.$moveLines(function(firstRow, lastRow) {
9910
- this.session.duplicateLines(firstRow, lastRow);
9911
- return 0;
9912
- });
9913
- };
9914
-
9915
- this.copyLinesDown = function() {
9916
- if (this.$readOnly)
9917
- return;
9918
-
9919
- this.$moveLines(function(firstRow, lastRow) {
9920
- return this.session.duplicateLines(firstRow, lastRow);
9921
- });
9922
- };
9923
-
9924
-
9925
- this.$moveLines = function(mover) {
9926
- var rows = this.$getSelectedRows();
9927
-
9928
- var linesMoved = mover.call(this, rows.first, rows.last);
9929
-
9930
- var selection = this.selection;
9931
- selection.setSelectionAnchor(rows.last+linesMoved+1, 0);
9932
- selection.$moveSelection(function() {
9933
- selection.moveCursorTo(rows.first+linesMoved, 0);
9934
- });
9935
- };
9936
-
9937
- this.$getSelectedRows = function() {
9938
- var range = this.getSelectionRange().collapseRows();
9939
-
9940
- return {
9941
- first: range.start.row,
9942
- last: range.end.row
9943
- };
9944
- };
9945
-
9946
- this.onCompositionStart = function(text) {
9947
- this.renderer.showComposition(this.getCursorPosition());
9948
- };
9949
-
9950
- this.onCompositionUpdate = function(text) {
9951
- this.renderer.setCompositionText(text);
9952
- };
9953
-
9954
- this.onCompositionEnd = function() {
9955
- this.renderer.hideComposition();
9956
- };
9957
-
9958
-
9959
- this.getFirstVisibleRow = function() {
9960
- return this.renderer.getFirstVisibleRow();
9961
- };
9962
-
9963
- this.getLastVisibleRow = function() {
9964
- return this.renderer.getLastVisibleRow();
9965
- };
9966
-
9967
- this.isRowVisible = function(row) {
9968
- return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
9969
- };
9970
-
9971
- this.$getVisibleRowCount = function() {
9972
- return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
9973
- };
9974
-
9975
- this.$getPageDownRow = function() {
9976
- return this.renderer.getScrollBottomRow();
9977
- };
9978
-
9979
- this.$getPageUpRow = function() {
9980
- var firstRow = this.renderer.getScrollTopRow();
9981
- var lastRow = this.renderer.getScrollBottomRow();
9982
-
9983
- return firstRow - (lastRow - firstRow);
9984
- };
9985
-
9986
- this.selectPageDown = function() {
9987
- var row = this.$getPageDownRow() + Math.floor(this.$getVisibleRowCount() / 2);
9988
-
9989
- this.scrollPageDown();
9990
-
9991
- var selection = this.getSelection();
9992
- var leadScreenPos = this.session.documentToScreenPosition(selection.getSelectionLead());
9993
- var dest = this.session.screenToDocumentPosition(row, leadScreenPos.column);
9994
- selection.selectTo(dest.row, dest.column);
9995
- };
9996
-
9997
- this.selectPageUp = function() {
9998
- var visibleRows = this.renderer.getScrollTopRow() - this.renderer.getScrollBottomRow();
9999
- var row = this.$getPageUpRow() + Math.round(visibleRows / 2);
10000
-
10001
- this.scrollPageUp();
10002
-
10003
- var selection = this.getSelection();
10004
- var leadScreenPos = this.session.documentToScreenPosition(selection.getSelectionLead());
10005
- var dest = this.session.screenToDocumentPosition(row, leadScreenPos.column);
10006
- selection.selectTo(dest.row, dest.column);
10007
- };
10008
-
10009
- this.gotoPageDown = function() {
10010
- var row = this.$getPageDownRow();
10011
- var column = this.getCursorPositionScreen().column;
10012
-
10013
- this.scrollToRow(row);
10014
- this.getSelection().moveCursorToScreen(row, column);
10015
- };
10016
-
10017
- this.gotoPageUp = function() {
10018
- var row = this.$getPageUpRow();
10019
- var column = this.getCursorPositionScreen().column;
10020
-
10021
- this.scrollToRow(row);
10022
- this.getSelection().moveCursorToScreen(row, column);
10023
- };
10024
-
10025
- this.scrollPageDown = function() {
10026
- this.scrollToRow(this.$getPageDownRow());
10027
- };
10028
-
10029
- this.scrollPageUp = function() {
10030
- this.renderer.scrollToRow(this.$getPageUpRow());
10031
- };
10032
-
10033
- this.scrollToRow = function(row) {
10034
- this.renderer.scrollToRow(row);
10035
- };
10036
-
10037
- this.scrollToLine = function(line, center) {
10038
- this.renderer.scrollToLine(line, center);
10039
- };
10040
-
10041
- this.centerSelection = function() {
10042
- var range = this.getSelectionRange();
10043
- var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2);
10044
- this.renderer.scrollToLine(line, true);
10045
- };
10046
-
10047
- this.getCursorPosition = function() {
10048
- return this.selection.getCursor();
10049
- };
10050
-
10051
- this.getCursorPositionScreen = function() {
10052
- return this.session.documentToScreenPosition(this.getCursorPosition());
10053
- };
10054
-
10055
- this.getSelectionRange = function() {
10056
- return this.selection.getRange();
10057
- };
10058
-
10059
-
10060
- this.selectAll = function() {
10061
- this.$blockScrolling += 1;
10062
- this.selection.selectAll();
10063
- this.$blockScrolling -= 1;
10064
- };
10065
-
10066
- this.clearSelection = function() {
10067
- this.selection.clearSelection();
10068
- };
10069
-
10070
- this.moveCursorTo = function(row, column) {
10071
- this.selection.moveCursorTo(row, column);
10072
- };
10073
-
10074
- this.moveCursorToPosition = function(pos) {
10075
- this.selection.moveCursorToPosition(pos);
10076
- };
10077
-
10078
-
10079
- this.gotoLine = function(lineNumber, column) {
10080
- this.selection.clearSelection();
10081
-
10082
- this.$blockScrolling += 1;
10083
- this.moveCursorTo(lineNumber-1, column || 0);
10084
- this.$blockScrolling -= 1;
10085
-
10086
- if (!this.isRowVisible(this.getCursorPosition().row)) {
10087
- this.scrollToLine(lineNumber, true);
10088
- }
10089
- },
10090
-
10091
- this.navigateTo = function(row, column) {
10092
- this.clearSelection();
10093
- this.moveCursorTo(row, column);
10094
- };
10095
-
10096
- this.navigateUp = function(times) {
10097
- this.selection.clearSelection();
10098
- times = times || 1;
10099
- this.selection.moveCursorBy(-times, 0);
10100
- };
10101
-
10102
- this.navigateDown = function(times) {
10103
- this.selection.clearSelection();
10104
- times = times || 1;
10105
- this.selection.moveCursorBy(times, 0);
10106
- };
10107
-
10108
- this.navigateLeft = function(times) {
10109
- if (!this.selection.isEmpty()) {
10110
- var selectionStart = this.getSelectionRange().start;
10111
- this.moveCursorToPosition(selectionStart);
10112
- }
10113
- else {
10114
- times = times || 1;
10115
- while (times--) {
10116
- this.selection.moveCursorLeft();
10117
- }
10118
- }
10119
- this.clearSelection();
10120
- };
10121
-
10122
- this.navigateRight = function(times) {
10123
- if (!this.selection.isEmpty()) {
10124
- var selectionEnd = this.getSelectionRange().end;
10125
- this.moveCursorToPosition(selectionEnd);
10126
- }
10127
- else {
10128
- times = times || 1;
10129
- while (times--) {
10130
- this.selection.moveCursorRight();
10131
- }
10132
- }
10133
- this.clearSelection();
10134
- };
10135
-
10136
- this.navigateLineStart = function() {
10137
- this.selection.moveCursorLineStart();
10138
- this.clearSelection();
10139
- };
10140
-
10141
- this.navigateLineEnd = function() {
10142
- this.selection.moveCursorLineEnd();
10143
- this.clearSelection();
10144
- };
10145
-
10146
- this.navigateFileEnd = function() {
10147
- this.selection.moveCursorFileEnd();
10148
- this.clearSelection();
10149
- };
10150
-
10151
- this.navigateFileStart = function() {
10152
- this.selection.moveCursorFileStart();
10153
- this.clearSelection();
10154
- };
10155
-
10156
- this.navigateWordRight = function() {
10157
- this.selection.moveCursorWordRight();
10158
- this.clearSelection();
10159
- };
10160
-
10161
- this.navigateWordLeft = function() {
10162
- this.selection.moveCursorWordLeft();
10163
- this.clearSelection();
10164
- };
10165
-
10166
- this.replace = function(replacement, options) {
10167
- if (options)
10168
- this.$search.set(options);
10169
-
10170
- var range = this.$search.find(this.session);
10171
- if (!range)
10172
- return;
10173
-
10174
- this.$tryReplace(range, replacement);
10175
- if (range !== null)
10176
- this.selection.setSelectionRange(range);
10177
- },
10178
-
10179
- this.replaceAll = function(replacement, options) {
10180
- if (options) {
10181
- this.$search.set(options);
10182
- }
10183
-
10184
- var ranges = this.$search.findAll(this.session);
10185
- if (!ranges.length)
10186
- return;
10187
-
10188
- var selection = this.getSelectionRange();
10189
- this.clearSelection();
10190
- this.selection.moveCursorTo(0, 0);
10191
-
10192
- this.$blockScrolling += 1;
10193
- for (var i = ranges.length - 1; i >= 0; --i)
10194
- this.$tryReplace(ranges[i], replacement);
10195
-
10196
- this.selection.setSelectionRange(selection);
10197
- this.$blockScrolling -= 1;
10198
- },
10199
-
10200
- this.$tryReplace = function(range, replacement) {
10201
- var input = this.session.getTextRange(range);
10202
- var replacement = this.$search.replace(input, replacement);
10203
- if (replacement !== null) {
10204
- range.end = this.session.replace(range, replacement);
10205
- return range;
10206
- } else {
10207
- return null;
10208
- }
10209
- };
10210
-
10211
- this.getLastSearchOptions = function() {
10212
- return this.$search.getOptions();
10213
- };
10214
-
10215
- this.find = function(needle, options) {
10216
- this.clearSelection();
10217
- options = options || {};
10218
- options.needle = needle;
10219
- this.$search.set(options);
10220
- this.$find();
10221
- },
10222
-
10223
- this.findNext = function(options) {
10224
- options = options || {};
10225
- if (typeof options.backwards == "undefined")
10226
- options.backwards = false;
10227
- this.$search.set(options);
10228
- this.$find();
10229
- };
10230
-
10231
- this.findPrevious = function(options) {
10232
- options = options || {};
10233
- if (typeof options.backwards == "undefined")
10234
- options.backwards = true;
10235
- this.$search.set(options);
10236
- this.$find();
10237
- };
10238
-
10239
- this.$find = function(backwards) {
10240
- if (!this.selection.isEmpty()) {
10241
- this.$search.set({needle: this.session.getTextRange(this.getSelectionRange())});
10242
- }
10243
-
10244
- if (typeof backwards != "undefined")
10245
- this.$search.set({backwards: backwards});
10246
-
10247
- var range = this.$search.find(this.session);
10248
- if (range) {
10249
- this.gotoLine(range.end.row+1, range.end.column);
10250
- this.selection.setSelectionRange(range);
10251
- }
10252
- };
10253
-
10254
- this.undo = function() {
10255
- this.session.getUndoManager().undo();
10256
- };
10257
-
10258
- this.redo = function() {
10259
- this.session.getUndoManager().redo();
10260
- };
10261
-
10262
- this.destroy = function() {
10263
- this.renderer.destroy();
10264
- }
10265
-
10266
- }).call(Editor.prototype);
10267
-
10268
-
10269
- exports.Editor = Editor;
10270
- });
10271
- /* vim:ts=4:sts=4:sw=4:
10272
- * ***** BEGIN LICENSE BLOCK *****
10273
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
10274
- *
10275
- * The contents of this file are subject to the Mozilla Public License Version
10276
- * 1.1 (the "License"); you may not use this file except in compliance with
10277
- * the License. You may obtain a copy of the License at
10278
- * http://www.mozilla.org/MPL/
10279
- *
10280
- * Software distributed under the License is distributed on an "AS IS" basis,
10281
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10282
- * for the specific language governing rights and limitations under the
10283
- * License.
10284
- *
10285
- * The Original Code is Ajax.org Code Editor (ACE).
10286
- *
10287
- * The Initial Developer of the Original Code is
10288
- * Ajax.org B.V.
10289
- * Portions created by the Initial Developer are Copyright (C) 2010
10290
- * the Initial Developer. All Rights Reserved.
10291
- *
10292
- * Contributor(s):
10293
- * Fabian Jakobs <fabian AT ajax DOT org>
10294
- * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
10295
- *
10296
- * Alternatively, the contents of this file may be used under the terms of
10297
- * either the GNU General Public License Version 2 or later (the "GPL"), or
10298
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
10299
- * in which case the provisions of the GPL or the LGPL are applicable instead
10300
- * of those above. If you wish to allow use of your version of this file only
10301
- * under the terms of either the GPL or the LGPL, and not to allow others to
10302
- * use your version of this file under the terms of the MPL, indicate your
10303
- * decision by deleting the provisions above and replace them with the notice
10304
- * and other provisions required by the GPL or the LGPL. If you do not delete
10305
- * the provisions above, a recipient may use your version of this file under
10306
- * the terms of any one of the MPL, the GPL or the LGPL.
10307
- *
10308
- * ***** END LICENSE BLOCK ***** */
10309
-
10310
- define('ace/keyboard/textinput', ['require', 'exports', 'module' , 'pilot/event', 'pilot/useragent', 'pilot/dom'], function(require, exports, module) {
10311
-
10312
- var event = require("pilot/event");
10313
- var useragent = require("pilot/useragent");
10314
- var dom = require("pilot/dom");
10315
-
10316
- var TextInput = function(parentNode, host) {
10317
-
10318
- var text = dom.createElement("textarea");
10319
- text.style.left = "-10000px";
10320
- parentNode.appendChild(text);
10321
-
10322
- var PLACEHOLDER = String.fromCharCode(0);
10323
- sendText();
10324
-
10325
- var inCompostion = false;
10326
- var copied = false;
10327
- var pasted = false;
10328
- var tempStyle = '';
10329
-
10330
- function sendText(valueToSend) {
10331
- if (!copied) {
10332
- var value = valueToSend || text.value;
10333
- if (value) {
10334
- if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0)) {
10335
- value = value.slice(0, -1);
10336
- if (value)
10337
- host.onTextInput(value, !pasted);
10338
- }
10339
- else {
10340
- host.onTextInput(value, !pasted);
10341
- }
10342
-
10343
- // If editor is no longer focused we quit immediately, since
10344
- // it means that something else is in charge now.
10345
- if (!isFocused())
10346
- return false;
10347
- }
10348
- }
10349
-
10350
- copied = false;
10351
- pasted = false;
10352
-
10353
- // Safari doesn't fire copy events if no text is selected
10354
- text.value = PLACEHOLDER;
10355
- text.select();
10356
- }
10357
-
10358
- var onTextInput = function(e) {
10359
- setTimeout(function () {
10360
- if (!inCompostion)
10361
- sendText(e.data);
10362
- }, 0);
10363
- };
10364
-
10365
- var onKeyPress = function(e) {
10366
- if (useragent.isIE && text.value.charCodeAt(0) > 128) return;
10367
- setTimeout(function() {
10368
- if (!inCompostion)
10369
- sendText();
10370
- }, 0);
10371
- };
10372
-
10373
- var onCompositionStart = function(e) {
10374
- inCompostion = true;
10375
- host.onCompositionStart();
10376
- if (!useragent.isGecko) setTimeout(onCompositionUpdate, 0);
10377
- };
10378
-
10379
- var onCompositionUpdate = function() {
10380
- if (!inCompostion) return;
10381
- host.onCompositionUpdate(text.value);
10382
- };
10383
-
10384
- var onCompositionEnd = function(e) {
10385
- inCompostion = false;
10386
- host.onCompositionEnd();
10387
- };
10388
-
10389
- var onCopy = function(e) {
10390
- copied = true;
10391
- var copyText = host.getCopyText();
10392
- if(copyText)
10393
- text.value = copyText;
10394
- else
10395
- e.preventDefault();
10396
- text.select();
10397
- setTimeout(function () {
10398
- sendText();
10399
- }, 0);
10400
- };
10401
-
10402
- var onCut = function(e) {
10403
- copied = true;
10404
- var copyText = host.getCopyText();
10405
- if(copyText) {
10406
- text.value = copyText;
10407
- host.onCut();
10408
- } else
10409
- e.preventDefault();
10410
- text.select();
10411
- setTimeout(function () {
10412
- sendText();
10413
- }, 0);
10414
- };
10415
-
10416
- event.addCommandKeyListener(text, host.onCommandKey.bind(host));
10417
- if (useragent.isIE) {
10418
- var keytable = { 13:1, 27:1 };
10419
- event.addListener(text, "keyup", function (e) {
10420
- if (inCompostion && (!text.value || keytable[e.keyCode]))
10421
- setTimeout(onCompositionEnd, 0);
10422
- if ((text.value.charCodeAt(0)|0) < 129) {
10423
- return;
10424
- };
10425
- inCompostion ? onCompositionUpdate() : onCompositionStart();
10426
- });
10427
- };
10428
-
10429
- if (text.attachEvent) {
10430
- // Old IE + Opera
10431
- event.addListener(text, "propertychange", onKeyPress);
10432
- }
10433
- else {
10434
- if (useragent.isChrome || useragent.isSafari)
10435
- event.addListener(text, "textInput", onTextInput);
10436
- else if (useragent.isIE)
10437
- // IE9
10438
- event.addListener(text, "textinput", onTextInput);
10439
- else
10440
- // All browsers except old IE
10441
- event.addListener(text, "input", onTextInput);
10442
- }
10443
-
10444
-
10445
- event.addListener(text, "paste", function(e) {
10446
- // Mark that the next input text comes from past.
10447
- pasted = true;
10448
- // Some browsers support the event.clipboardData API. Use this to get
10449
- // the pasted content which increases speed if pasting a lot of lines.
10450
- if (e.clipboardData && e.clipboardData.getData) {
10451
- sendText(e.clipboardData.getData("text/plain"));
10452
- e.preventDefault();
10453
- }
10454
- else {
10455
- // If a browser doesn't support any of the things above, use the regular
10456
- // method to detect the pasted input.
10457
- onKeyPress();
10458
- }
10459
- });
10460
-
10461
- if (useragent.isIE) {
10462
- event.addListener(text, "beforecopy", function(e) {
10463
- var copyText = host.getCopyText();
10464
- if(copyText)
10465
- clipboardData.setData("Text", copyText);
10466
- else
10467
- e.preventDefault();
10468
- });
10469
- event.addListener(parentNode, "keydown", function(e) {
10470
- if (e.ctrlKey && e.keyCode == 88) {
10471
- var copyText = host.getCopyText();
10472
- if (copyText) {
10473
- clipboardData.setData("Text", copyText);
10474
- host.onCut();
10475
- }
10476
- event.preventDefault(e)
10477
- }
10478
- });
10479
- }
10480
- else {
10481
- event.addListener(text, "copy", onCopy);
10482
- event.addListener(text, "cut", onCut);
10483
- }
10484
-
10485
- event.addListener(text, "compositionstart", onCompositionStart);
10486
- if (useragent.isGecko) {
10487
- event.addListener(text, "text", onCompositionUpdate);
10488
- };
10489
- if (useragent.isWebKit) {
10490
- event.addListener(text, "keyup", onCompositionUpdate);
10491
- };
10492
- event.addListener(text, "compositionend", onCompositionEnd);
10493
-
10494
- event.addListener(text, "blur", function() {
10495
- host.onBlur();
10496
- });
10497
-
10498
- event.addListener(text, "focus", function() {
10499
- host.onFocus();
10500
- text.select();
10501
- });
10502
-
10503
- this.focus = function() {
10504
- host.onFocus();
10505
- text.select();
10506
- text.focus();
10507
- };
10508
-
10509
- this.blur = function() {
10510
- text.blur();
10511
- };
10512
-
10513
- function isFocused() {
10514
- return document.activeElement === text;
10515
- };
10516
- this.isFocused = isFocused;
10517
-
10518
- this.getElement = function() {
10519
- return text;
10520
- };
10521
-
10522
- this.onContextMenu = function(mousePos, isEmpty){
10523
- if (mousePos) {
10524
- if(!tempStyle)
10525
- tempStyle = text.style.cssText;
10526
- text.style.cssText = 'position:fixed; z-index:1000;' +
10527
- 'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;'
10528
-
10529
- }
10530
- if (isEmpty)
10531
- text.value='';
10532
- }
10533
-
10534
- this.onContextMenuClose = function(){
10535
- setTimeout(function () {
10536
- if (tempStyle) {
10537
- text.style.cssText = tempStyle;
10538
- tempStyle = '';
10539
- }
10540
- sendText();
10541
- }, 0);
10542
- }
10543
- };
10544
-
10545
- exports.TextInput = TextInput;
10546
- });
10547
- /* vim:ts=4:sts=4:sw=4:
10548
- * ***** BEGIN LICENSE BLOCK *****
10549
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
10550
- *
10551
- * The contents of this file are subject to the Mozilla Public License Version
10552
- * 1.1 (the "License"); you may not use this file except in compliance with
10553
- * the License. You may obtain a copy of the License at
10554
- * http://www.mozilla.org/MPL/
10555
- *
10556
- * Software distributed under the License is distributed on an "AS IS" basis,
10557
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10558
- * for the specific language governing rights and limitations under the
10559
- * License.
10560
- *
10561
- * The Original Code is Ajax.org Code Editor (ACE).
10562
- *
10563
- * The Initial Developer of the Original Code is
10564
- * Ajax.org B.V.
10565
- * Portions created by the Initial Developer are Copyright (C) 2010
10566
- * the Initial Developer. All Rights Reserved.
10567
- *
10568
- * Contributor(s):
10569
- * Fabian Jakobs <fabian AT ajax DOT org>
10570
- * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
10571
- *
10572
- * Alternatively, the contents of this file may be used under the terms of
10573
- * either the GNU General Public License Version 2 or later (the "GPL"), or
10574
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
10575
- * in which case the provisions of the GPL or the LGPL are applicable instead
10576
- * of those above. If you wish to allow use of your version of this file only
10577
- * under the terms of either the GPL or the LGPL, and not to allow others to
10578
- * use your version of this file under the terms of the MPL, indicate your
10579
- * decision by deleting the provisions above and replace them with the notice
10580
- * and other provisions required by the GPL or the LGPL. If you do not delete
10581
- * the provisions above, a recipient may use your version of this file under
10582
- * the terms of any one of the MPL, the GPL or the LGPL.
10583
- *
10584
- * ***** END LICENSE BLOCK ***** */
10585
-
10586
- define('ace/mouse_handler', ['require', 'exports', 'module' , 'pilot/event', 'pilot/dom', 'pilot/browser_focus'], function(require, exports, module) {
10587
-
10588
- var event = require("pilot/event");
10589
- var dom = require("pilot/dom");
10590
- var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
10591
-
10592
- var STATE_UNKNOWN = 0;
10593
- var STATE_SELECT = 1;
10594
- var STATE_DRAG = 2;
10595
-
10596
- var DRAG_TIMER = 250; // milliseconds
10597
- var DRAG_OFFSET = 5; // pixels
10598
-
10599
- var MouseHandler = function(editor) {
10600
- this.editor = editor;
10601
-
10602
- this.browserFocus = new BrowserFocus();
10603
- event.addListener(editor.container, "mousedown", function(e) {
10604
- editor.focus();
10605
- return event.preventDefault(e);
10606
- });
10607
- event.addListener(editor.container, "selectstart", function(e) {
10608
- return event.preventDefault(e);
10609
- });
10610
-
10611
- var mouseTarget = editor.renderer.getMouseEventTarget();
10612
- event.addListener(mouseTarget, "mousedown", this.onMouseDown.bind(this));
10613
- event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
10614
- event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
10615
- event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
10616
- event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this));
10617
- };
10618
-
10619
- (function() {
10620
-
10621
- this.$scrollSpeed = 1;
10622
- this.setScrollSpeed = function(speed) {
10623
- this.$scrollSpeed = speed;
10624
- };
10625
-
10626
- this.getScrollSpeed = function() {
10627
- return this.$scrollSpeed;
10628
- };
10629
-
10630
- this.$getEventPosition = function(e) {
10631
- var pageX = event.getDocumentX(e);
10632
- var pageY = event.getDocumentY(e);
10633
- var pos = this.editor.renderer.screenToTextCoordinates(pageX, pageY);
10634
- pos.row = Math.max(0, Math.min(pos.row, this.editor.session.getLength()-1));
10635
- return pos;
10636
- };
10637
-
10638
- this.$distance = function(ax, ay, bx, by) {
10639
- return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
10640
- };
10641
-
10642
- this.onMouseDown = function(e) {
10643
- // if this click caused the editor to be focused ignore the click
10644
- // for selection and cursor placement
10645
- if (
10646
- !this.browserFocus.isFocused()
10647
- || new Date().getTime() - this.browserFocus.lastFocus < 20
10648
- || !this.editor.isFocused()
10649
- )
10650
- return;
10651
-
10652
- var pageX = event.getDocumentX(e);
10653
- var pageY = event.getDocumentY(e);
10654
- var pos = this.$getEventPosition(e);
10655
- var editor = this.editor;
10656
- var self = this;
10657
- var selectionRange = editor.getSelectionRange();
10658
- var selectionEmpty = selectionRange.isEmpty();
10659
- var state = STATE_UNKNOWN;
10660
- var inSelection = false;
10661
-
10662
- var button = event.getButton(e);
10663
- if (button !== 0) {
10664
- if (selectionEmpty) {
10665
- editor.moveCursorToPosition(pos);
10666
- }
10667
- if(button == 2) {
10668
- editor.textInput.onContextMenu({x: pageX, y: pageY}, selectionEmpty);
10669
- event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
10670
- }
10671
- return;
10672
- } else {
10673
- // Select the fold as the user clicks it.
10674
- var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
10675
- if (fold) {
10676
- editor.selection.setSelectionRange(fold.range);
10677
- return;
10678
- }
10679
-
10680
- inSelection = !editor.getReadOnly()
10681
- && !selectionEmpty
10682
- && selectionRange.contains(pos.row, pos.column);
10683
- }
10684
-
10685
- if (!inSelection) {
10686
- // Directly pick STATE_SELECT, since the user is not clicking inside
10687
- // a selection.
10688
- onStartSelect(pos);
10689
- }
10690
-
10691
- var mousePageX, mousePageY;
10692
- var overwrite = editor.getOverwrite();
10693
- var mousedownTime = (new Date()).getTime();
10694
- var dragCursor, dragRange;
10695
-
10696
- var onMouseSelection = function(e) {
10697
- mousePageX = event.getDocumentX(e);
10698
- mousePageY = event.getDocumentY(e);
10699
- };
10700
-
10701
- var onMouseSelectionEnd = function() {
10702
- clearInterval(timerId);
10703
- if (state == STATE_UNKNOWN)
10704
- onStartSelect(pos);
10705
- else if (state == STATE_DRAG)
10706
- onMouseDragSelectionEnd();
10707
-
10708
- self.$clickSelection = null;
10709
- state = STATE_UNKNOWN;
10710
- };
10711
-
10712
- var onMouseDragSelectionEnd = function() {
10713
- dom.removeCssClass(editor.container, "ace_dragging");
10714
- editor.session.removeMarker(dragSelectionMarker);
10715
-
10716
- if (!self.$clickSelection) {
10717
- if (!dragCursor) {
10718
- editor.moveCursorToPosition(pos);
10719
- editor.selection.clearSelection(pos.row, pos.column);
10720
- }
10721
- }
10722
-
10723
- if (!dragCursor)
10724
- return;
10725
-
10726
- if (dragRange.contains(dragCursor.row, dragCursor.column)) {
10727
- dragCursor = null;
10728
- return;
10729
- }
10730
-
10731
- editor.clearSelection();
10732
- var newRange = editor.moveText(dragRange, dragCursor);
10733
- if (!newRange) {
10734
- dragCursor = null;
10735
- return;
10736
- }
10737
-
10738
- editor.selection.setSelectionRange(newRange);
10739
- };
10740
-
10741
- var onSelectionInterval = function() {
10742
- if (mousePageX === undefined || mousePageY === undefined)
10743
- return;
10744
-
10745
- if (state == STATE_UNKNOWN) {
10746
- var distance = self.$distance(pageX, pageY, mousePageX, mousePageY);
10747
- var time = (new Date()).getTime();
10748
-
10749
-
10750
- if (distance > DRAG_OFFSET) {
10751
- state = STATE_SELECT;
10752
- var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
10753
- cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
10754
- onStartSelect(cursor);
10755
- } else if ((time - mousedownTime) > DRAG_TIMER) {
10756
- state = STATE_DRAG;
10757
- dragRange = editor.getSelectionRange();
10758
- var style = editor.getSelectionStyle();
10759
- dragSelectionMarker = editor.session.addMarker(dragRange, "ace_selection", style);
10760
- editor.clearSelection();
10761
- dom.addCssClass(editor.container, "ace_dragging");
10762
- }
10763
-
10764
- }
10765
-
10766
- if (state == STATE_DRAG)
10767
- onDragSelectionInterval();
10768
- else if (state == STATE_SELECT)
10769
- onUpdateSelectionInterval();
10770
- };
10771
-
10772
- function onStartSelect(pos) {
10773
- if (e.shiftKey)
10774
- editor.selection.selectToPosition(pos)
10775
- else {
10776
- if (!self.$clickSelection) {
10777
- editor.moveCursorToPosition(pos);
10778
- editor.selection.clearSelection(pos.row, pos.column);
10779
- }
10780
- }
10781
- state = STATE_SELECT;
10782
- }
10783
-
10784
- var onUpdateSelectionInterval = function() {
10785
- var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
10786
- cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
10787
-
10788
- if (self.$clickSelection) {
10789
- if (self.$clickSelection.contains(cursor.row, cursor.column)) {
10790
- editor.selection.setSelectionRange(self.$clickSelection);
10791
- } else {
10792
- if (self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
10793
- var anchor = self.$clickSelection.end;
10794
- } else {
10795
- var anchor = self.$clickSelection.start;
10796
- }
10797
- editor.selection.setSelectionAnchor(anchor.row, anchor.column);
10798
- editor.selection.selectToPosition(cursor);
10799
- }
10800
- }
10801
- else {
10802
- editor.selection.selectToPosition(cursor);
10803
- }
10804
-
10805
- editor.renderer.scrollCursorIntoView();
10806
- };
10807
-
10808
- var onDragSelectionInterval = function() {
10809
- dragCursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
10810
- dragCursor.row = Math.max(0, Math.min(dragCursor.row,
10811
- editor.session.getLength() - 1));
10812
-
10813
- editor.moveCursorToPosition(dragCursor);
10814
- };
10815
-
10816
- event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
10817
- var timerId = setInterval(onSelectionInterval, 20);
10818
-
10819
- return event.preventDefault(e);
10820
- };
10821
-
10822
- this.onMouseDoubleClick = function(e) {
10823
- var editor = this.editor;
10824
- var pos = this.$getEventPosition(e);
10825
-
10826
- // If the user dclicked on a fold, then expand it.
10827
- var fold = editor.session.getFoldAt(pos.row, pos.column, 1);
10828
- if (fold) {
10829
- editor.session.expandFold(fold);
10830
- } else {
10831
- editor.moveCursorToPosition(pos);
10832
- editor.selection.selectWord();
10833
- this.$clickSelection = editor.getSelectionRange();
10834
- }
10835
- };
10836
-
10837
- this.onMouseTripleClick = function(e) {
10838
- var pos = this.$getEventPosition(e);
10839
- this.editor.moveCursorToPosition(pos);
10840
- this.editor.selection.selectLine();
10841
- this.$clickSelection = this.editor.getSelectionRange();
10842
- };
10843
-
10844
- this.onMouseQuadClick = function(e) {
10845
- this.editor.selectAll();
10846
- this.$clickSelection = this.editor.getSelectionRange();
10847
- };
10848
-
10849
- this.onMouseWheel = function(e) {
10850
- var speed = this.$scrollSpeed * 2;
10851
-
10852
- this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
10853
- return event.preventDefault(e);
10854
- };
10855
-
10856
-
10857
- }).call(MouseHandler.prototype);
10858
-
10859
- exports.MouseHandler = MouseHandler;
10860
- });
10861
- /* vim:ts=4:sts=4:sw=4:
10862
- * ***** BEGIN LICENSE BLOCK *****
10863
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
10864
- *
10865
- * The contents of this file are subject to the Mozilla Public License Version
10866
- * 1.1 (the "License"); you may not use this file except in compliance with
10867
- * the License. You may obtain a copy of the License at
10868
- * http://www.mozilla.org/MPL/
10869
- *
10870
- * Software distributed under the License is distributed on an "AS IS" basis,
10871
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10872
- * for the specific language governing rights and limitations under the
10873
- * License.
10874
- *
10875
- * The Original Code is Ajax.org Code Editor (ACE).
10876
- *
10877
- * The Initial Developer of the Original Code is
10878
- * Ajax.org B.V.
10879
- * Portions created by the Initial Developer are Copyright (C) 2010
10880
- * the Initial Developer. All Rights Reserved.
10881
- *
10882
- * Contributor(s):
10883
- * Fabian Jakobs <fabian AT ajax DOT org>
10884
- * Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
10885
- * Julian Viereck <julian.viereck@gmail.com>
10886
- *
10887
- * Alternatively, the contents of this file may be used under the terms of
10888
- * either the GNU General Public License Version 2 or later (the "GPL"), or
10889
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
10890
- * in which case the provisions of the GPL or the LGPL are applicable instead
10891
- * of those above. If you wish to allow use of your version of this file only
10892
- * under the terms of either the GPL or the LGPL, and not to allow others to
10893
- * use your version of this file under the terms of the MPL, indicate your
10894
- * decision by deleting the provisions above and replace them with the notice
10895
- * and other provisions required by the GPL or the LGPL. If you do not delete
10896
- * the provisions above, a recipient may use your version of this file under
10897
- * the terms of any one of the MPL, the GPL or the LGPL.
10898
- *
10899
- * ***** END LICENSE BLOCK ***** */
10900
-
10901
- define('pilot/browser_focus', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event', 'pilot/event_emitter'], function(require, exports, module) {
10902
-
10903
- var oop = require("pilot/oop");
10904
- var event = require("pilot/event");
10905
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
10906
-
10907
- /**
10908
- * This class keeps track of the focus state of the given window.
10909
- * Focus changes for example when the user switches a browser tab,
10910
- * goes to the location bar or switches to another application.
10911
- */
10912
- var BrowserFocus = function(win) {
10913
- win = win || window;
10914
-
10915
- this.lastFocus = new Date().getTime();
10916
- this._isFocused = true;
10917
-
10918
- var _self = this;
10919
- event.addListener(win, "blur", function(e) {
10920
- _self._setFocused(false);
10921
- });
10922
-
10923
- event.addListener(win, "focus", function(e) {
10924
- _self._setFocused(true);
10925
- });
10926
- };
10927
-
10928
- (function(){
10929
-
10930
- oop.implement(this, EventEmitter);
10931
-
10932
- this.isFocused = function() {
10933
- return this._isFocused;
10934
- };
10935
-
10936
- this._setFocused = function(isFocused) {
10937
- if (this._isFocused == isFocused)
10938
- return;
10939
-
10940
- if (isFocused)
10941
- this.lastFocus = new Date().getTime();
10942
-
10943
- this._isFocused = isFocused;
10944
- this._emit("changeFocus");
10945
- };
10946
-
10947
- }).call(BrowserFocus.prototype);
10948
-
10949
-
10950
- exports.BrowserFocus = BrowserFocus;
10951
- });
10952
- /* ***** BEGIN LICENSE BLOCK *****
10953
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
10954
- *
10955
- * The contents of this file are subject to the Mozilla Public License Version
10956
- * 1.1 (the "License"); you may not use this file except in compliance with
10957
- * the License. You may obtain a copy of the License at
10958
- * http://www.mozilla.org/MPL/
10959
- *
10960
- * Software distributed under the License is distributed on an "AS IS" basis,
10961
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10962
- * for the specific language governing rights and limitations under the
10963
- * License.
10964
- *
10965
- * The Original Code is Ajax.org Code Editor (ACE).
10966
- *
10967
- * The Initial Developer of the Original Code is
10968
- * Ajax.org B.V.
10969
- * Portions created by the Initial Developer are Copyright (C) 2010
10970
- * the Initial Developer. All Rights Reserved.
10971
- *
10972
- * Contributor(s):
10973
- * Fabian Jakobs <fabian AT ajax DOT org>
10974
- * Julian Viereck <julian.viereck@gmail.com>
10975
- *
10976
- * Alternatively, the contents of this file may be used under the terms of
10977
- * either the GNU General Public License Version 2 or later (the "GPL"), or
10978
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
10979
- * in which case the provisions of the GPL or the LGPL are applicable instead
10980
- * of those above. If you wish to allow use of your version of this file only
10981
- * under the terms of either the GPL or the LGPL, and not to allow others to
10982
- * use your version of this file under the terms of the MPL, indicate your
10983
- * decision by deleting the provisions above and replace them with the notice
10984
- * and other provisions required by the GPL or the LGPL. If you do not delete
10985
- * the provisions above, a recipient may use your version of this file under
10986
- * the terms of any one of the MPL, the GPL or the LGPL.
10987
- *
10988
- * ***** END LICENSE BLOCK ***** */
10989
-
10990
- define('ace/keyboard/keybinding', ['require', 'exports', 'module' , 'pilot/useragent', 'pilot/keys', 'pilot/event', 'pilot/settings', 'pilot/canon', 'ace/commands/default_commands'], function(require, exports, module) {
10991
-
10992
- var useragent = require("pilot/useragent");
10993
- var keyUtil = require("pilot/keys");
10994
- var event = require("pilot/event");
10995
- var settings = require("pilot/settings").settings;
10996
- var canon = require("pilot/canon");
10997
- require("ace/commands/default_commands");
10998
-
10999
- var KeyBinding = function(editor) {
11000
- this.$editor = editor;
11001
- this.$data = { };
11002
- this.$keyboardHandler = null;
11003
- };
11004
-
11005
- (function() {
11006
- this.setKeyboardHandler = function(keyboardHandler) {
11007
- if (this.$keyboardHandler != keyboardHandler) {
11008
- this.$data = { };
11009
- this.$keyboardHandler = keyboardHandler;
11010
- }
11011
- };
11012
-
11013
- this.getKeyboardHandler = function() {
11014
- return this.$keyboardHandler;
11015
- };
11016
-
11017
- this.$callKeyboardHandler = function (e, hashId, keyOrText, keyCode) {
11018
- var env = {editor: this.$editor},
11019
- toExecute;
11020
-
11021
- if (this.$keyboardHandler) {
11022
- toExecute =
11023
- this.$keyboardHandler.handleKeyboard(this.$data, hashId, keyOrText, keyCode, e);
11024
- }
11025
-
11026
- // If there is nothing to execute yet, then use the default keymapping.
11027
- if (!toExecute || !toExecute.command) {
11028
- if (hashId != 0 || keyCode != 0) {
11029
- toExecute = {
11030
- command: canon.findKeyCommand(env, "editor", hashId, keyOrText)
11031
- }
11032
- } else {
11033
- toExecute = {
11034
- command: "inserttext",
11035
- args: {
11036
- text: keyOrText
11037
- }
11038
- }
11039
- }
11040
- }
11041
-
11042
- var success = false;
11043
- if (toExecute) {
11044
- success = canon.exec(toExecute.command,
11045
- env, "editor", toExecute.args);
11046
- if (success) {
11047
- event.stopEvent(e);
11048
- }
11049
- }
11050
- return success;
11051
- };
11052
-
11053
- this.onCommandKey = function(e, hashId, keyCode, keyString) {
11054
- // In case there is no keyString, try to interprete the keyCode.
11055
- if (!keyString) {
11056
- keyString = keyUtil.keyCodeToString(keyCode);
11057
- }
11058
- return this.$callKeyboardHandler(e, hashId, keyString, keyCode);
11059
- };
11060
-
11061
- this.onTextInput = function(text) {
11062
- return this.$callKeyboardHandler({}, 0, text, 0);
11063
- }
11064
-
11065
- }).call(KeyBinding.prototype);
11066
-
11067
- exports.KeyBinding = KeyBinding;
11068
- });
11069
- /* vim:ts=4:sts=4:sw=4:
11070
- * ***** BEGIN LICENSE BLOCK *****
11071
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
11072
- *
11073
- * The contents of this file are subject to the Mozilla Public License Version
11074
- * 1.1 (the "License"); you may not use this file except in compliance with
11075
- * the License. You may obtain a copy of the License at
11076
- * http://www.mozilla.org/MPL/
11077
- *
11078
- * Software distributed under the License is distributed on an "AS IS" basis,
11079
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11080
- * for the specific language governing rights and limitations under the
11081
- * License.
11082
- *
11083
- * The Original Code is Ajax.org Code Editor (ACE).
11084
- *
11085
- * The Initial Developer of the Original Code is
11086
- * Ajax.org B.V.
11087
- * Portions created by the Initial Developer are Copyright (C) 2010
11088
- * the Initial Developer. All Rights Reserved.
11089
- *
11090
- * Contributor(s):
11091
- * Fabian Jakobs <fabian AT ajax DOT org>
11092
- * Julian Viereck <julian.viereck@gmail.com>
11093
- * Mihai Sucan <mihai.sucan@gmail.com>
11094
- *
11095
- * Alternatively, the contents of this file may be used under the terms of
11096
- * either the GNU General Public License Version 2 or later (the "GPL"), or
11097
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
11098
- * in which case the provisions of the GPL or the LGPL are applicable instead
11099
- * of those above. If you wish to allow use of your version of this file only
11100
- * under the terms of either the GPL or the LGPL, and not to allow others to
11101
- * use your version of this file under the terms of the MPL, indicate your
11102
- * decision by deleting the provisions above and replace them with the notice
11103
- * and other provisions required by the GPL or the LGPL. If you do not delete
11104
- * the provisions above, a recipient may use your version of this file under
11105
- * the terms of any one of the MPL, the GPL or the LGPL.
11106
- *
11107
- * ***** END LICENSE BLOCK ***** */
11108
-
11109
- define('ace/commands/default_commands', ['require', 'exports', 'module' , 'pilot/lang', 'pilot/canon'], function(require, exports, module) {
11110
-
11111
- var lang = require("pilot/lang");
11112
- var canon = require("pilot/canon");
11113
-
11114
- function bindKey(win, mac) {
11115
- return {
11116
- win: win,
11117
- mac: mac,
11118
- sender: "editor"
11119
- };
11120
- }
11121
-
11122
- canon.addCommand({
11123
- name: "null",
11124
- exec: function(env, args, request) { }
11125
- });
11126
-
11127
- canon.addCommand({
11128
- name: "selectall",
11129
- bindKey: bindKey("Ctrl-A", "Command-A"),
11130
- exec: function(env, args, request) { env.editor.selectAll(); }
11131
- });
11132
- canon.addCommand({
11133
- name: "removeline",
11134
- bindKey: bindKey("Ctrl-D", "Command-D"),
11135
- exec: function(env, args, request) { env.editor.removeLines(); }
11136
- });
11137
- canon.addCommand({
11138
- name: "gotoline",
11139
- bindKey: bindKey("Ctrl-L", "Command-L"),
11140
- exec: function(env, args, request) {
11141
- var line = parseInt(prompt("Enter line number:"));
11142
- if (!isNaN(line)) {
11143
- env.editor.gotoLine(line);
11144
- }
11145
- }
11146
- });
11147
- canon.addCommand({
11148
- name: "togglecomment",
11149
- bindKey: bindKey("Ctrl-7", "Command-7"),
11150
- exec: function(env, args, request) { env.editor.toggleCommentLines(); }
11151
- });
11152
- canon.addCommand({
11153
- name: "findnext",
11154
- bindKey: bindKey("Ctrl-K", "Command-G"),
11155
- exec: function(env, args, request) { env.editor.findNext(); }
11156
- });
11157
- canon.addCommand({
11158
- name: "findprevious",
11159
- bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
11160
- exec: function(env, args, request) { env.editor.findPrevious(); }
11161
- });
11162
- canon.addCommand({
11163
- name: "find",
11164
- bindKey: bindKey("Ctrl-F", "Command-F"),
11165
- exec: function(env, args, request) {
11166
- var needle = prompt("Find:");
11167
- env.editor.find(needle);
11168
- }
11169
- });
11170
- canon.addCommand({
11171
- name: "replace",
11172
- bindKey: bindKey("Ctrl-R", "Command-Option-F"),
11173
- exec: function(env, args, request) {
11174
- var needle = prompt("Find:");
11175
- if (!needle)
11176
- return;
11177
- var replacement = prompt("Replacement:");
11178
- if (!replacement)
11179
- return;
11180
- env.editor.replace(replacement, {needle: needle});
11181
- }
11182
- });
11183
- canon.addCommand({
11184
- name: "replaceall",
11185
- bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
11186
- exec: function(env, args, request) {
11187
- var needle = prompt("Find:");
11188
- if (!needle)
11189
- return;
11190
- var replacement = prompt("Replacement:");
11191
- if (!replacement)
11192
- return;
11193
- env.editor.replaceAll(replacement, {needle: needle});
11194
- }
11195
- });
11196
- canon.addCommand({
11197
- name: "undo",
11198
- bindKey: bindKey("Ctrl-Z", "Command-Z"),
11199
- exec: function(env, args, request) { env.editor.undo(); }
11200
- });
11201
- canon.addCommand({
11202
- name: "redo",
11203
- bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
11204
- exec: function(env, args, request) { env.editor.redo(); }
11205
- });
11206
- canon.addCommand({
11207
- name: "overwrite",
11208
- bindKey: bindKey("Insert", "Insert"),
11209
- exec: function(env, args, request) { env.editor.toggleOverwrite(); }
11210
- });
11211
- canon.addCommand({
11212
- name: "copylinesup",
11213
- bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
11214
- exec: function(env, args, request) { env.editor.copyLinesUp(); }
11215
- });
11216
- canon.addCommand({
11217
- name: "movelinesup",
11218
- bindKey: bindKey("Alt-Up", "Option-Up"),
11219
- exec: function(env, args, request) { env.editor.moveLinesUp(); }
11220
- });
11221
- canon.addCommand({
11222
- name: "selecttostart",
11223
- bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
11224
- exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
11225
- });
11226
- canon.addCommand({
11227
- name: "gotostart",
11228
- bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
11229
- exec: function(env, args, request) { env.editor.navigateFileStart(); }
11230
- });
11231
- canon.addCommand({
11232
- name: "selectup",
11233
- bindKey: bindKey("Shift-Up", "Shift-Up"),
11234
- exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
11235
- });
11236
- canon.addCommand({
11237
- name: "golineup",
11238
- bindKey: bindKey("Up", "Up|Ctrl-P"),
11239
- exec: function(env, args, request) { env.editor.navigateUp(args.times); }
11240
- });
11241
- canon.addCommand({
11242
- name: "copylinesdown",
11243
- bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
11244
- exec: function(env, args, request) { env.editor.copyLinesDown(); }
11245
- });
11246
- canon.addCommand({
11247
- name: "movelinesdown",
11248
- bindKey: bindKey("Alt-Down", "Option-Down"),
11249
- exec: function(env, args, request) { env.editor.moveLinesDown(); }
11250
- });
11251
- canon.addCommand({
11252
- name: "selecttoend",
11253
- bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
11254
- exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
11255
- });
11256
- canon.addCommand({
11257
- name: "gotoend",
11258
- bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
11259
- exec: function(env, args, request) { env.editor.navigateFileEnd(); }
11260
- });
11261
- canon.addCommand({
11262
- name: "selectdown",
11263
- bindKey: bindKey("Shift-Down", "Shift-Down"),
11264
- exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
11265
- });
11266
- canon.addCommand({
11267
- name: "golinedown",
11268
- bindKey: bindKey("Down", "Down|Ctrl-N"),
11269
- exec: function(env, args, request) { env.editor.navigateDown(args.times); }
11270
- });
11271
- canon.addCommand({
11272
- name: "selectwordleft",
11273
- bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
11274
- exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
11275
- });
11276
- canon.addCommand({
11277
- name: "gotowordleft",
11278
- bindKey: bindKey("Ctrl-Left", "Option-Left"),
11279
- exec: function(env, args, request) { env.editor.navigateWordLeft(); }
11280
- });
11281
- canon.addCommand({
11282
- name: "selecttolinestart",
11283
- bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
11284
- exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
11285
- });
11286
- canon.addCommand({
11287
- name: "gotolinestart",
11288
- bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
11289
- exec: function(env, args, request) { env.editor.navigateLineStart(); }
11290
- });
11291
- canon.addCommand({
11292
- name: "selectleft",
11293
- bindKey: bindKey("Shift-Left", "Shift-Left"),
11294
- exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
11295
- });
11296
- canon.addCommand({
11297
- name: "gotoleft",
11298
- bindKey: bindKey("Left", "Left|Ctrl-B"),
11299
- exec: function(env, args, request) { env.editor.navigateLeft(args.times); }
11300
- });
11301
- canon.addCommand({
11302
- name: "selectwordright",
11303
- bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
11304
- exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
11305
- });
11306
- canon.addCommand({
11307
- name: "gotowordright",
11308
- bindKey: bindKey("Ctrl-Right", "Option-Right"),
11309
- exec: function(env, args, request) { env.editor.navigateWordRight(); }
11310
- });
11311
- canon.addCommand({
11312
- name: "selecttolineend",
11313
- bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
11314
- exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
11315
- });
11316
- canon.addCommand({
11317
- name: "gotolineend",
11318
- bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
11319
- exec: function(env, args, request) { env.editor.navigateLineEnd(); }
11320
- });
11321
- canon.addCommand({
11322
- name: "selectright",
11323
- bindKey: bindKey("Shift-Right", "Shift-Right"),
11324
- exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
11325
- });
11326
- canon.addCommand({
11327
- name: "gotoright",
11328
- bindKey: bindKey("Right", "Right|Ctrl-F"),
11329
- exec: function(env, args, request) { env.editor.navigateRight(args.times); }
11330
- });
11331
- canon.addCommand({
11332
- name: "selectpagedown",
11333
- bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
11334
- exec: function(env, args, request) { env.editor.selectPageDown(); }
11335
- });
11336
- canon.addCommand({
11337
- name: "pagedown",
11338
- bindKey: bindKey(null, "PageDown"),
11339
- exec: function(env, args, request) { env.editor.scrollPageDown(); }
11340
- });
11341
- canon.addCommand({
11342
- name: "gotopagedown",
11343
- bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
11344
- exec: function(env, args, request) { env.editor.gotoPageDown(); }
11345
- });
11346
- canon.addCommand({
11347
- name: "selectpageup",
11348
- bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
11349
- exec: function(env, args, request) { env.editor.selectPageUp(); }
11350
- });
11351
- canon.addCommand({
11352
- name: "pageup",
11353
- bindKey: bindKey(null, "PageUp"),
11354
- exec: function(env, args, request) { env.editor.scrollPageUp(); }
11355
- });
11356
- canon.addCommand({
11357
- name: "gotopageup",
11358
- bindKey: bindKey("PageUp", "Option-PageUp"),
11359
- exec: function(env, args, request) { env.editor.gotoPageUp(); }
11360
- });
11361
- canon.addCommand({
11362
- name: "selectlinestart",
11363
- bindKey: bindKey("Shift-Home", "Shift-Home"),
11364
- exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
11365
- });
11366
- canon.addCommand({
11367
- name: "selectlineend",
11368
- bindKey: bindKey("Shift-End", "Shift-End"),
11369
- exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
11370
- });
11371
- canon.addCommand({
11372
- name: "del",
11373
- bindKey: bindKey("Delete", "Delete|Ctrl-D"),
11374
- exec: function(env, args, request) { env.editor.removeRight(); }
11375
- });
11376
- canon.addCommand({
11377
- name: "backspace",
11378
- bindKey: bindKey(
11379
- "Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
11380
- "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
11381
- ),
11382
- exec: function(env, args, request) { env.editor.removeLeft(); }
11383
- });
11384
- canon.addCommand({
11385
- name: "removetolinestart",
11386
- bindKey: bindKey(null, "Option-Backspace"),
11387
- exec: function(env, args, request) { env.editor.removeToLineStart(); }
11388
- });
11389
- canon.addCommand({
11390
- name: "removetolineend",
11391
- bindKey: bindKey(null, "Ctrl-K"),
11392
- exec: function(env, args, request) { env.editor.removeToLineEnd(); }
11393
- });
11394
- canon.addCommand({
11395
- name: "removewordleft",
11396
- bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
11397
- exec: function(env, args, request) { env.editor.removeWordLeft(); }
11398
- });
11399
- canon.addCommand({
11400
- name: "removewordright",
11401
- bindKey: bindKey(null, "Alt-Delete"),
11402
- exec: function(env, args, request) { env.editor.removeWordRight(); }
11403
- });
11404
- canon.addCommand({
11405
- name: "outdent",
11406
- bindKey: bindKey("Shift-Tab", "Shift-Tab"),
11407
- exec: function(env, args, request) { env.editor.blockOutdent(); }
11408
- });
11409
- canon.addCommand({
11410
- name: "indent",
11411
- bindKey: bindKey("Tab", "Tab"),
11412
- exec: function(env, args, request) { env.editor.indent(); }
11413
- });
11414
- canon.addCommand({
11415
- name: "inserttext",
11416
- exec: function(env, args, request) {
11417
- env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
11418
- }
11419
- });
11420
- canon.addCommand({
11421
- name: "centerselection",
11422
- bindKey: bindKey(null, "Ctrl-L"),
11423
- exec: function(env, args, request) { env.editor.centerSelection(); }
11424
- });
11425
- canon.addCommand({
11426
- name: "splitline",
11427
- bindKey: bindKey(null, "Ctrl-O"),
11428
- exec: function(env, args, request) { env.editor.splitLine(); }
11429
- });
11430
- canon.addCommand({
11431
- name: "transposeletters",
11432
- bindKey: bindKey("Ctrl-T", "Ctrl-T"),
11433
- exec: function(env, args, request) { env.editor.transposeLetters(); }
11434
- });
11435
-
11436
- });/* vim:ts=4:sts=4:sw=4:
11437
- * ***** BEGIN LICENSE BLOCK *****
11438
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
11439
- *
11440
- * The contents of this file are subject to the Mozilla Public License Version
11441
- * 1.1 (the "License"); you may not use this file except in compliance with
11442
- * the License. You may obtain a copy of the License at
11443
- * http://www.mozilla.org/MPL/
11444
- *
11445
- * Software distributed under the License is distributed on an "AS IS" basis,
11446
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11447
- * for the specific language governing rights and limitations under the
11448
- * License.
11449
- *
11450
- * The Original Code is Ajax.org Code Editor (ACE).
11451
- *
11452
- * The Initial Developer of the Original Code is
11453
- * Ajax.org B.V.
11454
- * Portions created by the Initial Developer are Copyright (C) 2010
11455
- * the Initial Developer. All Rights Reserved.
11456
- *
11457
- * Contributor(s):
11458
- * Fabian Jakobs <fabian AT ajax DOT org>
11459
- * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
11460
- * Julian Viereck <julian DOT viereck AT gmail DOT com>
11461
- *
11462
- * Alternatively, the contents of this file may be used under the terms of
11463
- * either the GNU General Public License Version 2 or later (the "GPL"), or
11464
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
11465
- * in which case the provisions of the GPL or the LGPL are applicable instead
11466
- * of those above. If you wish to allow use of your version of this file only
11467
- * under the terms of either the GPL or the LGPL, and not to allow others to
11468
- * use your version of this file under the terms of the MPL, indicate your
11469
- * decision by deleting the provisions above and replace them with the notice
11470
- * and other provisions required by the GPL or the LGPL. If you do not delete
11471
- * the provisions above, a recipient may use your version of this file under
11472
- * the terms of any one of the MPL, the GPL or the LGPL.
11473
- *
11474
- * ***** END LICENSE BLOCK ***** */
11475
-
11476
- define('ace/edit_session', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'pilot/event_emitter', 'ace/selection', 'ace/mode/text', 'ace/range', 'ace/document', 'ace/background_tokenizer', 'ace/edit_session/folding'], function(require, exports, module) {
11477
-
11478
- var oop = require("pilot/oop");
11479
- var lang = require("pilot/lang");
11480
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
11481
- var Selection = require("ace/selection").Selection;
11482
- var TextMode = require("ace/mode/text").Mode;
11483
- var Range = require("ace/range").Range;
11484
- var Document = require("ace/document").Document;
11485
- var BackgroundTokenizer = require("ace/background_tokenizer").BackgroundTokenizer;
11486
-
11487
- var EditSession = function(text, mode) {
11488
- this.$modified = true;
11489
- this.$breakpoints = [];
11490
- this.$frontMarkers = {};
11491
- this.$backMarkers = {};
11492
- this.$markerId = 1;
11493
- this.$rowCache = [];
11494
- this.$wrapData = [];
11495
- this.$foldData = [];
11496
- this.$foldData.toString = function() {
11497
- var str = "";
11498
- this.forEach(function(foldLine) {
11499
- str += "\n" + foldLine.toString();
11500
- });
11501
- return str;
11502
- }
11503
-
11504
- if (text instanceof Document) {
11505
- this.setDocument(text);
11506
- } else {
11507
- this.setDocument(new Document(text));
11508
- }
11509
-
11510
- this.selection = new Selection(this);
11511
- if (mode)
11512
- this.setMode(mode);
11513
- else
11514
- this.setMode(new TextMode());
11515
- };
11516
-
11517
-
11518
- (function() {
11519
-
11520
- oop.implement(this, EventEmitter);
11521
-
11522
- this.setDocument = function(doc) {
11523
- if (this.doc)
11524
- throw new Error("Document is already set");
11525
-
11526
- this.doc = doc;
11527
- doc.on("change", this.onChange.bind(this));
11528
- this.on("changeFold", this.onChangeFold.bind(this));
11529
- };
11530
-
11531
- this.getDocument = function() {
11532
- return this.doc;
11533
- };
11534
-
11535
- this.$resetRowCache = function(row) {
11536
- if (row == 0) {
11537
- this.$rowCache = [];
11538
- return;
11539
- }
11540
- var rowCache = this.$rowCache;
11541
- for (var i = 0; i < rowCache.length; i++) {
11542
- if (rowCache[i].docRow >= row) {
11543
- rowCache.splice(i, rowCache.length);
11544
- return;
11545
- }
11546
- }
11547
- };
11548
-
11549
- this.onChangeFold = function(e) {
11550
- var fold = e.data;
11551
- this.$resetRowCache(fold.start.row);
11552
- };
11553
-
11554
- this.onChange = function(e) {
11555
- var delta = e.data;
11556
- this.$modified = true;
11557
-
11558
- this.$resetRowCache(delta.range.start.row);
11559
-
11560
- var removedFolds = this.$updateInternalDataOnChange(e);
11561
- if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
11562
- this.$deltasDoc.push(delta);
11563
- if (removedFolds && removedFolds.length != 0) {
11564
- this.$deltasFold.push({
11565
- action: "removeFolds",
11566
- folds: removedFolds
11567
- });
11568
- }
11569
-
11570
- this.$informUndoManager.schedule();
11571
- }
11572
-
11573
- this.bgTokenizer.start(delta.range.start.row);
11574
- this._dispatchEvent("change", e);
11575
- };
11576
-
11577
- this.setValue = function(text) {
11578
- this.doc.setValue(text);
11579
- this.selection.moveCursorTo(0, 0);
11580
- this.selection.clearSelection();
11581
-
11582
- this.$resetRowCache(0);
11583
- this.$deltas = [];
11584
- this.$deltasDoc = [];
11585
- this.$deltasFold = [];
11586
- this.getUndoManager().reset();
11587
- };
11588
-
11589
- this.getValue =
11590
- this.toString = function() {
11591
- return this.doc.getValue();
11592
- };
11593
-
11594
- this.getSelection = function() {
11595
- return this.selection;
11596
- };
11597
-
11598
- this.getState = function(row) {
11599
- return this.bgTokenizer.getState(row);
11600
- };
11601
-
11602
- this.getTokens = function(firstRow, lastRow) {
11603
- return this.bgTokenizer.getTokens(firstRow, lastRow);
11604
- };
11605
-
11606
- this.setUndoManager = function(undoManager) {
11607
- this.$undoManager = undoManager;
11608
- this.$resetRowCache(0);
11609
- this.$deltas = [];
11610
- this.$deltasDoc = [];
11611
- this.$deltasFold = [];
11612
-
11613
- if (this.$informUndoManager)
11614
- this.$informUndoManager.cancel();
11615
-
11616
- if (undoManager) {
11617
- var self = this;
11618
- this.$syncInformUndoManager = function() {
11619
- self.$informUndoManager.cancel();
11620
-
11621
- if (self.$deltasFold.length) {
11622
- self.$deltas.push({
11623
- group: "fold",
11624
- deltas: self.$deltasFold
11625
- });
11626
- self.$deltasFold = [];
11627
- }
11628
-
11629
- if (self.$deltasDoc.length) {
11630
- self.$deltas.push({
11631
- group: "doc",
11632
- deltas: self.$deltasDoc
11633
- });
11634
- self.$deltasDoc = [];
11635
- }
11636
-
11637
- if (self.$deltas.length > 0) {
11638
- undoManager.execute({
11639
- action: "aceupdate",
11640
- args: [self.$deltas, self]
11641
- });
11642
- }
11643
-
11644
- self.$deltas = [];
11645
- }
11646
- this.$informUndoManager =
11647
- lang.deferredCall(this.$syncInformUndoManager);
11648
- }
11649
- };
11650
-
11651
- this.$defaultUndoManager = {
11652
- undo: function() {},
11653
- redo: function() {},
11654
- reset: function() {}
11655
- };
11656
-
11657
- this.getUndoManager = function() {
11658
- return this.$undoManager || this.$defaultUndoManager;
11659
- },
11660
-
11661
- this.getTabString = function() {
11662
- if (this.getUseSoftTabs()) {
11663
- return lang.stringRepeat(" ", this.getTabSize());
11664
- } else {
11665
- return "\t";
11666
- }
11667
- };
11668
-
11669
- this.$useSoftTabs = true;
11670
- this.setUseSoftTabs = function(useSoftTabs) {
11671
- if (this.$useSoftTabs === useSoftTabs) return;
11672
-
11673
- this.$useSoftTabs = useSoftTabs;
11674
- };
11675
-
11676
- this.getUseSoftTabs = function() {
11677
- return this.$useSoftTabs;
11678
- };
11679
-
11680
- this.$tabSize = 4;
11681
- this.setTabSize = function(tabSize) {
11682
- if (isNaN(tabSize) || this.$tabSize === tabSize) return;
11683
-
11684
- this.$modified = true;
11685
- this.$tabSize = tabSize;
11686
- this._dispatchEvent("changeTabSize");
11687
- };
11688
-
11689
- this.getTabSize = function() {
11690
- return this.$tabSize;
11691
- };
11692
-
11693
- this.isTabStop = function(position) {
11694
- return this.$useSoftTabs && (position.column % this.$tabSize == 0);
11695
- };
11696
-
11697
- this.$overwrite = false;
11698
- this.setOverwrite = function(overwrite) {
11699
- if (this.$overwrite == overwrite) return;
11700
-
11701
- this.$overwrite = overwrite;
11702
- this._dispatchEvent("changeOverwrite");
11703
- };
11704
-
11705
- this.getOverwrite = function() {
11706
- return this.$overwrite;
11707
- };
11708
-
11709
- this.toggleOverwrite = function() {
11710
- this.setOverwrite(!this.$overwrite);
11711
- };
11712
-
11713
- this.getBreakpoints = function() {
11714
- return this.$breakpoints;
11715
- };
11716
-
11717
- this.setBreakpoints = function(rows) {
11718
- this.$breakpoints = [];
11719
- for (var i=0; i<rows.length; i++) {
11720
- this.$breakpoints[rows[i]] = true;
11721
- }
11722
- this._dispatchEvent("changeBreakpoint", {});
11723
- };
11724
-
11725
- this.clearBreakpoints = function() {
11726
- this.$breakpoints = [];
11727
- this._dispatchEvent("changeBreakpoint", {});
11728
- };
11729
-
11730
- this.setBreakpoint = function(row) {
11731
- this.$breakpoints[row] = true;
11732
- this._dispatchEvent("changeBreakpoint", {});
11733
- };
11734
-
11735
- this.clearBreakpoint = function(row) {
11736
- delete this.$breakpoints[row];
11737
- this._dispatchEvent("changeBreakpoint", {});
11738
- };
11739
-
11740
- this.getBreakpoints = function() {
11741
- return this.$breakpoints;
11742
- };
11743
-
11744
- this.addMarker = function(range, clazz, type, inFront) {
11745
- var id = this.$markerId++;
11746
-
11747
- var marker = {
11748
- range : range,
11749
- type : type || "line",
11750
- renderer: typeof type == "function" ? type : null,
11751
- clazz : clazz,
11752
- inFront: !!inFront
11753
- }
11754
-
11755
- if (inFront) {
11756
- this.$frontMarkers[id] = marker;
11757
- this._dispatchEvent("changeFrontMarker")
11758
- } else {
11759
- this.$backMarkers[id] = marker;
11760
- this._dispatchEvent("changeBackMarker")
11761
- }
11762
-
11763
- return id;
11764
- };
11765
-
11766
- this.removeMarker = function(markerId) {
11767
- var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
11768
- if (!marker)
11769
- return;
11770
-
11771
- var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
11772
- if (marker) {
11773
- delete (markers[markerId]);
11774
- this._dispatchEvent(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
11775
- }
11776
- };
11777
-
11778
- this.getMarkers = function(inFront) {
11779
- return inFront ? this.$frontMarkers : this.$backMarkers;
11780
- };
11781
-
11782
- /**
11783
- * Error:
11784
- * {
11785
- * row: 12,
11786
- * column: 2, //can be undefined
11787
- * text: "Missing argument",
11788
- * type: "error" // or "warning" or "info"
11789
- * }
11790
- */
11791
- this.setAnnotations = function(annotations) {
11792
- this.$annotations = {};
11793
- for (var i=0; i<annotations.length; i++) {
11794
- var annotation = annotations[i];
11795
- var row = annotation.row;
11796
- if (this.$annotations[row])
11797
- this.$annotations[row].push(annotation);
11798
- else
11799
- this.$annotations[row] = [annotation];
11800
- }
11801
- this._dispatchEvent("changeAnnotation", {});
11802
- };
11803
-
11804
- this.getAnnotations = function() {
11805
- return this.$annotations;
11806
- };
11807
-
11808
- this.clearAnnotations = function() {
11809
- this.$annotations = {};
11810
- this._dispatchEvent("changeAnnotation", {});
11811
- };
11812
-
11813
- this.$detectNewLine = function(text) {
11814
- var match = text.match(/^.*?(\r?\n)/m);
11815
- if (match) {
11816
- this.$autoNewLine = match[1];
11817
- } else {
11818
- this.$autoNewLine = "\n";
11819
- }
11820
- };
11821
-
11822
- this.getWordRange = function(row, column) {
11823
- var line = this.getLine(row);
11824
-
11825
- var inToken = false;
11826
- if (column > 0) {
11827
- inToken = !!line.charAt(column - 1).match(this.tokenRe);
11828
- }
11829
-
11830
- if (!inToken) {
11831
- inToken = !!line.charAt(column).match(this.tokenRe);
11832
- }
11833
-
11834
- var re = inToken ? this.tokenRe : this.nonTokenRe;
11835
-
11836
- var start = column;
11837
- if (start > 0) {
11838
- do {
11839
- start--;
11840
- }
11841
- while (start >= 0 && line.charAt(start).match(re));
11842
- start++;
11843
- }
11844
-
11845
- var end = column;
11846
- while (end < line.length && line.charAt(end).match(re)) {
11847
- end++;
11848
- }
11849
-
11850
- return new Range(row, start, row, end);
11851
- };
11852
-
11853
- this.setNewLineMode = function(newLineMode) {
11854
- this.doc.setNewLineMode(newLineMode);
11855
- };
11856
-
11857
- this.getNewLineMode = function() {
11858
- return this.doc.getNewLineMode();
11859
- };
11860
-
11861
- this.$useWorker = true;
11862
- this.setUseWorker = function(useWorker) {
11863
- if (this.$useWorker == useWorker)
11864
- return;
11865
-
11866
- this.$useWorker = useWorker;
11867
-
11868
- this.$stopWorker();
11869
- if (useWorker)
11870
- this.$startWorker();
11871
- };
11872
-
11873
- this.getUseWorker = function() {
11874
- return this.$useWorker;
11875
- };
11876
-
11877
- this.onReloadTokenizer = function(e) {
11878
- var rows = e.data;
11879
- this.bgTokenizer.start(rows.first);
11880
- this._dispatchEvent("tokenizerUpdate", e);
11881
- };
11882
-
11883
- this.$mode = null;
11884
- this.setMode = function(mode) {
11885
- if (this.$mode === mode) return;
11886
- this.$mode = mode;
11887
-
11888
- this.$stopWorker();
11889
-
11890
- if (this.$useWorker)
11891
- this.$startWorker();
11892
-
11893
- var tokenizer = mode.getTokenizer();
11894
-
11895
- if(tokenizer.addEventListener !== undefined) {
11896
- var onReloadTokenizer = this.onReloadTokenizer.bind(this);
11897
- tokenizer.addEventListener("update", onReloadTokenizer);
11898
- }
11899
-
11900
- if (!this.bgTokenizer) {
11901
- this.bgTokenizer = new BackgroundTokenizer(tokenizer);
11902
- var _self = this;
11903
- this.bgTokenizer.addEventListener("update", function(e) {
11904
- _self._dispatchEvent("tokenizerUpdate", e);
11905
- });
11906
- } else {
11907
- this.bgTokenizer.setTokenizer(tokenizer);
11908
- }
11909
-
11910
- this.bgTokenizer.setDocument(this.getDocument());
11911
- this.bgTokenizer.start(0);
11912
-
11913
- this.tokenRe = mode.tokenRe;
11914
- this.nonTokenRe = mode.nonTokenRe;
11915
-
11916
- this._dispatchEvent("changeMode");
11917
- };
11918
-
11919
- this.$stopWorker = function() {
11920
- if (this.$worker)
11921
- this.$worker.terminate();
11922
-
11923
- this.$worker = null;
11924
- };
11925
-
11926
- this.$startWorker = function() {
11927
- if (typeof Worker !== "undefined" && !require.noWorker) {
11928
- try {
11929
- this.$worker = this.$mode.createWorker(this);
11930
- } catch (e) {
11931
- console.log("Could not load worker");
11932
- console.log(e);
11933
- this.$worker = null;
11934
- }
11935
- }
11936
- else
11937
- this.$worker = null;
11938
- };
11939
-
11940
- this.getMode = function() {
11941
- return this.$mode;
11942
- };
11943
-
11944
- this.$scrollTop = 0;
11945
- this.setScrollTopRow = function(scrollTopRow) {
11946
- if (this.$scrollTop === scrollTopRow) return;
11947
-
11948
- this.$scrollTop = scrollTopRow;
11949
- this._dispatchEvent("changeScrollTop");
11950
- };
11951
-
11952
- this.getScrollTopRow = function() {
11953
- return this.$scrollTop;
11954
- };
11955
-
11956
- this.getWidth = function() {
11957
- this.$computeWidth();
11958
- return this.width;
11959
- };
11960
-
11961
- this.getScreenWidth = function() {
11962
- this.$computeWidth();
11963
- return this.screenWidth;
11964
- };
11965
-
11966
- this.$computeWidth = function(force) {
11967
- if (this.$modified || force) {
11968
- this.$modified = false;
11969
-
11970
- var lines = this.doc.getAllLines();
11971
- var longestLine = 0;
11972
- var longestScreenLine = 0;
11973
-
11974
- for ( var i = 0; i < lines.length; i++) {
11975
- var foldLine = this.getFoldLine(i),
11976
- line, len;
11977
-
11978
- line = lines[i];
11979
- if (foldLine) {
11980
- var end = foldLine.range.end;
11981
- line = this.getFoldDisplayLine(foldLine);
11982
- // Continue after the foldLine.end.row. All the lines in
11983
- // between are folded.
11984
- i = end.row;
11985
- }
11986
- len = line.length;
11987
- longestLine = Math.max(longestLine, len);
11988
- if (!this.$useWrapMode) {
11989
- longestScreenLine = Math.max(
11990
- longestScreenLine,
11991
- this.$getStringScreenWidth(line)[0]
11992
- );
11993
- }
11994
- }
11995
- this.width = longestLine;
11996
-
11997
- if (this.$useWrapMode) {
11998
- this.screenWidth = this.$wrapLimit;
11999
- } else {
12000
- this.screenWidth = longestScreenLine;
12001
- }
12002
- }
12003
- };
12004
-
12005
- /**
12006
- * Get a verbatim copy of the given line as it is in the document
12007
- */
12008
- this.getLine = function(row) {
12009
- return this.doc.getLine(row);
12010
- };
12011
-
12012
- this.getLines = function(firstRow, lastRow) {
12013
- return this.doc.getLines(firstRow, lastRow);
12014
- };
12015
-
12016
- this.getLength = function() {
12017
- return this.doc.getLength();
12018
- };
12019
-
12020
- this.getTextRange = function(range) {
12021
- return this.doc.getTextRange(range);
12022
- };
12023
-
12024
- this.findMatchingBracket = function(position) {
12025
- if (position.column == 0) return null;
12026
-
12027
- var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
12028
- if (charBeforeCursor == "") return null;
12029
-
12030
- var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
12031
- if (!match) {
12032
- return null;
12033
- }
12034
-
12035
- if (match[1]) {
12036
- return this.$findClosingBracket(match[1], position);
12037
- } else {
12038
- return this.$findOpeningBracket(match[2], position);
12039
- }
12040
- };
12041
-
12042
- this.$brackets = {
12043
- ")": "(",
12044
- "(": ")",
12045
- "]": "[",
12046
- "[": "]",
12047
- "{": "}",
12048
- "}": "{"
12049
- };
12050
-
12051
- this.$findOpeningBracket = function(bracket, position) {
12052
- var openBracket = this.$brackets[bracket];
12053
-
12054
- var column = position.column - 2;
12055
- var row = position.row;
12056
- var depth = 1;
12057
-
12058
- var line = this.getLine(row);
12059
-
12060
- while (true) {
12061
- while(column >= 0) {
12062
- var ch = line.charAt(column);
12063
- if (ch == openBracket) {
12064
- depth -= 1;
12065
- if (depth == 0) {
12066
- return {row: row, column: column};
12067
- }
12068
- }
12069
- else if (ch == bracket) {
12070
- depth +=1;
12071
- }
12072
- column -= 1;
12073
- }
12074
- row -=1;
12075
- if (row < 0) break;
12076
-
12077
- var line = this.getLine(row);
12078
- var column = line.length-1;
12079
- }
12080
- return null;
12081
- };
12082
-
12083
- this.$findClosingBracket = function(bracket, position) {
12084
- var closingBracket = this.$brackets[bracket];
12085
-
12086
- var column = position.column;
12087
- var row = position.row;
12088
- var depth = 1;
12089
-
12090
- var line = this.getLine(row);
12091
- var lineCount = this.getLength();
12092
-
12093
- while (true) {
12094
- while(column < line.length) {
12095
- var ch = line.charAt(column);
12096
- if (ch == closingBracket) {
12097
- depth -= 1;
12098
- if (depth == 0) {
12099
- return {row: row, column: column};
12100
- }
12101
- }
12102
- else if (ch == bracket) {
12103
- depth +=1;
12104
- }
12105
- column += 1;
12106
- }
12107
- row +=1;
12108
- if (row >= lineCount) break;
12109
-
12110
- var line = this.getLine(row);
12111
- var column = 0;
12112
- }
12113
- return null;
12114
- };
12115
-
12116
- this.insert = function(position, text) {
12117
- return this.doc.insert(position, text);
12118
- };
12119
-
12120
- this.remove = function(range) {
12121
- return this.doc.remove(range);
12122
- };
12123
-
12124
- this.undoChanges = function(deltas, dontSelect) {
12125
- if (!deltas.length)
12126
- return;
12127
-
12128
- this.$fromUndo = true;
12129
- var lastUndoRange = null;
12130
- for (var i = deltas.length - 1; i != -1; i--) {
12131
- delta = deltas[i];
12132
- if (delta.group == "doc") {
12133
- this.doc.revertDeltas(delta.deltas);
12134
- lastUndoRange =
12135
- this.$getUndoSelection(delta.deltas, true, lastUndoRange);
12136
- } else {
12137
- delta.deltas.forEach(function(foldDelta) {
12138
- this.addFolds(foldDelta.folds);
12139
- }, this);
12140
- }
12141
- }
12142
- this.$fromUndo = false;
12143
- lastUndoRange &&
12144
- !dontSelect &&
12145
- this.selection.setSelectionRange(lastUndoRange);
12146
- return lastUndoRange;
12147
- },
12148
-
12149
- this.redoChanges = function(deltas, dontSelect) {
12150
- if (!deltas.length)
12151
- return;
12152
-
12153
- this.$fromUndo = true;
12154
- var lastUndoRange = null;
12155
- for (var i = 0; i < deltas.length; i++) {
12156
- delta = deltas[i];
12157
- if (delta.group == "doc") {
12158
- this.doc.applyDeltas(delta.deltas);
12159
- lastUndoRange =
12160
- this.$getUndoSelection(delta.deltas, false, lastUndoRange);
12161
- }
12162
- }
12163
- this.$fromUndo = false;
12164
- lastUndoRange &&
12165
- !dontSelect &&
12166
- this.selection.setSelectionRange(lastUndoRange);
12167
- return lastUndoRange;
12168
- },
12169
-
12170
- this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
12171
- function isInsert(delta) {
12172
- var insert =
12173
- delta.action == "insertText" || delta.action == "insertLines";
12174
- return isUndo ? !insert : insert;
12175
- }
12176
-
12177
- var delta = deltas[0];
12178
- var range, point;
12179
- var lastDeltaIsInsert = false;
12180
- if (isInsert(delta)) {
12181
- range = delta.range.clone();
12182
- lastDeltaIsInsert = true;
12183
- } else {
12184
- range = Range.fromPoints(delta.range.start, delta.range.start);
12185
- lastDeltaIsInsert = false;
12186
- }
12187
-
12188
- for (var i = 1; i < deltas.length; i++) {
12189
- delta = deltas[i];
12190
- if (isInsert(delta)) {
12191
- point = delta.range.start;
12192
- if (range.compare(point.row, point.column) == -1) {
12193
- range.setStart(delta.range.start);
12194
- }
12195
- point = delta.range.end;
12196
- if (range.compare(point.row, point.column) == 1) {
12197
- range.setEnd(delta.range.end);
12198
- }
12199
- lastDeltaIsInsert = true;
12200
- } else {
12201
- point = delta.range.start;
12202
- if (range.compare(point.row, point.column) == -1) {
12203
- range =
12204
- Range.fromPoints(delta.range.start, delta.range.start);
12205
- }
12206
- lastDeltaIsInsert = false;
12207
- }
12208
- }
12209
-
12210
- // Check if this range and the last undo range has something in common.
12211
- // If true, merge the ranges.
12212
- if (lastUndoRange != null) {
12213
- var cmp = lastUndoRange.compareRange(range);
12214
- if (cmp == 1) {
12215
- range.setStart(lastUndoRange.start);
12216
- } else if (cmp == -1) {
12217
- range.setEnd(lastUndoRange.end);
12218
- }
12219
- }
12220
-
12221
- return range;
12222
- },
12223
-
12224
- this.replace = function(range, text) {
12225
- return this.doc.replace(range, text);
12226
- };
12227
-
12228
- /**
12229
- * Move a range of text from the given range to the given position.
12230
- *
12231
- * @param fromRange {Range} The range of text you want moved within the
12232
- * document.
12233
- * @param toPosition {Object} The location (row and column) where you want
12234
- * to move the text to.
12235
- * @return {Range} The new range where the text was moved to.
12236
- */
12237
- this.moveText = function(fromRange, toPosition) {
12238
- var text = this.getTextRange(fromRange);
12239
- this.remove(fromRange);
12240
-
12241
- var toRow = toPosition.row;
12242
- var toColumn = toPosition.column;
12243
-
12244
- // Make sure to update the insert location, when text is removed in
12245
- // front of the chosen point of insertion.
12246
- if (!fromRange.isMultiLine() && fromRange.start.row == toRow &&
12247
- fromRange.end.column < toColumn)
12248
- toColumn -= text.length;
12249
-
12250
- if (fromRange.isMultiLine() && fromRange.end.row < toRow) {
12251
- var lines = this.doc.$split(text);
12252
- toRow -= lines.length - 1;
12253
- }
12254
-
12255
- var endRow = toRow + fromRange.end.row - fromRange.start.row;
12256
- var endColumn = fromRange.isMultiLine() ?
12257
- fromRange.end.column :
12258
- toColumn + fromRange.end.column - fromRange.start.column;
12259
-
12260
- var toRange = new Range(toRow, toColumn, endRow, endColumn);
12261
-
12262
- this.insert(toRange.start, text);
12263
-
12264
- return toRange;
12265
- };
12266
-
12267
- this.indentRows = function(startRow, endRow, indentString) {
12268
- indentString = indentString.replace(/\t/g, this.getTabString());
12269
- for (var row=startRow; row<=endRow; row++) {
12270
- this.insert({row: row, column:0}, indentString);
12271
- }
12272
- };
12273
-
12274
- this.outdentRows = function (range) {
12275
- var rowRange = range.collapseRows();
12276
- var deleteRange = new Range(0, 0, 0, 0);
12277
- var size = this.getTabSize();
12278
-
12279
- for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
12280
- var line = this.getLine(i);
12281
-
12282
- deleteRange.start.row = i;
12283
- deleteRange.end.row = i;
12284
- for (var j = 0; j < size; ++j)
12285
- if (line.charAt(j) != ' ')
12286
- break;
12287
- if (j < size && line.charAt(j) == '\t') {
12288
- deleteRange.start.column = j;
12289
- deleteRange.end.column = j + 1;
12290
- } else {
12291
- deleteRange.start.column = 0;
12292
- deleteRange.end.column = j;
12293
- }
12294
- this.remove(deleteRange);
12295
- }
12296
- };
12297
-
12298
- this.moveLinesUp = function(firstRow, lastRow) {
12299
- if (firstRow <= 0) return 0;
12300
-
12301
- var removed = this.doc.removeLines(firstRow, lastRow);
12302
- this.doc.insertLines(firstRow - 1, removed);
12303
- return -1;
12304
- };
12305
-
12306
- this.moveLinesDown = function(firstRow, lastRow) {
12307
- if (lastRow >= this.doc.getLength()-1) return 0;
12308
-
12309
- var removed = this.doc.removeLines(firstRow, lastRow);
12310
- this.doc.insertLines(firstRow+1, removed);
12311
- return 1;
12312
- };
12313
-
12314
- this.duplicateLines = function(firstRow, lastRow) {
12315
- var firstRow = this.$clipRowToDocument(firstRow);
12316
- var lastRow = this.$clipRowToDocument(lastRow);
12317
-
12318
- var lines = this.getLines(firstRow, lastRow);
12319
- this.doc.insertLines(firstRow, lines);
12320
-
12321
- var addedRows = lastRow - firstRow + 1;
12322
- return addedRows;
12323
- };
12324
-
12325
- this.$clipRowToDocument = function(row) {
12326
- return Math.max(0, Math.min(row, this.doc.getLength()-1));
12327
- };
12328
-
12329
- this.$clipPositionToDocument = function(row, column) {
12330
- column = Math.max(0, column);
12331
-
12332
- if (row < 0) {
12333
- row = 0;
12334
- column = 0;
12335
- } else {
12336
- var len = this.doc.getLength();
12337
- if (row >= len) {
12338
- row = len - 1;
12339
- column = this.doc.getLine(len-1).length;
12340
- } else {
12341
- column = Math.min(this.doc.getLine(row).length, column);
12342
- }
12343
- }
12344
-
12345
- return {
12346
- row: row,
12347
- column: column
12348
- };
12349
- };
12350
-
12351
- // WRAPMODE
12352
- this.$wrapLimit = 80;
12353
- this.$useWrapMode = false;
12354
- this.$wrapLimitRange = {
12355
- min : null,
12356
- max : null
12357
- };
12358
-
12359
- this.setUseWrapMode = function(useWrapMode) {
12360
- if (useWrapMode != this.$useWrapMode) {
12361
- this.$useWrapMode = useWrapMode;
12362
- this.$modified = true;
12363
- this.$resetRowCache(0);
12364
-
12365
- // If wrapMode is activaed, the wrapData array has to be initialized.
12366
- if (useWrapMode) {
12367
- var len = this.getLength();
12368
- this.$wrapData = [];
12369
- for (i = 0; i < len; i++) {
12370
- this.$wrapData.push([]);
12371
- }
12372
- this.$updateWrapData(0, len - 1);
12373
- }
12374
-
12375
- this._dispatchEvent("changeWrapMode");
12376
- }
12377
- };
12378
-
12379
- this.getUseWrapMode = function() {
12380
- return this.$useWrapMode;
12381
- };
12382
-
12383
- // Allow the wrap limit to move freely between min and max. Either
12384
- // parameter can be null to allow the wrap limit to be unconstrained
12385
- // in that direction. Or set both parameters to the same number to pin
12386
- // the limit to that value.
12387
- this.setWrapLimitRange = function(min, max) {
12388
- if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
12389
- this.$wrapLimitRange.min = min;
12390
- this.$wrapLimitRange.max = max;
12391
- this.$modified = true;
12392
- // This will force a recalculation of the wrap limit
12393
- this._dispatchEvent("changeWrapMode");
12394
- }
12395
- };
12396
-
12397
- // This should generally only be called by the renderer when a resize
12398
- // is detected.
12399
- this.adjustWrapLimit = function(desiredLimit) {
12400
- var wrapLimit = this.$constrainWrapLimit(desiredLimit);
12401
- if (wrapLimit != this.$wrapLimit && wrapLimit > 0) {
12402
- this.$wrapLimit = wrapLimit;
12403
- this.$modified = true;
12404
- if (this.$useWrapMode) {
12405
- this.$updateWrapData(0, this.getLength() - 1);
12406
- this.$resetRowCache(0)
12407
- this._dispatchEvent("changeWrapLimit");
12408
- }
12409
- return true;
12410
- }
12411
- return false;
12412
- };
12413
-
12414
- this.$constrainWrapLimit = function(wrapLimit) {
12415
- var min = this.$wrapLimitRange.min;
12416
- if (min)
12417
- wrapLimit = Math.max(min, wrapLimit);
12418
-
12419
- var max = this.$wrapLimitRange.max;
12420
- if (max)
12421
- wrapLimit = Math.min(max, wrapLimit);
12422
-
12423
- // What would a limit of 0 even mean?
12424
- return Math.max(1, wrapLimit);
12425
- };
12426
-
12427
- this.getWrapLimit = function() {
12428
- return this.$wrapLimit;
12429
- };
12430
-
12431
- this.getWrapLimitRange = function() {
12432
- // Avoid unexpected mutation by returning a copy
12433
- return {
12434
- min : this.$wrapLimitRange.min,
12435
- max : this.$wrapLimitRange.max
12436
- };
12437
- };
12438
-
12439
- this.$updateInternalDataOnChange = function(e) {
12440
- var useWrapMode = this.$useWrapMode;
12441
- var len;
12442
- var action = e.data.action;
12443
- var firstRow = e.data.range.start.row,
12444
- lastRow = e.data.range.end.row,
12445
- start = e.data.range.start,
12446
- end = e.data.range.end;
12447
- var removedFolds = null;
12448
-
12449
- if (action.indexOf("Lines") != -1) {
12450
- if (action == "insertLines") {
12451
- lastRow = firstRow + (e.data.lines.length);
12452
- } else {
12453
- lastRow = firstRow;
12454
- }
12455
- len = e.data.lines.length;
12456
- } else {
12457
- len = lastRow - firstRow;
12458
- }
12459
-
12460
- if (len != 0) {
12461
- if (action.indexOf("remove") != -1) {
12462
- useWrapMode && this.$wrapData.splice(firstRow, len);
12463
-
12464
- var foldLines = this.$foldData;
12465
- removedFolds = this.getFoldsInRange(e.data.range);
12466
- this.removeFolds(removedFolds);
12467
-
12468
- var foldLine = this.getFoldLine(end.row);
12469
- var idx = 0;
12470
- if (foldLine) {
12471
- foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
12472
- foldLine.shiftRow(-len);
12473
-
12474
- var foldLineBefore = this.getFoldLine(firstRow);
12475
- if (foldLineBefore && foldLineBefore !== foldLine) {
12476
- foldLineBefore.merge(foldLine);
12477
- foldLine = foldLineBefore;
12478
- }
12479
- idx = foldLines.indexOf(foldLine) + 1;
12480
- }
12481
-
12482
- for (idx; idx < foldLines.length; idx++) {
12483
- var foldLine = foldLines[idx];
12484
- if (foldLine.start.row >= end.row) {
12485
- foldLine.shiftRow(-len);
12486
- }
12487
- }
12488
-
12489
- lastRow = firstRow;
12490
- } else {
12491
- var args;
12492
- if (useWrapMode) {
12493
- args = [firstRow, 0];
12494
- for (var i = 0; i < len; i++) args.push([]);
12495
- this.$wrapData.splice.apply(this.$wrapData, args);
12496
- }
12497
-
12498
- // If some new line is added inside of a foldLine, then split
12499
- // the fold line up.
12500
- var foldLines = this.$foldData;
12501
- var foldLine = this.getFoldLine(firstRow);
12502
- var idx = 0;
12503
- if (foldLine) {
12504
- var cmp = foldLine.range.compareInside(start.row, start.column)
12505
- // Inside of the foldLine range. Need to split stuff up.
12506
- if (cmp == 0) {
12507
- foldLine = foldLine.split(start.row, start.column);
12508
- foldLine.shiftRow(len);
12509
- foldLine.addRemoveChars(
12510
- lastRow, 0, end.column - start.column);
12511
- } else
12512
- // Infront of the foldLine but same row. Need to shift column.
12513
- if (cmp == -1) {
12514
- foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
12515
- foldLine.shiftRow(len);
12516
- }
12517
- // Nothing to do if the insert is after the foldLine.
12518
- idx = foldLines.indexOf(foldLine) + 1;
12519
- }
12520
-
12521
- for (idx; idx < foldLines.length; idx++) {
12522
- var foldLine = foldLines[idx];
12523
- if (foldLine.start.row >= firstRow) {
12524
- foldLine.shiftRow(len);
12525
- }
12526
- }
12527
- }
12528
- } else {
12529
- // Realign folds. E.g. if you add some new chars before a fold, the
12530
- // fold should "move" to the right.
12531
- var column;
12532
- len = Math.abs(e.data.range.start.column - e.data.range.end.column);
12533
- if (action.indexOf("remove") != -1) {
12534
- // Get all the folds in the change range and remove them.
12535
- removedFolds = this.getFoldsInRange(e.data.range);
12536
- this.removeFolds(removedFolds);
12537
-
12538
- len = -len;
12539
- }
12540
- var foldLine = this.getFoldLine(firstRow);
12541
- if (foldLine) {
12542
- foldLine.addRemoveChars(firstRow, start.column, len);
12543
- }
12544
- }
12545
-
12546
- if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
12547
- console.error("doc.getLength() and $wrapData.length have to be the same!");
12548
- }
12549
-
12550
- useWrapMode && this.$updateWrapData(firstRow, lastRow);
12551
-
12552
- return removedFolds;
12553
- };
12554
-
12555
- this.$updateWrapData = function(firstRow, lastRow) {
12556
- var lines = this.doc.getAllLines();
12557
- var tabSize = this.getTabSize();
12558
- var wrapData = this.$wrapData;
12559
- var wrapLimit = this.$wrapLimit;
12560
- var tokens;
12561
- var foldLine;
12562
-
12563
- var row = firstRow;
12564
- lastRow = Math.min(lastRow, lines.length - 1);
12565
- while (row <= lastRow) {
12566
- foldLine = this.getFoldLine(row);
12567
- if (!foldLine) {
12568
- tokens = this.$getDisplayTokens(lang.stringTrimRight(lines[row]));
12569
- } else {
12570
- tokens = [];
12571
- foldLine.walk(
12572
- function(placeholder, row, column, lastColumn) {
12573
- var walkTokens;
12574
- if (placeholder) {
12575
- walkTokens = this.$getDisplayTokens(
12576
- placeholder, tokens.length);
12577
- walkTokens[0] = PLACEHOLDER_START;
12578
- for (var i = 1; i < walkTokens.length; i++) {
12579
- walkTokens[i] = PLACEHOLDER_BODY;
12580
- }
12581
- } else {
12582
- walkTokens = this.$getDisplayTokens(
12583
- lines[row].substring(lastColumn, column),
12584
- tokens.length);
12585
- }
12586
- tokens = tokens.concat(walkTokens);
12587
- }.bind(this),
12588
- foldLine.end.row,
12589
- lines[foldLine.end.row].length + 1
12590
- );
12591
- // Remove spaces/tabs from the back of the token array.
12592
- while (tokens.length != 0
12593
- && tokens[tokens.length - 1] >= SPACE)
12594
- {
12595
- tokens.pop();
12596
- }
12597
- }
12598
- wrapData[row] =
12599
- this.$computeWrapSplits(tokens, wrapLimit, tabSize);
12600
-
12601
- row = this.getRowFoldEnd(row) + 1;
12602
- }
12603
- };
12604
-
12605
- // "Tokens"
12606
- var CHAR = 1,
12607
- CHAR_EXT = 2,
12608
- PLACEHOLDER_START = 3,
12609
- PLACEHOLDER_BODY = 4,
12610
- SPACE = 10,
12611
- TAB = 11,
12612
- TAB_SPACE = 12;
12613
-
12614
- this.$computeWrapSplits = function(tokens, wrapLimit, tabSize) {
12615
- if (tokens.length == 0) {
12616
- return [];
12617
- }
12618
-
12619
- var tabSize = this.getTabSize();
12620
- var splits = [];
12621
- var displayLength = tokens.length;
12622
- var lastSplit = 0, lastDocSplit = 0;
12623
-
12624
- function addSplit(screenPos) {
12625
- var displayed = tokens.slice(lastSplit, screenPos);
12626
-
12627
- // The document size is the current size - the extra width for tabs
12628
- // and multipleWidth characters.
12629
- var len = displayed.length;
12630
- displayed.join("").
12631
- // Get all the TAB_SPACEs.
12632
- replace(/12/g, function(m) {
12633
- len -= 1;
12634
- }).
12635
- // Get all the CHAR_EXT/multipleWidth characters.
12636
- replace(/2/g, function(m) {
12637
- len -= 1;
12638
- });
12639
-
12640
- lastDocSplit += len;
12641
- splits.push(lastDocSplit);
12642
- lastSplit = screenPos;
12643
- }
12644
-
12645
- while (displayLength - lastSplit > wrapLimit) {
12646
- // This is, where the split should be.
12647
- var split = lastSplit + wrapLimit;
12648
-
12649
- // If there is a space or tab at this split position, then making
12650
- // a split is simple.
12651
- if (tokens[split] >= SPACE) {
12652
- // Include all following spaces + tabs in this split as well.
12653
- while (tokens[split] >= SPACE) {
12654
- split ++;
12655
- }
12656
- addSplit(split);
12657
- continue;
12658
- }
12659
-
12660
- // === ELSE ===
12661
- // Check if split is inside of a placeholder. Placeholder are
12662
- // not splitable. Therefore, seek the beginning of the placeholder
12663
- // and try to place the split beofre the placeholder's start.
12664
- if (tokens[split] == PLACEHOLDER_START
12665
- || tokens[split] == PLACEHOLDER_BODY)
12666
- {
12667
- // Seek the start of the placeholder and do the split
12668
- // before the placeholder. By definition there always
12669
- // a PLACEHOLDER_START between split and lastSplit.
12670
- for (split; split != lastSplit - 1; split--) {
12671
- if (tokens[split] == PLACEHOLDER_START) {
12672
- // split++; << No incremental here as we want to
12673
- // have the position before the Placeholder.
12674
- break;
12675
- }
12676
- }
12677
-
12678
- // If the PLACEHOLDER_START is not the index of the
12679
- // last split, then we can do the split
12680
- if (split > lastSplit) {
12681
- addSplit(split);
12682
- continue;
12683
- }
12684
-
12685
- // If the PLACEHOLDER_START IS the index of the last
12686
- // split, then we have to place the split after the
12687
- // placeholder. So, let's seek for the end of the placeholder.
12688
- split = lastSplit + wrapLimit;
12689
- for (split; split < tokens.length; split++) {
12690
- if (tokens[split] != PLACEHOLDER_BODY)
12691
- {
12692
- break;
12693
- }
12694
- }
12695
-
12696
- // If spilt == tokens.length, then the placeholder is the last
12697
- // thing in the line and adding a new split doesn't make sense.
12698
- if (split == tokens.length) {
12699
- break; // Breaks the while-loop.
12700
- }
12701
-
12702
- // Finally, add the split...
12703
- addSplit(split);
12704
- continue;
12705
- }
12706
-
12707
- // === ELSE ===
12708
- // Search for the first non space/tab/placeholder token backwards.
12709
- for (split; split != lastSplit - 1; split--) {
12710
- if (tokens[split] >= PLACEHOLDER_START) {
12711
- split++;
12712
- break;
12713
- }
12714
- }
12715
- // If we found one, then add the split.
12716
- if (split > lastSplit) {
12717
- addSplit(split);
12718
- continue;
12719
- }
12720
-
12721
- // === ELSE ===
12722
- split = lastSplit + wrapLimit;
12723
- // The split is inside of a CHAR or CHAR_EXT token and no space
12724
- // around -> force a split.
12725
- addSplit(lastSplit + wrapLimit);
12726
- }
12727
- return splits;
12728
- }
12729
-
12730
- /**
12731
- * @param
12732
- * offset: The offset in screenColumn at which position str starts.
12733
- * Important for calculating the realTabSize.
12734
- */
12735
- this.$getDisplayTokens = function(str, offset) {
12736
- var arr = [];
12737
- var tabSize;
12738
- offset = offset || 0;
12739
-
12740
- for (var i = 0; i < str.length; i++) {
12741
- var c = str.charCodeAt(i);
12742
- // Tab
12743
- if (c == 9) {
12744
- tabSize = this.getScreenTabSize(arr.length + offset);
12745
- arr.push(TAB);
12746
- for (var n = 1; n < tabSize; n++) {
12747
- arr.push(TAB_SPACE);
12748
- }
12749
- }
12750
- // Space
12751
- else if(c == 32) {
12752
- arr.push(SPACE);
12753
- }
12754
- // full width characters
12755
- else if (isFullWidth(c)) {
12756
- arr.push(CHAR, CHAR_EXT);
12757
- } else {
12758
- arr.push(CHAR);
12759
- }
12760
- }
12761
- return arr;
12762
- }
12763
-
12764
- /**
12765
- * Calculates the width of the a string on the screen while assuming that
12766
- * the string starts at the first column on the screen.
12767
- *
12768
- * @param string str String to calculate the screen width of
12769
- * @return array
12770
- * [0]: number of columns for str on screen.
12771
- * [1]: docColumn position that was read until (useful with screenColumn)
12772
- */
12773
- this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
12774
- if (maxScreenColumn == 0) {
12775
- return [0, 0];
12776
- }
12777
- if (maxScreenColumn == null) {
12778
- maxScreenColumn = screenColumn +
12779
- str.length * Math.max(this.getTabSize(), 2);
12780
- }
12781
- screenColumn = screenColumn || 0;
12782
-
12783
- var c, column;
12784
- for (column = 0; column < str.length; column++) {
12785
- c = str.charCodeAt(column);
12786
- // tab
12787
- if (c == 9) {
12788
- screenColumn += this.getScreenTabSize(screenColumn);
12789
- }
12790
- // full width characters
12791
- else if (isFullWidth(c)) {
12792
- screenColumn += 2;
12793
- } else {
12794
- screenColumn += 1;
12795
- }
12796
- if (screenColumn > maxScreenColumn) {
12797
- break
12798
- }
12799
- }
12800
-
12801
- return [screenColumn, column];
12802
- }
12803
-
12804
- /**
12805
- * Returns the number of rows required to render this row on the screen
12806
- */
12807
- this.getRowLength = function(row) {
12808
- if (!this.$useWrapMode || !this.$wrapData[row]) {
12809
- return 1;
12810
- } else {
12811
- return this.$wrapData[row].length + 1;
12812
- }
12813
- }
12814
-
12815
- /**
12816
- * Returns the height in pixels required to render this row on the screen
12817
- **/
12818
- this.getRowHeight = function(config, row) {
12819
- return this.getRowLength(row) * config.lineHeight;
12820
- }
12821
-
12822
- this.getScreenLastRowColumn = function(screenRow) {
12823
- //return this.screenToDocumentColumn(screenRow, Number.MAX_VALUE / 10)
12824
- return this.documentToScreenColumn(screenRow, this.doc.getLine(screenRow).length);
12825
- };
12826
-
12827
- this.getDocumentLastRowColumn = function(docRow, docColumn) {
12828
- var screenRow = this.documentToScreenRow(docRow, docColumn);
12829
- return this.getScreenLastRowColumn(screenRow);
12830
- };
12831
-
12832
- this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
12833
- var screenRow = this.documentToScreenRow(docRow, docColumn);
12834
- return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
12835
- };
12836
-
12837
- this.getRowSplitData = function(row) {
12838
- if (!this.$useWrapMode) {
12839
- return undefined;
12840
- } else {
12841
- return this.$wrapData[row];
12842
- }
12843
- };
12844
-
12845
- /**
12846
- * Returns the width of a tab character at screenColumn.
12847
- */
12848
- this.getScreenTabSize = function(screenColumn) {
12849
- return this.$tabSize - screenColumn % this.$tabSize;
12850
- };
12851
-
12852
- this.screenToDocumentRow = function(screenRow, screenColumn) {
12853
- return this.screenToDocumentPosition(screenRow, screenColumn).row;
12854
- };
12855
-
12856
- this.screenToDocumentColumn = function(screenRow, screenColumn) {
12857
- return this.screenToDocumentPosition(screenRow, screenColumn).column;
12858
- };
12859
-
12860
- this.screenToDocumentPosition = function(screenRow, screenColumn) {
12861
- if (screenRow < 0) {
12862
- return {
12863
- row: 0,
12864
- column: 0
12865
- }
12866
- }
12867
-
12868
- var line;
12869
- var docRow = 0;
12870
- var docColumn = 0;
12871
- var column;
12872
- var foldLineRowLength;
12873
- var row = 0;
12874
- var rowLength = 0;
12875
-
12876
- var rowCache = this.$rowCache;
12877
- for (var i = 0; i < rowCache.length; i++) {
12878
- if (rowCache[i].screenRow < screenRow) {
12879
- row = rowCache[i].screenRow;
12880
- docRow = rowCache[i].docRow;
12881
- }
12882
- else {
12883
- break;
12884
- }
12885
- }
12886
- var doCache = !rowCache.length || i == rowCache.length;
12887
-
12888
- // clamp row before clamping column, for selection on last line
12889
- var maxRow = this.getLength() - 1;
12890
-
12891
- var foldLine = this.getNextFold(docRow);
12892
- var foldStart = foldLine ? foldLine.start.row : Infinity;
12893
-
12894
- while (row <= screenRow) {
12895
- rowLength = this.getRowLength(docRow);
12896
- if (row + rowLength - 1 >= screenRow || docRow >= maxRow) {
12897
- break;
12898
- } else {
12899
- row += rowLength;
12900
- docRow++;
12901
- if (docRow > foldStart) {
12902
- docRow = foldLine.end.row+1;
12903
- foldLine = this.getNextFold(docRow);
12904
- foldStart = foldLine ? foldLine.start.row : Infinity;
12905
- }
12906
- }
12907
- if (doCache) {
12908
- rowCache.push({
12909
- docRow: docRow,
12910
- screenRow: row
12911
- });
12912
- }
12913
- }
12914
-
12915
- if (foldLine && foldLine.start.row <= docRow)
12916
- line = this.getFoldDisplayLine(foldLine);
12917
- else {
12918
- line = this.getLine(docRow);
12919
- foldLine = null;
12920
- }
12921
-
12922
- var splits = [];
12923
- if (this.$useWrapMode) {
12924
- splits = this.$wrapData[docRow];
12925
- if (splits) {
12926
- column = splits[screenRow - row]
12927
- if(screenRow > row && splits.length) {
12928
- docColumn = splits[screenRow - row - 1] || splits[splits.length - 1];
12929
- line = line.substring(docColumn);
12930
- }
12931
- }
12932
- }
12933
-
12934
- docColumn += this.$getStringScreenWidth(line, screenColumn)[1];
12935
-
12936
- // clip row at the end of the document
12937
- if (row + splits.length < screenRow)
12938
- docColumn = Number.MAX_VALUE;
12939
-
12940
- // Need to do some clamping action here.
12941
- if (this.$useWrapMode) {
12942
- if (docColumn >= column) {
12943
- // We remove one character at the end such that the docColumn
12944
- // position returned is not associated to the next row on the
12945
- // screen.
12946
- docColumn = column - 1;
12947
- }
12948
- } else {
12949
- docColumn = Math.min(docColumn, line.length);
12950
- }
12951
-
12952
- if (foldLine) {
12953
- return foldLine.idxToPosition(docColumn);
12954
- }
12955
-
12956
- return {
12957
- row: docRow,
12958
- column: docColumn
12959
- }
12960
- };
12961
-
12962
- this.documentToScreenPosition = function(docRow, docColumn) {
12963
- // Normalize the passed in arguments.
12964
- if (typeof docColumn === "undefined")
12965
- var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
12966
- else
12967
- pos = this.$clipPositionToDocument(docRow, docColumn);
12968
-
12969
- docRow = pos.row;
12970
- docColumn = pos.column;
12971
-
12972
- var LL = this.$rowCache.length;
12973
-
12974
- var wrapData;
12975
- // Special case in wrapMode if the doc is at the end of the document.
12976
- if (this.$useWrapMode) {
12977
- wrapData = this.$wrapData;
12978
- if (docRow > wrapData.length - 1) {
12979
- return {
12980
- row: this.getScreenLength(),
12981
- column: wrapData.length == 0
12982
- ? 0
12983
- : (wrapData[wrapData.length - 1].length - 1)
12984
- };
12985
- }
12986
- }
12987
-
12988
- var screenRow = 0;
12989
- var screenColumn = 0;
12990
- var foldStartRow = null;
12991
- var fold = null;
12992
-
12993
- // Clamp the docRow position in case it's inside of a folded block.
12994
- fold = this.getFoldAt(docRow, docColumn, 1);
12995
- if (fold) {
12996
- docRow = fold.start.row;
12997
- docColumn = fold.start.column;
12998
- }
12999
-
13000
- var rowEnd, row = 0;
13001
- var rowCache = this.$rowCache;
13002
-
13003
- for (var i = 0; i < rowCache.length; i++) {
13004
- if (rowCache[i].docRow < docRow) {
13005
- screenRow = rowCache[i].screenRow;
13006
- row = rowCache[i].docRow;
13007
- } else {
13008
- break;
13009
- }
13010
- }
13011
- var doCache = !rowCache.length || i == rowCache.length;
13012
-
13013
- var foldLine = this.getNextFold(row);
13014
- var foldStart = foldLine ?foldLine.start.row :Infinity;
13015
-
13016
- while (row < docRow) {
13017
- if (row >= foldStart) {
13018
- rowEnd = foldLine.end.row + 1;
13019
- if (rowEnd > docRow)
13020
- break;
13021
- foldLine = this.getNextFold(rowEnd);
13022
- foldStart = foldLine ?foldLine.start.row :Infinity;
13023
- }
13024
- else {
13025
- rowEnd = row + 1;
13026
- }
13027
-
13028
- screenRow += this.getRowLength(row);
13029
- row = rowEnd;
13030
-
13031
- if (doCache) {
13032
- rowCache.push({
13033
- docRow: row,
13034
- screenRow: screenRow
13035
- });
13036
- }
13037
- }
13038
-
13039
- // Calculate the text line that is displayed in docRow on the screen.
13040
- var textLine = "";
13041
- // Check if the final row we want to reach is inside of a fold.
13042
- if (foldLine && row >= foldStart) {
13043
- textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
13044
- foldStartRow = foldLine.start.row;
13045
- } else {
13046
- textLine = this.getLine(docRow).substring(0, docColumn);
13047
- foldStartRow = docRow;
13048
- }
13049
- // Clamp textLine if in wrapMode.
13050
- if (this.$useWrapMode) {
13051
- var wrapRow = wrapData[foldStartRow];
13052
- var screenRowOffset = 0;
13053
- while (textLine.length >= wrapRow[screenRowOffset]) {
13054
- screenRow ++;
13055
- screenRowOffset++;
13056
- }
13057
- textLine = textLine.substring(
13058
- wrapRow[screenRowOffset - 1] || 0, textLine.length
13059
- );
13060
- }
13061
-
13062
- return {
13063
- row: screenRow,
13064
- column: this.$getStringScreenWidth(textLine)[0]
13065
- };
13066
- };
13067
-
13068
- this.documentToScreenColumn = function(row, docColumn) {
13069
- return this.documentToScreenPosition(row, docColumn).column;
13070
- };
13071
-
13072
- this.documentToScreenRow = function(docRow, docColumn) {
13073
- return this.documentToScreenPosition(docRow, docColumn).row;
13074
- };
13075
-
13076
- this.getScreenLength = function() {
13077
- var screenRows = 0;
13078
- var lastFoldLine = null;
13079
- var foldLine = null;
13080
- if (!this.$useWrapMode) {
13081
- screenRows = this.getLength();
13082
-
13083
- // Remove the folded lines again.
13084
- var foldData = this.$foldData;
13085
- for (var i = 0; i < foldData.length; i++) {
13086
- foldLine = foldData[i];
13087
- screenRows -= foldLine.end.row - foldLine.start.row;
13088
- }
13089
- } else {
13090
- for (var row = 0; row < this.$wrapData.length; row++) {
13091
- if (foldLine = this.getFoldLine(row, lastFoldLine)) {
13092
- row = foldLine.end.row;
13093
- screenRows += 1;
13094
- } else {
13095
- screenRows += this.$wrapData[row].length + 1;
13096
- }
13097
- }
13098
- }
13099
-
13100
- return screenRows;
13101
- }
13102
-
13103
- // For every keystroke this gets called once per char in the whole doc!!
13104
- // Wouldn't hurt to make it a bit faster for c >= 0x1100
13105
- function isFullWidth(c) {
13106
- if (c < 0x1100)
13107
- return false;
13108
- return c >= 0x1100 && c <= 0x115F ||
13109
- c >= 0x11A3 && c <= 0x11A7 ||
13110
- c >= 0x11FA && c <= 0x11FF ||
13111
- c >= 0x2329 && c <= 0x232A ||
13112
- c >= 0x2E80 && c <= 0x2E99 ||
13113
- c >= 0x2E9B && c <= 0x2EF3 ||
13114
- c >= 0x2F00 && c <= 0x2FD5 ||
13115
- c >= 0x2FF0 && c <= 0x2FFB ||
13116
- c >= 0x3000 && c <= 0x303E ||
13117
- c >= 0x3041 && c <= 0x3096 ||
13118
- c >= 0x3099 && c <= 0x30FF ||
13119
- c >= 0x3105 && c <= 0x312D ||
13120
- c >= 0x3131 && c <= 0x318E ||
13121
- c >= 0x3190 && c <= 0x31BA ||
13122
- c >= 0x31C0 && c <= 0x31E3 ||
13123
- c >= 0x31F0 && c <= 0x321E ||
13124
- c >= 0x3220 && c <= 0x3247 ||
13125
- c >= 0x3250 && c <= 0x32FE ||
13126
- c >= 0x3300 && c <= 0x4DBF ||
13127
- c >= 0x4E00 && c <= 0xA48C ||
13128
- c >= 0xA490 && c <= 0xA4C6 ||
13129
- c >= 0xA960 && c <= 0xA97C ||
13130
- c >= 0xAC00 && c <= 0xD7A3 ||
13131
- c >= 0xD7B0 && c <= 0xD7C6 ||
13132
- c >= 0xD7CB && c <= 0xD7FB ||
13133
- c >= 0xF900 && c <= 0xFAFF ||
13134
- c >= 0xFE10 && c <= 0xFE19 ||
13135
- c >= 0xFE30 && c <= 0xFE52 ||
13136
- c >= 0xFE54 && c <= 0xFE66 ||
13137
- c >= 0xFE68 && c <= 0xFE6B ||
13138
- c >= 0xFF01 && c <= 0xFF60 ||
13139
- c >= 0xFFE0 && c <= 0xFFE6;
13140
- };
13141
-
13142
- }).call(EditSession.prototype);
13143
-
13144
- require("ace/edit_session/folding").Folding.call(EditSession.prototype);
13145
-
13146
- exports.EditSession = EditSession;
13147
- });
13148
- /* ***** BEGIN LICENSE BLOCK *****
13149
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
13150
- *
13151
- * The contents of this file are subject to the Mozilla Public License Version
13152
- * 1.1 (the "License"); you may not use this file except in compliance with
13153
- * the License. You may obtain a copy of the License at
13154
- * http://www.mozilla.org/MPL/
13155
- *
13156
- * Software distributed under the License is distributed on an "AS IS" basis,
13157
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13158
- * for the specific language governing rights and limitations under the
13159
- * License.
13160
- *
13161
- * The Original Code is Ajax.org Code Editor (ACE).
13162
- *
13163
- * The Initial Developer of the Original Code is
13164
- * Ajax.org B.V.
13165
- * Portions created by the Initial Developer are Copyright (C) 2010
13166
- * the Initial Developer. All Rights Reserved.
13167
- *
13168
- * Contributor(s):
13169
- * Fabian Jakobs <fabian AT ajax DOT org>
13170
- * Julian Viereck <julian.viereck@gmail.com>
13171
- *
13172
- * Alternatively, the contents of this file may be used under the terms of
13173
- * either the GNU General Public License Version 2 or later (the "GPL"), or
13174
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
13175
- * in which case the provisions of the GPL or the LGPL are applicable instead
13176
- * of those above. If you wish to allow use of your version of this file only
13177
- * under the terms of either the GPL or the LGPL, and not to allow others to
13178
- * use your version of this file under the terms of the MPL, indicate your
13179
- * decision by deleting the provisions above and replace them with the notice
13180
- * and other provisions required by the GPL or the LGPL. If you do not delete
13181
- * the provisions above, a recipient may use your version of this file under
13182
- * the terms of any one of the MPL, the GPL or the LGPL.
13183
- *
13184
- * ***** END LICENSE BLOCK ***** */
13185
-
13186
- define('ace/selection', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'pilot/event_emitter', 'ace/range'], function(require, exports, module) {
13187
-
13188
- var oop = require("pilot/oop");
13189
- var lang = require("pilot/lang");
13190
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
13191
- var Range = require("ace/range").Range;
13192
-
13193
- /**
13194
- * Keeps cursor position and the text selection of an edit session.
13195
- *
13196
- * The row/columns used in the selection are in document coordinates
13197
- * representing ths coordinates as thez appear in the document
13198
- * before applying soft wrap and folding.
13199
- */
13200
- var Selection = function(session) {
13201
- this.session = session;
13202
- this.doc = session.getDocument();
13203
-
13204
- this.clearSelection();
13205
- this.selectionLead = this.doc.createAnchor(0, 0);
13206
- this.selectionAnchor = this.doc.createAnchor(0, 0);
13207
-
13208
- var _self = this;
13209
- this.selectionLead.on("change", function(e) {
13210
- _self._dispatchEvent("changeCursor");
13211
- if (!_self.$isEmpty)
13212
- _self._dispatchEvent("changeSelection");
13213
- if (!_self.$preventUpdateDesiredColumnOnChange && e.old.column != e.value.column)
13214
- _self.$updateDesiredColumn();
13215
- });
13216
-
13217
- this.selectionAnchor.on("change", function() {
13218
- if (!_self.$isEmpty)
13219
- _self._dispatchEvent("changeSelection");
13220
- });
13221
- };
13222
-
13223
- (function() {
13224
-
13225
- oop.implement(this, EventEmitter);
13226
-
13227
- this.isEmpty = function() {
13228
- return (this.$isEmpty || (
13229
- this.selectionAnchor.row == this.selectionLead.row &&
13230
- this.selectionAnchor.column == this.selectionLead.column
13231
- ));
13232
- };
13233
-
13234
- this.isMultiLine = function() {
13235
- if (this.isEmpty()) {
13236
- return false;
13237
- }
13238
-
13239
- return this.getRange().isMultiLine();
13240
- };
13241
-
13242
- this.getCursor = function() {
13243
- return this.selectionLead.getPosition();
13244
- };
13245
-
13246
- this.setSelectionAnchor = function(row, column) {
13247
- this.selectionAnchor.setPosition(row, column);
13248
-
13249
- if (this.$isEmpty) {
13250
- this.$isEmpty = false;
13251
- this._dispatchEvent("changeSelection");
13252
- }
13253
- };
13254
-
13255
- this.getSelectionAnchor = function() {
13256
- if (this.$isEmpty)
13257
- return this.getSelectionLead()
13258
- else
13259
- return this.selectionAnchor.getPosition();
13260
- };
13261
-
13262
- this.getSelectionLead = function() {
13263
- return this.selectionLead.getPosition();
13264
- };
13265
-
13266
- this.shiftSelection = function(columns) {
13267
- if (this.$isEmpty) {
13268
- this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
13269
- return;
13270
- };
13271
-
13272
- var anchor = this.getSelectionAnchor();
13273
- var lead = this.getSelectionLead();
13274
-
13275
- var isBackwards = this.isBackwards();
13276
-
13277
- if (!isBackwards || anchor.column !== 0)
13278
- this.setSelectionAnchor(anchor.row, anchor.column + columns);
13279
-
13280
- if (isBackwards || lead.column !== 0) {
13281
- this.$moveSelection(function() {
13282
- this.moveCursorTo(lead.row, lead.column + columns);
13283
- });
13284
- }
13285
- };
13286
-
13287
- this.isBackwards = function() {
13288
- var anchor = this.selectionAnchor;
13289
- var lead = this.selectionLead;
13290
- return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
13291
- };
13292
-
13293
- this.getRange = function() {
13294
- var anchor = this.selectionAnchor;
13295
- var lead = this.selectionLead;
13296
-
13297
- if (this.isEmpty())
13298
- return Range.fromPoints(lead, lead);
13299
-
13300
- if (this.isBackwards()) {
13301
- return Range.fromPoints(lead, anchor);
13302
- }
13303
- else {
13304
- return Range.fromPoints(anchor, lead);
13305
- }
13306
- };
13307
-
13308
- this.clearSelection = function() {
13309
- if (!this.$isEmpty) {
13310
- this.$isEmpty = true;
13311
- this._dispatchEvent("changeSelection");
13312
- }
13313
- };
13314
-
13315
- this.selectAll = function() {
13316
- var lastRow = this.doc.getLength() - 1;
13317
- this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
13318
- this.moveCursorTo(0, 0);
13319
- };
13320
-
13321
- this.setSelectionRange = function(range, reverse) {
13322
- if (reverse) {
13323
- this.setSelectionAnchor(range.end.row, range.end.column);
13324
- this.selectTo(range.start.row, range.start.column);
13325
- } else {
13326
- this.setSelectionAnchor(range.start.row, range.start.column);
13327
- this.selectTo(range.end.row, range.end.column);
13328
- }
13329
- this.$updateDesiredColumn();
13330
- };
13331
-
13332
- this.$updateDesiredColumn = function() {
13333
- var cursor = this.getCursor();
13334
- this.$desiredColumn = this.session.documentToScreenColumn(cursor.row, cursor.column);
13335
- };
13336
-
13337
- this.$moveSelection = function(mover) {
13338
- var lead = this.selectionLead;
13339
- if (this.$isEmpty)
13340
- this.setSelectionAnchor(lead.row, lead.column);
13341
-
13342
- mover.call(this);
13343
- };
13344
-
13345
- this.selectTo = function(row, column) {
13346
- this.$moveSelection(function() {
13347
- this.moveCursorTo(row, column);
13348
- });
13349
- };
13350
-
13351
- this.selectToPosition = function(pos) {
13352
- this.$moveSelection(function() {
13353
- this.moveCursorToPosition(pos);
13354
- });
13355
- };
13356
-
13357
- this.selectUp = function() {
13358
- this.$moveSelection(this.moveCursorUp);
13359
- };
13360
-
13361
- this.selectDown = function() {
13362
- this.$moveSelection(this.moveCursorDown);
13363
- };
13364
-
13365
- this.selectRight = function() {
13366
- this.$moveSelection(this.moveCursorRight);
13367
- };
13368
-
13369
- this.selectLeft = function() {
13370
- this.$moveSelection(this.moveCursorLeft);
13371
- };
13372
-
13373
- this.selectLineStart = function() {
13374
- this.$moveSelection(this.moveCursorLineStart);
13375
- };
13376
-
13377
- this.selectLineEnd = function() {
13378
- this.$moveSelection(this.moveCursorLineEnd);
13379
- };
13380
-
13381
- this.selectFileEnd = function() {
13382
- this.$moveSelection(this.moveCursorFileEnd);
13383
- };
13384
-
13385
- this.selectFileStart = function() {
13386
- this.$moveSelection(this.moveCursorFileStart);
13387
- };
13388
-
13389
- this.selectWordRight = function() {
13390
- this.$moveSelection(this.moveCursorWordRight);
13391
- };
13392
-
13393
- this.selectWordLeft = function() {
13394
- this.$moveSelection(this.moveCursorWordLeft);
13395
- };
13396
-
13397
- this.selectWord = function() {
13398
- var cursor = this.getCursor();
13399
- var range = this.session.getWordRange(cursor.row, cursor.column);
13400
- this.setSelectionRange(range);
13401
- };
13402
-
13403
- this.selectLine = function() {
13404
- var rowStart = this.selectionLead.row;
13405
- var rowEnd;
13406
-
13407
- var foldLine = this.session.getFoldLine(rowStart);
13408
- if (foldLine) {
13409
- rowStart = foldLine.start.row;
13410
- rowEnd = foldLine.end.row;
13411
- } else {
13412
- rowEnd = rowStart;
13413
- }
13414
- this.setSelectionAnchor(rowStart, 0);
13415
- this.$moveSelection(function() {
13416
- this.moveCursorTo(rowEnd + 1, 0);
13417
- });
13418
- };
13419
-
13420
- this.moveCursorUp = function() {
13421
- this.moveCursorBy(-1, 0);
13422
- };
13423
-
13424
- this.moveCursorDown = function() {
13425
- this.moveCursorBy(1, 0);
13426
- };
13427
-
13428
- this.moveCursorLeft = function() {
13429
- var cursor = this.selectionLead.getPosition(),
13430
- fold;
13431
-
13432
- if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
13433
- this.moveCursorTo(fold.start.row, fold.start.column);
13434
- } else if (cursor.column == 0) {
13435
- // cursor is a line (start
13436
- if (cursor.row > 0) {
13437
- this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
13438
- }
13439
- }
13440
- else {
13441
- var tabSize = this.session.getTabSize();
13442
- if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
13443
- this.moveCursorBy(0, -tabSize);
13444
- else
13445
- this.moveCursorBy(0, -1);
13446
- }
13447
- };
13448
-
13449
- this.moveCursorRight = function() {
13450
- var cursor = this.selectionLead.getPosition(),
13451
- fold;
13452
- if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
13453
- this.moveCursorTo(fold.end.row, fold.end.column);
13454
- }
13455
- else if (this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) {
13456
- if (this.selectionLead.row < this.doc.getLength() - 1) {
13457
- this.moveCursorTo(this.selectionLead.row + 1, 0);
13458
- }
13459
- }
13460
- else {
13461
- var tabSize = this.session.getTabSize();
13462
- var cursor = this.selectionLead;
13463
- if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
13464
- this.moveCursorBy(0, tabSize);
13465
- else
13466
- this.moveCursorBy(0, 1);
13467
- }
13468
- };
13469
-
13470
- this.moveCursorLineStart = function() {
13471
- var row = this.selectionLead.row;
13472
- var column = this.selectionLead.column;
13473
- var screenRow = this.session.documentToScreenRow(row, column);
13474
-
13475
- // Determ the doc-position of the first character at the screen line.
13476
- var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
13477
-
13478
- // Determ the line
13479
- var beforeCursor = this.session.getDisplayLine(
13480
- row, null,
13481
- firstColumnPosition.row, firstColumnPosition.column
13482
- );
13483
-
13484
- var leadingSpace = beforeCursor.match(/^\s*/);
13485
- if (leadingSpace[0].length == column) {
13486
- this.moveCursorTo(
13487
- firstColumnPosition.row, firstColumnPosition.column
13488
- );
13489
- }
13490
- else {
13491
- this.moveCursorTo(
13492
- firstColumnPosition.row,
13493
- firstColumnPosition.column + leadingSpace[0].length
13494
- );
13495
- }
13496
- };
13497
-
13498
- this.moveCursorLineEnd = function() {
13499
- var lead = this.selectionLead;
13500
- var lastRowColumnPosition =
13501
- this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
13502
- this.moveCursorTo(
13503
- lastRowColumnPosition.row,
13504
- lastRowColumnPosition.column
13505
- );
13506
- };
13507
-
13508
- this.moveCursorFileEnd = function() {
13509
- var row = this.doc.getLength() - 1;
13510
- var column = this.doc.getLine(row).length;
13511
- this.moveCursorTo(row, column);
13512
- };
13513
-
13514
- this.moveCursorFileStart = function() {
13515
- this.moveCursorTo(0, 0);
13516
- };
13517
-
13518
- this.moveCursorWordRight = function() {
13519
- var row = this.selectionLead.row;
13520
- var column = this.selectionLead.column;
13521
- var line = this.doc.getLine(row);
13522
- var rightOfCursor = line.substring(column);
13523
-
13524
- var match;
13525
- this.session.nonTokenRe.lastIndex = 0;
13526
- this.session.tokenRe.lastIndex = 0;
13527
-
13528
- var fold;
13529
- if (fold = this.session.getFoldAt(row, column, 1)) {
13530
- this.moveCursorTo(fold.end.row, fold.end.column);
13531
- return;
13532
- } else if (column == line.length) {
13533
- this.moveCursorRight();
13534
- return;
13535
- }
13536
- else if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
13537
- column += this.session.nonTokenRe.lastIndex;
13538
- this.session.nonTokenRe.lastIndex = 0;
13539
- }
13540
- else if (match = this.session.tokenRe.exec(rightOfCursor)) {
13541
- column += this.session.tokenRe.lastIndex;
13542
- this.session.tokenRe.lastIndex = 0;
13543
- }
13544
-
13545
- this.moveCursorTo(row, column);
13546
- };
13547
-
13548
- this.moveCursorWordLeft = function() {
13549
- var row = this.selectionLead.row;
13550
- var column = this.selectionLead.column;
13551
-
13552
- var fold;
13553
- if (fold = this.session.getFoldAt(row, column, -1)) {
13554
- this.moveCursorTo(fold.start.row, fold.start.column);
13555
- return;
13556
- }
13557
-
13558
- if (column == 0) {
13559
- this.moveCursorLeft();
13560
- return;
13561
- }
13562
-
13563
- var str = this.session.getFoldStringAt(row, column, -1);
13564
- if (str == null) {
13565
- str = this.doc.getLine(row).substring(0, column)
13566
- }
13567
- var leftOfCursor = lang.stringReverse(str);
13568
-
13569
- var match;
13570
- this.session.nonTokenRe.lastIndex = 0;
13571
- this.session.tokenRe.lastIndex = 0;
13572
-
13573
- if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
13574
- column -= this.session.nonTokenRe.lastIndex;
13575
- this.session.nonTokenRe.lastIndex = 0;
13576
- }
13577
- else if (match = this.session.tokenRe.exec(leftOfCursor)) {
13578
- column -= this.session.tokenRe.lastIndex;
13579
- this.session.tokenRe.lastIndex = 0;
13580
- }
13581
-
13582
- this.moveCursorTo(row, column);
13583
- };
13584
-
13585
- this.moveCursorBy = function(rows, chars) {
13586
- var screenPos = this.session.documentToScreenPosition(
13587
- this.selectionLead.row,
13588
- this.selectionLead.column
13589
- );
13590
- var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column;
13591
- var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
13592
- this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
13593
- };
13594
-
13595
- this.moveCursorToPosition = function(position) {
13596
- this.moveCursorTo(position.row, position.column);
13597
- };
13598
-
13599
- this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
13600
- // Ensure the row/column is not inside of a fold.
13601
- var fold = this.session.getFoldAt(row, column, 1);
13602
- if (fold) {
13603
- row = fold.start.row;
13604
- column = fold.start.column;
13605
- }
13606
-
13607
- this.$preventUpdateDesiredColumnOnChange = true;
13608
- this.selectionLead.setPosition(row, column);
13609
- this.$preventUpdateDesiredColumnOnChange = false;
13610
-
13611
- if (!preventUpdateDesiredColumn)
13612
- this.$updateDesiredColumn(this.selectionLead.column);
13613
- };
13614
-
13615
- this.moveCursorToScreen = function(row, column, preventUpdateDesiredColumn) {
13616
- var pos = this.session.screenToDocumentPosition(row, column);
13617
- row = pos.row;
13618
- column = pos.column;
13619
- this.moveCursorTo(row, column, preventUpdateDesiredColumn);
13620
- };
13621
-
13622
- }).call(Selection.prototype);
13623
-
13624
- exports.Selection = Selection;
13625
- });
13626
- /* vim:ts=4:sts=4:sw=4:
13627
- * ***** BEGIN LICENSE BLOCK *****
13628
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
13629
- *
13630
- * The contents of this file are subject to the Mozilla Public License Version
13631
- * 1.1 (the "License"); you may not use this file except in compliance with
13632
- * the License. You may obtain a copy of the License at
13633
- * http://www.mozilla.org/MPL/
13634
- *
13635
- * Software distributed under the License is distributed on an "AS IS" basis,
13636
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13637
- * for the specific language governing rights and limitations under the
13638
- * License.
13639
- *
13640
- * The Original Code is Ajax.org Code Editor (ACE).
13641
- *
13642
- * The Initial Developer of the Original Code is
13643
- * Ajax.org B.V.
13644
- * Portions created by the Initial Developer are Copyright (C) 2010
13645
- * the Initial Developer. All Rights Reserved.
13646
- *
13647
- * Contributor(s):
13648
- * Fabian Jakobs <fabian AT ajax DOT org>
13649
- * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
13650
- * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
13651
- *
13652
- * Alternatively, the contents of this file may be used under the terms of
13653
- * either the GNU General Public License Version 2 or later (the "GPL"), or
13654
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
13655
- * in which case the provisions of the GPL or the LGPL are applicable instead
13656
- * of those above. If you wish to allow use of your version of this file only
13657
- * under the terms of either the GPL or the LGPL, and not to allow others to
13658
- * use your version of this file under the terms of the MPL, indicate your
13659
- * decision by deleting the provisions above and replace them with the notice
13660
- * and other provisions required by the GPL or the LGPL. If you do not delete
13661
- * the provisions above, a recipient may use your version of this file under
13662
- * the terms of any one of the MPL, the GPL or the LGPL.
13663
- *
13664
- * ***** END LICENSE BLOCK ***** */
13665
-
13666
- define('ace/mode/text', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/behaviour', 'ace/unicode'], function(require, exports, module) {
13667
-
13668
- var Tokenizer = require("ace/tokenizer").Tokenizer;
13669
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
13670
- var Behaviour = require("ace/mode/behaviour").Behaviour;
13671
- var unicode = require("ace/unicode");
13672
-
13673
- var Mode = function() {
13674
- this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules());
13675
- this.$behaviour = new Behaviour();
13676
- };
13677
-
13678
- (function() {
13679
-
13680
- this.tokenRe = new RegExp("^["
13681
- + unicode.packages.L
13682
- + unicode.packages.Mn + unicode.packages.Mc
13683
- + unicode.packages.Nd
13684
- + unicode.packages.Pc + "\\$_]+", "g"
13685
- );
13686
-
13687
- this.nonTokenRe = new RegExp("^(?:[^"
13688
- + unicode.packages.L
13689
- + unicode.packages.Mn + unicode.packages.Mc
13690
- + unicode.packages.Nd
13691
- + unicode.packages.Pc + "\\$_]|\s])+", "g"
13692
- );
13693
-
13694
- this.getTokenizer = function() {
13695
- return this.$tokenizer;
13696
- };
13697
-
13698
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
13699
- };
13700
-
13701
- this.getNextLineIndent = function(state, line, tab) {
13702
- return "";
13703
- };
13704
-
13705
- this.checkOutdent = function(state, line, input) {
13706
- return false;
13707
- };
13708
-
13709
- this.autoOutdent = function(state, doc, row) {
13710
- };
13711
-
13712
- this.$getIndent = function(line) {
13713
- var match = line.match(/^(\s+)/);
13714
- if (match) {
13715
- return match[1];
13716
- }
13717
-
13718
- return "";
13719
- };
13720
-
13721
- this.createWorker = function(session) {
13722
- return null;
13723
- };
13724
-
13725
- this.highlightSelection = function(editor) {
13726
- var session = editor.session;
13727
- if (!session.$selectionOccurrences)
13728
- session.$selectionOccurrences = [];
13729
-
13730
- if (session.$selectionOccurrences.length)
13731
- this.clearSelectionHighlight(editor);
13732
-
13733
- var selection = editor.getSelectionRange();
13734
- if (selection.isEmpty() || selection.isMultiLine())
13735
- return;
13736
-
13737
- var startOuter = selection.start.column - 1;
13738
- var endOuter = selection.end.column + 1;
13739
- var line = session.getLine(selection.start.row);
13740
- var lineCols = line.length;
13741
- var needle = line.substring(Math.max(startOuter, 0),
13742
- Math.min(endOuter, lineCols));
13743
-
13744
- // Make sure the outer characters are not part of the word.
13745
- if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
13746
- (endOuter <= lineCols && /[\w\d]$/.test(needle)))
13747
- return;
13748
-
13749
- needle = line.substring(selection.start.column, selection.end.column);
13750
- if (!/^[\w\d]+$/.test(needle))
13751
- return;
13752
-
13753
- var cursor = editor.getCursorPosition();
13754
-
13755
- var newOptions = {
13756
- wrap: true,
13757
- wholeWord: true,
13758
- caseSensitive: true,
13759
- needle: needle
13760
- };
13761
-
13762
- var currentOptions = editor.$search.getOptions();
13763
- editor.$search.set(newOptions);
13764
-
13765
- var ranges = editor.$search.findAll(session);
13766
- ranges.forEach(function(range) {
13767
- if (!range.contains(cursor.row, cursor.column)) {
13768
- var marker = session.addMarker(range, "ace_selected_word", "text");
13769
- session.$selectionOccurrences.push(marker);
13770
- }
13771
- });
13772
-
13773
- editor.$search.set(currentOptions);
13774
- };
13775
-
13776
- this.clearSelectionHighlight = function(editor) {
13777
- if (!editor.session.$selectionOccurrences)
13778
- return;
13779
-
13780
- editor.session.$selectionOccurrences.forEach(function(marker) {
13781
- editor.session.removeMarker(marker);
13782
- });
13783
-
13784
- editor.session.$selectionOccurrences = [];
13785
- };
13786
-
13787
- this.createModeDelegates = function (mapping) {
13788
- if (!this.$embeds) {
13789
- return;
13790
- }
13791
- this.$modes = {};
13792
- for (var i = 0; i < this.$embeds.length; i++) {
13793
- if (mapping[this.$embeds[i]]) {
13794
- this.$modes[this.$embeds[i]] = new mapping[this.$embeds[i]]();
13795
- }
13796
- }
13797
-
13798
- var delegations = ['toggleCommentLines', 'getNextLineIndent', 'checkOutdent', 'autoOutdent', 'transformAction'];
13799
-
13800
- for (var i = 0; i < delegations.length; i++) {
13801
- (function(scope) {
13802
- var functionName = delegations[i];
13803
- var defaultHandler = scope[functionName];
13804
- scope[delegations[i]] = function() {
13805
- return this.$delegator(functionName, arguments, defaultHandler);
13806
- }
13807
- } (this));
13808
- }
13809
- }
13810
-
13811
- this.$delegator = function(method, args, defaultHandler) {
13812
- var state = args[0];
13813
-
13814
- for (var i = 0; i < this.$embeds.length; i++) {
13815
- if (!this.$modes[this.$embeds[i]]) continue;
13816
-
13817
- var split = state.split(this.$embeds[i]);
13818
- if (!split[0] && split[1]) {
13819
- args[0] = split[1];
13820
- var mode = this.$modes[this.$embeds[i]];
13821
- return mode[method].apply(mode, args);
13822
- }
13823
- }
13824
- var ret = defaultHandler.apply(this, args);
13825
- return defaultHandler ? ret : undefined;
13826
- };
13827
-
13828
- this.transformAction = function(state, action, editor, session, param) {
13829
- if (this.$behaviour) {
13830
- var behaviours = this.$behaviour.getBehaviours();
13831
- for (var key in behaviours) {
13832
- if (behaviours[key][action]) {
13833
- var ret = behaviours[key][action].apply(this, arguments);
13834
- if (ret !== false) {
13835
- return ret;
13836
- }
13837
- }
13838
- }
13839
- }
13840
- return false;
13841
- }
13842
-
13843
- }).call(Mode.prototype);
13844
-
13845
- exports.Mode = Mode;
13846
- });
13847
- /* ***** BEGIN LICENSE BLOCK *****
13848
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
13849
- *
13850
- * The contents of this file are subject to the Mozilla Public License Version
13851
- * 1.1 (the "License"); you may not use this file except in compliance with
13852
- * the License. You may obtain a copy of the License at
13853
- * http://www.mozilla.org/MPL/
13854
- *
13855
- * Software distributed under the License is distributed on an "AS IS" basis,
13856
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13857
- * for the specific language governing rights and limitations under the
13858
- * License.
13859
- *
13860
- * The Original Code is Ajax.org Code Editor (ACE).
13861
- *
13862
- * The Initial Developer of the Original Code is
13863
- * Ajax.org B.V.
13864
- * Portions created by the Initial Developer are Copyright (C) 2010
13865
- * the Initial Developer. All Rights Reserved.
13866
- *
13867
- * Contributor(s):
13868
- * Fabian Jakobs <fabian AT ajax DOT org>
13869
- *
13870
- * Alternatively, the contents of this file may be used under the terms of
13871
- * either the GNU General Public License Version 2 or later (the "GPL"), or
13872
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
13873
- * in which case the provisions of the GPL or the LGPL are applicable instead
13874
- * of those above. If you wish to allow use of your version of this file only
13875
- * under the terms of either the GPL or the LGPL, and not to allow others to
13876
- * use your version of this file under the terms of the MPL, indicate your
13877
- * decision by deleting the provisions above and replace them with the notice
13878
- * and other provisions required by the GPL or the LGPL. If you do not delete
13879
- * the provisions above, a recipient may use your version of this file under
13880
- * the terms of any one of the MPL, the GPL or the LGPL.
13881
- *
13882
- * ***** END LICENSE BLOCK ***** */
13883
-
13884
- define('ace/tokenizer', ['require', 'exports', 'module' ], function(require, exports, module) {
13885
-
13886
- var Tokenizer = function(rules) {
13887
- this.rules = rules;
13888
-
13889
- this.regExps = {};
13890
- this.matchMappings = {};
13891
- for ( var key in this.rules) {
13892
- var rule = this.rules[key];
13893
- var state = rule;
13894
- var ruleRegExps = [];
13895
- var matchTotal = 0;
13896
- var mapping = this.matchMappings[key] = {};
13897
-
13898
- for ( var i = 0; i < state.length; i++) {
13899
- // Count number of matching groups. 2 extra groups from the full match
13900
- // And the catch-all on the end (used to force a match);
13901
- var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
13902
-
13903
- // Replace any backreferences and offset appropriately.
13904
- var adjustedregex = state[i].regex.replace(/\\([0-9]+)/g, function (match, digit) {
13905
- return "\\" + (parseInt(digit, 10) + matchTotal + 1);
13906
- });
13907
-
13908
- mapping[matchTotal] = {
13909
- rule: i,
13910
- len: matchcount
13911
- };
13912
- matchTotal += matchcount;
13913
-
13914
- ruleRegExps.push(adjustedregex);
13915
- }
13916
-
13917
- this.regExps[key] = new RegExp("(?:(" + ruleRegExps.join(")|(") + ")|(.))", "g");
13918
- }
13919
- };
13920
-
13921
- (function() {
13922
-
13923
- this.getLineTokens = function(line, startState) {
13924
- var currentState = startState;
13925
- var state = this.rules[currentState];
13926
- var mapping = this.matchMappings[currentState];
13927
- var re = this.regExps[currentState];
13928
- re.lastIndex = 0;
13929
-
13930
- var match, tokens = [];
13931
-
13932
- var lastIndex = 0;
13933
-
13934
- var token = {
13935
- type: null,
13936
- value: ""
13937
- };
13938
-
13939
- while (match = re.exec(line)) {
13940
- var type = "text";
13941
- var rule = null;
13942
- var value = [match[0]];
13943
-
13944
- for (var i = 0; i < match.length-2; i++) {
13945
- if (match[i + 1] !== undefined) {
13946
- rule = state[mapping[i].rule];
13947
-
13948
- if (mapping[i].len > 1) {
13949
- value = match.slice(i+2, i+1+mapping[i].len);
13950
- }
13951
-
13952
- // compute token type
13953
- if (typeof rule.token == "function")
13954
- type = rule.token.apply(this, value);
13955
- else
13956
- type = rule.token;
13957
-
13958
- var next = rule.next;
13959
- if (next && next !== currentState) {
13960
- currentState = next;
13961
- state = this.rules[currentState];
13962
- mapping = this.matchMappings[currentState];
13963
- lastIndex = re.lastIndex;
13964
-
13965
- re = this.regExps[currentState];
13966
- re.lastIndex = lastIndex;
13967
- }
13968
- break;
13969
- }
13970
- };
13971
-
13972
- if (value[0]) {
13973
- if (typeof type == "string") {
13974
- value = [value.join("")];
13975
- type = [type];
13976
- }
13977
- for (var i = 0; i < value.length; i++) {
13978
- if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
13979
- token.value += value[i];
13980
- } else {
13981
- if (token.type) {
13982
- tokens.push(token);
13983
- }
13984
-
13985
- token = {
13986
- type: type[i],
13987
- value: value[i]
13988
- }
13989
- }
13990
- }
13991
- }
13992
-
13993
- if (lastIndex == line.length)
13994
- break;
13995
-
13996
- lastIndex = re.lastIndex;
13997
- };
13998
-
13999
- if (token.type)
14000
- tokens.push(token);
14001
-
14002
- return {
14003
- tokens : tokens,
14004
- state : currentState
14005
- };
14006
- };
14007
-
14008
- }).call(Tokenizer.prototype);
14009
-
14010
- exports.Tokenizer = Tokenizer;
14011
- });
14012
- /* ***** BEGIN LICENSE BLOCK *****
14013
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
14014
- *
14015
- * The contents of this file are subject to the Mozilla Public License Version
14016
- * 1.1 (the "License"); you may not use this file except in compliance with
14017
- * the License. You may obtain a copy of the License at
14018
- * http://www.mozilla.org/MPL/
14019
- *
14020
- * Software distributed under the License is distributed on an "AS IS" basis,
14021
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14022
- * for the specific language governing rights and limitations under the
14023
- * License.
14024
- *
14025
- * The Original Code is Ajax.org Code Editor (ACE).
14026
- *
14027
- * The Initial Developer of the Original Code is
14028
- * Ajax.org B.V.
14029
- * Portions created by the Initial Developer are Copyright (C) 2010
14030
- * the Initial Developer. All Rights Reserved.
14031
- *
14032
- * Contributor(s):
14033
- * Fabian Jakobs <fabian AT ajax DOT org>
14034
- *
14035
- * Alternatively, the contents of this file may be used under the terms of
14036
- * either the GNU General Public License Version 2 or later (the "GPL"), or
14037
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
14038
- * in which case the provisions of the GPL or the LGPL are applicable instead
14039
- * of those above. If you wish to allow use of your version of this file only
14040
- * under the terms of either the GPL or the LGPL, and not to allow others to
14041
- * use your version of this file under the terms of the MPL, indicate your
14042
- * decision by deleting the provisions above and replace them with the notice
14043
- * and other provisions required by the GPL or the LGPL. If you do not delete
14044
- * the provisions above, a recipient may use your version of this file under
14045
- * the terms of any one of the MPL, the GPL or the LGPL.
14046
- *
14047
- * ***** END LICENSE BLOCK ***** */
14048
-
14049
- define('ace/mode/text_highlight_rules', ['require', 'exports', 'module' , 'pilot/lang'], function(require, exports, module) {
14050
-
14051
- var lang = require("pilot/lang");
14052
-
14053
- var TextHighlightRules = function() {
14054
-
14055
- // regexp must not have capturing parentheses
14056
- // regexps are ordered -> the first match is used
14057
-
14058
- this.$rules = {
14059
- "start" : [{
14060
- token : "empty_line",
14061
- regex : '^$'
14062
- }, {
14063
- token : "text",
14064
- regex : ".+"
14065
- }]
14066
- };
14067
- };
14068
-
14069
- (function() {
14070
-
14071
- this.addRules = function(rules, prefix) {
14072
- for (var key in rules) {
14073
- var state = rules[key];
14074
- for (var i=0; i<state.length; i++) {
14075
- var rule = state[i];
14076
- if (rule.next) {
14077
- rule.next = prefix + rule.next;
14078
- } else {
14079
- rule.next = prefix + key;
14080
- }
14081
- }
14082
- this.$rules[prefix + key] = state;
14083
- }
14084
- };
14085
-
14086
- this.getRules = function() {
14087
- return this.$rules;
14088
- };
14089
-
14090
- this.embedRules = function (HighlightRules, prefix, escapeRules, states) {
14091
- var embedRules = new HighlightRules().getRules();
14092
- if (states) {
14093
- for (var i = 0; i < states.length; i++) {
14094
- states[i] = prefix + states[i];
14095
- }
14096
- } else {
14097
- states = [];
14098
- for (var key in embedRules) {
14099
- states.push(prefix + key);
14100
- }
14101
- }
14102
- this.addRules(embedRules, prefix);
14103
-
14104
- for (var i = 0; i < states.length; i++) {
14105
- Array.prototype.unshift.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
14106
- }
14107
-
14108
- if (!this.$embeds) {
14109
- this.$embeds = [];
14110
- }
14111
- this.$embeds.push(prefix);
14112
- }
14113
-
14114
- this.getEmbeds = function() {
14115
- return this.$embeds;
14116
- }
14117
-
14118
- }).call(TextHighlightRules.prototype);
14119
-
14120
- exports.TextHighlightRules = TextHighlightRules;
14121
- });
14122
- /* vim:ts=4:sts=4:sw=4:
14123
- * ***** BEGIN LICENSE BLOCK *****
14124
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
14125
- *
14126
- * The contents of this file are subject to the Mozilla Public License Version
14127
- * 1.1 (the "License"); you may not use this file except in compliance with
14128
- * the License. You may obtain a copy of the License at
14129
- * http://www.mozilla.org/MPL/
14130
- *
14131
- * Software distributed under the License is distributed on an "AS IS" basis,
14132
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14133
- * for the specific language governing rights and limitations under the
14134
- * License.
14135
- *
14136
- * The Original Code is Ajax.org Code Editor (ACE).
14137
- *
14138
- * The Initial Developer of the Original Code is
14139
- * Ajax.org B.V.
14140
- * Portions created by the Initial Developer are Copyright (C) 2010
14141
- * the Initial Developer. All Rights Reserved.
14142
- *
14143
- * Contributor(s):
14144
- * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
14145
- *
14146
- * Alternatively, the contents of this file may be used under the terms of
14147
- * either the GNU General Public License Version 2 or later (the "GPL"), or
14148
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
14149
- * in which case the provisions of the GPL or the LGPL are applicable instead
14150
- * of those above. If you wish to allow use of your version of this file only
14151
- * under the terms of either the GPL or the LGPL, and not to allow others to
14152
- * use your version of this file under the terms of the MPL, indicate your
14153
- * decision by deleting the provisions above and replace them with the notice
14154
- * and other provisions required by the GPL or the LGPL. If you do not delete
14155
- * the provisions above, a recipient may use your version of this file under
14156
- * the terms of any one of the MPL, the GPL or the LGPL.
14157
- *
14158
- * ***** END LICENSE BLOCK ***** */
14159
-
14160
- define('ace/mode/behaviour', ['require', 'exports', 'module' ], function(require, exports, module) {
14161
-
14162
- var Behaviour = function() {
14163
- this.$behaviours = {};
14164
- };
14165
-
14166
- (function () {
14167
-
14168
- this.add = function (name, action, callback) {
14169
- switch (undefined) {
14170
- case this.$behaviours:
14171
- this.$behaviours = {};
14172
- case this.$behaviours[name]:
14173
- this.$behaviours[name] = {};
14174
- }
14175
- this.$behaviours[name][action] = callback;
14176
- }
14177
-
14178
- this.addBehaviours = function (behaviours) {
14179
- for (var key in behaviours) {
14180
- for (var action in behaviours[key]) {
14181
- this.add(key, action, behaviours[key][action]);
14182
- }
14183
- }
14184
- }
14185
-
14186
- this.remove = function (name) {
14187
- if (this.$behaviours && this.$behaviours[name]) {
14188
- delete this.$behaviours[name];
14189
- }
14190
- }
14191
-
14192
- this.inherit = function (mode, filter) {
14193
- if (typeof mode === "function") {
14194
- var behaviours = new mode().getBehaviours(filter);
14195
- } else {
14196
- var behaviours = mode.getBehaviours(filter);
14197
- }
14198
- this.addBehaviours(behaviours);
14199
- }
14200
-
14201
- this.getBehaviours = function (filter) {
14202
- if (!filter) {
14203
- return this.$behaviours;
14204
- } else {
14205
- var ret = {}
14206
- for (var i = 0; i < filter.length; i++) {
14207
- if (this.$behaviours[filter[i]]) {
14208
- ret[filter[i]] = this.$behaviours[filter[i]];
14209
- }
14210
- }
14211
- return ret;
14212
- }
14213
- }
14214
-
14215
- }).call(Behaviour.prototype);
14216
-
14217
- exports.Behaviour = Behaviour;
14218
- });define('ace/unicode', ['require', 'exports', 'module' ], function(require, exports, module) {
14219
-
14220
- /*
14221
- XRegExp Unicode plugin pack: Categories 1.0
14222
- (c) 2010 Steven Levithan
14223
- MIT License
14224
- <http://xregexp.com>
14225
- Uses the Unicode 5.2 character database
14226
-
14227
- This package for the XRegExp Unicode plugin enables the following Unicode categories (aka properties):
14228
-
14229
- L - Letter (the top-level Letter category is included in the Unicode plugin base script)
14230
- Ll - Lowercase letter
14231
- Lu - Uppercase letter
14232
- Lt - Titlecase letter
14233
- Lm - Modifier letter
14234
- Lo - Letter without case
14235
- M - Mark
14236
- Mn - Non-spacing mark
14237
- Mc - Spacing combining mark
14238
- Me - Enclosing mark
14239
- N - Number
14240
- Nd - Decimal digit
14241
- Nl - Letter number
14242
- No - Other number
14243
- P - Punctuation
14244
- Pd - Dash punctuation
14245
- Ps - Open punctuation
14246
- Pe - Close punctuation
14247
- Pi - Initial punctuation
14248
- Pf - Final punctuation
14249
- Pc - Connector punctuation
14250
- Po - Other punctuation
14251
- S - Symbol
14252
- Sm - Math symbol
14253
- Sc - Currency symbol
14254
- Sk - Modifier symbol
14255
- So - Other symbol
14256
- Z - Separator
14257
- Zs - Space separator
14258
- Zl - Line separator
14259
- Zp - Paragraph separator
14260
- C - Other
14261
- Cc - Control
14262
- Cf - Format
14263
- Co - Private use
14264
- Cs - Surrogate
14265
- Cn - Unassigned
14266
-
14267
- Example usage:
14268
-
14269
- \p{N}
14270
- \p{Cn}
14271
- */
14272
-
14273
-
14274
- // will be populated by addUnicodePackage
14275
- exports.packages = {};
14276
-
14277
- addUnicodePackage({
14278
- L: "0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
14279
- Ll: "0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",
14280
- Lu: "0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",
14281
- Lt: "01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",
14282
- Lm: "02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",
14283
- Lo: "01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
14284
- M: "0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",
14285
- Mn: "0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",
14286
- Mc: "0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",
14287
- Me: "0488048906DE20DD-20E020E2-20E4A670-A672",
14288
- N: "0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
14289
- Nd: "0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
14290
- Nl: "16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",
14291
- No: "00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",
14292
- P: "0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",
14293
- Pd: "002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",
14294
- Ps: "0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",
14295
- Pe: "0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",
14296
- Pi: "00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",
14297
- Pf: "00BB2019201D203A2E032E052E0A2E0D2E1D2E21",
14298
- Pc: "005F203F20402054FE33FE34FE4D-FE4FFF3F",
14299
- Po: "0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",
14300
- S: "0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",
14301
- Sm: "002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",
14302
- Sc: "002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",
14303
- Sk: "005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",
14304
- So: "00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",
14305
- Z: "002000A01680180E2000-200A20282029202F205F3000",
14306
- Zs: "002000A01680180E2000-200A202F205F3000",
14307
- Zl: "2028",
14308
- Zp: "2029",
14309
- C: "0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",
14310
- Cc: "0000-001F007F-009F",
14311
- Cf: "00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",
14312
- Co: "E000-F8FF",
14313
- Cs: "D800-DFFF",
14314
- Cn: "03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"
14315
- });
14316
-
14317
- function addUnicodePackage (pack) {
14318
- var codePoint = /\w{4}/g;
14319
- for (var name in pack)
14320
- exports.packages[name] = pack[name].replace(codePoint, "\\u$&");
14321
- };
14322
-
14323
- });/* ***** BEGIN LICENSE BLOCK *****
14324
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
14325
- *
14326
- * The contents of this file are subject to the Mozilla Public License Version
14327
- * 1.1 (the "License"); you may not use this file except in compliance with
14328
- * the License. You may obtain a copy of the License at
14329
- * http://www.mozilla.org/MPL/
14330
- *
14331
- * Software distributed under the License is distributed on an "AS IS" basis,
14332
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14333
- * for the specific language governing rights and limitations under the
14334
- * License.
14335
- *
14336
- * The Original Code is Ajax.org Code Editor (ACE).
14337
- *
14338
- * The Initial Developer of the Original Code is
14339
- * Ajax.org B.V.
14340
- * Portions created by the Initial Developer are Copyright (C) 2010
14341
- * the Initial Developer. All Rights Reserved.
14342
- *
14343
- * Contributor(s):
14344
- * Fabian Jakobs <fabian AT ajax DOT org>
14345
- *
14346
- * Alternatively, the contents of this file may be used under the terms of
14347
- * either the GNU General Public License Version 2 or later (the "GPL"), or
14348
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
14349
- * in which case the provisions of the GPL or the LGPL are applicable instead
14350
- * of those above. If you wish to allow use of your version of this file only
14351
- * under the terms of either the GPL or the LGPL, and not to allow others to
14352
- * use your version of this file under the terms of the MPL, indicate your
14353
- * decision by deleting the provisions above and replace them with the notice
14354
- * and other provisions required by the GPL or the LGPL. If you do not delete
14355
- * the provisions above, a recipient may use your version of this file under
14356
- * the terms of any one of the MPL, the GPL or the LGPL.
14357
- *
14358
- * ***** END LICENSE BLOCK ***** */
14359
-
14360
- define('ace/document', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
14361
-
14362
- var oop = require("pilot/oop");
14363
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
14364
- var Range = require("ace/range").Range;
14365
- var Anchor = require("ace/anchor").Anchor;
14366
-
14367
- var Document = function(text) {
14368
- this.$lines = [];
14369
-
14370
- if (Array.isArray(text)) {
14371
- this.insertLines(0, text);
14372
- }
14373
- // There has to be one line at least in the document. If you pass an empty
14374
- // string to the insert function, nothing will happen. Workaround.
14375
- else if (text.length == 0) {
14376
- this.$lines = [""];
14377
- } else {
14378
- this.insert({row: 0, column:0}, text);
14379
- }
14380
- };
14381
-
14382
- (function() {
14383
-
14384
- oop.implement(this, EventEmitter);
14385
-
14386
- this.setValue = function(text) {
14387
- var len = this.getLength();
14388
- this.remove(new Range(0, 0, len, this.getLine(len-1).length));
14389
- this.insert({row: 0, column:0}, text);
14390
- };
14391
-
14392
- this.getValue = function() {
14393
- return this.getAllLines().join(this.getNewLineCharacter());
14394
- };
14395
-
14396
- this.createAnchor = function(row, column) {
14397
- return new Anchor(this, row, column);
14398
- };
14399
-
14400
- // check for IE split bug
14401
- if ("aaa".split(/a/).length == 0)
14402
- this.$split = function(text) {
14403
- return text.replace(/\r\n|\r/g, "\n").split("\n");
14404
- }
14405
- else
14406
- this.$split = function(text) {
14407
- return text.split(/\r\n|\r|\n/);
14408
- };
14409
-
14410
-
14411
- this.$detectNewLine = function(text) {
14412
- var match = text.match(/^.*?(\r?\n)/m);
14413
- if (match) {
14414
- this.$autoNewLine = match[1];
14415
- } else {
14416
- this.$autoNewLine = "\n";
14417
- }
14418
- };
14419
-
14420
- this.getNewLineCharacter = function() {
14421
- switch (this.$newLineMode) {
14422
- case "windows":
14423
- return "\r\n";
14424
-
14425
- case "unix":
14426
- return "\n";
14427
-
14428
- case "auto":
14429
- return this.$autoNewLine;
14430
- }
14431
- },
14432
-
14433
- this.$autoNewLine = "\n";
14434
- this.$newLineMode = "auto";
14435
- this.setNewLineMode = function(newLineMode) {
14436
- if (this.$newLineMode === newLineMode) return;
14437
-
14438
- this.$newLineMode = newLineMode;
14439
- };
14440
-
14441
- this.getNewLineMode = function() {
14442
- return this.$newLineMode;
14443
- };
14444
-
14445
- this.isNewLine = function(text) {
14446
- return (text == "\r\n" || text == "\r" || text == "\n");
14447
- };
14448
-
14449
- /**
14450
- * Get a verbatim copy of the given line as it is in the document
14451
- */
14452
- this.getLine = function(row) {
14453
- return this.$lines[row] || "";
14454
- };
14455
-
14456
- this.getLines = function(firstRow, lastRow) {
14457
- return this.$lines.slice(firstRow, lastRow + 1);
14458
- };
14459
-
14460
- /**
14461
- * Returns all lines in the document as string array. Warning: The caller
14462
- * should not modify this array!
14463
- */
14464
- this.getAllLines = function() {
14465
- return this.getLines(0, this.getLength());
14466
- };
14467
-
14468
- this.getLength = function() {
14469
- return this.$lines.length;
14470
- };
14471
-
14472
- this.getTextRange = function(range) {
14473
- if (range.start.row == range.end.row) {
14474
- return this.$lines[range.start.row].substring(range.start.column,
14475
- range.end.column);
14476
- }
14477
- else {
14478
- var lines = [];
14479
- lines.push(this.$lines[range.start.row].substring(range.start.column));
14480
- lines.push.apply(lines, this.getLines(range.start.row+1, range.end.row-1));
14481
- lines.push(this.$lines[range.end.row].substring(0, range.end.column));
14482
- return lines.join(this.getNewLineCharacter());
14483
- }
14484
- };
14485
-
14486
- this.$clipPosition = function(position) {
14487
- var length = this.getLength();
14488
- if (position.row >= length) {
14489
- position.row = Math.max(0, length - 1);
14490
- position.column = this.getLine(length-1).length;
14491
- }
14492
- return position;
14493
- }
14494
-
14495
- this.insert = function(position, text) {
14496
- if (text.length == 0)
14497
- return position;
14498
-
14499
- position = this.$clipPosition(position);
14500
-
14501
- if (this.getLength() <= 1)
14502
- this.$detectNewLine(text);
14503
-
14504
- var lines = this.$split(text);
14505
- var firstLine = lines.splice(0, 1)[0];
14506
- var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
14507
-
14508
- position = this.insertInLine(position, firstLine);
14509
- if (lastLine !== null) {
14510
- position = this.insertNewLine(position); // terminate first line
14511
- position = this.insertLines(position.row, lines);
14512
- position = this.insertInLine(position, lastLine || "");
14513
- }
14514
- return position;
14515
- };
14516
-
14517
- this.insertLines = function(row, lines) {
14518
- if (lines.length == 0)
14519
- return {row: row, column: 0};
14520
-
14521
- var args = [row, 0];
14522
- args.push.apply(args, lines);
14523
- this.$lines.splice.apply(this.$lines, args);
14524
-
14525
- var range = new Range(row, 0, row + lines.length, 0);
14526
- var delta = {
14527
- action: "insertLines",
14528
- range: range,
14529
- lines: lines
14530
- };
14531
- this._dispatchEvent("change", { data: delta });
14532
- return range.end;
14533
- },
14534
-
14535
- this.insertNewLine = function(position) {
14536
- position = this.$clipPosition(position);
14537
- var line = this.$lines[position.row] || "";
14538
-
14539
- this.$lines[position.row] = line.substring(0, position.column);
14540
- this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
14541
-
14542
- var end = {
14543
- row : position.row + 1,
14544
- column : 0
14545
- };
14546
-
14547
- var delta = {
14548
- action: "insertText",
14549
- range: Range.fromPoints(position, end),
14550
- text: this.getNewLineCharacter()
14551
- };
14552
- this._dispatchEvent("change", { data: delta });
14553
-
14554
- return end;
14555
- };
14556
-
14557
- this.insertInLine = function(position, text) {
14558
- if (text.length == 0)
14559
- return position;
14560
-
14561
- var line = this.$lines[position.row] || "";
14562
-
14563
- this.$lines[position.row] = line.substring(0, position.column) + text
14564
- + line.substring(position.column);
14565
-
14566
- var end = {
14567
- row : position.row,
14568
- column : position.column + text.length
14569
- };
14570
-
14571
- var delta = {
14572
- action: "insertText",
14573
- range: Range.fromPoints(position, end),
14574
- text: text
14575
- };
14576
- this._dispatchEvent("change", { data: delta });
14577
-
14578
- return end;
14579
- };
14580
-
14581
- this.remove = function(range) {
14582
- // clip to document
14583
- range.start = this.$clipPosition(range.start);
14584
- range.end = this.$clipPosition(range.end);
14585
-
14586
- if (range.isEmpty())
14587
- return range.start;
14588
-
14589
- var firstRow = range.start.row;
14590
- var lastRow = range.end.row;
14591
-
14592
- if (range.isMultiLine()) {
14593
- var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
14594
- var lastFullRow = lastRow - 1;
14595
-
14596
- if (range.end.column > 0)
14597
- this.removeInLine(lastRow, 0, range.end.column);
14598
-
14599
- if (lastFullRow >= firstFullRow)
14600
- this.removeLines(firstFullRow, lastFullRow);
14601
-
14602
- if (firstFullRow != firstRow) {
14603
- this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
14604
- this.removeNewLine(range.start.row);
14605
- }
14606
- }
14607
- else {
14608
- this.removeInLine(firstRow, range.start.column, range.end.column);
14609
- }
14610
- return range.start;
14611
- };
14612
-
14613
- this.removeInLine = function(row, startColumn, endColumn) {
14614
- if (startColumn == endColumn)
14615
- return;
14616
-
14617
- var range = new Range(row, startColumn, row, endColumn);
14618
- var line = this.getLine(row);
14619
- var removed = line.substring(startColumn, endColumn);
14620
- var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
14621
- this.$lines.splice(row, 1, newLine);
14622
-
14623
- var delta = {
14624
- action: "removeText",
14625
- range: range,
14626
- text: removed
14627
- };
14628
- this._dispatchEvent("change", { data: delta });
14629
- return range.start;
14630
- };
14631
-
14632
- /**
14633
- * Removes a range of full lines
14634
- *
14635
- * @param firstRow {Integer} The first row to be removed
14636
- * @param lastRow {Integer} The last row to be removed
14637
- * @return {String[]} The removed lines
14638
- */
14639
- this.removeLines = function(firstRow, lastRow) {
14640
- var range = new Range(firstRow, 0, lastRow + 1, 0);
14641
- var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
14642
-
14643
- var delta = {
14644
- action: "removeLines",
14645
- range: range,
14646
- nl: this.getNewLineCharacter(),
14647
- lines: removed
14648
- };
14649
- this._dispatchEvent("change", { data: delta });
14650
- return removed;
14651
- };
14652
-
14653
- this.removeNewLine = function(row) {
14654
- var firstLine = this.getLine(row);
14655
- var secondLine = this.getLine(row+1);
14656
-
14657
- var range = new Range(row, firstLine.length, row+1, 0);
14658
- var line = firstLine + secondLine;
14659
-
14660
- this.$lines.splice(row, 2, line);
14661
-
14662
- var delta = {
14663
- action: "removeText",
14664
- range: range,
14665
- text: this.getNewLineCharacter()
14666
- };
14667
- this._dispatchEvent("change", { data: delta });
14668
- };
14669
-
14670
- this.replace = function(range, text) {
14671
- if (text.length == 0 && range.isEmpty())
14672
- return range.start;
14673
-
14674
- // Shortcut: If the text we want to insert is the same as it is already
14675
- // in the document, we don't have to replace anything.
14676
- if (text == this.getTextRange(range))
14677
- return range.end;
14678
-
14679
- this.remove(range);
14680
- if (text) {
14681
- var end = this.insert(range.start, text);
14682
- }
14683
- else {
14684
- end = range.start;
14685
- }
14686
-
14687
- return end;
14688
- };
14689
-
14690
- this.applyDeltas = function(deltas) {
14691
- for (var i=0; i<deltas.length; i++) {
14692
- var delta = deltas[i];
14693
- var range = Range.fromPoints(delta.range.start, delta.range.end);
14694
-
14695
- if (delta.action == "insertLines")
14696
- this.insertLines(range.start.row, delta.lines)
14697
- else if (delta.action == "insertText")
14698
- this.insert(range.start, delta.text)
14699
- else if (delta.action == "removeLines")
14700
- this.removeLines(range.start.row, range.end.row - 1)
14701
- else if (delta.action == "removeText")
14702
- this.remove(range)
14703
- }
14704
- };
14705
-
14706
- this.revertDeltas = function(deltas) {
14707
- for (var i=deltas.length-1; i>=0; i--) {
14708
- var delta = deltas[i];
14709
-
14710
- var range = Range.fromPoints(delta.range.start, delta.range.end);
14711
-
14712
- if (delta.action == "insertLines")
14713
- this.removeLines(range.start.row, range.end.row - 1)
14714
- else if (delta.action == "insertText")
14715
- this.remove(range)
14716
- else if (delta.action == "removeLines")
14717
- this.insertLines(range.start.row, delta.lines)
14718
- else if (delta.action == "removeText")
14719
- this.insert(range.start, delta.text)
14720
- }
14721
- };
14722
-
14723
- }).call(Document.prototype);
14724
-
14725
- exports.Document = Document;
14726
- });
14727
- /* ***** BEGIN LICENSE BLOCK *****
14728
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
14729
- *
14730
- * The contents of this file are subject to the Mozilla Public License Version
14731
- * 1.1 (the "License"); you may not use this file except in compliance with
14732
- * the License. You may obtain a copy of the License at
14733
- * http://www.mozilla.org/MPL/
14734
- *
14735
- * Software distributed under the License is distributed on an "AS IS" basis,
14736
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14737
- * for the specific language governing rights and limitations under the
14738
- * License.
14739
- *
14740
- * The Original Code is Ajax.org Code Editor (ACE).
14741
- *
14742
- * The Initial Developer of the Original Code is
14743
- * Ajax.org B.V.
14744
- * Portions created by the Initial Developer are Copyright (C) 2010
14745
- * the Initial Developer. All Rights Reserved.
14746
- *
14747
- * Contributor(s):
14748
- * Fabian Jakobs <fabian AT ajax DOT org>
14749
- *
14750
- * Alternatively, the contents of this file may be used under the terms of
14751
- * either the GNU General Public License Version 2 or later (the "GPL"), or
14752
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
14753
- * in which case the provisions of the GPL or the LGPL are applicable instead
14754
- * of those above. If you wish to allow use of your version of this file only
14755
- * under the terms of either the GPL or the LGPL, and not to allow others to
14756
- * use your version of this file under the terms of the MPL, indicate your
14757
- * decision by deleting the provisions above and replace them with the notice
14758
- * and other provisions required by the GPL or the LGPL. If you do not delete
14759
- * the provisions above, a recipient may use your version of this file under
14760
- * the terms of any one of the MPL, the GPL or the LGPL.
14761
- *
14762
- * ***** END LICENSE BLOCK ***** */
14763
-
14764
- define('ace/anchor', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event_emitter'], function(require, exports, module) {
14765
-
14766
- var oop = require("pilot/oop");
14767
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
14768
-
14769
- /**
14770
- * An Anchor is a floating pointer in the document. Whenever text is inserted or
14771
- * deleted before the cursor, the position of the cursor is updated
14772
- */
14773
- var Anchor = exports.Anchor = function(doc, row, column) {
14774
- this.document = doc;
14775
-
14776
- if (typeof column == "undefined")
14777
- this.setPosition(row.row, row.column);
14778
- else
14779
- this.setPosition(row, column);
14780
-
14781
- this.$onChange = this.onChange.bind(this);
14782
- doc.on("change", this.$onChange);
14783
- };
14784
-
14785
- (function() {
14786
-
14787
- oop.implement(this, EventEmitter);
14788
-
14789
- this.getPosition = function() {
14790
- return this.$clipPositionToDocument(this.row, this.column);
14791
- };
14792
-
14793
- this.getDocument = function() {
14794
- return this.document;
14795
- };
14796
-
14797
- this.onChange = function(e) {
14798
- var delta = e.data;
14799
- var range = delta.range;
14800
-
14801
- if (range.start.row == range.end.row && range.start.row != this.row)
14802
- return;
14803
-
14804
- if (range.start.row > this.row)
14805
- return;
14806
-
14807
- if (range.start.row == this.row && range.start.column > this.column)
14808
- return;
14809
-
14810
- var row = this.row;
14811
- var column = this.column;
14812
-
14813
- if (delta.action === "insertText") {
14814
- if (range.start.row === row && range.start.column <= column) {
14815
- if (range.start.row === range.end.row) {
14816
- column += range.end.column - range.start.column;
14817
- }
14818
- else {
14819
- column -= range.start.column;
14820
- row += range.end.row - range.start.row;
14821
- }
14822
- }
14823
- else if (range.start.row !== range.end.row && range.start.row < row) {
14824
- row += range.end.row - range.start.row;
14825
- }
14826
- } else if (delta.action === "insertLines") {
14827
- if (range.start.row <= row) {
14828
- row += range.end.row - range.start.row;
14829
- }
14830
- }
14831
- else if (delta.action == "removeText") {
14832
- if (range.start.row == row && range.start.column < column) {
14833
- if (range.end.column >= column)
14834
- column = range.start.column;
14835
- else
14836
- column = Math.max(0, column - (range.end.column - range.start.column));
14837
-
14838
- } else if (range.start.row !== range.end.row && range.start.row < row) {
14839
- if (range.end.row == row) {
14840
- column = Math.max(0, column - range.end.column) + range.start.column;
14841
- }
14842
- row -= (range.end.row - range.start.row);
14843
- }
14844
- else if (range.end.row == row) {
14845
- row -= range.end.row - range.start.row;
14846
- column = Math.max(0, column - range.end.column) + range.start.column;
14847
- }
14848
- } else if (delta.action == "removeLines") {
14849
- if (range.start.row <= row) {
14850
- if (range.end.row <= row)
14851
- row -= range.end.row - range.start.row;
14852
- else {
14853
- row = range.start.row;
14854
- column = 0;
14855
- }
14856
- }
14857
- }
14858
-
14859
- this.setPosition(row, column, true);
14860
- };
14861
-
14862
- this.setPosition = function(row, column, noClip) {
14863
- var pos;
14864
- if (noClip) {
14865
- pos = {
14866
- row: row,
14867
- column: column
14868
- };
14869
- }
14870
- else {
14871
- pos = this.$clipPositionToDocument(row, column);
14872
- }
14873
-
14874
- if (this.row == pos.row && this.column == pos.column)
14875
- return;
14876
-
14877
- var old = {
14878
- row: this.row,
14879
- column: this.column
14880
- };
14881
-
14882
- this.row = pos.row;
14883
- this.column = pos.column;
14884
- this._dispatchEvent("change", {
14885
- old: old,
14886
- value: pos
14887
- });
14888
- };
14889
-
14890
- this.detach = function() {
14891
- this.document.removeEventListener("change", this.$onChange);
14892
- };
14893
-
14894
- this.$clipPositionToDocument = function(row, column) {
14895
- var pos = {};
14896
-
14897
- if (row >= this.document.getLength()) {
14898
- pos.row = Math.max(0, this.document.getLength() - 1);
14899
- pos.column = this.document.getLine(pos.row).length;
14900
- }
14901
- else if (row < 0) {
14902
- pos.row = 0;
14903
- pos.column = 0;
14904
- }
14905
- else {
14906
- pos.row = row;
14907
- pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
14908
- }
14909
-
14910
- if (column < 0)
14911
- pos.column = 0;
14912
-
14913
- return pos;
14914
- };
14915
-
14916
- }).call(Anchor.prototype);
14917
-
14918
- });
14919
- /* ***** BEGIN LICENSE BLOCK *****
14920
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
14921
- *
14922
- * The contents of this file are subject to the Mozilla Public License Version
14923
- * 1.1 (the "License"); you may not use this file except in compliance with
14924
- * the License. You may obtain a copy of the License at
14925
- * http://www.mozilla.org/MPL/
14926
- *
14927
- * Software distributed under the License is distributed on an "AS IS" basis,
14928
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14929
- * for the specific language governing rights and limitations under the
14930
- * License.
14931
- *
14932
- * The Original Code is Ajax.org Code Editor (ACE).
14933
- *
14934
- * The Initial Developer of the Original Code is
14935
- * Ajax.org B.V.
14936
- * Portions created by the Initial Developer are Copyright (C) 2010
14937
- * the Initial Developer. All Rights Reserved.
14938
- *
14939
- * Contributor(s):
14940
- * Fabian Jakobs <fabian AT ajax DOT org>
14941
- *
14942
- * Alternatively, the contents of this file may be used under the terms of
14943
- * either the GNU General Public License Version 2 or later (the "GPL"), or
14944
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
14945
- * in which case the provisions of the GPL or the LGPL are applicable instead
14946
- * of those above. If you wish to allow use of your version of this file only
14947
- * under the terms of either the GPL or the LGPL, and not to allow others to
14948
- * use your version of this file under the terms of the MPL, indicate your
14949
- * decision by deleting the provisions above and replace them with the notice
14950
- * and other provisions required by the GPL or the LGPL. If you do not delete
14951
- * the provisions above, a recipient may use your version of this file under
14952
- * the terms of any one of the MPL, the GPL or the LGPL.
14953
- *
14954
- * ***** END LICENSE BLOCK ***** */
14955
-
14956
- define('ace/background_tokenizer', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event_emitter'], function(require, exports, module) {
14957
-
14958
- var oop = require("pilot/oop");
14959
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
14960
-
14961
- var BackgroundTokenizer = function(tokenizer, editor) {
14962
- this.running = false;
14963
- this.lines = [];
14964
- this.currentLine = 0;
14965
- this.tokenizer = tokenizer;
14966
-
14967
- var self = this;
14968
-
14969
- this.$worker = function() {
14970
- if (!self.running) { return; }
14971
-
14972
- var workerStart = new Date();
14973
- var startLine = self.currentLine;
14974
- var doc = self.doc;
14975
-
14976
- var processedLines = 0;
14977
-
14978
- var len = doc.getLength();
14979
- while (self.currentLine < len) {
14980
- self.lines[self.currentLine] = self.$tokenizeRows(self.currentLine, self.currentLine)[0];
14981
- self.currentLine++;
14982
-
14983
- // only check every 5 lines
14984
- processedLines += 1;
14985
- if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
14986
- self.fireUpdateEvent(startLine, self.currentLine-1);
14987
- self.running = setTimeout(self.$worker, 20);
14988
- return;
14989
- }
14990
- }
14991
-
14992
- self.running = false;
14993
-
14994
- self.fireUpdateEvent(startLine, len - 1);
14995
- };
14996
- };
14997
-
14998
- (function(){
14999
-
15000
- oop.implement(this, EventEmitter);
15001
-
15002
- this.setTokenizer = function(tokenizer) {
15003
- this.tokenizer = tokenizer;
15004
- this.lines = [];
15005
-
15006
- this.start(0);
15007
- };
15008
-
15009
- this.setDocument = function(doc) {
15010
- this.doc = doc;
15011
- this.lines = [];
15012
-
15013
- this.stop();
15014
- };
15015
-
15016
- this.fireUpdateEvent = function(firstRow, lastRow) {
15017
- var data = {
15018
- first: firstRow,
15019
- last: lastRow
15020
- };
15021
- this._dispatchEvent("update", {data: data});
15022
- };
15023
-
15024
- this.start = function(startRow) {
15025
- this.currentLine = Math.min(startRow || 0, this.currentLine,
15026
- this.doc.getLength());
15027
-
15028
- // remove all cached items below this line
15029
- this.lines.splice(this.currentLine, this.lines.length);
15030
-
15031
- this.stop();
15032
- // pretty long delay to prevent the tokenizer from interfering with the user
15033
- this.running = setTimeout(this.$worker, 700);
15034
- };
15035
-
15036
- this.stop = function() {
15037
- if (this.running)
15038
- clearTimeout(this.running);
15039
- this.running = false;
15040
- };
15041
-
15042
- this.getTokens = function(firstRow, lastRow) {
15043
- return this.$tokenizeRows(firstRow, lastRow);
15044
- };
15045
-
15046
- this.getState = function(row) {
15047
- return this.$tokenizeRows(row, row)[0].state;
15048
- };
15049
-
15050
- this.$tokenizeRows = function(firstRow, lastRow) {
15051
- if (!this.doc)
15052
- return [];
15053
-
15054
- var rows = [];
15055
-
15056
- // determine start state
15057
- var state = "start";
15058
- var doCache = false;
15059
- if (firstRow > 0 && this.lines[firstRow - 1]) {
15060
- state = this.lines[firstRow - 1].state;
15061
- doCache = true;
15062
- } else if (firstRow == 0) {
15063
- state = "start";
15064
- doCache = true;
15065
- } else if (this.lines.length > 0) {
15066
- // Guess that we haven't changed state.
15067
- state = this.lines[this.lines.length-1].state;
15068
- }
15069
-
15070
- var lines = this.doc.getLines(firstRow, lastRow);
15071
- for (var row=firstRow; row<=lastRow; row++) {
15072
- if (!this.lines[row]) {
15073
- var tokens = this.tokenizer.getLineTokens(lines[row-firstRow] || "", state);
15074
- var state = tokens.state;
15075
- rows.push(tokens);
15076
-
15077
- if (doCache) {
15078
- this.lines[row] = tokens;
15079
- }
15080
- }
15081
- else {
15082
- var tokens = this.lines[row];
15083
- state = tokens.state;
15084
- rows.push(tokens);
15085
- }
15086
- }
15087
- return rows;
15088
- };
15089
-
15090
- }).call(BackgroundTokenizer.prototype);
15091
-
15092
- exports.BackgroundTokenizer = BackgroundTokenizer;
15093
- });
15094
- /* vim:ts=4:sts=4:sw=4:
15095
- * ***** BEGIN LICENSE BLOCK *****
15096
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
15097
- *
15098
- * The contents of this file are subject to the Mozilla Public License Version
15099
- * 1.1 (the "License"); you may not use this file except in compliance with
15100
- * the License. You may obtain a copy of the License at
15101
- * http://www.mozilla.org/MPL/
15102
- *
15103
- * Software distributed under the License is distributed on an "AS IS" basis,
15104
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15105
- * for the specific language governing rights and limitations under the
15106
- * License.
15107
- *
15108
- * The Original Code is Ajax.org Code Editor (ACE).
15109
- *
15110
- * The Initial Developer of the Original Code is
15111
- * Ajax.org B.V.
15112
- * Portions created by the Initial Developer are Copyright (C) 2010
15113
- * the Initial Developer. All Rights Reserved.
15114
- *
15115
- * Contributor(s):
15116
- * Julian Viereck <julian DOT viereck AT gmail DOT com>
15117
- *
15118
- * Alternatively, the contents of this file may be used under the terms of
15119
- * either the GNU General Public License Version 2 or later (the "GPL"), or
15120
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
15121
- * in which case the provisions of the GPL or the LGPL are applicable instead
15122
- * of those above. If you wish to allow use of your version of this file only
15123
- * under the terms of either the GPL or the LGPL, and not to allow others to
15124
- * use your version of this file under the terms of the MPL, indicate your
15125
- * decision by deleting the provisions above and replace them with the notice
15126
- * and other provisions required by the GPL or the LGPL. If you do not delete
15127
- * the provisions above, a recipient may use your version of this file under
15128
- * the terms of any one of the MPL, the GPL or the LGPL.
15129
- *
15130
- * ***** END LICENSE BLOCK ***** */
15131
-
15132
- define('ace/edit_session/folding', ['require', 'exports', 'module' , 'ace/range', 'ace/edit_session/fold_line', 'ace/edit_session/fold'], function(require, exports, module) {
15133
-
15134
- var Range = require("ace/range").Range;
15135
- var FoldLine = require("ace/edit_session/fold_line").FoldLine;
15136
- var Fold = require("ace/edit_session/fold").Fold;
15137
-
15138
- function Folding() {
15139
- /**
15140
- * Looks up a fold at a given row/column. Possible values for side:
15141
- * -1: ignore a fold if fold.start = row/column
15142
- * +1: ignore a fold if fold.end = row/column
15143
- */
15144
- this.getFoldAt = function(row, column, side) {
15145
- var foldLine = this.getFoldLine(row);
15146
- if (!foldLine)
15147
- return null;
15148
-
15149
- var folds = foldLine.folds;
15150
- for (var i = 0; i < folds.length; i++) {
15151
- var fold = folds[i];
15152
- if (fold.range.contains(row, column)) {
15153
- if (side == 1 && fold.range.isEnd(row, column)) {
15154
- continue;
15155
- } else if (side == -1 && fold.range.isStart(row, column)) {
15156
- continue;
15157
- }
15158
- return fold;
15159
- }
15160
- }
15161
- };
15162
-
15163
- /**
15164
- * Returns all folds in the given range. Note, that this will return folds
15165
- *
15166
- */
15167
- this.getFoldsInRange = function(range) {
15168
- range = range.clone();
15169
- var start = range.start;
15170
- var end = range.end;
15171
- var foldLines = this.$foldData;
15172
- var foundFolds = [];
15173
-
15174
- start.column += 1;
15175
- end.column -= 1;
15176
-
15177
- for (var i = 0; i < foldLines.length; i++) {
15178
- var cmp = foldLines[i].range.compareRange(range);
15179
- if (cmp == 2) {
15180
- // Range is before foldLine. No intersection. This means,
15181
- // there might be other foldLines that intersect.
15182
- continue;
15183
- }
15184
- else if (cmp == -2) {
15185
- // Range is after foldLine. There can't be any other foldLines then,
15186
- // so let's give up.
15187
- break;
15188
- }
15189
-
15190
- var folds = foldLines[i].folds;
15191
- for (var j = 0; j < folds.length; j++) {
15192
- var fold = folds[j];
15193
- cmp = fold.range.compareRange(range);
15194
- if (cmp == -2) {
15195
- break;
15196
- } else if (cmp == 2) {
15197
- continue;
15198
- } else
15199
- // WTF-state: Can happen due to -1/+1 to start/end column.
15200
- if (cmp == 42) {
15201
- break;
15202
- }
15203
- foundFolds.push(fold);
15204
- }
15205
- }
15206
- return foundFolds;
15207
- }
15208
-
15209
- /**
15210
- * Returns the string between folds at the given position.
15211
- * E.g.
15212
- * foo<fold>b|ar<fold>wolrd -> "bar"
15213
- * foo<fold>bar<fold>wol|rd -> "world"
15214
- * foo<fold>bar<fo|ld>wolrd -> <null>
15215
- *
15216
- * where | means the position of row/column
15217
- *
15218
- * The trim option determs if the return string should be trimed according
15219
- * to the "side" passed with the trim value:
15220
- *
15221
- * E.g.
15222
- * foo<fold>b|ar<fold>wolrd -trim=-1> "b"
15223
- * foo<fold>bar<fold>wol|rd -trim=+1> "rld"
15224
- * fo|o<fold>bar<fold>wolrd -trim=00> "foo"
15225
- */
15226
- this.getFoldStringAt = function(row, column, trim, foldLine) {
15227
- var foldLine = foldLine || this.getFoldLine(row);
15228
- if (!foldLine)
15229
- return null;
15230
-
15231
- var lastFold = {
15232
- end: { column: 0 }
15233
- };
15234
- // TODO: Refactor to use getNextFoldTo function.
15235
- for (var i = 0; i < foldLine.folds.length; i++) {
15236
- var fold = foldLine.folds[i];
15237
- var cmp = fold.range.compareEnd(row, column);
15238
- if (cmp == -1) {
15239
- var str = this
15240
- .getLine(fold.start.row)
15241
- .substring(lastFold.end.column, fold.start.column);
15242
- break;
15243
- }
15244
- else if (cmp == 0) {
15245
- return null;
15246
- }
15247
- lastFold = fold;
15248
- }
15249
- if (!str)
15250
- str = this.getLine(fold.start.row).substring(lastFold.end.column);
15251
-
15252
- if (trim == -1)
15253
- return str.substring(0, column - lastFold.end.column);
15254
- else if (trim == 1)
15255
- return str.substring(column - lastFold.end.column)
15256
- else
15257
- return str;
15258
- }
15259
-
15260
- this.getFoldLine = function(docRow, startFoldLine) {
15261
- var foldData = this.$foldData;
15262
- var i = 0;
15263
- if (startFoldLine)
15264
- i = foldData.indexOf(startFoldLine);
15265
- if (i == -1)
15266
- i = 0;
15267
- for (i; i < foldData.length; i++) {
15268
- var foldLine = foldData[i];
15269
- if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
15270
- return foldLine;
15271
- } else if (foldLine.end.row > docRow) {
15272
- return null;
15273
- }
15274
- }
15275
- return null;
15276
- }
15277
-
15278
- // returns the fold which starts after or contains docRow
15279
- this.getNextFold = function(docRow, startFoldLine) {
15280
- var foldData = this.$foldData, ans;
15281
- var i = 0;
15282
- if (startFoldLine)
15283
- i = foldData.indexOf(startFoldLine);
15284
- if (i == -1)
15285
- i = 0;
15286
- for (i; i < foldData.length; i++) {
15287
- var foldLine = foldData[i];
15288
- if (foldLine.end.row >= docRow) {
15289
- return foldLine;
15290
- }
15291
- }
15292
- return null;
15293
- }
15294
-
15295
- this.getFoldedRowCount = function(first, last) {
15296
- var foldData = this.$foldData, rowCount = last-first+1;
15297
- for (var i = 0; i < foldData.length; i++) {
15298
- var foldLine = foldData[i],
15299
- end = foldLine.end.row,
15300
- start = foldLine.start.row;
15301
- if (end >= last) {
15302
- if(start < last) {
15303
- if(start >= first)
15304
- rowCount -= last-start;
15305
- else
15306
- rowCount = 0;//in one fold
15307
- }
15308
- break;
15309
- } else if(end >= first){
15310
- if (start >= first) //fold inside range
15311
- rowCount -= end-start;
15312
- else
15313
- rowCount -= end-first+1;
15314
- }
15315
- }
15316
- return rowCount;
15317
- }
15318
-
15319
- this.$addFoldLine = function(foldLine) {
15320
- this.$foldData.push(foldLine);
15321
- this.$foldData.sort(function(a, b) {
15322
- return a.start.row - b.start.row;
15323
- });
15324
- return foldLine;
15325
- }
15326
-
15327
- /**
15328
- * Adds a new fold.
15329
- *
15330
- * @returns
15331
- * The new created Fold object or an existing fold object in case the
15332
- * passed in range fits an existing fold exactly.
15333
- */
15334
- this.addFold = function(placeholder, range) {
15335
- var foldData = this.$foldData;
15336
- var added = false;
15337
-
15338
- if (placeholder instanceof Fold)
15339
- var fold = placeholder;
15340
- else
15341
- fold = new Fold(range, placeholder);
15342
-
15343
- var startRow = fold.start.row;
15344
- var startColumn = fold.start.column;
15345
- var endRow = fold.end.row;
15346
- var endColumn = fold.end.column;
15347
-
15348
- // --- Some checking ---
15349
- if (fold.placeholder.length < 2)
15350
- throw "Placeholder has to be at least 2 characters";
15351
-
15352
- if (startRow == endRow && endColumn - startColumn < 2)
15353
- throw "The range has to be at least 2 characters width";
15354
-
15355
- var existingFold = this.getFoldAt(startRow, startColumn, 1);
15356
- if (
15357
- existingFold
15358
- && existingFold.range.isEnd(endRow, endColumn)
15359
- && existingFold.range.isStart(startRow, startColumn)
15360
- ) {
15361
- return fold;
15362
- }
15363
-
15364
- existingFold = this.getFoldAt(startRow, startColumn, 1);
15365
- if (existingFold && !existingFold.range.isStart(startRow, startColumn))
15366
- throw "A fold can't start inside of an already existing fold";
15367
-
15368
- existingFold = this.getFoldAt(endRow, endColumn, -1);
15369
- if (existingFold && !existingFold.range.isEnd(endRow, endColumn))
15370
- throw "A fold can't end inside of an already existing fold";
15371
-
15372
- if (endRow >= this.doc.getLength())
15373
- throw "End of fold is outside of the document.";
15374
-
15375
- if (endColumn > this.getLine(endRow).length || startColumn > this.getLine(startRow).length)
15376
- throw "End of fold is outside of the document.";
15377
-
15378
- // Check if there are folds in the range we create the new fold for.
15379
- var folds = this.getFoldsInRange(fold.range);
15380
- if (folds.length > 0) {
15381
- // Remove the folds from fold data.
15382
- this.removeFolds(folds);
15383
- // Add the removed folds as subfolds on the new fold.
15384
- fold.subFolds = folds;
15385
- }
15386
-
15387
- for (var i = 0; i < foldData.length; i++) {
15388
- var foldLine = foldData[i];
15389
- if (endRow == foldLine.start.row) {
15390
- foldLine.addFold(fold);
15391
- added = true;
15392
- break;
15393
- }
15394
- else if (startRow == foldLine.end.row) {
15395
- foldLine.addFold(fold);
15396
- added = true;
15397
- if (!fold.sameRow) {
15398
- // Check if we might have to merge two FoldLines.
15399
- foldLineNext = foldData[i + 1];
15400
- if (foldLineNext && foldLineNext.start.row == endRow) {
15401
- // We need to merge!
15402
- foldLine.merge(foldLineNext);
15403
- break;
15404
- }
15405
- }
15406
- break;
15407
- }
15408
- else if (endRow <= foldLine.start.row) {
15409
- break;
15410
- }
15411
- }
15412
-
15413
- if (!added)
15414
- foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
15415
-
15416
- if (this.$useWrapMode)
15417
- this.$updateWrapData(foldLine.start.row, foldLine.start.row);
15418
-
15419
- // Notify that fold data has changed.
15420
- this.$modified = true;
15421
- this._dispatchEvent("changeFold", { data: fold });
15422
-
15423
- return fold;
15424
- };
15425
-
15426
- this.addFolds = function(folds) {
15427
- folds.forEach(function(fold) {
15428
- this.addFold(fold);
15429
- }, this);
15430
- };
15431
-
15432
- this.removeFold = function(fold) {
15433
- var foldLine = fold.foldLine;
15434
- var startRow = foldLine.start.row;
15435
- var endRow = foldLine.end.row;
15436
-
15437
- var foldLines = this.$foldData,
15438
- folds = foldLine.folds;
15439
- // Simple case where there is only one fold in the FoldLine such that
15440
- // the entire fold line can get removed directly.
15441
- if (folds.length == 1) {
15442
- foldLines.splice(foldLines.indexOf(foldLine), 1);
15443
- } else
15444
- // If the fold is the last fold of the foldLine, just remove it.
15445
- if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
15446
- folds.pop();
15447
- foldLine.end.row = folds[folds.length - 1].end.row;
15448
- foldLine.end.column = folds[folds.length - 1].end.column;
15449
- } else
15450
- // If the fold is the first fold of the foldLine, just remove it.
15451
- if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
15452
- folds.shift();
15453
- foldLine.start.row = folds[0].start.row;
15454
- foldLine.start.column = folds[0].start.column;
15455
- } else
15456
- // We know there are more then 2 folds and the fold is not at the edge.
15457
- // This means, the fold is somewhere in between.
15458
- //
15459
- // If the fold is in one row, we just can remove it.
15460
- if (fold.sameRow) {
15461
- folds.splice(folds.indexOf(fold), 1);
15462
- } else
15463
- // The fold goes over more then one row. This means remvoing this fold
15464
- // will cause the fold line to get splitted up.
15465
- {
15466
- var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
15467
- newFoldLine.folds.shift();
15468
- foldLine.start.row = folds[0].start.row;
15469
- foldLine.start.column = folds[0].start.column;
15470
- this.$addFoldLine(newFoldLine);
15471
- }
15472
-
15473
- if (this.$useWrapMode) {
15474
- this.$updateWrapData(startRow, endRow);
15475
- }
15476
-
15477
- // Notify that fold data has changed.
15478
- this.$modified = true;
15479
- this._dispatchEvent("changeFold", { data: fold });
15480
- }
15481
-
15482
- this.removeFolds = function(folds) {
15483
- // We need to clone the folds array passed in as it might be the folds
15484
- // array of a fold line and as we call this.removeFold(fold), folds
15485
- // are removed from folds and changes the current index.
15486
- var cloneFolds = [];
15487
- for (var i = 0; i < folds.length; i++) {
15488
- cloneFolds.push(folds[i]);
15489
- }
15490
-
15491
- cloneFolds.forEach(function(fold) {
15492
- this.removeFold(fold);
15493
- }, this);
15494
- this.$modified = true;
15495
- }
15496
-
15497
- this.expandFold = function(fold) {
15498
- this.removeFold(fold);
15499
- fold.subFolds.forEach(function(fold) {
15500
- this.addFold(fold);
15501
- }, this);
15502
- fold.subFolds = [];
15503
- }
15504
-
15505
- this.expandFolds = function(folds) {
15506
- folds.forEach(function(fold) {
15507
- this.expandFold(fold);
15508
- }, this);
15509
- }
15510
-
15511
- /**
15512
- * Checks if a given documentRow is folded. This is true if there are some
15513
- * folded parts such that some parts of the line is still visible.
15514
- **/
15515
- this.isRowFolded = function(docRow, startFoldRow) {
15516
- return !!this.getFoldLine(docRow, startFoldRow);
15517
- };
15518
-
15519
- this.getRowFoldEnd = function(docRow, startFoldRow) {
15520
- var foldLine = this.getFoldLine(docRow, startFoldRow);
15521
- return (foldLine
15522
- ? foldLine.end.row
15523
- : docRow)
15524
- };
15525
-
15526
- this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
15527
- if (startRow == null) {
15528
- startRow = foldLine.start.row;
15529
- startColumn = 0;
15530
- }
15531
-
15532
- if (endRow == null) {
15533
- endRow = foldLine.end.row;
15534
- endColumn = this.getLine(endRow).length;
15535
- }
15536
-
15537
- // Build the textline using the FoldLine walker.
15538
- var line = "";
15539
- var doc = this.doc;
15540
- var textLine = "";
15541
-
15542
- foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
15543
- if (row < startRow) {
15544
- return;
15545
- } else if (row == startRow) {
15546
- if (column < startColumn) {
15547
- return;
15548
- }
15549
- lastColumn = Math.max(startColumn, lastColumn);
15550
- }
15551
- if (placeholder) {
15552
- textLine += placeholder;
15553
- } else {
15554
- textLine += doc.getLine(row).substring(lastColumn, column);
15555
- }
15556
- }.bind(this), endRow, endColumn);
15557
- return textLine;
15558
- };
15559
-
15560
- this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
15561
- var foldLine = this.getFoldLine(row);
15562
-
15563
- if (!foldLine) {
15564
- var line;
15565
- line = this.doc.getLine(row);
15566
- return line.substring(startColumn || 0, endColumn || line.length);
15567
- } else {
15568
- return this.getFoldDisplayLine(
15569
- foldLine, row, endColumn, startRow, startColumn);
15570
- }
15571
- };
15572
-
15573
- this.$cloneFoldData = function() {
15574
- var foldData = this.$foldData;
15575
- var fd = [];
15576
- fd = this.$foldData.map(function(foldLine) {
15577
- var folds = foldLine.folds.map(function(fold) {
15578
- return fold.clone();
15579
- });
15580
- return new FoldLine(fd, folds);
15581
- });
15582
-
15583
- return fd;
15584
- };
15585
- }
15586
-
15587
- exports.Folding = Folding;
15588
-
15589
- });/* vim:ts=4:sts=4:sw=4:
15590
- * ***** BEGIN LICENSE BLOCK *****
15591
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
15592
- *
15593
- * The contents of this file are subject to the Mozilla Public License Version
15594
- * 1.1 (the "License"); you may not use this file except in compliance with
15595
- * the License. You may obtain a copy of the License at
15596
- * http://www.mozilla.org/MPL/
15597
- *
15598
- * Software distributed under the License is distributed on an "AS IS" basis,
15599
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15600
- * for the specific language governing rights and limitations under the
15601
- * License.
15602
- *
15603
- * The Original Code is Ajax.org Code Editor (ACE).
15604
- *
15605
- * The Initial Developer of the Original Code is
15606
- * Ajax.org B.V.
15607
- * Portions created by the Initial Developer are Copyright (C) 2010
15608
- * the Initial Developer. All Rights Reserved.
15609
- *
15610
- * Contributor(s):
15611
- * Julian Viereck <julian DOT viereck AT gmail DOT com>
15612
- *
15613
- * Alternatively, the contents of this file may be used under the terms of
15614
- * either the GNU General Public License Version 2 or later (the "GPL"), or
15615
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
15616
- * in which case the provisions of the GPL or the LGPL are applicable instead
15617
- * of those above. If you wish to allow use of your version of this file only
15618
- * under the terms of either the GPL or the LGPL, and not to allow others to
15619
- * use your version of this file under the terms of the MPL, indicate your
15620
- * decision by deleting the provisions above and replace them with the notice
15621
- * and other provisions required by the GPL or the LGPL. If you do not delete
15622
- * the provisions above, a recipient may use your version of this file under
15623
- * the terms of any one of the MPL, the GPL or the LGPL.
15624
- *
15625
- * ***** END LICENSE BLOCK ***** */
15626
-
15627
- define('ace/edit_session/fold_line', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
15628
-
15629
- var Range = require("ace/range").Range;
15630
-
15631
- /**
15632
- * If the an array is passed in, the folds are expected to be sorted already.
15633
- */
15634
- function FoldLine(foldData, folds) {
15635
- this.foldData = foldData;
15636
- if (Array.isArray(folds)) {
15637
- this.folds = folds;
15638
- } else {
15639
- folds = this.folds = [ folds ];
15640
- }
15641
-
15642
- var last = folds[folds.length - 1]
15643
- this.range = new Range(folds[0].start.row, folds[0].start.column,
15644
- last.end.row, last.end.column);
15645
- this.start = this.range.start;
15646
- this.end = this.range.end;
15647
-
15648
- this.folds.forEach(function(fold) {
15649
- fold.setFoldLine(this);
15650
- }, this);
15651
- }
15652
-
15653
- (function() {
15654
- /**
15655
- * Note: This doesn't update wrapData!
15656
- */
15657
- this.shiftRow = function(shift) {
15658
- this.start.row += shift;
15659
- this.end.row += shift;
15660
- this.folds.forEach(function(fold) {
15661
- fold.start.row += shift;
15662
- fold.end.row += shift;
15663
- });
15664
- }
15665
-
15666
- this.addFold = function(fold) {
15667
- if (fold.sameRow) {
15668
- if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
15669
- throw "Can't add a fold to this FoldLine as it has no connection";
15670
- }
15671
- this.folds.push(fold);
15672
- this.folds.sort(function(a, b) {
15673
- return -a.range.compareEnd(b.start.row, b.start.column);
15674
- });
15675
- if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
15676
- this.end.row = fold.end.row;
15677
- this.end.column = fold.end.column;
15678
- } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
15679
- this.start.row = fold.start.row;
15680
- this.start.column = fold.start.column;
15681
- }
15682
- } else if (fold.start.row == this.end.row) {
15683
- this.folds.push(fold);
15684
- this.end.row = fold.end.row;
15685
- this.end.column = fold.end.column;
15686
- } else if (fold.end.row == this.start.row) {
15687
- this.folds.unshift(fold);
15688
- this.start.row = fold.start.row;
15689
- this.start.column = fold.start.column;
15690
- } else {
15691
- throw "Trying to add fold to FoldRow that doesn't have a matching row";
15692
- }
15693
- fold.foldLine = this;
15694
- }
15695
-
15696
- this.containsRow = function(row) {
15697
- return row >= this.start.row && row <= this.end.row;
15698
- }
15699
-
15700
- this.walk = function(callback, endRow, endColumn) {
15701
- var lastEnd = 0,
15702
- folds = this.folds,
15703
- fold,
15704
- comp, stop, isNewRow = true;
15705
-
15706
- if (endRow == null) {
15707
- endRow = this.end.row;
15708
- endColumn = this.end.column;
15709
- }
15710
-
15711
- for (var i = 0; i < folds.length; i++) {
15712
- fold = folds[i];
15713
-
15714
- comp = fold.range.compareStart(endRow, endColumn);
15715
- // This fold is after the endRow/Column.
15716
- if (comp == -1) {
15717
- callback(null, endRow, endColumn, lastEnd, isNewRow);
15718
- return;
15719
- }
15720
-
15721
- stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
15722
- stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
15723
-
15724
- // If the user requested to stop the walk or endRow/endColumn is
15725
- // inside of this fold (comp == 0), then end here.
15726
- if (stop || comp == 0) {
15727
- return;
15728
- }
15729
-
15730
- // Note the new lastEnd might not be on the same line. However,
15731
- // it's the callback's job to recognize this.
15732
- isNewRow = !fold.sameRow;
15733
- lastEnd = fold.end.column;
15734
- }
15735
- callback(null, endRow, endColumn, lastEnd, isNewRow);
15736
- }
15737
-
15738
- this.getNextFoldTo = function(row, column) {
15739
- var fold, cmp;
15740
- for (var i = 0; i < this.folds.length; i++) {
15741
- fold = this.folds[i];
15742
- cmp = fold.range.compareEnd(row, column);
15743
- if (cmp == -1) {
15744
- return {
15745
- fold: fold,
15746
- kind: "after"
15747
- };
15748
- } else if (cmp == 0) {
15749
- return {
15750
- fold: fold,
15751
- kind: "inside"
15752
- }
15753
- }
15754
- }
15755
- return null;
15756
- }
15757
-
15758
- this.addRemoveChars = function(row, column, len) {
15759
- var ret = this.getNextFoldTo(row, column),
15760
- fold, folds;
15761
- if (ret) {
15762
- fold = ret.fold;
15763
- if (ret.kind == "inside"
15764
- && fold.start.column != column
15765
- && fold.start.row != row)
15766
- {
15767
- throw "Moving characters inside of a fold should never be reached";
15768
- } else if (fold.start.row == row) {
15769
- folds = this.folds;
15770
- var i = folds.indexOf(fold);
15771
- if (i == 0) {
15772
- this.start.column += len;
15773
- }
15774
- for (i; i < folds.length; i++) {
15775
- fold = folds[i];
15776
- fold.start.column += len;
15777
- if (!fold.sameRow) {
15778
- return;
15779
- }
15780
- fold.end.column += len;
15781
- }
15782
- this.end.column += len;
15783
- }
15784
- }
15785
- }
15786
-
15787
- this.split = function(row, column) {
15788
- var fold = this.getNextFoldTo(row, column).fold,
15789
- folds = this.folds;
15790
- var foldData = this.foldData;
15791
-
15792
- if (!fold) {
15793
- return null;
15794
- }
15795
- var i = folds.indexOf(fold);
15796
- var foldBefore = folds[i - 1];
15797
- this.end.row = foldBefore.end.row;
15798
- this.end.column = foldBefore.end.column;
15799
-
15800
- // Remove the folds after row/column and create a new FoldLine
15801
- // containing these removed folds.
15802
- folds = folds.splice(i, folds.length - i);
15803
-
15804
- var newFoldLine = new FoldLine(foldData, folds);
15805
- foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
15806
- return newFoldLine;
15807
- }
15808
-
15809
- this.merge = function(foldLineNext) {
15810
- var folds = foldLineNext.folds;
15811
- for (var i = 0; i < folds.length; i++) {
15812
- this.addFold(folds[i]);
15813
- }
15814
- // Remove the foldLineNext - no longer needed, as
15815
- // it's merged now with foldLineNext.
15816
- var foldData = this.foldData;
15817
- foldData.splice(foldData.indexOf(foldLineNext), 1);
15818
- }
15819
-
15820
- this.toString = function() {
15821
- var ret = [this.range.toString() + ": [" ];
15822
-
15823
- this.folds.forEach(function(fold) {
15824
- ret.push(" " + fold.toString());
15825
- });
15826
- ret.push("]")
15827
- return ret.join("\n");
15828
- }
15829
-
15830
- this.idxToPosition = function(idx) {
15831
- var lastFoldEndColumn = 0;
15832
- var fold;
15833
-
15834
- for (var i = 0; i < this.folds.length; i++) {
15835
- var fold = this.folds[i];
15836
-
15837
- idx -= fold.start.column - lastFoldEndColumn;
15838
- if (idx < 0) {
15839
- return {
15840
- row: fold.start.row,
15841
- column: fold.start.column + idx
15842
- };
15843
- }
15844
-
15845
- idx -= fold.placeholder.length;
15846
- if (idx < 0) {
15847
- return fold.start;
15848
- }
15849
-
15850
- lastFoldEndColumn = fold.end.column;
15851
- }
15852
-
15853
- return {
15854
- row: this.end.row,
15855
- column: this.end.column + idx
15856
- };
15857
- }
15858
- }).call(FoldLine.prototype);
15859
-
15860
- exports.FoldLine = FoldLine;
15861
- });/* vim:ts=4:sts=4:sw=4:
15862
- * ***** BEGIN LICENSE BLOCK *****
15863
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
15864
- *
15865
- * The contents of this file are subject to the Mozilla Public License Version
15866
- * 1.1 (the "License"); you may not use this file except in compliance with
15867
- * the License. You may obtain a copy of the License at
15868
- * http://www.mozilla.org/MPL/
15869
- *
15870
- * Software distributed under the License is distributed on an "AS IS" basis,
15871
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15872
- * for the specific language governing rights and limitations under the
15873
- * License.
15874
- *
15875
- * The Original Code is Ajax.org Code Editor (ACE).
15876
- *
15877
- * The Initial Developer of the Original Code is
15878
- * Ajax.org B.V.
15879
- * Portions created by the Initial Developer are Copyright (C) 2010
15880
- * the Initial Developer. All Rights Reserved.
15881
- *
15882
- * Contributor(s):
15883
- * Julian Viereck <julian DOT viereck AT gmail DOT com>
15884
- *
15885
- * Alternatively, the contents of this file may be used under the terms of
15886
- * either the GNU General Public License Version 2 or later (the "GPL"), or
15887
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
15888
- * in which case the provisions of the GPL or the LGPL are applicable instead
15889
- * of those above. If you wish to allow use of your version of this file only
15890
- * under the terms of either the GPL or the LGPL, and not to allow others to
15891
- * use your version of this file under the terms of the MPL, indicate your
15892
- * decision by deleting the provisions above and replace them with the notice
15893
- * and other provisions required by the GPL or the LGPL. If you do not delete
15894
- * the provisions above, a recipient may use your version of this file under
15895
- * the terms of any one of the MPL, the GPL or the LGPL.
15896
- *
15897
- * ***** END LICENSE BLOCK ***** */
15898
-
15899
- define('ace/edit_session/fold', ['require', 'exports', 'module' ], function(require, exports, module) {
15900
-
15901
- /**
15902
- * Simple fold-data struct.
15903
- **/
15904
- var Fold = exports.Fold = function(range, placeholder) {
15905
- this.foldLine = null;
15906
- this.placeholder = placeholder;
15907
- this.range = range;
15908
- this.start = range.start;
15909
- this.end = range.end;
15910
-
15911
- this.sameRow = range.start.row == range.end.row;
15912
- this.subFolds = [];
15913
- };
15914
-
15915
- (function() {
15916
-
15917
- this.toString = function() {
15918
- return '"' + this.placeholder + '" ' + this.range.toString();
15919
- };
15920
-
15921
- this.setFoldLine = function(foldLine) {
15922
- this.foldLine = foldLine;
15923
- this.subFolds.forEach(function(fold) {
15924
- fold.setFoldLine(foldLine);
15925
- });
15926
- };
15927
-
15928
- this.clone = function() {
15929
- var range = this.range.clone();
15930
- var fold = new Fold(range, this.placeholder);
15931
- this.subFolds.forEach(function(subFold) {
15932
- fold.subFolds.push(subFold.clone());
15933
- });
15934
- return fold;
15935
- };
15936
-
15937
- }).call(Fold.prototype);
15938
-
15939
- });/* vim:ts=4:sts=4:sw=4:
15940
- * ***** BEGIN LICENSE BLOCK *****
15941
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
15942
- *
15943
- * The contents of this file are subject to the Mozilla Public License Version
15944
- * 1.1 (the "License"); you may not use this file except in compliance with
15945
- * the License. You may obtain a copy of the License at
15946
- * http://www.mozilla.org/MPL/
15947
- *
15948
- * Software distributed under the License is distributed on an "AS IS" basis,
15949
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15950
- * for the specific language governing rights and limitations under the
15951
- * License.
15952
- *
15953
- * The Original Code is Ajax.org Code Editor (ACE).
15954
- *
15955
- * The Initial Developer of the Original Code is
15956
- * Ajax.org B.V.
15957
- * Portions created by the Initial Developer are Copyright (C) 2010
15958
- * the Initial Developer. All Rights Reserved.
15959
- *
15960
- * Contributor(s):
15961
- * Fabian Jakobs <fabian AT ajax DOT org>
15962
- * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
15963
- *
15964
- * Alternatively, the contents of this file may be used under the terms of
15965
- * either the GNU General Public License Version 2 or later (the "GPL"), or
15966
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
15967
- * in which case the provisions of the GPL or the LGPL are applicable instead
15968
- * of those above. If you wish to allow use of your version of this file only
15969
- * under the terms of either the GPL or the LGPL, and not to allow others to
15970
- * use your version of this file under the terms of the MPL, indicate your
15971
- * decision by deleting the provisions above and replace them with the notice
15972
- * and other provisions required by the GPL or the LGPL. If you do not delete
15973
- * the provisions above, a recipient may use your version of this file under
15974
- * the terms of any one of the MPL, the GPL or the LGPL.
15975
- *
15976
- * ***** END LICENSE BLOCK ***** */
15977
-
15978
- define('ace/search', ['require', 'exports', 'module' , 'pilot/lang', 'pilot/oop', 'ace/range'], function(require, exports, module) {
15979
-
15980
- var lang = require("pilot/lang");
15981
- var oop = require("pilot/oop");
15982
- var Range = require("ace/range").Range;
15983
-
15984
- var Search = function() {
15985
- this.$options = {
15986
- needle: "",
15987
- backwards: false,
15988
- wrap: false,
15989
- caseSensitive: false,
15990
- wholeWord: false,
15991
- scope: Search.ALL,
15992
- regExp: false
15993
- };
15994
- };
15995
-
15996
- Search.ALL = 1;
15997
- Search.SELECTION = 2;
15998
-
15999
- (function() {
16000
-
16001
- this.set = function(options) {
16002
- oop.mixin(this.$options, options);
16003
- return this;
16004
- };
16005
-
16006
- this.getOptions = function() {
16007
- return lang.copyObject(this.$options);
16008
- };
16009
-
16010
- this.find = function(session) {
16011
- if (!this.$options.needle)
16012
- return null;
16013
-
16014
- if (this.$options.backwards) {
16015
- var iterator = this.$backwardMatchIterator(session);
16016
- } else {
16017
- iterator = this.$forwardMatchIterator(session);
16018
- }
16019
-
16020
- var firstRange = null;
16021
- iterator.forEach(function(range) {
16022
- firstRange = range;
16023
- return true;
16024
- });
16025
-
16026
- return firstRange;
16027
- };
16028
-
16029
- this.findAll = function(session) {
16030
- if (!this.$options.needle)
16031
- return [];
16032
-
16033
- if (this.$options.backwards) {
16034
- var iterator = this.$backwardMatchIterator(session);
16035
- } else {
16036
- iterator = this.$forwardMatchIterator(session);
16037
- }
16038
-
16039
- var ranges = [];
16040
- iterator.forEach(function(range) {
16041
- ranges.push(range);
16042
- });
16043
-
16044
- return ranges;
16045
- };
16046
-
16047
- this.replace = function(input, replacement) {
16048
- var re = this.$assembleRegExp();
16049
- var match = re.exec(input);
16050
- if (match && match[0].length == input.length) {
16051
- if (this.$options.regExp) {
16052
- return input.replace(re, replacement);
16053
- } else {
16054
- return replacement;
16055
- }
16056
- } else {
16057
- return null;
16058
- }
16059
- };
16060
-
16061
- this.$forwardMatchIterator = function(session) {
16062
- var re = this.$assembleRegExp();
16063
- var self = this;
16064
-
16065
- return {
16066
- forEach: function(callback) {
16067
- self.$forwardLineIterator(session).forEach(function(line, startIndex, row) {
16068
- if (startIndex) {
16069
- line = line.substring(startIndex);
16070
- }
16071
-
16072
- var matches = [];
16073
-
16074
- line.replace(re, function(str) {
16075
- var offset = arguments[arguments.length-2];
16076
- matches.push({
16077
- str: str,
16078
- offset: startIndex + offset
16079
- });
16080
- return str;
16081
- });
16082
-
16083
- for (var i=0; i<matches.length; i++) {
16084
- var match = matches[i];
16085
- var range = self.$rangeFromMatch(row, match.offset, match.str.length);
16086
- if (callback(range))
16087
- return true;
16088
- }
16089
-
16090
- });
16091
- }
16092
- };
16093
- };
16094
-
16095
- this.$backwardMatchIterator = function(session) {
16096
- var re = this.$assembleRegExp();
16097
- var self = this;
16098
-
16099
- return {
16100
- forEach: function(callback) {
16101
- self.$backwardLineIterator(session).forEach(function(line, startIndex, row) {
16102
- if (startIndex) {
16103
- line = line.substring(startIndex);
16104
- }
16105
-
16106
- var matches = [];
16107
-
16108
- line.replace(re, function(str, offset) {
16109
- matches.push({
16110
- str: str,
16111
- offset: startIndex + offset
16112
- });
16113
- return str;
16114
- });
16115
-
16116
- for (var i=matches.length-1; i>= 0; i--) {
16117
- var match = matches[i];
16118
- var range = self.$rangeFromMatch(row, match.offset, match.str.length);
16119
- if (callback(range))
16120
- return true;
16121
- }
16122
- });
16123
- }
16124
- };
16125
- };
16126
-
16127
- this.$rangeFromMatch = function(row, column, length) {
16128
- return new Range(row, column, row, column+length);
16129
- };
16130
-
16131
- this.$assembleRegExp = function() {
16132
- if (this.$options.regExp) {
16133
- var needle = this.$options.needle;
16134
- } else {
16135
- needle = lang.escapeRegExp(this.$options.needle);
16136
- }
16137
-
16138
- if (this.$options.wholeWord) {
16139
- needle = "\\b" + needle + "\\b";
16140
- }
16141
-
16142
- var modifier = "g";
16143
- if (!this.$options.caseSensitive) {
16144
- modifier += "i";
16145
- }
16146
-
16147
- var re = new RegExp(needle, modifier);
16148
- return re;
16149
- };
16150
-
16151
- this.$forwardLineIterator = function(session) {
16152
- var searchSelection = this.$options.scope == Search.SELECTION;
16153
-
16154
- var range = session.getSelection().getRange();
16155
- var start = session.getSelection().getCursor();
16156
-
16157
- var firstRow = searchSelection ? range.start.row : 0;
16158
- var firstColumn = searchSelection ? range.start.column : 0;
16159
- var lastRow = searchSelection ? range.end.row : session.getLength() - 1;
16160
-
16161
- var wrap = this.$options.wrap;
16162
- var inWrap = false;
16163
-
16164
- function getLine(row) {
16165
- var line = session.getLine(row);
16166
- if (searchSelection && row == range.end.row) {
16167
- line = line.substring(0, range.end.column);
16168
- }
16169
- if (inWrap && row == start.row) {
16170
- line = line.substring(0, start.column);
16171
- }
16172
- return line;
16173
- }
16174
-
16175
- return {
16176
- forEach: function(callback) {
16177
- var row = start.row;
16178
-
16179
- var line = getLine(row);
16180
- var startIndex = start.column;
16181
-
16182
- var stop = false;
16183
- inWrap = false;
16184
-
16185
- while (!callback(line, startIndex, row)) {
16186
-
16187
- if (stop) {
16188
- return;
16189
- }
16190
-
16191
- row++;
16192
- startIndex = 0;
16193
-
16194
- if (row > lastRow) {
16195
- if (wrap) {
16196
- row = firstRow;
16197
- startIndex = firstColumn;
16198
- inWrap = true;
16199
- } else {
16200
- return;
16201
- }
16202
- }
16203
-
16204
- if (row == start.row)
16205
- stop = true;
16206
-
16207
- line = getLine(row);
16208
- }
16209
- }
16210
- };
16211
- };
16212
-
16213
- this.$backwardLineIterator = function(session) {
16214
- var searchSelection = this.$options.scope == Search.SELECTION;
16215
-
16216
- var range = session.getSelection().getRange();
16217
- var start = searchSelection ? range.end : range.start;
16218
-
16219
- var firstRow = searchSelection ? range.start.row : 0;
16220
- var firstColumn = searchSelection ? range.start.column : 0;
16221
- var lastRow = searchSelection ? range.end.row : session.getLength() - 1;
16222
-
16223
- var wrap = this.$options.wrap;
16224
-
16225
- return {
16226
- forEach : function(callback) {
16227
- var row = start.row;
16228
-
16229
- var line = session.getLine(row).substring(0, start.column);
16230
- var startIndex = 0;
16231
- var stop = false;
16232
- var inWrap = false;
16233
-
16234
- while (!callback(line, startIndex, row)) {
16235
-
16236
- if (stop)
16237
- return;
16238
-
16239
- row--;
16240
- startIndex = 0;
16241
-
16242
- if (row < firstRow) {
16243
- if (wrap) {
16244
- row = lastRow;
16245
- inWrap = true;
16246
- } else {
16247
- return;
16248
- }
16249
- }
16250
-
16251
- if (row == start.row)
16252
- stop = true;
16253
-
16254
- line = session.getLine(row);
16255
- if (searchSelection) {
16256
- if (row == firstRow)
16257
- startIndex = firstColumn;
16258
- else if (row == lastRow)
16259
- line = line.substring(0, range.end.column);
16260
- }
16261
-
16262
- if (inWrap && row == start.row)
16263
- startIndex = start.column;
16264
- }
16265
- }
16266
- };
16267
- };
16268
-
16269
- }).call(Search.prototype);
16270
-
16271
- exports.Search = Search;
16272
- });
16273
- /* vim:ts=4:sts=4:sw=4:
16274
- * ***** BEGIN LICENSE BLOCK *****
16275
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
16276
- *
16277
- * The contents of this file are subject to the Mozilla Public License Version
16278
- * 1.1 (the "License"); you may not use this file except in compliance with
16279
- * the License. You may obtain a copy of the License at
16280
- * http://www.mozilla.org/MPL/
16281
- *
16282
- * Software distributed under the License is distributed on an "AS IS" basis,
16283
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
16284
- * for the specific language governing rights and limitations under the
16285
- * License.
16286
- *
16287
- * The Original Code is Ajax.org Code Editor (ACE).
16288
- *
16289
- * The Initial Developer of the Original Code is
16290
- * Ajax.org B.V.
16291
- * Portions created by the Initial Developer are Copyright (C) 2010
16292
- * the Initial Developer. All Rights Reserved.
16293
- *
16294
- * Contributor(s):
16295
- * Fabian Jakobs <fabian@ajax.org>
16296
- * Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
16297
- * Julian Viereck <julian.viereck@gmail.com>
16298
- *
16299
- * Alternatively, the contents of this file may be used under the terms of
16300
- * either the GNU General Public License Version 2 or later (the "GPL"), or
16301
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
16302
- * in which case the provisions of the GPL or the LGPL are applicable instead
16303
- * of those above. If you wish to allow use of your version of this file only
16304
- * under the terms of either the GPL or the LGPL, and not to allow others to
16305
- * use your version of this file under the terms of the MPL, indicate your
16306
- * decision by deleting the provisions above and replace them with the notice
16307
- * and other provisions required by the GPL or the LGPL. If you do not delete
16308
- * the provisions above, a recipient may use your version of this file under
16309
- * the terms of any one of the MPL, the GPL or the LGPL.
16310
- *
16311
- * ***** END LICENSE BLOCK ***** */
16312
-
16313
- define('ace/virtual_renderer', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/event', 'pilot/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'pilot/event_emitter', 'text!ace/css/editor.css'], function(require, exports, module) {
16314
-
16315
- var oop = require("pilot/oop");
16316
- var dom = require("pilot/dom");
16317
- var event = require("pilot/event");
16318
- var useragent = require("pilot/useragent");
16319
- var GutterLayer = require("ace/layer/gutter").Gutter;
16320
- var MarkerLayer = require("ace/layer/marker").Marker;
16321
- var TextLayer = require("ace/layer/text").Text;
16322
- var CursorLayer = require("ace/layer/cursor").Cursor;
16323
- var ScrollBar = require("ace/scrollbar").ScrollBar;
16324
- var RenderLoop = require("ace/renderloop").RenderLoop;
16325
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
16326
- var editorCss = require("text!ace/css/editor.css");
16327
-
16328
- // import CSS once
16329
- dom.importCssString(editorCss);
16330
-
16331
- var VirtualRenderer = function(container, theme) {
16332
- this.container = container;
16333
- dom.addCssClass(this.container, "ace_editor");
16334
-
16335
- this.setTheme(theme);
16336
-
16337
- this.$gutter = dom.createElement("div");
16338
- this.$gutter.className = "ace_gutter";
16339
- this.container.appendChild(this.$gutter);
16340
-
16341
- this.scroller = dom.createElement("div");
16342
- this.scroller.className = "ace_scroller";
16343
- this.container.appendChild(this.scroller);
16344
-
16345
- this.content = dom.createElement("div");
16346
- this.content.className = "ace_content";
16347
- this.scroller.appendChild(this.content);
16348
-
16349
- this.$gutterLayer = new GutterLayer(this.$gutter);
16350
- this.$markerBack = new MarkerLayer(this.content);
16351
-
16352
- var textLayer = this.$textLayer = new TextLayer(this.content);
16353
- this.canvas = textLayer.element;
16354
-
16355
- this.$markerFront = new MarkerLayer(this.content);
16356
-
16357
- this.characterWidth = textLayer.getCharacterWidth();
16358
- this.lineHeight = textLayer.getLineHeight();
16359
-
16360
- this.$cursorLayer = new CursorLayer(this.content);
16361
- this.$cursorPadding = 8;
16362
-
16363
- // Indicates whether the horizontal scrollbar is visible
16364
- this.$horizScroll = true;
16365
- this.$horizScrollAlwaysVisible = true;
16366
-
16367
- this.scrollBar = new ScrollBar(container);
16368
- this.scrollBar.addEventListener("scroll", this.onScroll.bind(this));
16369
-
16370
- this.scrollTop = 0;
16371
-
16372
- this.cursorPos = {
16373
- row : 0,
16374
- column : 0
16375
- };
16376
-
16377
- var _self = this;
16378
- this.$textLayer.addEventListener("changeCharaterSize", function() {
16379
- _self.characterWidth = textLayer.getCharacterWidth();
16380
- _self.lineHeight = textLayer.getLineHeight();
16381
- _self.$updatePrintMargin();
16382
- _self.onResize(true);
16383
-
16384
- _self.$loop.schedule(_self.CHANGE_FULL);
16385
- });
16386
- event.addListener(this.$gutter, "click", this.$onGutterClick.bind(this));
16387
- event.addListener(this.$gutter, "dblclick", this.$onGutterClick.bind(this));
16388
-
16389
- this.$size = {
16390
- width: 0,
16391
- height: 0,
16392
- scrollerHeight: 0,
16393
- scrollerWidth: 0
16394
- };
16395
-
16396
- this.layerConfig = {
16397
- width : 1,
16398
- padding : 0,
16399
- firstRow : 0,
16400
- firstRowScreen: 0,
16401
- lastRow : 0,
16402
- lineHeight : 1,
16403
- characterWidth : 1,
16404
- minHeight : 1,
16405
- maxHeight : 1,
16406
- offset : 0,
16407
- height : 1
16408
- };
16409
-
16410
- this.$loop = new RenderLoop(this.$renderChanges.bind(this));
16411
- this.$loop.schedule(this.CHANGE_FULL);
16412
-
16413
- this.setPadding(4);
16414
- this.$updatePrintMargin();
16415
- };
16416
-
16417
- (function() {
16418
- this.showGutter = true;
16419
-
16420
- this.CHANGE_CURSOR = 1;
16421
- this.CHANGE_MARKER = 2;
16422
- this.CHANGE_GUTTER = 4;
16423
- this.CHANGE_SCROLL = 8;
16424
- this.CHANGE_LINES = 16;
16425
- this.CHANGE_TEXT = 32;
16426
- this.CHANGE_SIZE = 64;
16427
- this.CHANGE_MARKER_BACK = 128;
16428
- this.CHANGE_MARKER_FRONT = 256;
16429
- this.CHANGE_FULL = 512;
16430
-
16431
- oop.implement(this, EventEmitter);
16432
-
16433
- this.setSession = function(session) {
16434
- this.session = session;
16435
- this.$cursorLayer.setSession(session);
16436
- this.$markerBack.setSession(session);
16437
- this.$markerFront.setSession(session);
16438
- this.$gutterLayer.setSession(session);
16439
- this.$textLayer.setSession(session);
16440
- this.$loop.schedule(this.CHANGE_FULL);
16441
- };
16442
-
16443
- /**
16444
- * Triggers partial update of the text layer
16445
- */
16446
- this.updateLines = function(firstRow, lastRow) {
16447
- if (lastRow === undefined)
16448
- lastRow = Infinity;
16449
-
16450
- if (!this.$changedLines) {
16451
- this.$changedLines = {
16452
- firstRow: firstRow,
16453
- lastRow: lastRow
16454
- };
16455
- }
16456
- else {
16457
- if (this.$changedLines.firstRow > firstRow)
16458
- this.$changedLines.firstRow = firstRow;
16459
-
16460
- if (this.$changedLines.lastRow < lastRow)
16461
- this.$changedLines.lastRow = lastRow;
16462
- }
16463
-
16464
- this.$loop.schedule(this.CHANGE_LINES);
16465
- };
16466
-
16467
- /**
16468
- * Triggers full update of the text layer
16469
- */
16470
- this.updateText = function() {
16471
- this.$loop.schedule(this.CHANGE_TEXT);
16472
- };
16473
-
16474
- /**
16475
- * Triggers a full update of all layers
16476
- */
16477
- this.updateFull = function() {
16478
- this.$loop.schedule(this.CHANGE_FULL);
16479
- };
16480
-
16481
- this.updateFontSize = function() {
16482
- this.$textLayer.checkForSizeChanges();
16483
- };
16484
-
16485
- /**
16486
- * Triggers resize of the editor
16487
- */
16488
- this.onResize = function(force) {
16489
- var changes = this.CHANGE_SIZE;
16490
- var size = this.$size;
16491
-
16492
- var height = dom.getInnerHeight(this.container);
16493
- if (force || size.height != height) {
16494
- size.height = height;
16495
-
16496
- this.scroller.style.height = height + "px";
16497
- size.scrollerHeight = this.scroller.clientHeight;
16498
- this.scrollBar.setHeight(size.scrollerHeight);
16499
-
16500
- if (this.session) {
16501
- this.scrollToY(this.getScrollTop());
16502
- changes = changes | this.CHANGE_FULL;
16503
- }
16504
- }
16505
-
16506
- var width = dom.getInnerWidth(this.container);
16507
- if (force || size.width != width) {
16508
- size.width = width;
16509
-
16510
- var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
16511
- this.scroller.style.left = gutterWidth + "px";
16512
- size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth())
16513
- this.scroller.style.width = size.scrollerWidth + "px";
16514
-
16515
- if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
16516
- changes = changes | this.CHANGE_FULL;
16517
- }
16518
-
16519
- this.$loop.schedule(changes);
16520
- };
16521
-
16522
- this.adjustWrapLimit = function(){
16523
- var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
16524
- var limit = Math.floor(availableWidth / this.characterWidth) - 1;
16525
- return this.session.adjustWrapLimit(limit);
16526
- };
16527
-
16528
- this.$onGutterClick = function(e) {
16529
- var pageX = event.getDocumentX(e);
16530
- var pageY = event.getDocumentY(e);
16531
-
16532
- this._dispatchEvent("gutter" + e.type, {
16533
- row: this.screenToTextCoordinates(pageX, pageY).row,
16534
- htmlEvent: e
16535
- });
16536
- };
16537
-
16538
- this.setShowInvisibles = function(showInvisibles) {
16539
- if (this.$textLayer.setShowInvisibles(showInvisibles))
16540
- this.$loop.schedule(this.CHANGE_TEXT);
16541
- };
16542
-
16543
- this.getShowInvisibles = function() {
16544
- return this.$textLayer.showInvisibles;
16545
- };
16546
-
16547
- this.$showPrintMargin = true;
16548
- this.setShowPrintMargin = function(showPrintMargin) {
16549
- this.$showPrintMargin = showPrintMargin;
16550
- this.$updatePrintMargin();
16551
- };
16552
-
16553
- this.getShowPrintMargin = function() {
16554
- return this.$showPrintMargin;
16555
- };
16556
-
16557
- this.$printMarginColumn = 80;
16558
- this.setPrintMarginColumn = function(showPrintMargin) {
16559
- this.$printMarginColumn = showPrintMargin;
16560
- this.$updatePrintMargin();
16561
- };
16562
-
16563
- this.getPrintMarginColumn = function() {
16564
- return this.$printMarginColumn;
16565
- };
16566
-
16567
- this.getShowGutter = function(){
16568
- return this.showGutter;
16569
- };
16570
-
16571
- this.setShowGutter = function(show){
16572
- if(this.showGutter === show)
16573
- return;
16574
- this.$gutter.style.display = show ? "block" : "none";
16575
- this.showGutter = show;
16576
- this.onResize(true);
16577
- };
16578
-
16579
- this.$updatePrintMargin = function() {
16580
- var containerEl;
16581
-
16582
- if (!this.$showPrintMargin && !this.$printMarginEl)
16583
- return;
16584
-
16585
- if (!this.$printMarginEl) {
16586
- containerEl = dom.createElement("div");
16587
- containerEl.className = "ace_print_margin_layer";
16588
- this.$printMarginEl = dom.createElement("div");
16589
- this.$printMarginEl.className = "ace_print_margin";
16590
- containerEl.appendChild(this.$printMarginEl);
16591
- this.content.insertBefore(containerEl, this.$textLayer.element);
16592
- }
16593
-
16594
- var style = this.$printMarginEl.style;
16595
- style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding * 2) + "px";
16596
- style.visibility = this.$showPrintMargin ? "visible" : "hidden";
16597
- };
16598
-
16599
- this.getContainerElement = function() {
16600
- return this.container;
16601
- };
16602
-
16603
- this.getMouseEventTarget = function() {
16604
- return this.content;
16605
- };
16606
-
16607
- this.getTextAreaContainer = function() {
16608
- return this.container;
16609
- };
16610
-
16611
- this.moveTextAreaToCursor = function(textarea) {
16612
- // in IE the native cursor always shines through
16613
- if (useragent.isIE)
16614
- return;
16615
-
16616
- var pos = this.$cursorLayer.getPixelPosition();
16617
- if (!pos)
16618
- return;
16619
-
16620
- var bounds = this.content.getBoundingClientRect();
16621
- var offset = this.layerConfig.offset;
16622
-
16623
- textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
16624
- textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
16625
- };
16626
-
16627
- this.getFirstVisibleRow = function() {
16628
- return this.layerConfig.firstRow;
16629
- };
16630
-
16631
- this.getFirstFullyVisibleRow = function() {
16632
- return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
16633
- };
16634
-
16635
- this.getLastFullyVisibleRow = function() {
16636
- var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
16637
- return this.layerConfig.firstRow - 1 + flint;
16638
- };
16639
-
16640
- this.getLastVisibleRow = function() {
16641
- return this.layerConfig.lastRow;
16642
- };
16643
-
16644
- this.$padding = null;
16645
- this.setPadding = function(padding) {
16646
- this.$padding = padding;
16647
- this.$textLayer.setPadding(padding);
16648
- this.$cursorLayer.setPadding(padding);
16649
- this.$markerFront.setPadding(padding);
16650
- this.$markerBack.setPadding(padding);
16651
- this.$loop.schedule(this.CHANGE_FULL);
16652
- this.$updatePrintMargin();
16653
- };
16654
-
16655
- this.getHScrollBarAlwaysVisible = function() {
16656
- return this.$horizScrollAlwaysVisible;
16657
- };
16658
-
16659
- this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
16660
- if (this.$horizScrollAlwaysVisible != alwaysVisible) {
16661
- this.$horizScrollAlwaysVisible = alwaysVisible;
16662
- if (!this.$horizScrollAlwaysVisible || !this.$horizScroll)
16663
- this.$loop.schedule(this.CHANGE_SCROLL);
16664
- }
16665
- };
16666
-
16667
- this.onScroll = function(e) {
16668
- this.scrollToY(e.data);
16669
- };
16670
-
16671
- this.$updateScrollBar = function() {
16672
- this.scrollBar.setInnerHeight(this.layerConfig.maxHeight);
16673
- this.scrollBar.setScrollTop(this.scrollTop);
16674
- };
16675
-
16676
- this.$renderChanges = function(changes) {
16677
- if (!changes || !this.session)
16678
- return;
16679
-
16680
- // text, scrolling and resize changes can cause the view port size to change
16681
- if (changes & this.CHANGE_FULL ||
16682
- changes & this.CHANGE_SIZE ||
16683
- changes & this.CHANGE_TEXT ||
16684
- changes & this.CHANGE_LINES ||
16685
- changes & this.CHANGE_SCROLL
16686
- )
16687
- this.$computeLayerConfig();
16688
-
16689
- // full
16690
- if (changes & this.CHANGE_FULL) {
16691
- this.$textLayer.update(this.layerConfig);
16692
- if (this.showGutter)
16693
- this.$gutterLayer.update(this.layerConfig);
16694
- this.$markerBack.update(this.layerConfig);
16695
- this.$markerFront.update(this.layerConfig);
16696
- this.$cursorLayer.update(this.layerConfig);
16697
- this.$updateScrollBar();
16698
- return;
16699
- }
16700
-
16701
- // scrolling
16702
- if (changes & this.CHANGE_SCROLL) {
16703
- if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
16704
- this.$textLayer.update(this.layerConfig);
16705
- else
16706
- this.$textLayer.scrollLines(this.layerConfig);
16707
-
16708
- if (this.showGutter)
16709
- this.$gutterLayer.update(this.layerConfig);
16710
- this.$markerBack.update(this.layerConfig);
16711
- this.$markerFront.update(this.layerConfig);
16712
- this.$cursorLayer.update(this.layerConfig);
16713
- this.$updateScrollBar();
16714
- return;
16715
- }
16716
-
16717
- if (changes & this.CHANGE_TEXT) {
16718
- this.$textLayer.update(this.layerConfig);
16719
- if (this.showGutter)
16720
- this.$gutterLayer.update(this.layerConfig);
16721
- }
16722
- else if (changes & this.CHANGE_LINES) {
16723
- this.$updateLines();
16724
- this.$updateScrollBar();
16725
- if (this.showGutter)
16726
- this.$gutterLayer.update(this.layerConfig);
16727
- } else if (changes & this.CHANGE_GUTTER) {
16728
- if (this.showGutter)
16729
- this.$gutterLayer.update(this.layerConfig);
16730
- }
16731
-
16732
- if (changes & this.CHANGE_CURSOR)
16733
- this.$cursorLayer.update(this.layerConfig);
16734
-
16735
- if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
16736
- this.$markerFront.update(this.layerConfig);
16737
- }
16738
-
16739
- if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
16740
- this.$markerBack.update(this.layerConfig);
16741
- }
16742
-
16743
- if (changes & this.CHANGE_SIZE)
16744
- this.$updateScrollBar();
16745
- };
16746
-
16747
- this.$computeLayerConfig = function() {
16748
- var session = this.session;
16749
-
16750
- var offset = this.scrollTop % this.lineHeight;
16751
- var minHeight = this.$size.scrollerHeight + this.lineHeight;
16752
-
16753
- var longestLine = this.$getLongestLine();
16754
- var widthChanged = this.layerConfig.width != longestLine;
16755
-
16756
- var horizScroll = this.$horizScrollAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
16757
- var horizScrollChanged = this.$horizScroll !== horizScroll;
16758
- this.$horizScroll = horizScroll;
16759
- if (horizScrollChanged)
16760
- this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
16761
-
16762
- var maxHeight = this.session.getScreenLength() * this.lineHeight;
16763
- this.scrollTop = Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight));
16764
-
16765
- var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
16766
- var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
16767
- var lastRow = firstRow + lineCount;
16768
-
16769
- // Map lines on the screen to lines in the document.
16770
- var firstRowScreen, firstRowHeight;
16771
- var lineHeight = { lineHeight: this.lineHeight };
16772
- firstRow = session.screenToDocumentRow(firstRow, 0);
16773
-
16774
- // Check if firstRow is inside of a foldLine. If true, then use the first
16775
- // row of the foldLine.
16776
- var foldLine = session.getFoldLine(firstRow);
16777
- if (foldLine) {
16778
- firstRow = foldLine.start.row;
16779
- }
16780
-
16781
- firstRowScreen = session.documentToScreenRow(firstRow, 0);
16782
- firstRowHeight = session.getRowHeight(lineHeight, firstRow);
16783
-
16784
- lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
16785
- minHeight = this.$size.scrollerHeight + session.getRowHeight(lineHeight, lastRow)+
16786
- firstRowHeight;
16787
-
16788
- offset = this.scrollTop - firstRowScreen * this.lineHeight;
16789
-
16790
- this.layerConfig = {
16791
- width : longestLine,
16792
- padding : this.$padding,
16793
- firstRow : firstRow,
16794
- firstRowScreen: firstRowScreen,
16795
- lastRow : lastRow,
16796
- lineHeight : this.lineHeight,
16797
- characterWidth : this.characterWidth,
16798
- minHeight : minHeight,
16799
- maxHeight : maxHeight,
16800
- offset : offset,
16801
- height : this.$size.scrollerHeight
16802
- };
16803
-
16804
- // For debugging.
16805
- // console.log(JSON.stringify(this.layerConfig));
16806
-
16807
- this.$gutterLayer.element.style.marginTop = (-offset) + "px";
16808
- this.content.style.marginTop = (-offset) + "px";
16809
- this.content.style.width = longestLine + "px";
16810
- this.content.style.height = minHeight + "px";
16811
-
16812
- // scroller.scrollWidth was smaller than scrollLeft we needed
16813
- if (this.$desiredScrollLeft) {
16814
- this.scrollToX(this.$desiredScrollLeft);
16815
- this.$desiredScrollLeft = 0;
16816
- }
16817
-
16818
- // Horizontal scrollbar visibility may have changed, which changes
16819
- // the client height of the scroller
16820
- if (horizScrollChanged)
16821
- this.onResize(true);
16822
- };
16823
-
16824
- this.$updateLines = function() {
16825
- var firstRow = this.$changedLines.firstRow;
16826
- var lastRow = this.$changedLines.lastRow;
16827
- this.$changedLines = null;
16828
-
16829
- var layerConfig = this.layerConfig;
16830
-
16831
- // if the update changes the width of the document do a full redraw
16832
- if (layerConfig.width != this.$getLongestLine())
16833
- return this.$textLayer.update(layerConfig);
16834
-
16835
- if (firstRow > layerConfig.lastRow + 1) { return; }
16836
- if (lastRow < layerConfig.firstRow) { return; }
16837
-
16838
- // if the last row is unknown -> redraw everything
16839
- if (lastRow === Infinity) {
16840
- if (this.showGutter)
16841
- this.$gutterLayer.update(layerConfig);
16842
- this.$textLayer.update(layerConfig);
16843
- return;
16844
- }
16845
-
16846
- // else update only the changed rows
16847
- this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
16848
- };
16849
-
16850
- this.$getLongestLine = function() {
16851
- var charCount = this.session.getScreenWidth() + 1;
16852
- if (this.$textLayer.showInvisibles)
16853
- charCount += 1;
16854
-
16855
- return Math.max(this.$size.scrollerWidth, Math.round(charCount * this.characterWidth));
16856
- };
16857
-
16858
- this.updateFrontMarkers = function() {
16859
- this.$markerFront.setMarkers(this.session.getMarkers(true));
16860
- this.$loop.schedule(this.CHANGE_MARKER_FRONT);
16861
- };
16862
-
16863
- this.updateBackMarkers = function() {
16864
- this.$markerBack.setMarkers(this.session.getMarkers());
16865
- this.$loop.schedule(this.CHANGE_MARKER_BACK);
16866
- };
16867
-
16868
- this.addGutterDecoration = function(row, className){
16869
- this.$gutterLayer.addGutterDecoration(row, className);
16870
- this.$loop.schedule(this.CHANGE_GUTTER);
16871
- };
16872
-
16873
- this.removeGutterDecoration = function(row, className){
16874
- this.$gutterLayer.removeGutterDecoration(row, className);
16875
- this.$loop.schedule(this.CHANGE_GUTTER);
16876
- };
16877
-
16878
- this.setBreakpoints = function(rows) {
16879
- this.$gutterLayer.setBreakpoints(rows);
16880
- this.$loop.schedule(this.CHANGE_GUTTER);
16881
- };
16882
-
16883
- this.setAnnotations = function(annotations) {
16884
- this.$gutterLayer.setAnnotations(annotations);
16885
- this.$loop.schedule(this.CHANGE_GUTTER);
16886
- };
16887
-
16888
- this.updateCursor = function() {
16889
- this.$loop.schedule(this.CHANGE_CURSOR);
16890
- };
16891
-
16892
- this.hideCursor = function() {
16893
- this.$cursorLayer.hideCursor();
16894
- };
16895
-
16896
- this.showCursor = function() {
16897
- this.$cursorLayer.showCursor();
16898
- };
16899
-
16900
- this.scrollCursorIntoView = function() {
16901
- // the editor is not visible
16902
- if (this.$size.scrollerHeight === 0)
16903
- return;
16904
-
16905
- var pos = this.$cursorLayer.getPixelPosition();
16906
-
16907
- var left = pos.left + this.$padding;
16908
- var top = pos.top;
16909
-
16910
- if (this.scrollTop > top) {
16911
- this.scrollToY(top);
16912
- }
16913
-
16914
- if (this.scrollTop + this.$size.scrollerHeight < top + this.lineHeight) {
16915
- this.scrollToY(top + this.lineHeight - this.$size.scrollerHeight);
16916
- }
16917
-
16918
- var scrollLeft = this.scroller.scrollLeft;
16919
-
16920
- if (scrollLeft > left) {
16921
- this.scrollToX(left);
16922
- }
16923
-
16924
- if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
16925
- if (left > this.layerConfig.width)
16926
- this.$desiredScrollLeft = left + 2 * this.characterWidth;
16927
- else
16928
- this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
16929
- }
16930
- };
16931
-
16932
- this.getScrollTop = function() {
16933
- return this.scrollTop;
16934
- };
16935
-
16936
- this.getScrollLeft = function() {
16937
- return this.scroller.scrollLeft;
16938
- };
16939
-
16940
- this.getScrollTopRow = function() {
16941
- return this.scrollTop / this.lineHeight;
16942
- };
16943
-
16944
- this.getScrollBottomRow = function() {
16945
- return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
16946
- };
16947
-
16948
- this.scrollToRow = function(row) {
16949
- this.scrollToY(row * this.lineHeight);
16950
- };
16951
-
16952
- this.scrollToLine = function(line, center) {
16953
- var lineHeight = { lineHeight: this.lineHeight };
16954
- var offset = 0;
16955
- for (var l = 1; l < line; l++) {
16956
- offset += this.session.getRowHeight(lineHeight, l-1);
16957
- }
16958
-
16959
- if (center) {
16960
- offset -= this.$size.scrollerHeight / 2;
16961
- }
16962
- this.scrollToY(offset);
16963
- };
16964
-
16965
- this.scrollToY = function(scrollTop) {
16966
- // after calling scrollBar.setScrollTop
16967
- // scrollbar sends us event with same scrollTop. ignore it
16968
- scrollTop = Math.max(0, scrollTop);
16969
- if (this.scrollTop !== scrollTop) {
16970
- this.$loop.schedule(this.CHANGE_SCROLL);
16971
- this.scrollTop = scrollTop;
16972
- }
16973
- };
16974
-
16975
- this.scrollToX = function(scrollLeft) {
16976
- if (scrollLeft <= this.$padding)
16977
- scrollLeft = 0;
16978
-
16979
- this.scroller.scrollLeft = scrollLeft;
16980
- };
16981
-
16982
- this.scrollBy = function(deltaX, deltaY) {
16983
- deltaY && this.scrollToY(this.scrollTop + deltaY);
16984
- deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
16985
- };
16986
-
16987
- this.screenToTextCoordinates = function(pageX, pageY) {
16988
- var canvasPos = this.scroller.getBoundingClientRect();
16989
-
16990
- var col = Math.round((pageX + this.scroller.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft())
16991
- / this.characterWidth);
16992
- var row = Math.floor((pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop())
16993
- / this.lineHeight);
16994
-
16995
- return this.session.screenToDocumentPosition(row, Math.max(col, 0));
16996
- };
16997
-
16998
- this.textToScreenCoordinates = function(row, column) {
16999
- var canvasPos = this.scroller.getBoundingClientRect();
17000
- var pos = this.session.documentToScreenPosition(row, column);
17001
-
17002
- var x = this.$padding + Math.round(pos.column * this.characterWidth);
17003
- var y = pos.row * this.lineHeight;
17004
-
17005
- return {
17006
- pageX: canvasPos.left + x - this.getScrollLeft(),
17007
- pageY: canvasPos.top + y - this.getScrollTop()
17008
- };
17009
- };
17010
-
17011
- this.visualizeFocus = function() {
17012
- dom.addCssClass(this.container, "ace_focus");
17013
- };
17014
-
17015
- this.visualizeBlur = function() {
17016
- dom.removeCssClass(this.container, "ace_focus");
17017
- };
17018
-
17019
- this.showComposition = function(position) {
17020
- if (!this.$composition) {
17021
- this.$composition = dom.createElement("div");
17022
- this.$composition.className = "ace_composition";
17023
- this.content.appendChild(this.$composition);
17024
- }
17025
-
17026
- this.$composition.innerHTML = "&#160;";
17027
-
17028
- var pos = this.$cursorLayer.getPixelPosition();
17029
- var style = this.$composition.style;
17030
- style.top = pos.top + "px";
17031
- style.left = (pos.left + this.$padding) + "px";
17032
- style.height = this.lineHeight + "px";
17033
-
17034
- this.hideCursor();
17035
- };
17036
-
17037
- this.setCompositionText = function(text) {
17038
- dom.setInnerText(this.$composition, text);
17039
- };
17040
-
17041
- this.hideComposition = function() {
17042
- this.showCursor();
17043
-
17044
- if (!this.$composition)
17045
- return;
17046
-
17047
- var style = this.$composition.style;
17048
- style.top = "-10000px";
17049
- style.left = "-10000px";
17050
- };
17051
-
17052
- this.setTheme = function(theme) {
17053
- var _self = this;
17054
-
17055
- this.$themeValue = theme;
17056
- if (!theme || typeof theme == "string") {
17057
- theme = theme || "ace/theme/textmate";
17058
- require([theme], function(theme) {
17059
- afterLoad(theme);
17060
- });
17061
- } else {
17062
- afterLoad(theme);
17063
- }
17064
-
17065
- function afterLoad(theme) {
17066
- if (_self.$theme)
17067
- dom.removeCssClass(_self.container, _self.$theme);
17068
-
17069
- _self.$theme = theme ? theme.cssClass : null;
17070
-
17071
- if (_self.$theme)
17072
- dom.addCssClass(_self.container, _self.$theme);
17073
-
17074
- // force re-measure of the gutter width
17075
- if (_self.$size) {
17076
- _self.$size.width = 0;
17077
- _self.onResize();
17078
- }
17079
- }
17080
- };
17081
-
17082
- this.getTheme = function() {
17083
- return this.$themeValue;
17084
- };
17085
-
17086
- // Methods allows to add / remove CSS classnames to the editor element.
17087
- // This feature can be used by plug-ins to provide a visual indication of
17088
- // a certain mode that editor is in.
17089
-
17090
- this.setStyle = function setStyle(style) {
17091
- dom.addCssClass(this.container, style);
17092
- };
17093
-
17094
- this.unsetStyle = function unsetStyle(style) {
17095
- dom.removeCssClass(this.container, style);
17096
- };
17097
-
17098
- this.destroy = function() {
17099
- this.$textLayer.destroy();
17100
- this.$cursorLayer.destroy();
17101
- };
17102
-
17103
- }).call(VirtualRenderer.prototype);
17104
-
17105
- exports.VirtualRenderer = VirtualRenderer;
17106
- });
17107
- /* vim:ts=4:sts=4:sw=4:
17108
- * ***** BEGIN LICENSE BLOCK *****
17109
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
17110
- *
17111
- * The contents of this file are subject to the Mozilla Public License Version
17112
- * 1.1 (the "License"); you may not use this file except in compliance with
17113
- * the License. You may obtain a copy of the License at
17114
- * http://www.mozilla.org/MPL/
17115
- *
17116
- * Software distributed under the License is distributed on an "AS IS" basis,
17117
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17118
- * for the specific language governing rights and limitations under the
17119
- * License.
17120
- *
17121
- * The Original Code is Ajax.org Code Editor (ACE).
17122
- *
17123
- * The Initial Developer of the Original Code is
17124
- * Ajax.org B.V.
17125
- * Portions created by the Initial Developer are Copyright (C) 2010
17126
- * the Initial Developer. All Rights Reserved.
17127
- *
17128
- * Contributor(s):
17129
- * Fabian Jakobs <fabian AT ajax DOT org>
17130
- * Julian Viereck <julian DOT viereck AT gmail DOT com>
17131
- *
17132
- * Alternatively, the contents of this file may be used under the terms of
17133
- * either the GNU General Public License Version 2 or later (the "GPL"), or
17134
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
17135
- * in which case the provisions of the GPL or the LGPL are applicable instead
17136
- * of those above. If you wish to allow use of your version of this file only
17137
- * under the terms of either the GPL or the LGPL, and not to allow others to
17138
- * use your version of this file under the terms of the MPL, indicate your
17139
- * decision by deleting the provisions above and replace them with the notice
17140
- * and other provisions required by the GPL or the LGPL. If you do not delete
17141
- * the provisions above, a recipient may use your version of this file under
17142
- * the terms of any one of the MPL, the GPL or the LGPL.
17143
- *
17144
- * ***** END LICENSE BLOCK ***** */
17145
-
17146
- define('ace/layer/gutter', ['require', 'exports', 'module' , 'pilot/dom'], function(require, exports, module) {
17147
-
17148
- var dom = require("pilot/dom");
17149
-
17150
- var Gutter = function(parentEl) {
17151
- this.element = dom.createElement("div");
17152
- this.element.className = "ace_layer ace_gutter-layer";
17153
- parentEl.appendChild(this.element);
17154
-
17155
- this.$breakpoints = [];
17156
- this.$annotations = [];
17157
- this.$decorations = [];
17158
- };
17159
-
17160
- (function() {
17161
-
17162
- this.setSession = function(session) {
17163
- this.session = session;
17164
- };
17165
-
17166
- this.addGutterDecoration = function(row, className){
17167
- if (!this.$decorations[row])
17168
- this.$decorations[row] = "";
17169
- this.$decorations[row] += " ace_" + className;
17170
- }
17171
-
17172
- this.removeGutterDecoration = function(row, className){
17173
- this.$decorations[row] = this.$decorations[row].replace(" ace_" + className, "");
17174
- };
17175
-
17176
- this.setBreakpoints = function(rows) {
17177
- this.$breakpoints = rows.concat();
17178
- };
17179
-
17180
- this.setAnnotations = function(annotations) {
17181
- // iterate over sparse array
17182
- this.$annotations = [];
17183
- for (var row in annotations) if (annotations.hasOwnProperty(row)) {
17184
- var rowAnnotations = annotations[row];
17185
- if (!rowAnnotations)
17186
- continue;
17187
-
17188
- var rowInfo = this.$annotations[row] = {
17189
- text: []
17190
- };
17191
- for (var i=0; i<rowAnnotations.length; i++) {
17192
- var annotation = rowAnnotations[i];
17193
- rowInfo.text.push(annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</, "&lt;"));
17194
- var type = annotation.type;
17195
- if (type == "error")
17196
- rowInfo.className = "ace_error";
17197
- else if (type == "warning" && rowInfo.className != "ace_error")
17198
- rowInfo.className = "ace_warning";
17199
- else if (type == "info" && (!rowInfo.className))
17200
- rowInfo.className = "ace_info";
17201
- }
17202
- }
17203
- };
17204
-
17205
- this.update = function(config) {
17206
- this.$config = config;
17207
-
17208
- var emptyAnno = {className: "", text: []};
17209
- var html = [];
17210
- var i = config.firstRow;
17211
- var lastRow = config.lastRow;
17212
- var fold = this.session.getNextFold(i);
17213
- var foldStart = fold ? fold.start.row : Infinity;
17214
-
17215
- while (true) {
17216
- if(i > foldStart) {
17217
- i = fold.end.row + 1;
17218
- fold = this.session.getNextFold(i);
17219
- foldStart = fold ?fold.start.row :Infinity;
17220
- }
17221
- if(i > lastRow)
17222
- break;
17223
-
17224
- var annotation = this.$annotations[i] || emptyAnno;
17225
- html.push("<div class='ace_gutter-cell",
17226
- this.$decorations[i] || "",
17227
- this.$breakpoints[i] ? " ace_breakpoint " : " ",
17228
- annotation.className,
17229
- "' title='", annotation.text.join("\n"),
17230
- "' style='height:", config.lineHeight, "px;'>", (i+1));
17231
-
17232
- var wrappedRowLength = this.session.getRowLength(i) - 1;
17233
- while (wrappedRowLength--) {
17234
- html.push("</div><div class='ace_gutter-cell' style='height:", config.lineHeight, "px'>&brvbar;</div>");
17235
- }
17236
-
17237
- html.push("</div>");
17238
-
17239
- i++;
17240
- }
17241
- this.element = dom.setInnerHtml(this.element, html.join(""));
17242
- this.element.style.height = config.minHeight + "px";
17243
- };
17244
-
17245
- }).call(Gutter.prototype);
17246
-
17247
- exports.Gutter = Gutter;
17248
-
17249
- });
17250
- /* vim:ts=4:sts=4:sw=4:
17251
- * ***** BEGIN LICENSE BLOCK *****
17252
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
17253
- *
17254
- * The contents of this file are subject to the Mozilla Public License Version
17255
- * 1.1 (the "License"); you may not use this file except in compliance with
17256
- * the License. You may obtain a copy of the License at
17257
- * http://www.mozilla.org/MPL/
17258
- *
17259
- * Software distributed under the License is distributed on an "AS IS" basis,
17260
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17261
- * for the specific language governing rights and limitations under the
17262
- * License.
17263
- *
17264
- * The Original Code is Ajax.org Code Editor (ACE).
17265
- *
17266
- * The Initial Developer of the Original Code is
17267
- * Ajax.org B.V.
17268
- * Portions created by the Initial Developer are Copyright (C) 2010
17269
- * the Initial Developer. All Rights Reserved.
17270
- *
17271
- * Contributor(s):
17272
- * Fabian Jakobs <fabian AT ajax DOT org>
17273
- * Julian Viereck <julian.viereck@gmail.com>
17274
- *
17275
- * Alternatively, the contents of this file may be used under the terms of
17276
- * either the GNU General Public License Version 2 or later (the "GPL"), or
17277
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
17278
- * in which case the provisions of the GPL or the LGPL are applicable instead
17279
- * of those above. If you wish to allow use of your version of this file only
17280
- * under the terms of either the GPL or the LGPL, and not to allow others to
17281
- * use your version of this file under the terms of the MPL, indicate your
17282
- * decision by deleting the provisions above and replace them with the notice
17283
- * and other provisions required by the GPL or the LGPL. If you do not delete
17284
- * the provisions above, a recipient may use your version of this file under
17285
- * the terms of any one of the MPL, the GPL or the LGPL.
17286
- *
17287
- * ***** END LICENSE BLOCK ***** */
17288
-
17289
- define('ace/layer/marker', ['require', 'exports', 'module' , 'ace/range', 'pilot/dom'], function(require, exports, module) {
17290
-
17291
- var Range = require("ace/range").Range;
17292
- var dom = require("pilot/dom");
17293
-
17294
- var Marker = function(parentEl) {
17295
- this.element = dom.createElement("div");
17296
- this.element.className = "ace_layer ace_marker-layer";
17297
- parentEl.appendChild(this.element);
17298
- };
17299
-
17300
- (function() {
17301
-
17302
- this.$padding = 0;
17303
-
17304
- this.setPadding = function(padding) {
17305
- this.$padding = padding;
17306
- };
17307
- this.setSession = function(session) {
17308
- this.session = session;
17309
- };
17310
-
17311
- this.setMarkers = function(markers) {
17312
- this.markers = markers;
17313
- };
17314
-
17315
- this.update = function(config) {
17316
- var config = config || this.config;
17317
- if (!config)
17318
- return;
17319
-
17320
- this.config = config;
17321
-
17322
-
17323
- var html = [];
17324
- for ( var key in this.markers) {
17325
- var marker = this.markers[key];
17326
-
17327
- var range = marker.range.clipRows(config.firstRow, config.lastRow);
17328
- if (range.isEmpty()) continue;
17329
-
17330
- range = range.toScreenRange(this.session);
17331
- if (marker.renderer) {
17332
- var top = this.$getTop(range.start.row, config);
17333
- var left = Math.round(
17334
- this.$padding + range.start.column * config.characterWidth
17335
- );
17336
- marker.renderer(html, range, left, top, config);
17337
- }
17338
- else if (range.isMultiLine()) {
17339
- if (marker.type == "text") {
17340
- this.drawTextMarker(html, range, marker.clazz, config);
17341
- } else {
17342
- this.drawMultiLineMarker(
17343
- html, range, marker.clazz, config,
17344
- marker.type
17345
- );
17346
- }
17347
- }
17348
- else {
17349
- this.drawSingleLineMarker(
17350
- html, range, marker.clazz, config,
17351
- null, marker.type
17352
- );
17353
- }
17354
- }
17355
- this.element = dom.setInnerHtml(this.element, html.join(""));
17356
- };
17357
-
17358
- this.$getTop = function(row, layerConfig) {
17359
- return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
17360
- };
17361
-
17362
- /**
17363
- * Draws a marker, which spans a range of text in a single line
17364
- */
17365
- this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
17366
- // selection start
17367
- var row = range.start.row;
17368
-
17369
- var lineRange = new Range(
17370
- row, range.start.column,
17371
- row, this.session.getScreenLastRowColumn(row)
17372
- );
17373
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
17374
-
17375
- // selection end
17376
- row = range.end.row;
17377
- lineRange = new Range(row, 0, row, range.end.column);
17378
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, "text");
17379
-
17380
- for (row = range.start.row + 1; row < range.end.row; row++) {
17381
- lineRange.start.row = row;
17382
- lineRange.end.row = row;
17383
- lineRange.end.column = this.session.getScreenLastRowColumn(row);
17384
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
17385
- }
17386
- };
17387
-
17388
- /**
17389
- * Draws a multi line marker, where lines span the full width
17390
- */
17391
- this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
17392
- // from selection start to the end of the line
17393
- var padding = type === "background" ? 0 : this.$padding;
17394
- var height = layerConfig.lineHeight;
17395
- var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth));
17396
- var top = this.$getTop(range.start.row, layerConfig);
17397
- var left = Math.round(
17398
- padding + range.start.column * layerConfig.characterWidth
17399
- );
17400
-
17401
- stringBuilder.push(
17402
- "<div class='", clazz, "' style='",
17403
- "height:", height, "px;",
17404
- "width:", width, "px;",
17405
- "top:", top, "px;",
17406
- "left:", left, "px;'></div>"
17407
- );
17408
-
17409
- // from start of the last line to the selection end
17410
- top = this.$getTop(range.end.row, layerConfig);
17411
- width = Math.round(range.end.column * layerConfig.characterWidth);
17412
-
17413
- stringBuilder.push(
17414
- "<div class='", clazz, "' style='",
17415
- "height:", height, "px;",
17416
- "width:", width, "px;",
17417
- "top:", top, "px;",
17418
- "left:", padding, "px;'></div>"
17419
- );
17420
-
17421
- // all the complete lines
17422
- height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
17423
- if (height < 0)
17424
- return;
17425
- top = this.$getTop(range.start.row + 1, layerConfig);
17426
- width = layerConfig.width;
17427
-
17428
- stringBuilder.push(
17429
- "<div class='", clazz, "' style='",
17430
- "height:", height, "px;",
17431
- "width:", width, "px;",
17432
- "top:", top, "px;",
17433
- "left:", padding, "px;'></div>"
17434
- );
17435
- };
17436
-
17437
- /**
17438
- * Draws a marker which covers one single full line
17439
- */
17440
- this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, type) {
17441
- var padding = type === "background" ? 0 : this.$padding;
17442
- var height = layerConfig.lineHeight;
17443
-
17444
- if (type === "background")
17445
- var width = layerConfig.width;
17446
- else
17447
- width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
17448
-
17449
- var top = this.$getTop(range.start.row, layerConfig);
17450
- var left = Math.round(
17451
- padding + range.start.column * layerConfig.characterWidth
17452
- );
17453
-
17454
- stringBuilder.push(
17455
- "<div class='", clazz, "' style='",
17456
- "height:", height, "px;",
17457
- "width:", width, "px;",
17458
- "top:", top, "px;",
17459
- "left:", left,"px;'></div>"
17460
- );
17461
- };
17462
-
17463
- }).call(Marker.prototype);
17464
-
17465
- exports.Marker = Marker;
17466
-
17467
- });
17468
- /* vim:ts=4:sts=4:sw=4:
17469
- * ***** BEGIN LICENSE BLOCK *****
17470
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
17471
- *
17472
- * The contents of this file are subject to the Mozilla Public License Version
17473
- * 1.1 (the "License"); you may not use this file except in compliance with
17474
- * the License. You may obtain a copy of the License at
17475
- * http://www.mozilla.org/MPL/
17476
- *
17477
- * Software distributed under the License is distributed on an "AS IS" basis,
17478
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17479
- * for the specific language governing rights and limitations under the
17480
- * License.
17481
- *
17482
- * The Original Code is Ajax.org Code Editor (ACE).
17483
- *
17484
- * The Initial Developer of the Original Code is
17485
- * Ajax.org B.V.
17486
- * Portions created by the Initial Developer are Copyright (C) 2010
17487
- * the Initial Developer. All Rights Reserved.
17488
- *
17489
- * Contributor(s):
17490
- * Fabian Jakobs <fabian AT ajax DOT org>
17491
- * Julian Viereck <julian DOT viereck AT gmail DOT com>
17492
- * Mihai Sucan <mihai.sucan@gmail.com>
17493
- *
17494
- * Alternatively, the contents of this file may be used under the terms of
17495
- * either the GNU General Public License Version 2 or later (the "GPL"), or
17496
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
17497
- * in which case the provisions of the GPL or the LGPL are applicable instead
17498
- * of those above. If you wish to allow use of your version of this file only
17499
- * under the terms of either the GPL or the LGPL, and not to allow others to
17500
- * use your version of this file under the terms of the MPL, indicate your
17501
- * decision by deleting the provisions above and replace them with the notice
17502
- * and other provisions required by the GPL or the LGPL. If you do not delete
17503
- * the provisions above, a recipient may use your version of this file under
17504
- * the terms of any one of the MPL, the GPL or the LGPL.
17505
- *
17506
- * ***** END LICENSE BLOCK ***** */
17507
-
17508
- define('ace/layer/text', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/lang', 'pilot/useragent', 'pilot/event_emitter'], function(require, exports, module) {
17509
-
17510
- var oop = require("pilot/oop");
17511
- var dom = require("pilot/dom");
17512
- var lang = require("pilot/lang");
17513
- var useragent = require("pilot/useragent");
17514
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
17515
-
17516
- var Text = function(parentEl) {
17517
- this.element = dom.createElement("div");
17518
- this.element.className = "ace_layer ace_text-layer";
17519
- this.element.style.width = "auto";
17520
- parentEl.appendChild(this.element);
17521
-
17522
- this.$characterSize = this.$measureSizes() || {width: 0, height: 0};
17523
- this.$pollSizeChanges();
17524
- };
17525
-
17526
- (function() {
17527
-
17528
- oop.implement(this, EventEmitter);
17529
-
17530
- this.EOF_CHAR = "&para;";
17531
- this.EOL_CHAR = "&not;";
17532
- this.TAB_CHAR = "&rarr;";
17533
- this.SPACE_CHAR = "&middot;";
17534
- this.$padding = 0;
17535
-
17536
- this.setPadding = function(padding) {
17537
- this.$padding = padding;
17538
- this.element.style.padding = "0 " + padding + "px";
17539
- };
17540
-
17541
- this.getLineHeight = function() {
17542
- return this.$characterSize.height || 1;
17543
- };
17544
-
17545
- this.getCharacterWidth = function() {
17546
- return this.$characterSize.width || 1;
17547
- };
17548
-
17549
- this.checkForSizeChanges = function() {
17550
- var size = this.$measureSizes();
17551
- if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
17552
- this.$characterSize = size;
17553
- this._dispatchEvent("changeCharaterSize", {data: size});
17554
- }
17555
- };
17556
-
17557
- this.$pollSizeChanges = function() {
17558
- var self = this;
17559
- this.$pollSizeChangesTimer = setInterval(function() {
17560
- self.checkForSizeChanges();
17561
- }, 500);
17562
- };
17563
-
17564
- this.$fontStyles = {
17565
- fontFamily : 1,
17566
- fontSize : 1,
17567
- fontWeight : 1,
17568
- fontStyle : 1,
17569
- lineHeight : 1
17570
- };
17571
-
17572
- this.$measureSizes = function() {
17573
- var n = 1000;
17574
- if (!this.$measureNode) {
17575
- var measureNode = this.$measureNode = dom.createElement("div");
17576
- var style = measureNode.style;
17577
-
17578
- style.width = style.height = "auto";
17579
- style.left = style.top = (-n * 40) + "px";
17580
-
17581
- style.visibility = "hidden";
17582
- style.position = "absolute";
17583
- style.overflow = "visible";
17584
- style.whiteSpace = "nowrap";
17585
-
17586
- // in FF 3.6 monospace fonts can have a fixed sub pixel width.
17587
- // that's why we have to measure many characters
17588
- // Note: characterWidth can be a float!
17589
- measureNode.innerHTML = lang.stringRepeat("Xy", n);
17590
-
17591
- if (document.body) {
17592
- document.body.appendChild(measureNode);
17593
- } else {
17594
- var container = this.element.parentNode;
17595
- while (!dom.hasCssClass(container, "ace_editor"))
17596
- container = container.parentNode;
17597
- container.appendChild(measureNode);
17598
- }
17599
-
17600
- }
17601
-
17602
- var style = this.$measureNode.style;
17603
- var computedStyle = dom.computedStyle(this.element);
17604
- for (var prop in this.$fontStyles)
17605
- style[prop] = computedStyle[prop];
17606
-
17607
- var size = {
17608
- height: this.$measureNode.offsetHeight,
17609
- width: this.$measureNode.offsetWidth / (n * 2)
17610
- };
17611
-
17612
- // Size and width can be null if the editor is not visible or
17613
- // detached from the document
17614
- if (size.width == 0 && size.height == 0)
17615
- return null;
17616
-
17617
- return size;
17618
- };
17619
-
17620
- this.setSession = function(session) {
17621
- this.session = session;
17622
- };
17623
-
17624
- this.showInvisibles = false;
17625
- this.setShowInvisibles = function(showInvisibles) {
17626
- if (this.showInvisibles == showInvisibles)
17627
- return false;
17628
-
17629
- this.showInvisibles = showInvisibles;
17630
- return true;
17631
- };
17632
-
17633
- this.$tabStrings = [];
17634
- this.$computeTabString = function() {
17635
- var tabSize = this.session.getTabSize();
17636
- var tabStr = this.$tabStrings = [0];
17637
- for (var i = 1; i < tabSize + 1; i++) {
17638
- if (this.showInvisibles) {
17639
- tabStr.push("<span class='ace_invisible'>"
17640
- + this.TAB_CHAR
17641
- + new Array(i).join("&#160;")
17642
- + "</span>");
17643
- } else {
17644
- tabStr.push(new Array(i+1).join("&#160;"));
17645
- }
17646
- }
17647
-
17648
- };
17649
-
17650
- this.updateLines = function(config, firstRow, lastRow) {
17651
- this.$computeTabString();
17652
- // Due to wrap line changes there can be new lines if e.g.
17653
- // the line to updated wrapped in the meantime.
17654
- if (this.config.lastRow != config.lastRow ||
17655
- this.config.firstRow != config.firstRow) {
17656
- this.scrollLines(config);
17657
- }
17658
- this.config = config;
17659
-
17660
- var first = Math.max(firstRow, config.firstRow);
17661
- var last = Math.min(lastRow, config.lastRow);
17662
-
17663
- var lineElements = this.element.childNodes;
17664
- var lineElementsIdx = 0;
17665
-
17666
- for (var row = config.firstRow; row < first; row++) {
17667
- var foldLine = this.session.getFoldLine(row);
17668
- if (foldLine) {
17669
- if (foldLine.containsRow(first)) {
17670
- break;
17671
- } else {
17672
- row = foldLine.end.row;
17673
- }
17674
- }
17675
- lineElementsIdx ++;
17676
- }
17677
-
17678
- for (var i=first; i<=last; i++) {
17679
- var lineElement = lineElements[lineElementsIdx++];
17680
- if (!lineElement)
17681
- continue;
17682
-
17683
- var html = [];
17684
- var tokens = this.session.getTokens(i, i);
17685
- this.$renderLine(html, i, tokens[0].tokens, true);
17686
- lineElement = dom.setInnerHtml(lineElement, html.join(""));
17687
-
17688
- i = this.session.getRowFoldEnd(i);
17689
- }
17690
- };
17691
-
17692
- this.scrollLines = function(config) {
17693
- this.$computeTabString();
17694
- var oldConfig = this.config;
17695
- this.config = config;
17696
-
17697
- if (!oldConfig || oldConfig.lastRow < config.firstRow)
17698
- return this.update(config);
17699
-
17700
- if (config.lastRow < oldConfig.firstRow)
17701
- return this.update(config);
17702
-
17703
- var el = this.element;
17704
- if (oldConfig.firstRow < config.firstRow)
17705
- for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)
17706
- el.removeChild(el.firstChild);
17707
-
17708
- if (oldConfig.lastRow > config.lastRow)
17709
- for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)
17710
- el.removeChild(el.lastChild);
17711
-
17712
- if (config.firstRow < oldConfig.firstRow) {
17713
- var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);
17714
- if (el.firstChild)
17715
- el.insertBefore(fragment, el.firstChild);
17716
- else
17717
- el.appendChild(fragment);
17718
- }
17719
-
17720
- if (config.lastRow > oldConfig.lastRow) {
17721
- var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);
17722
- el.appendChild(fragment);
17723
- }
17724
- };
17725
-
17726
- this.$renderLinesFragment = function(config, firstRow, lastRow) {
17727
- var fragment = document.createDocumentFragment(),
17728
- row = firstRow,
17729
- fold = this.session.getNextFold(row),
17730
- foldStart = fold ?fold.start.row :Infinity;
17731
-
17732
- while (true) {
17733
- if(row > foldStart) {
17734
- row = fold.end.row+1;
17735
- fold = this.session.getNextFold(row);
17736
- foldStart = fold ?fold.start.row :Infinity;
17737
- }
17738
- if(row > lastRow)
17739
- break;
17740
-
17741
- var container = dom.createElement("div");
17742
-
17743
- var html = [];
17744
- // Get the tokens per line as there might be some lines in between
17745
- // beeing folded.
17746
- // OPTIMIZE: If there is a long block of unfolded lines, just make
17747
- // this call once for that big block of unfolded lines.
17748
- var tokens = this.session.getTokens(row, row);
17749
- if (tokens.length == 1)
17750
- this.$renderLine(html, row, tokens[0].tokens, false);
17751
-
17752
- // don't use setInnerHtml since we are working with an empty DIV
17753
- container.innerHTML = html.join("");
17754
- var lines = container.childNodes
17755
- while(lines.length)
17756
- fragment.appendChild(lines[0]);
17757
-
17758
- row++;
17759
- }
17760
- return fragment;
17761
- };
17762
-
17763
- this.update = function(config) {
17764
- this.$computeTabString();
17765
- this.config = config;
17766
-
17767
- var html = [];
17768
- var firstRow = config.firstRow, lastRow = config.lastRow;
17769
-
17770
- var row = firstRow,
17771
- fold = this.session.getNextFold(row),
17772
- foldStart = fold ?fold.start.row :Infinity;
17773
-
17774
- while (true) {
17775
- if(row > foldStart) {
17776
- row = fold.end.row+1;
17777
- fold = this.session.getNextFold(row);
17778
- foldStart = fold ?fold.start.row :Infinity;
17779
- }
17780
- if(row > lastRow)
17781
- break;
17782
-
17783
- // Get the tokens per line as there might be some lines in between
17784
- // beeing folded.
17785
- // OPTIMIZE: If there is a long block of unfolded lines, just make
17786
- // this call once for that big block of unfolded lines.
17787
- var tokens = this.session.getTokens(row, row);
17788
- if (tokens.length == 1)
17789
- this.$renderLine(html, row, tokens[0].tokens, false);
17790
-
17791
- row++;
17792
- }
17793
- this.element = dom.setInnerHtml(this.element, html.join(""));
17794
- };
17795
-
17796
- this.$textToken = {
17797
- "text": true,
17798
- "rparen": true,
17799
- "lparen": true
17800
- };
17801
-
17802
- this.$renderToken = function(stringBuilder, screenColumn, token, value) {
17803
- var self = this;
17804
- var replaceReg = /\t|&|<|( +)|([\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000])|[\u1100-\u115F]|[\u11A3-\u11A7]|[\u11FA-\u11FF]|[\u2329-\u232A]|[\u2E80-\u2E99]|[\u2E9B-\u2EF3]|[\u2F00-\u2FD5]|[\u2FF0-\u2FFB]|[\u3000-\u303E]|[\u3041-\u3096]|[\u3099-\u30FF]|[\u3105-\u312D]|[\u3131-\u318E]|[\u3190-\u31BA]|[\u31C0-\u31E3]|[\u31F0-\u321E]|[\u3220-\u3247]|[\u3250-\u32FE]|[\u3300-\u4DBF]|[\u4E00-\uA48C]|[\uA490-\uA4C6]|[\uA960-\uA97C]|[\uAC00-\uD7A3]|[\uD7B0-\uD7C6]|[\uD7CB-\uD7FB]|[\uF900-\uFAFF]|[\uFE10-\uFE19]|[\uFE30-\uFE52]|[\uFE54-\uFE66]|[\uFE68-\uFE6B]|[\uFF01-\uFF60]|[\uFFE0-\uFFE6]/g;
17805
- var replaceFunc = function(c, a, b, tabIdx, idx4) {
17806
- if (c.charCodeAt(0) == 32) {
17807
- return new Array(c.length+1).join("&#160;");
17808
- } else if (c == "\t") {
17809
- var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);
17810
- screenColumn += tabSize - 1;
17811
- return self.$tabStrings[tabSize];
17812
- } else if (c == "&") {
17813
- if (useragent.isOldGecko)
17814
- return "&";
17815
- else
17816
- return "&amp;";
17817
- } else if (c == "<") {
17818
- return "&lt;";
17819
- } else if (c.match(/[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/)) {
17820
- if (self.showInvisibles) {
17821
- var space = new Array(c.length+1).join(self.SPACE_CHAR);
17822
- return "<span class='ace_invisible'>" + space + "</span>";
17823
- } else {
17824
- return "&#160;";
17825
- }
17826
- } else {
17827
- screenColumn += 1;
17828
- return "<span class='ace_cjk' style='width:" +
17829
- (self.config.characterWidth * 2) +
17830
- "px'>" + c + "</span>";
17831
- }
17832
- };
17833
-
17834
- var output = value.replace(replaceReg, replaceFunc);
17835
-
17836
- if (!this.$textToken[token.type]) {
17837
- var classes = "ace_" + token.type.replace(/\./g, " ace_");
17838
- stringBuilder.push("<span class='", classes, "'>", output, "</span>");
17839
- }
17840
- else {
17841
- stringBuilder.push(output);
17842
- }
17843
- return screenColumn + value.length;
17844
- };
17845
-
17846
- this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits, onlyContents) {
17847
- var chars = 0;
17848
- var split = 0;
17849
- var splitChars;
17850
- var characterWidth = this.config.characterWidth;
17851
- var screenColumn = 0;
17852
- var self = this;
17853
-
17854
- if (!splits || splits.length == 0)
17855
- splitChars = Number.MAX_VALUE;
17856
- else
17857
- splitChars = splits[0];
17858
-
17859
- if (!onlyContents) {
17860
- stringBuilder.push("<div class='ace_line' style='height:",
17861
- this.config.lineHeight, "px",
17862
- "'>"
17863
- );
17864
- }
17865
-
17866
- for (var i = 0; i < tokens.length; i++) {
17867
- var token = tokens[i];
17868
- var value = token.value;
17869
-
17870
- if (chars + value.length < splitChars) {
17871
- screenColumn = self.$renderToken(
17872
- stringBuilder, screenColumn, token, value
17873
- );
17874
- chars += value.length;
17875
- }
17876
- else {
17877
- while (chars + value.length >= splitChars) {
17878
- screenColumn = self.$renderToken(
17879
- stringBuilder, screenColumn,
17880
- token, value.substring(0, splitChars - chars)
17881
- );
17882
- value = value.substring(splitChars - chars);
17883
- chars = splitChars;
17884
-
17885
- if (!onlyContents) {
17886
- stringBuilder.push("</div>",
17887
- "<div class='ace_line' style='height:",
17888
- this.config.lineHeight, "px",
17889
- "'>"
17890
- );
17891
- }
17892
-
17893
- split ++;
17894
- screenColumn = 0;
17895
- splitChars = splits[split] || Number.MAX_VALUE;
17896
- }
17897
- if (value.length != 0) {
17898
- chars += value.length;
17899
- screenColumn = self.$renderToken(
17900
- stringBuilder, screenColumn, token, value
17901
- );
17902
- }
17903
- }
17904
- }
17905
-
17906
- if (this.showInvisibles) {
17907
- if (lastRow !== this.session.getLength() - 1)
17908
- stringBuilder.push("<span class='ace_invisible'>" + this.EOL_CHAR + "</span>");
17909
- else
17910
- stringBuilder.push("<span class='ace_invisible'>" + this.EOF_CHAR + "</span>");
17911
- }
17912
- stringBuilder.push("</div>");
17913
- };
17914
-
17915
- this.$renderLine = function(stringBuilder, row, tokens, onlyContents) {
17916
- // Check if the line to render is folded or not. If not, things are
17917
- // simple, otherwise, we need to fake some things...
17918
- if (!this.session.isRowFolded(row)) {
17919
- var splits = this.session.getRowSplitData(row);
17920
- this.$renderLineCore(stringBuilder, row, tokens, splits, onlyContents);
17921
- } else {
17922
- this.$renderFoldLine(stringBuilder, row, tokens, onlyContents);
17923
- }
17924
- };
17925
-
17926
- this.$renderFoldLine = function(stringBuilder, row, tokens, onlyContents) {
17927
- var session = this.session,
17928
- foldLine = session.getFoldLine(row),
17929
- renderTokens = [];
17930
-
17931
- function addTokens(tokens, from, to) {
17932
- var idx = 0, col = 0;
17933
- while ((col + tokens[idx].value.length) < from) {
17934
- col += tokens[idx].value.length;
17935
- idx++;
17936
-
17937
- if (idx == tokens.length) {
17938
- return;
17939
- }
17940
- }
17941
- if (col != from) {
17942
- var value = tokens[idx].value.substring(from - col);
17943
- // Check if the token value is longer then the from...to spacing.
17944
- if (value.length > (to - from)) {
17945
- value = value.substring(0, to - from);
17946
- }
17947
-
17948
- renderTokens.push({
17949
- type: tokens[idx].type,
17950
- value: value
17951
- });
17952
-
17953
- col = from + value.length;
17954
- idx += 1;
17955
- }
17956
-
17957
- while (col < to) {
17958
- var value = tokens[idx].value;
17959
- if (value.length + col > to) {
17960
- value = value.substring(0, to - col);
17961
- }
17962
- renderTokens.push({
17963
- type: tokens[idx].type,
17964
- value: value
17965
- });
17966
- col += value.length;
17967
- idx += 1;
17968
- }
17969
- }
17970
-
17971
- foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
17972
- if (placeholder) {
17973
- renderTokens.push({
17974
- type: "fold",
17975
- value: placeholder
17976
- });
17977
- } else {
17978
- if (isNewRow) {
17979
- tokens = this.session.getTokens(row, row)[0].tokens;
17980
- }
17981
- if (tokens.length != 0) {
17982
- addTokens(tokens, lastColumn, column);
17983
- }
17984
- }
17985
- }.bind(this), foldLine.end.row, this.session.getLine(foldLine.end.row).length);
17986
-
17987
- // TODO: Build a fake splits array!
17988
- var splits = this.session.$useWrapMode?this.session.$wrapData[row]:null;
17989
- this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
17990
- };
17991
-
17992
- this.destroy = function() {
17993
- clearInterval(this.$pollSizeChangesTimer);
17994
- if (this.$measureNode)
17995
- this.$measureNode.parentNode.removeChild(this.$measureNode);
17996
- delete this.$measureNode;
17997
- };
17998
-
17999
- }).call(Text.prototype);
18000
-
18001
- exports.Text = Text;
18002
-
18003
- });
18004
- /* vim:ts=4:sts=4:sw=4:
18005
- * ***** BEGIN LICENSE BLOCK *****
18006
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
18007
- *
18008
- * The contents of this file are subject to the Mozilla Public License Version
18009
- * 1.1 (the "License"); you may not use this file except in compliance with
18010
- * the License. You may obtain a copy of the License at
18011
- * http://www.mozilla.org/MPL/
18012
- *
18013
- * Software distributed under the License is distributed on an "AS IS" basis,
18014
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
18015
- * for the specific language governing rights and limitations under the
18016
- * License.
18017
- *
18018
- * The Original Code is Ajax.org Code Editor (ACE).
18019
- *
18020
- * The Initial Developer of the Original Code is
18021
- * Ajax.org B.V.
18022
- * Portions created by the Initial Developer are Copyright (C) 2010
18023
- * the Initial Developer. All Rights Reserved.
18024
- *
18025
- * Contributor(s):
18026
- * Fabian Jakobs <fabian AT ajax DOT org>
18027
- * Julian Viereck <julian.viereck@gmail.com>
18028
- *
18029
- * Alternatively, the contents of this file may be used under the terms of
18030
- * either the GNU General Public License Version 2 or later (the "GPL"), or
18031
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
18032
- * in which case the provisions of the GPL or the LGPL are applicable instead
18033
- * of those above. If you wish to allow use of your version of this file only
18034
- * under the terms of either the GPL or the LGPL, and not to allow others to
18035
- * use your version of this file under the terms of the MPL, indicate your
18036
- * decision by deleting the provisions above and replace them with the notice
18037
- * and other provisions required by the GPL or the LGPL. If you do not delete
18038
- * the provisions above, a recipient may use your version of this file under
18039
- * the terms of any one of the MPL, the GPL or the LGPL.
18040
- *
18041
- * ***** END LICENSE BLOCK ***** */
18042
-
18043
- define('ace/layer/cursor', ['require', 'exports', 'module' , 'pilot/dom'], function(require, exports, module) {
18044
-
18045
- var dom = require("pilot/dom");
18046
-
18047
- var Cursor = function(parentEl) {
18048
- this.element = dom.createElement("div");
18049
- this.element.className = "ace_layer ace_cursor-layer";
18050
- parentEl.appendChild(this.element);
18051
-
18052
- this.cursor = dom.createElement("div");
18053
- this.cursor.className = "ace_cursor ace_hidden";
18054
- this.element.appendChild(this.cursor);
18055
-
18056
- this.isVisible = false;
18057
- };
18058
-
18059
- (function() {
18060
-
18061
- this.$padding = 0;
18062
- this.setPadding = function(padding) {
18063
- this.$padding = padding;
18064
- };
18065
-
18066
- this.setSession = function(session) {
18067
- this.session = session;
18068
- };
18069
-
18070
- this.hideCursor = function() {
18071
- this.isVisible = false;
18072
- dom.addCssClass(this.cursor, "ace_hidden");
18073
- clearInterval(this.blinkId);
18074
- };
18075
-
18076
- this.showCursor = function() {
18077
- this.isVisible = true;
18078
- dom.removeCssClass(this.cursor, "ace_hidden");
18079
- this.cursor.style.visibility = "visible";
18080
- this.restartTimer();
18081
- };
18082
-
18083
- this.restartTimer = function() {
18084
- clearInterval(this.blinkId);
18085
- if (!this.isVisible) {
18086
- return;
18087
- }
18088
-
18089
- var cursor = this.cursor;
18090
- this.blinkId = setInterval(function() {
18091
- cursor.style.visibility = "hidden";
18092
- setTimeout(function() {
18093
- cursor.style.visibility = "visible";
18094
- }, 400);
18095
- }, 1000);
18096
- };
18097
-
18098
- this.getPixelPosition = function(onScreen) {
18099
- if (!this.config || !this.session) {
18100
- return {
18101
- left : 0,
18102
- top : 0
18103
- };
18104
- }
18105
-
18106
- var position = this.session.selection.getCursor();
18107
- var pos = this.session.documentToScreenPosition(position);
18108
- var cursorLeft = Math.round(this.$padding +
18109
- pos.column * this.config.characterWidth);
18110
- var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
18111
- this.config.lineHeight;
18112
-
18113
- return {
18114
- left : cursorLeft,
18115
- top : cursorTop
18116
- };
18117
- };
18118
-
18119
- this.update = function(config) {
18120
- this.config = config;
18121
-
18122
- this.pixelPos = this.getPixelPosition(true);
18123
-
18124
- this.cursor.style.left = this.pixelPos.left + "px";
18125
- this.cursor.style.top = this.pixelPos.top + "px";
18126
- this.cursor.style.width = config.characterWidth + "px";
18127
- this.cursor.style.height = config.lineHeight + "px";
18128
-
18129
- var overwrite = this.session.getOverwrite()
18130
- if (overwrite != this.overwrite) {
18131
- this.overwrite = overwrite;
18132
- if (overwrite)
18133
- dom.addCssClass(this.cursor, "ace_overwrite");
18134
- else
18135
- dom.removeCssClass(this.cursor, "ace_overwrite");
18136
- }
18137
-
18138
- this.restartTimer();
18139
- };
18140
-
18141
- this.destroy = function() {
18142
- clearInterval(this.blinkId);
18143
- }
18144
-
18145
- }).call(Cursor.prototype);
18146
-
18147
- exports.Cursor = Cursor;
18148
-
18149
- });
18150
- /* ***** BEGIN LICENSE BLOCK *****
18151
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
18152
- *
18153
- * The contents of this file are subject to the Mozilla Public License Version
18154
- * 1.1 (the "License"); you may not use this file except in compliance with
18155
- * the License. You may obtain a copy of the License at
18156
- * http://www.mozilla.org/MPL/
18157
- *
18158
- * Software distributed under the License is distributed on an "AS IS" basis,
18159
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
18160
- * for the specific language governing rights and limitations under the
18161
- * License.
18162
- *
18163
- * The Original Code is Ajax.org Code Editor (ACE).
18164
- *
18165
- * The Initial Developer of the Original Code is
18166
- * Ajax.org B.V.
18167
- * Portions created by the Initial Developer are Copyright (C) 2010
18168
- * the Initial Developer. All Rights Reserved.
18169
- *
18170
- * Contributor(s):
18171
- * Fabian Jakobs <fabian AT ajax DOT org>
18172
- *
18173
- * Alternatively, the contents of this file may be used under the terms of
18174
- * either the GNU General Public License Version 2 or later (the "GPL"), or
18175
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
18176
- * in which case the provisions of the GPL or the LGPL are applicable instead
18177
- * of those above. If you wish to allow use of your version of this file only
18178
- * under the terms of either the GPL or the LGPL, and not to allow others to
18179
- * use your version of this file under the terms of the MPL, indicate your
18180
- * decision by deleting the provisions above and replace them with the notice
18181
- * and other provisions required by the GPL or the LGPL. If you do not delete
18182
- * the provisions above, a recipient may use your version of this file under
18183
- * the terms of any one of the MPL, the GPL or the LGPL.
18184
- *
18185
- * ***** END LICENSE BLOCK ***** */
18186
-
18187
- define('ace/scrollbar', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/event', 'pilot/event_emitter'], function(require, exports, module) {
18188
-
18189
- var oop = require("pilot/oop");
18190
- var dom = require("pilot/dom");
18191
- var event = require("pilot/event");
18192
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
18193
-
18194
- var ScrollBar = function(parent) {
18195
- this.element = dom.createElement("div");
18196
- this.element.className = "ace_sb";
18197
-
18198
- this.inner = dom.createElement("div");
18199
- this.element.appendChild(this.inner);
18200
-
18201
- parent.appendChild(this.element);
18202
-
18203
- // in OSX lion the scrollbars appear to have no width. In this case resize
18204
- // the to show the scrollbar but still pretend that the scrollbar has a width
18205
- // of 0px
18206
- this.width = dom.scrollbarWidth();
18207
- this.element.style.width = (this.width || 15) + "px";
18208
-
18209
- event.addListener(this.element, "scroll", this.onScroll.bind(this));
18210
- };
18211
-
18212
- (function() {
18213
- oop.implement(this, EventEmitter);
18214
-
18215
- this.onScroll = function() {
18216
- this._dispatchEvent("scroll", {data: this.element.scrollTop});
18217
- };
18218
-
18219
- this.getWidth = function() {
18220
- return this.width;
18221
- };
18222
-
18223
- this.setHeight = function(height) {
18224
- this.element.style.height = height + "px";
18225
- };
18226
-
18227
- this.setInnerHeight = function(height) {
18228
- this.inner.style.height = height + "px";
18229
- };
18230
-
18231
- this.setScrollTop = function(scrollTop) {
18232
- this.element.scrollTop = scrollTop;
18233
- };
18234
-
18235
- }).call(ScrollBar.prototype);
18236
-
18237
- exports.ScrollBar = ScrollBar;
18238
- });
18239
- /* ***** BEGIN LICENSE BLOCK *****
18240
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
18241
- *
18242
- * The contents of this file are subject to the Mozilla Public License Version
18243
- * 1.1 (the "License"); you may not use this file except in compliance with
18244
- * the License. You may obtain a copy of the License at
18245
- * http://www.mozilla.org/MPL/
18246
- *
18247
- * Software distributed under the License is distributed on an "AS IS" basis,
18248
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
18249
- * for the specific language governing rights and limitations under the
18250
- * License.
18251
- *
18252
- * The Original Code is Ajax.org Code Editor (ACE).
18253
- *
18254
- * The Initial Developer of the Original Code is
18255
- * Ajax.org B.V.
18256
- * Portions created by the Initial Developer are Copyright (C) 2010
18257
- * the Initial Developer. All Rights Reserved.
18258
- *
18259
- * Contributor(s):
18260
- * Fabian Jakobs <fabian AT ajax DOT org>
18261
- *
18262
- * Alternatively, the contents of this file may be used under the terms of
18263
- * either the GNU General Public License Version 2 or later (the "GPL"), or
18264
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
18265
- * in which case the provisions of the GPL or the LGPL are applicable instead
18266
- * of those above. If you wish to allow use of your version of this file only
18267
- * under the terms of either the GPL or the LGPL, and not to allow others to
18268
- * use your version of this file under the terms of the MPL, indicate your
18269
- * decision by deleting the provisions above and replace them with the notice
18270
- * and other provisions required by the GPL or the LGPL. If you do not delete
18271
- * the provisions above, a recipient may use your version of this file under
18272
- * the terms of any one of the MPL, the GPL or the LGPL.
18273
- *
18274
- * ***** END LICENSE BLOCK ***** */
18275
-
18276
- define('ace/renderloop', ['require', 'exports', 'module' , 'pilot/event'], function(require, exports, module) {
18277
-
18278
- var event = require("pilot/event");
18279
-
18280
- var RenderLoop = function(onRender) {
18281
- this.onRender = onRender;
18282
- this.pending = false;
18283
- this.changes = 0;
18284
- };
18285
-
18286
- (function() {
18287
-
18288
- this.schedule = function(change) {
18289
- //this.onRender(change);
18290
- //return;
18291
- this.changes = this.changes | change;
18292
- if (!this.pending) {
18293
- this.pending = true;
18294
- var _self = this;
18295
- this.setTimeoutZero(function() {
18296
- _self.pending = false;
18297
- var changes = _self.changes;
18298
- _self.changes = 0;
18299
- _self.onRender(changes);
18300
- })
18301
- }
18302
- };
18303
-
18304
- this.setTimeoutZero = window.requestAnimationFrame ||
18305
- window.webkitRequestAnimationFrame ||
18306
- window.mozRequestAnimationFrame ||
18307
- window.oRequestAnimationFrame ||
18308
- window.msRequestAnimationFrame;
18309
-
18310
- if (this.setTimeoutZero) {
18311
-
18312
- this.setTimeoutZero = this.setTimeoutZero.bind(window)
18313
- } else if (window.postMessage) {
18314
-
18315
- this.messageName = "zero-timeout-message";
18316
-
18317
- this.setTimeoutZero = function(callback) {
18318
- if (!this.attached) {
18319
- var _self = this;
18320
- event.addListener(window, "message", function(e) {
18321
- if (_self.callback && e.data == _self.messageName) {
18322
- event.stopPropagation(e);
18323
- _self.callback();
18324
- }
18325
- });
18326
- this.attached = true;
18327
- }
18328
- this.callback = callback;
18329
- window.postMessage(this.messageName, "*");
18330
- }
18331
-
18332
- } else {
18333
-
18334
- this.setTimeoutZero = function(callback) {
18335
- setTimeout(callback, 0);
18336
- }
18337
- }
18338
-
18339
- }).call(RenderLoop.prototype);
18340
-
18341
- exports.RenderLoop = RenderLoop;
18342
- });
18343
- /* ***** BEGIN LICENSE BLOCK *****
18344
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
18345
- *
18346
- * The contents of this file are subject to the Mozilla Public License Version
18347
- * 1.1 (the "License"); you may not use this file except in compliance with
18348
- * the License. You may obtain a copy of the License at
18349
- * http://www.mozilla.org/MPL/
18350
- *
18351
- * Software distributed under the License is distributed on an "AS IS" basis,
18352
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
18353
- * for the specific language governing rights and limitations under the
18354
- * License.
18355
- *
18356
- * The Original Code is Ajax.org Code Editor (ACE).
18357
- *
18358
- * The Initial Developer of the Original Code is
18359
- * Ajax.org B.V.
18360
- * Portions created by the Initial Developer are Copyright (C) 2010
18361
- * the Initial Developer. All Rights Reserved.
18362
- *
18363
- * Contributor(s):
18364
- * Fabian Jakobs <fabian AT ajax DOT org>
18365
- *
18366
- * Alternatively, the contents of this file may be used under the terms of
18367
- * either the GNU General Public License Version 2 or later (the "GPL"), or
18368
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
18369
- * in which case the provisions of the GPL or the LGPL are applicable instead
18370
- * of those above. If you wish to allow use of your version of this file only
18371
- * under the terms of either the GPL or the LGPL, and not to allow others to
18372
- * use your version of this file under the terms of the MPL, indicate your
18373
- * decision by deleting the provisions above and replace them with the notice
18374
- * and other provisions required by the GPL or the LGPL. If you do not delete
18375
- * the provisions above, a recipient may use your version of this file under
18376
- * the terms of any one of the MPL, the GPL or the LGPL.
18377
- *
18378
- * ***** END LICENSE BLOCK ***** */
18379
-
18380
- define('ace/theme/textmate', ['require', 'exports', 'module' , 'pilot/dom'], function(require, exports, module) {
18381
-
18382
- var dom = require("pilot/dom");
18383
-
18384
- var cssText = ".ace-tm .ace_editor {\
18385
- border: 2px solid rgb(159, 159, 159);\
18386
- }\
18387
- \
18388
- .ace-tm .ace_editor.ace_focus {\
18389
- border: 2px solid #327fbd;\
18390
- }\
18391
- \
18392
- .ace-tm .ace_gutter {\
18393
- width: 50px;\
18394
- background: #e8e8e8;\
18395
- color: #333;\
18396
- overflow : hidden;\
18397
- }\
18398
- \
18399
- .ace-tm .ace_gutter-layer {\
18400
- width: 100%;\
18401
- text-align: right;\
18402
- }\
18403
- \
18404
- .ace-tm .ace_gutter-layer .ace_gutter-cell {\
18405
- padding-right: 6px;\
18406
- }\
18407
- \
18408
- .ace-tm .ace_print_margin {\
18409
- width: 1px;\
18410
- background: #e8e8e8;\
18411
- }\
18412
- \
18413
- .ace-tm .ace_text-layer {\
18414
- cursor: text;\
18415
- }\
18416
- \
18417
- .ace-tm .ace_cursor {\
18418
- border-left: 2px solid black;\
18419
- }\
18420
- \
18421
- .ace-tm .ace_cursor.ace_overwrite {\
18422
- border-left: 0px;\
18423
- border-bottom: 1px solid black;\
18424
- }\
18425
- \
18426
- .ace-tm .ace_line .ace_invisible {\
18427
- color: rgb(191, 191, 191);\
18428
- }\
18429
- \
18430
- .ace-tm .ace_line .ace_keyword {\
18431
- color: blue;\
18432
- }\
18433
- \
18434
- .ace-tm .ace_line .ace_constant.ace_buildin {\
18435
- color: rgb(88, 72, 246);\
18436
- }\
18437
- \
18438
- .ace-tm .ace_line .ace_constant.ace_language {\
18439
- color: rgb(88, 92, 246);\
18440
- }\
18441
- \
18442
- .ace-tm .ace_line .ace_constant.ace_library {\
18443
- color: rgb(6, 150, 14);\
18444
- }\
18445
- \
18446
- .ace-tm .ace_line .ace_invalid {\
18447
- background-color: rgb(153, 0, 0);\
18448
- color: white;\
18449
- }\
18450
- \
18451
- .ace-tm .ace_line .ace_fold {\
18452
- background-color: #E4E4E4;\
18453
- border-radius: 3px;\
18454
- }\
18455
- \
18456
- .ace-tm .ace_line .ace_support.ace_function {\
18457
- color: rgb(60, 76, 114);\
18458
- }\
18459
- \
18460
- .ace-tm .ace_line .ace_support.ace_constant {\
18461
- color: rgb(6, 150, 14);\
18462
- }\
18463
- \
18464
- .ace-tm .ace_line .ace_support.ace_type,\
18465
- .ace-tm .ace_line .ace_support.ace_class {\
18466
- color: rgb(109, 121, 222);\
18467
- }\
18468
- \
18469
- .ace-tm .ace_line .ace_keyword.ace_operator {\
18470
- color: rgb(104, 118, 135);\
18471
- }\
18472
- \
18473
- .ace-tm .ace_line .ace_string {\
18474
- color: rgb(3, 106, 7);\
18475
- }\
18476
- \
18477
- .ace-tm .ace_line .ace_comment {\
18478
- color: rgb(76, 136, 107);\
18479
- }\
18480
- \
18481
- .ace-tm .ace_line .ace_comment.ace_doc {\
18482
- color: rgb(0, 102, 255);\
18483
- }\
18484
- \
18485
- .ace-tm .ace_line .ace_comment.ace_doc.ace_tag {\
18486
- color: rgb(128, 159, 191);\
18487
- }\
18488
- \
18489
- .ace-tm .ace_line .ace_constant.ace_numeric {\
18490
- color: rgb(0, 0, 205);\
18491
- }\
18492
- \
18493
- .ace-tm .ace_line .ace_variable {\
18494
- color: rgb(49, 132, 149);\
18495
- }\
18496
- \
18497
- .ace-tm .ace_line .ace_xml_pe {\
18498
- color: rgb(104, 104, 91);\
18499
- }\
18500
- \
18501
- .ace-tm .ace_marker-layer .ace_selection {\
18502
- background: rgb(181, 213, 255);\
18503
- }\
18504
- \
18505
- .ace-tm .ace_marker-layer .ace_step {\
18506
- background: rgb(252, 255, 0);\
18507
- }\
18508
- \
18509
- .ace-tm .ace_marker-layer .ace_stack {\
18510
- background: rgb(164, 229, 101);\
18511
- }\
18512
- \
18513
- .ace-tm .ace_marker-layer .ace_bracket {\
18514
- margin: -1px 0 0 -1px;\
18515
- border: 1px solid rgb(192, 192, 192);\
18516
- }\
18517
- \
18518
- .ace-tm .ace_marker-layer .ace_active_line {\
18519
- background: rgba(0, 0, 0, 0.07);\
18520
- }\
18521
- \
18522
- .ace-tm .ace_marker-layer .ace_selected_word {\
18523
- background: rgb(250, 250, 255);\
18524
- border: 1px solid rgb(200, 200, 250);\
18525
- }\
18526
- \
18527
- .ace-tm .ace_string.ace_regex {\
18528
- color: rgb(255, 0, 0)\
18529
- }";
18530
-
18531
- // import CSS once
18532
- dom.importCssString(cssText);
18533
-
18534
- exports.cssClass = "ace-tm";
18535
- });
18536
- /* ***** BEGIN LICENSE BLOCK *****
18537
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
18538
- *
18539
- * The contents of this file are subject to the Mozilla Public License Version
18540
- * 1.1 (the "License"); you may not use this file except in compliance with
18541
- * the License. You may obtain a copy of the License at
18542
- * http://www.mozilla.org/MPL/
18543
- *
18544
- * Software distributed under the License is distributed on an "AS IS" basis,
18545
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
18546
- * for the specific language governing rights and limitations under the
18547
- * License.
18548
- *
18549
- * The Original Code is Ajax.org Code Editor (ACE).
18550
- *
18551
- * The Initial Developer of the Original Code is
18552
- * Ajax.org B.V.
18553
- * Portions created by the Initial Developer are Copyright (C) 2010
18554
- * the Initial Developer. All Rights Reserved.
18555
- *
18556
- * Contributor(s):
18557
- * Fabian Jakobs <fabian AT ajax DOT org>
18558
- *
18559
- * Alternatively, the contents of this file may be used under the terms of
18560
- * either the GNU General Public License Version 2 or later (the "GPL"), or
18561
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
18562
- * in which case the provisions of the GPL or the LGPL are applicable instead
18563
- * of those above. If you wish to allow use of your version of this file only
18564
- * under the terms of either the GPL or the LGPL, and not to allow others to
18565
- * use your version of this file under the terms of the MPL, indicate your
18566
- * decision by deleting the provisions above and replace them with the notice
18567
- * and other provisions required by the GPL or the LGPL. If you do not delete
18568
- * the provisions above, a recipient may use your version of this file under
18569
- * the terms of any one of the MPL, the GPL or the LGPL.
18570
- *
18571
- * ***** END LICENSE BLOCK ***** */
18572
-
18573
- define('ace/mode/javascript', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
18574
-
18575
- var oop = require("pilot/oop");
18576
- var TextMode = require("ace/mode/text").Mode;
18577
- var Tokenizer = require("ace/tokenizer").Tokenizer;
18578
- var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
18579
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
18580
- var Range = require("ace/range").Range;
18581
- var WorkerClient = require("ace/worker/worker_client").WorkerClient;
18582
- var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
18583
-
18584
- var Mode = function() {
18585
- this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
18586
- this.$outdent = new MatchingBraceOutdent();
18587
- this.$behaviour = new CstyleBehaviour();
18588
- };
18589
- oop.inherits(Mode, TextMode);
18590
-
18591
- (function() {
18592
-
18593
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
18594
- var outdent = true;
18595
- var outentedRows = [];
18596
- var re = /^(\s*)\/\//;
18597
-
18598
- for (var i=startRow; i<= endRow; i++) {
18599
- if (!re.test(doc.getLine(i))) {
18600
- outdent = false;
18601
- break;
18602
- }
18603
- }
18604
-
18605
- if (outdent) {
18606
- var deleteRange = new Range(0, 0, 0, 0);
18607
- for (var i=startRow; i<= endRow; i++)
18608
- {
18609
- var line = doc.getLine(i);
18610
- var m = line.match(re);
18611
- deleteRange.start.row = i;
18612
- deleteRange.end.row = i;
18613
- deleteRange.end.column = m[0].length;
18614
- doc.replace(deleteRange, m[1]);
18615
- }
18616
- }
18617
- else {
18618
- doc.indentRows(startRow, endRow, "//");
18619
- }
18620
- };
18621
-
18622
- this.getNextLineIndent = function(state, line, tab) {
18623
- var indent = this.$getIndent(line);
18624
-
18625
- var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
18626
- var tokens = tokenizedLine.tokens;
18627
- var endState = tokenizedLine.state;
18628
-
18629
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
18630
- return indent;
18631
- }
18632
-
18633
- if (state == "start") {
18634
- var match = line.match(/^.*[\{\(\[\:]\s*$/);
18635
- if (match) {
18636
- indent += tab;
18637
- }
18638
- } else if (state == "doc-start") {
18639
- if (endState == "start") {
18640
- return "";
18641
- }
18642
- var match = line.match(/^\s*(\/?)\*/);
18643
- if (match) {
18644
- if (match[1]) {
18645
- indent += " ";
18646
- }
18647
- indent += "* ";
18648
- }
18649
- }
18650
-
18651
- return indent;
18652
- };
18653
-
18654
- this.checkOutdent = function(state, line, input) {
18655
- return this.$outdent.checkOutdent(line, input);
18656
- };
18657
-
18658
- this.autoOutdent = function(state, doc, row) {
18659
- this.$outdent.autoOutdent(doc, row);
18660
- };
18661
-
18662
- this.createWorker = function(session) {
18663
- var doc = session.getDocument();
18664
- var worker = new WorkerClient(["ace", "pilot"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
18665
- worker.call("setValue", [doc.getValue()]);
18666
-
18667
- doc.on("change", function(e) {
18668
- e.range = {
18669
- start: e.data.range.start,
18670
- end: e.data.range.end
18671
- };
18672
- worker.emit("change", e);
18673
- });
18674
-
18675
- worker.on("jslint", function(results) {
18676
- var errors = [];
18677
- for (var i=0; i<results.data.length; i++) {
18678
- var error = results.data[i];
18679
- if (error)
18680
- errors.push({
18681
- row: error.line-1,
18682
- column: error.character-1,
18683
- text: error.reason,
18684
- type: "warning",
18685
- lint: error
18686
- });
18687
- }
18688
- session.setAnnotations(errors);
18689
- });
18690
-
18691
- worker.on("narcissus", function(e) {
18692
- session.setAnnotations([e.data]);
18693
- });
18694
-
18695
- worker.on("terminate", function() {
18696
- session.clearAnnotations();
18697
- });
18698
-
18699
- return worker;
18700
- };
18701
-
18702
- }).call(Mode.prototype);
18703
-
18704
- exports.Mode = Mode;
18705
- });
18706
- /* ***** BEGIN LICENSE BLOCK *****
18707
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
18708
- *
18709
- * The contents of this file are subject to the Mozilla Public License Version
18710
- * 1.1 (the "License"); you may not use this file except in compliance with
18711
- * the License. You may obtain a copy of the License at
18712
- * http://www.mozilla.org/MPL/
18713
- *
18714
- * Software distributed under the License is distributed on an "AS IS" basis,
18715
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
18716
- * for the specific language governing rights and limitations under the
18717
- * License.
18718
- *
18719
- * The Original Code is Ajax.org Code Editor (ACE).
18720
- *
18721
- * The Initial Developer of the Original Code is
18722
- * Ajax.org B.V.
18723
- * Portions created by the Initial Developer are Copyright (C) 2010
18724
- * the Initial Developer. All Rights Reserved.
18725
- *
18726
- * Contributor(s):
18727
- * Fabian Jakobs <fabian AT ajax DOT org>
18728
- * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
18729
- *
18730
- * Alternatively, the contents of this file may be used under the terms of
18731
- * either the GNU General Public License Version 2 or later (the "GPL"), or
18732
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
18733
- * in which case the provisions of the GPL or the LGPL are applicable instead
18734
- * of those above. If you wish to allow use of your version of this file only
18735
- * under the terms of either the GPL or the LGPL, and not to allow others to
18736
- * use your version of this file under the terms of the MPL, indicate your
18737
- * decision by deleting the provisions above and replace them with the notice
18738
- * and other provisions required by the GPL or the LGPL. If you do not delete
18739
- * the provisions above, a recipient may use your version of this file under
18740
- * the terms of any one of the MPL, the GPL or the LGPL.
18741
- *
18742
- * ***** END LICENSE BLOCK ***** */
18743
-
18744
- define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/unicode', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
18745
-
18746
- var oop = require("pilot/oop");
18747
- var lang = require("pilot/lang");
18748
- var unicode = require("ace/unicode");
18749
- var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
18750
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
18751
-
18752
- var JavaScriptHighlightRules = function() {
18753
-
18754
- var keywords = lang.arrayToMap(
18755
- ("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
18756
- "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
18757
- "const|yield|import|get|set").split("|")
18758
- );
18759
-
18760
- var buildinConstants = lang.arrayToMap(
18761
- ("null|Infinity|NaN|undefined").split("|")
18762
- );
18763
-
18764
- var futureReserved = lang.arrayToMap(
18765
- ("class|enum|extends|super|export|implements|private|" +
18766
- "public|interface|package|protected|static").split("|")
18767
- );
18768
-
18769
- // TODO: Unicode escape sequences
18770
- var identifierRe = "[" + unicode.packages.L + "\\$_]["
18771
- + unicode.packages.L
18772
- + unicode.packages.Mn + unicode.packages.Mc
18773
- + unicode.packages.Nd
18774
- + unicode.packages.Pc + "\\$_]*\\b";
18775
-
18776
- // regexp must not have capturing parentheses. Use (?:) instead.
18777
- // regexps are ordered -> the first match is used
18778
-
18779
- this.$rules = {
18780
- "start" : [
18781
- {
18782
- token : "comment",
18783
- regex : "\\/\\/.*$"
18784
- },
18785
- new DocCommentHighlightRules().getStartRule("doc-start"),
18786
- {
18787
- token : "comment", // multi line comment
18788
- merge : true,
18789
- regex : "\\/\\*",
18790
- next : "comment"
18791
- }, {
18792
- token : "string", // single line
18793
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
18794
- }, {
18795
- token : "string", // multi line string start
18796
- merge : true,
18797
- regex : '["].*\\\\$',
18798
- next : "qqstring"
18799
- }, {
18800
- token : "string", // single line
18801
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
18802
- }, {
18803
- token : "string", // multi line string start
18804
- merge : true,
18805
- regex : "['].*\\\\$",
18806
- next : "qstring"
18807
- }, {
18808
- token : "constant.numeric", // hex
18809
- regex : "0[xX][0-9a-fA-F]+\\b"
18810
- }, {
18811
- token : "constant.numeric", // float
18812
- regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
18813
- }, {
18814
- token : "constant.language.boolean",
18815
- regex : "(?:true|false)\\b"
18816
- }, {
18817
- token : function(value) {
18818
- if (value == "this")
18819
- return "variable.language";
18820
- else if (keywords.hasOwnProperty(value))
18821
- return "keyword";
18822
- else if (buildinConstants.hasOwnProperty(value))
18823
- return "constant.language";
18824
- else if (futureReserved.hasOwnProperty(value))
18825
- return "invalid.illegal";
18826
- else if (value == "debugger")
18827
- return "invalid.deprecated";
18828
- else
18829
- return "identifier";
18830
- },
18831
- regex : identifierRe
18832
- }, {
18833
- token : "keyword.operator",
18834
- regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
18835
- next : "regex_allowed"
18836
- }, {
18837
- token : "lparen",
18838
- regex : "[[({]",
18839
- next : "regex_allowed"
18840
- }, {
18841
- token : "rparen",
18842
- regex : "[\\])}]"
18843
- }, {
18844
- token : "keyword.operator",
18845
- regex : "\\/=?",
18846
- next : "regex_allowed"
18847
- }, {
18848
- token: "comment",
18849
- regex: "^#!.*$"
18850
- }, {
18851
- token : "text",
18852
- regex : "\\s+"
18853
- }
18854
- ],
18855
- // regular expressions are only allowed after certain tokens. This
18856
- // makes sure we don't mix up regexps with the divison operator
18857
- "regex_allowed": [
18858
- {
18859
- token: "string.regexp",
18860
- regex: "\\/(?:(?:\\[(?:\\\\]|[^\\]])+\\])"
18861
- + "|(?:\\\\/|[^\\]/]))*"
18862
- + "[/]\\w*",
18863
- next: "start"
18864
- }, {
18865
- token : "text",
18866
- regex : "\\s+"
18867
- }, {
18868
- // immediately return to the start mode without matching
18869
- // anything
18870
- token: "empty",
18871
- regex: "",
18872
- next: "start"
18873
- }
18874
- ],
18875
- "comment" : [
18876
- {
18877
- token : "comment", // closing comment
18878
- regex : ".*?\\*\\/",
18879
- next : "start"
18880
- }, {
18881
- token : "comment", // comment spanning whole line
18882
- merge : true,
18883
- regex : ".+"
18884
- }
18885
- ],
18886
- "qqstring" : [
18887
- {
18888
- token : "string",
18889
- regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
18890
- next : "start"
18891
- }, {
18892
- token : "string",
18893
- merge : true,
18894
- regex : '.+'
18895
- }
18896
- ],
18897
- "qstring" : [
18898
- {
18899
- token : "string",
18900
- regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
18901
- next : "start"
18902
- }, {
18903
- token : "string",
18904
- merge : true,
18905
- regex : '.+'
18906
- }
18907
- ]
18908
- };
18909
-
18910
- this.embedRules(DocCommentHighlightRules, "doc-",
18911
- [ new DocCommentHighlightRules().getEndRule("start") ]);
18912
- };
18913
-
18914
- oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
18915
-
18916
- exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
18917
- });
18918
- /* ***** BEGIN LICENSE BLOCK *****
18919
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
18920
- *
18921
- * The contents of this file are subject to the Mozilla Public License Version
18922
- * 1.1 (the "License"); you may not use this file except in compliance with
18923
- * the License. You may obtain a copy of the License at
18924
- * http://www.mozilla.org/MPL/
18925
- *
18926
- * Software distributed under the License is distributed on an "AS IS" basis,
18927
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
18928
- * for the specific language governing rights and limitations under the
18929
- * License.
18930
- *
18931
- * The Original Code is Ajax.org Code Editor (ACE).
18932
- *
18933
- * The Initial Developer of the Original Code is
18934
- * Ajax.org B.V.
18935
- * Portions created by the Initial Developer are Copyright (C) 2010
18936
- * the Initial Developer. All Rights Reserved.
18937
- *
18938
- * Contributor(s):
18939
- * Fabian Jakobs <fabian AT ajax DOT org>
18940
- *
18941
- * Alternatively, the contents of this file may be used under the terms of
18942
- * either the GNU General Public License Version 2 or later (the "GPL"), or
18943
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
18944
- * in which case the provisions of the GPL or the LGPL are applicable instead
18945
- * of those above. If you wish to allow use of your version of this file only
18946
- * under the terms of either the GPL or the LGPL, and not to allow others to
18947
- * use your version of this file under the terms of the MPL, indicate your
18948
- * decision by deleting the provisions above and replace them with the notice
18949
- * and other provisions required by the GPL or the LGPL. If you do not delete
18950
- * the provisions above, a recipient may use your version of this file under
18951
- * the terms of any one of the MPL, the GPL or the LGPL.
18952
- *
18953
- * ***** END LICENSE BLOCK ***** */
18954
-
18955
- define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
18956
-
18957
- var oop = require("pilot/oop");
18958
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
18959
-
18960
- var DocCommentHighlightRules = function() {
18961
-
18962
- this.$rules = {
18963
- "start" : [ {
18964
- token : "comment.doc.tag",
18965
- regex : "@[\\w\\d_]+" // TODO: fix email addresses
18966
- }, {
18967
- token : "comment.doc",
18968
- merge : true,
18969
- regex : "\\s+"
18970
- }, {
18971
- token : "comment.doc",
18972
- merge : true,
18973
- regex : "TODO"
18974
- }, {
18975
- token : "comment.doc",
18976
- merge : true,
18977
- regex : "[^@\\*]+"
18978
- }, {
18979
- token : "comment.doc",
18980
- merge : true,
18981
- regex : "."
18982
- }]
18983
- };
18984
- };
18985
-
18986
- oop.inherits(DocCommentHighlightRules, TextHighlightRules);
18987
-
18988
- (function() {
18989
-
18990
- this.getStartRule = function(start) {
18991
- return {
18992
- token : "comment.doc", // doc comment
18993
- merge : true,
18994
- regex : "\\/\\*(?=\\*)",
18995
- next : start
18996
- };
18997
- };
18998
-
18999
- this.getEndRule = function (start) {
19000
- return {
19001
- token : "comment.doc", // closing comment
19002
- merge : true,
19003
- regex : "\\*\\/",
19004
- next : start
19005
- };
19006
- };
19007
-
19008
- }).call(DocCommentHighlightRules.prototype);
19009
-
19010
- exports.DocCommentHighlightRules = DocCommentHighlightRules;
19011
-
19012
- });
19013
- /* ***** BEGIN LICENSE BLOCK *****
19014
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
19015
- *
19016
- * The contents of this file are subject to the Mozilla Public License Version
19017
- * 1.1 (the "License"); you may not use this file except in compliance with
19018
- * the License. You may obtain a copy of the License at
19019
- * http://www.mozilla.org/MPL/
19020
- *
19021
- * Software distributed under the License is distributed on an "AS IS" basis,
19022
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19023
- * for the specific language governing rights and limitations under the
19024
- * License.
19025
- *
19026
- * The Original Code is Ajax.org Code Editor (ACE).
19027
- *
19028
- * The Initial Developer of the Original Code is
19029
- * Ajax.org B.V.
19030
- * Portions created by the Initial Developer are Copyright (C) 2010
19031
- * the Initial Developer. All Rights Reserved.
19032
- *
19033
- * Contributor(s):
19034
- * Fabian Jakobs <fabian AT ajax DOT org>
19035
- *
19036
- * Alternatively, the contents of this file may be used under the terms of
19037
- * either the GNU General Public License Version 2 or later (the "GPL"), or
19038
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19039
- * in which case the provisions of the GPL or the LGPL are applicable instead
19040
- * of those above. If you wish to allow use of your version of this file only
19041
- * under the terms of either the GPL or the LGPL, and not to allow others to
19042
- * use your version of this file under the terms of the MPL, indicate your
19043
- * decision by deleting the provisions above and replace them with the notice
19044
- * and other provisions required by the GPL or the LGPL. If you do not delete
19045
- * the provisions above, a recipient may use your version of this file under
19046
- * the terms of any one of the MPL, the GPL or the LGPL.
19047
- *
19048
- * ***** END LICENSE BLOCK ***** */
19049
-
19050
- define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
19051
-
19052
- var Range = require("ace/range").Range;
19053
-
19054
- var MatchingBraceOutdent = function() {};
19055
-
19056
- (function() {
19057
-
19058
- this.checkOutdent = function(line, input) {
19059
- if (! /^\s+$/.test(line))
19060
- return false;
19061
-
19062
- return /^\s*\}/.test(input);
19063
- };
19064
-
19065
- this.autoOutdent = function(doc, row) {
19066
- var line = doc.getLine(row);
19067
- var match = line.match(/^(\s*\})/);
19068
-
19069
- if (!match) return 0;
19070
-
19071
- var column = match[1].length;
19072
- var openBracePos = doc.findMatchingBracket({row: row, column: column});
19073
-
19074
- if (!openBracePos || openBracePos.row == row) return 0;
19075
-
19076
- var indent = this.$getIndent(doc.getLine(openBracePos.row));
19077
- doc.replace(new Range(row, 0, row, column-1), indent);
19078
- };
19079
-
19080
- this.$getIndent = function(line) {
19081
- var match = line.match(/^(\s+)/);
19082
- if (match) {
19083
- return match[1];
19084
- }
19085
-
19086
- return "";
19087
- };
19088
-
19089
- }).call(MatchingBraceOutdent.prototype);
19090
-
19091
- exports.MatchingBraceOutdent = MatchingBraceOutdent;
19092
- });
19093
- /* ***** BEGIN LICENSE BLOCK *****
19094
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
19095
- *
19096
- * The contents of this file are subject to the Mozilla Public License Version
19097
- * 1.1 (the "License"); you may not use this file except in compliance with
19098
- * the License. You may obtain a copy of the License at
19099
- * http://www.mozilla.org/MPL/
19100
- *
19101
- * Software distributed under the License is distributed on an "AS IS" basis,
19102
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19103
- * for the specific language governing rights and limitations under the
19104
- * License.
19105
- *
19106
- * The Original Code is Ajax.org Code Editor (ACE).
19107
- *
19108
- * The Initial Developer of the Original Code is
19109
- * Ajax.org B.V.
19110
- * Portions created by the Initial Developer are Copyright (C) 2010
19111
- * the Initial Developer. All Rights Reserved.
19112
- *
19113
- * Contributor(s):
19114
- * Fabian Jakobs <fabian AT ajax DOT org>
19115
- *
19116
- * Alternatively, the contents of this file may be used under the terms of
19117
- * either the GNU General Public License Version 2 or later (the "GPL"), or
19118
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19119
- * in which case the provisions of the GPL or the LGPL are applicable instead
19120
- * of those above. If you wish to allow use of your version of this file only
19121
- * under the terms of either the GPL or the LGPL, and not to allow others to
19122
- * use your version of this file under the terms of the MPL, indicate your
19123
- * decision by deleting the provisions above and replace them with the notice
19124
- * and other provisions required by the GPL or the LGPL. If you do not delete
19125
- * the provisions above, a recipient may use your version of this file under
19126
- * the terms of any one of the MPL, the GPL or the LGPL.
19127
- *
19128
- * ***** END LICENSE BLOCK ***** */
19129
-
19130
- define('ace/worker/worker_client', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/event_emitter'], function(require, exports, module) {
19131
-
19132
- var oop = require("pilot/oop");
19133
- var EventEmitter = require("pilot/event_emitter").EventEmitter;
19134
-
19135
- var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
19136
-
19137
- this.callbacks = [];
19138
-
19139
- if (require.packaged) {
19140
- var base = this.$guessBasePath();
19141
- var worker = this.$worker = new Worker(base + packagedJs);
19142
- }
19143
- else {
19144
- var workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
19145
- var worker = this.$worker = new Worker(workerUrl);
19146
-
19147
- var tlns = {};
19148
- for (var i=0; i<topLevelNamespaces.length; i++) {
19149
- var ns = topLevelNamespaces[i];
19150
- var path = this.$normalizePath(require.nameToUrl(ns, null, "_").replace(/.js$/, ""));
19151
-
19152
- tlns[ns] = path;
19153
- }
19154
- }
19155
-
19156
- this.$worker.postMessage({
19157
- init : true,
19158
- tlns: tlns,
19159
- module: module,
19160
- classname: classname
19161
- });
19162
-
19163
- this.callbackId = 1;
19164
- this.callbacks = {};
19165
-
19166
- var _self = this;
19167
- this.$worker.onerror = function(e) {
19168
- window.console && console.log && console.log(e);
19169
- throw e;
19170
- };
19171
- this.$worker.onmessage = function(e) {
19172
- var msg = e.data;
19173
- switch(msg.type) {
19174
- case "log":
19175
- window.console && console.log && console.log(msg.data);
19176
- break;
19177
-
19178
- case "event":
19179
- _self._dispatchEvent(msg.name, {data: msg.data});
19180
- break;
19181
-
19182
- case "call":
19183
- var callback = _self.callbacks[msg.id];
19184
- if (callback) {
19185
- callback(msg.data);
19186
- delete _self.callbacks[msg.id];
19187
- }
19188
- break;
19189
- }
19190
- };
19191
- };
19192
-
19193
- (function(){
19194
-
19195
- oop.implement(this, EventEmitter);
19196
-
19197
- this.$normalizePath = function(path) {
19198
- if (!path.match(/^\w+:/))
19199
- path = location.protocol + "//" + location.host + location.pathname + "/" + path;
19200
- return path;
19201
- };
19202
-
19203
- this.$guessBasePath = function() {
19204
- if (require.aceBaseUrl)
19205
- return require.aceBaseUrl;
19206
-
19207
- var scripts = document.getElementsByTagName("script");
19208
- for (var i=0; i<scripts.length; i++) {
19209
- var script = scripts[i];
19210
-
19211
- var base = script.getAttribute("data-ace-base");
19212
- if (base)
19213
- return base.replace(/\/*$/, "/");
19214
-
19215
- var src = script.src || script.getAttribute("src");
19216
- if (!src) {
19217
- continue;
19218
- }
19219
- var m = src.match(/^(?:(.*\/)ace\.js|(.*\/)ace-uncompressed\.js)(?:\?|$)/);
19220
- if (m)
19221
- return m[1] || m[2];
19222
- }
19223
- return "";
19224
- };
19225
-
19226
- this.terminate = function() {
19227
- this._dispatchEvent("terminate", {});
19228
- this.$worker.terminate();
19229
- };
19230
-
19231
- this.send = function(cmd, args) {
19232
- this.$worker.postMessage({command: cmd, args: args});
19233
- };
19234
-
19235
- this.call = function(cmd, args, callback) {
19236
- if (callback) {
19237
- var id = this.callbackId++;
19238
- this.callbacks[id] = callback;
19239
- args.push(id);
19240
- }
19241
- this.send(cmd, args);
19242
- };
19243
-
19244
- this.emit = function(event, data) {
19245
- this.$worker.postMessage({event: event, data: data});
19246
- };
19247
-
19248
- }).call(WorkerClient.prototype);
19249
-
19250
- exports.WorkerClient = WorkerClient;
19251
-
19252
- });
19253
- /* vim:ts=4:sts=4:sw=4:
19254
- * ***** BEGIN LICENSE BLOCK *****
19255
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
19256
- *
19257
- * The contents of this file are subject to the Mozilla Public License Version
19258
- * 1.1 (the "License"); you may not use this file except in compliance with
19259
- * the License. You may obtain a copy of the License at
19260
- * http://www.mozilla.org/MPL/
19261
- *
19262
- * Software distributed under the License is distributed on an "AS IS" basis,
19263
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19264
- * for the specific language governing rights and limitations under the
19265
- * License.
19266
- *
19267
- * The Original Code is Ajax.org Code Editor (ACE).
19268
- *
19269
- * The Initial Developer of the Original Code is
19270
- * Ajax.org B.V.
19271
- * Portions created by the Initial Developer are Copyright (C) 2010
19272
- * the Initial Developer. All Rights Reserved.
19273
- *
19274
- * Contributor(s):
19275
- * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
19276
- *
19277
- * Alternatively, the contents of this file may be used under the terms of
19278
- * either the GNU General Public License Version 2 or later (the "GPL"), or
19279
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19280
- * in which case the provisions of the GPL or the LGPL are applicable instead
19281
- * of those above. If you wish to allow use of your version of this file only
19282
- * under the terms of either the GPL or the LGPL, and not to allow others to
19283
- * use your version of this file under the terms of the MPL, indicate your
19284
- * decision by deleting the provisions above and replace them with the notice
19285
- * and other provisions required by the GPL or the LGPL. If you do not delete
19286
- * the provisions above, a recipient may use your version of this file under
19287
- * the terms of any one of the MPL, the GPL or the LGPL.
19288
- *
19289
- * ***** END LICENSE BLOCK ***** */
19290
-
19291
- define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/behaviour'], function(require, exports, module) {
19292
-
19293
- var oop = require("pilot/oop");
19294
- var Behaviour = require('ace/mode/behaviour').Behaviour;
19295
-
19296
- var CstyleBehaviour = function () {
19297
-
19298
- this.add("braces", "insertion", function (state, action, editor, session, text) {
19299
- if (text == '{') {
19300
- var selection = editor.getSelectionRange();
19301
- var selected = session.doc.getTextRange(selection);
19302
- if (selected !== "") {
19303
- return {
19304
- text: '{' + selected + '}',
19305
- selection: false
19306
- }
19307
- } else {
19308
- return {
19309
- text: '{}',
19310
- selection: [1, 1]
19311
- }
19312
- }
19313
- } else if (text == '}') {
19314
- var cursor = editor.getCursorPosition();
19315
- var line = session.doc.getLine(cursor.row);
19316
- var rightChar = line.substring(cursor.column, cursor.column + 1);
19317
- if (rightChar == '}') {
19318
- var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
19319
- if (matching !== null) {
19320
- return {
19321
- text: '',
19322
- selection: [1, 1]
19323
- }
19324
- }
19325
- }
19326
- } else if (text == "\n") {
19327
- var cursor = editor.getCursorPosition();
19328
- var line = session.doc.getLine(cursor.row);
19329
- var rightChar = line.substring(cursor.column, cursor.column + 1);
19330
- if (rightChar == '}') {
19331
- var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
19332
- if (!openBracePos)
19333
- return false;
19334
-
19335
- var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
19336
- var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
19337
-
19338
- return {
19339
- text: '\n' + indent + '\n' + next_indent,
19340
- selection: [1, indent.length, 1, indent.length]
19341
- }
19342
- }
19343
- }
19344
- return false;
19345
- });
19346
-
19347
- this.add("braces", "deletion", function (state, action, editor, session, range) {
19348
- var selected = session.doc.getTextRange(range);
19349
- if (!range.isMultiLine() && selected == '{') {
19350
- var line = session.doc.getLine(range.start.row);
19351
- var rightChar = line.substring(range.end.column, range.end.column + 1);
19352
- if (rightChar == '}') {
19353
- range.end.column++;
19354
- return range;
19355
- }
19356
- }
19357
- return false;
19358
- });
19359
-
19360
- this.add("parens", "insertion", function (state, action, editor, session, text) {
19361
- if (text == '(') {
19362
- var selection = editor.getSelectionRange();
19363
- var selected = session.doc.getTextRange(selection);
19364
- if (selected !== "") {
19365
- return {
19366
- text: '(' + selected + ')',
19367
- selection: false
19368
- }
19369
- } else {
19370
- return {
19371
- text: '()',
19372
- selection: [1, 1]
19373
- }
19374
- }
19375
- } else if (text == ')') {
19376
- var cursor = editor.getCursorPosition();
19377
- var line = session.doc.getLine(cursor.row);
19378
- var rightChar = line.substring(cursor.column, cursor.column + 1);
19379
- if (rightChar == ')') {
19380
- var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
19381
- if (matching !== null) {
19382
- return {
19383
- text: '',
19384
- selection: [1, 1]
19385
- }
19386
- }
19387
- }
19388
- }
19389
- return false;
19390
- });
19391
-
19392
- this.add("parens", "deletion", function (state, action, editor, session, range) {
19393
- var selected = session.doc.getTextRange(range);
19394
- if (!range.isMultiLine() && selected == '(') {
19395
- var line = session.doc.getLine(range.start.row);
19396
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
19397
- if (rightChar == ')') {
19398
- range.end.column++;
19399
- return range;
19400
- }
19401
- }
19402
- return false;
19403
- });
19404
-
19405
- this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
19406
- if (text == '"') {
19407
- var selection = editor.getSelectionRange();
19408
- var selected = session.doc.getTextRange(selection);
19409
- if (selected !== "") {
19410
- return {
19411
- text: '"' + selected + '"',
19412
- selection: false
19413
- }
19414
- } else {
19415
- var cursor = editor.getCursorPosition();
19416
- var line = session.doc.getLine(cursor.row);
19417
- var leftChar = line.substring(cursor.column-1, cursor.column);
19418
-
19419
- // We're escaped.
19420
- if (leftChar == '\\') {
19421
- return false;
19422
- }
19423
-
19424
- // Find what token we're inside.
19425
- var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
19426
- var col = 0, token;
19427
- var quotepos = -1; // Track whether we're inside an open quote.
19428
-
19429
- for (var x = 0; x < tokens.length; x++) {
19430
- token = tokens[x];
19431
- if (token.type == "string") {
19432
- quotepos = -1;
19433
- } else if (quotepos < 0) {
19434
- quotepos = token.value.indexOf('"');
19435
- }
19436
- if ((token.value.length + col) > selection.start.column) {
19437
- break;
19438
- }
19439
- col += tokens[x].value.length;
19440
- }
19441
-
19442
- // Try and be smart about when we auto insert.
19443
- if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
19444
- return {
19445
- text: '""',
19446
- selection: [1,1]
19447
- }
19448
- } else if (token && token.type === "string") {
19449
- // Ignore input and move right one if we're typing over the closing quote.
19450
- var rightChar = line.substring(cursor.column, cursor.column + 1);
19451
- if (rightChar == '"') {
19452
- return {
19453
- text: '',
19454
- selection: [1, 1]
19455
- }
19456
- }
19457
- }
19458
- }
19459
- }
19460
- return false;
19461
- });
19462
-
19463
- this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
19464
- var selected = session.doc.getTextRange(range);
19465
- if (!range.isMultiLine() && selected == '"') {
19466
- var line = session.doc.getLine(range.start.row);
19467
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
19468
- if (rightChar == '"') {
19469
- range.end.column++;
19470
- return range;
19471
- }
19472
- }
19473
- return false;
19474
- });
19475
-
19476
- }
19477
- oop.inherits(CstyleBehaviour, Behaviour);
19478
-
19479
- exports.CstyleBehaviour = CstyleBehaviour;
19480
- });/* ***** BEGIN LICENSE BLOCK *****
19481
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
19482
- *
19483
- * The contents of this file are subject to the Mozilla Public License Version
19484
- * 1.1 (the "License"); you may not use this file except in compliance with
19485
- * the License. You may obtain a copy of the License at
19486
- * http://www.mozilla.org/MPL/
19487
- *
19488
- * Software distributed under the License is distributed on an "AS IS" basis,
19489
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19490
- * for the specific language governing rights and limitations under the
19491
- * License.
19492
- *
19493
- * The Original Code is Ajax.org Code Editor (ACE).
19494
- *
19495
- * The Initial Developer of the Original Code is
19496
- * Ajax.org B.V.
19497
- * Portions created by the Initial Developer are Copyright (C) 2010
19498
- * the Initial Developer. All Rights Reserved.
19499
- *
19500
- * Contributor(s):
19501
- * Fabian Jakobs <fabian AT ajax DOT org>
19502
- *
19503
- * Alternatively, the contents of this file may be used under the terms of
19504
- * either the GNU General Public License Version 2 or later (the "GPL"), or
19505
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19506
- * in which case the provisions of the GPL or the LGPL are applicable instead
19507
- * of those above. If you wish to allow use of your version of this file only
19508
- * under the terms of either the GPL or the LGPL, and not to allow others to
19509
- * use your version of this file under the terms of the MPL, indicate your
19510
- * decision by deleting the provisions above and replace them with the notice
19511
- * and other provisions required by the GPL or the LGPL. If you do not delete
19512
- * the provisions above, a recipient may use your version of this file under
19513
- * the terms of any one of the MPL, the GPL or the LGPL.
19514
- *
19515
- * ***** END LICENSE BLOCK ***** */
19516
-
19517
- define('ace/mode/css', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client'], function(require, exports, module) {
19518
-
19519
- var oop = require("pilot/oop");
19520
- var TextMode = require("ace/mode/text").Mode;
19521
- var Tokenizer = require("ace/tokenizer").Tokenizer;
19522
- var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
19523
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
19524
- var WorkerClient = require("ace/worker/worker_client").WorkerClient;
19525
-
19526
- var Mode = function() {
19527
- this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules());
19528
- this.$outdent = new MatchingBraceOutdent();
19529
- };
19530
- oop.inherits(Mode, TextMode);
19531
-
19532
- (function() {
19533
-
19534
- this.getNextLineIndent = function(state, line, tab) {
19535
- var indent = this.$getIndent(line);
19536
-
19537
- // ignore braces in comments
19538
- var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
19539
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
19540
- return indent;
19541
- }
19542
-
19543
- var match = line.match(/^.*\{\s*$/);
19544
- if (match) {
19545
- indent += tab;
19546
- }
19547
-
19548
- return indent;
19549
- };
19550
-
19551
- this.checkOutdent = function(state, line, input) {
19552
- return this.$outdent.checkOutdent(line, input);
19553
- };
19554
-
19555
- this.autoOutdent = function(state, doc, row) {
19556
- this.$outdent.autoOutdent(doc, row);
19557
- };
19558
-
19559
- this.createWorker = function(session) {
19560
- var doc = session.getDocument();
19561
- var worker = new WorkerClient(["ace", "pilot"], "worker-css.js", "ace/mode/css_worker", "Worker");
19562
- worker.call("setValue", [doc.getValue()]);
19563
-
19564
- doc.on("change", function(e) {
19565
- e.range = {
19566
- start: e.data.range.start,
19567
- end: e.data.range.end
19568
- };
19569
- worker.emit("change", e);
19570
- });
19571
-
19572
- worker.on("csslint", function(e) {
19573
- var errors = [];
19574
- e.data.forEach(function(message) {
19575
- errors.push({
19576
- row: message.line - 1,
19577
- column: message.col - 1,
19578
- text: message.message,
19579
- type: message.type,
19580
- lint: message
19581
- });
19582
- });
19583
-
19584
- session.setAnnotations(errors);
19585
- });
19586
- };
19587
-
19588
- }).call(Mode.prototype);
19589
-
19590
- exports.Mode = Mode;
19591
-
19592
- });
19593
- /* ***** BEGIN LICENSE BLOCK *****
19594
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
19595
- *
19596
- * The contents of this file are subject to the Mozilla Public License Version
19597
- * 1.1 (the "License"); you may not use this file except in compliance with
19598
- * the License. You may obtain a copy of the License at
19599
- * http://www.mozilla.org/MPL/
19600
- *
19601
- * Software distributed under the License is distributed on an "AS IS" basis,
19602
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19603
- * for the specific language governing rights and limitations under the
19604
- * License.
19605
- *
19606
- * The Original Code is Ajax.org Code Editor (ACE).
19607
- *
19608
- * The Initial Developer of the Original Code is
19609
- * Ajax.org B.V.
19610
- * Portions created by the Initial Developer are Copyright (C) 2010
19611
- * the Initial Developer. All Rights Reserved.
19612
- *
19613
- * Contributor(s):
19614
- * Fabian Jakobs <fabian AT ajax DOT org>
19615
- *
19616
- * Alternatively, the contents of this file may be used under the terms of
19617
- * either the GNU General Public License Version 2 or later (the "GPL"), or
19618
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19619
- * in which case the provisions of the GPL or the LGPL are applicable instead
19620
- * of those above. If you wish to allow use of your version of this file only
19621
- * under the terms of either the GPL or the LGPL, and not to allow others to
19622
- * use your version of this file under the terms of the MPL, indicate your
19623
- * decision by deleting the provisions above and replace them with the notice
19624
- * and other provisions required by the GPL or the LGPL. If you do not delete
19625
- * the provisions above, a recipient may use your version of this file under
19626
- * the terms of any one of the MPL, the GPL or the LGPL.
19627
- *
19628
- * ***** END LICENSE BLOCK ***** */
19629
-
19630
- define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
19631
-
19632
- var oop = require("pilot/oop");
19633
- var lang = require("pilot/lang");
19634
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
19635
-
19636
- var CssHighlightRules = function() {
19637
-
19638
- var properties = lang.arrayToMap(
19639
- ("-moz-box-sizing|-webkit-box-sizing|appearance|azimuth|background-attachment|background-color|background-image|" +
19640
- "background-position|background-repeat|background|border-bottom-color|" +
19641
- "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
19642
- "border-color|border-left-color|border-left-style|border-left-width|" +
19643
- "border-left|border-right-color|border-right-style|border-right-width|" +
19644
- "border-right|border-spacing|border-style|border-top-color|" +
19645
- "border-top-style|border-top-width|border-top|border-width|border|" +
19646
- "bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
19647
- "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
19648
- "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
19649
- "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
19650
- "letter-spacing|line-height|list-style-image|list-style-position|" +
19651
- "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
19652
- "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
19653
- "min-width|-moz-border-radius|opacity|orphans|outline-color|" +
19654
- "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
19655
- "padding-left|padding-right|padding-top|padding|page-break-after|" +
19656
- "page-break-before|page-break-inside|page|pause-after|pause-before|" +
19657
- "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
19658
- "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
19659
- "stress|table-layout|text-align|text-decoration|text-indent|" +
19660
- "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
19661
- "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
19662
- "z-index").split("|")
19663
- );
19664
-
19665
- var functions = lang.arrayToMap(
19666
- ("rgb|rgba|url|attr|counter|counters").split("|")
19667
- );
19668
-
19669
- var constants = lang.arrayToMap(
19670
- ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
19671
- "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
19672
- "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
19673
- "decimal-leading-zero|decimal|default|disabled|disc|" +
19674
- "distribute-all-lines|distribute-letter|distribute-space|" +
19675
- "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
19676
- "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
19677
- "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
19678
- "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
19679
- "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
19680
- "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
19681
- "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
19682
- "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
19683
- "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
19684
- "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
19685
- "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
19686
- "solid|square|static|strict|super|sw-resize|table-footer-group|" +
19687
- "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
19688
- "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
19689
- "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
19690
- "zero").split("|")
19691
- );
19692
-
19693
- var colors = lang.arrayToMap(
19694
- ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
19695
- "purple|red|silver|teal|white|yellow").split("|")
19696
- );
19697
-
19698
- // regexp must not have capturing parentheses. Use (?:) instead.
19699
- // regexps are ordered -> the first match is used
19700
-
19701
- var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
19702
-
19703
- function ic(str) {
19704
- var re = [];
19705
- var chars = str.split("");
19706
- for (var i=0; i<chars.length; i++) {
19707
- re.push(
19708
- "[",
19709
- chars[i].toLowerCase(),
19710
- chars[i].toUpperCase(),
19711
- "]"
19712
- );
19713
- }
19714
- return re.join("");
19715
- }
19716
-
19717
- var base_ruleset = [
19718
- {
19719
- token : "comment", // multi line comment
19720
- merge : true,
19721
- regex : "\\/\\*",
19722
- next : "ruleset_comment"
19723
- },{
19724
- token : "string", // single line
19725
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
19726
- }, {
19727
- token : "string", // single line
19728
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
19729
- }, {
19730
- token : "constant.numeric",
19731
- regex : numRe + ic("em")
19732
- }, {
19733
- token : "constant.numeric",
19734
- regex : numRe + ic("ex")
19735
- }, {
19736
- token : "constant.numeric",
19737
- regex : numRe + ic("px")
19738
- }, {
19739
- token : "constant.numeric",
19740
- regex : numRe + ic("cm")
19741
- }, {
19742
- token : "constant.numeric",
19743
- regex : numRe + ic("mm")
19744
- }, {
19745
- token : "constant.numeric",
19746
- regex : numRe + ic("in")
19747
- }, {
19748
- token : "constant.numeric",
19749
- regex : numRe + ic("pt")
19750
- }, {
19751
- token : "constant.numeric",
19752
- regex : numRe + ic("pc")
19753
- }, {
19754
- token : "constant.numeric",
19755
- regex : numRe + ic("deg")
19756
- }, {
19757
- token : "constant.numeric",
19758
- regex : numRe + ic("rad")
19759
- }, {
19760
- token : "constant.numeric",
19761
- regex : numRe + ic("grad")
19762
- }, {
19763
- token : "constant.numeric",
19764
- regex : numRe + ic("ms")
19765
- }, {
19766
- token : "constant.numeric",
19767
- regex : numRe + ic("s")
19768
- }, {
19769
- token : "constant.numeric",
19770
- regex : numRe + ic("hz")
19771
- }, {
19772
- token : "constant.numeric",
19773
- regex : numRe + ic("khz")
19774
- }, {
19775
- token : "constant.numeric",
19776
- regex : numRe + "%"
19777
- }, {
19778
- token : "constant.numeric",
19779
- regex : numRe
19780
- }, {
19781
- token : "constant.numeric", // hex6 color
19782
- regex : "#[a-fA-F0-9]{6}"
19783
- }, {
19784
- token : "constant.numeric", // hex3 color
19785
- regex : "#[a-fA-F0-9]{3}"
19786
- }, {
19787
- token : function(value) {
19788
- if (properties.hasOwnProperty(value.toLowerCase())) {
19789
- return "support.type";
19790
- }
19791
- else if (functions.hasOwnProperty(value.toLowerCase())) {
19792
- return "support.function";
19793
- }
19794
- else if (constants.hasOwnProperty(value.toLowerCase())) {
19795
- return "support.constant";
19796
- }
19797
- else if (colors.hasOwnProperty(value.toLowerCase())) {
19798
- return "support.constant.color";
19799
- }
19800
- else {
19801
- return "text";
19802
- }
19803
- },
19804
- regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
19805
- }
19806
- ];
19807
-
19808
- var ruleset = lang.copyArray(base_ruleset);
19809
- ruleset.unshift({
19810
- token : "rparen",
19811
- regex : "\\}",
19812
- next: "start"
19813
- });
19814
-
19815
- var media_ruleset = lang.copyArray( base_ruleset );
19816
- media_ruleset.unshift({
19817
- token : "rparen",
19818
- regex : "\\}",
19819
- next: "media"
19820
- });
19821
-
19822
- var base_comment = [{
19823
- token : "comment", // comment spanning whole line
19824
- merge : true,
19825
- regex : ".+"
19826
- }];
19827
-
19828
- var comment = lang.copyArray(base_comment);
19829
- comment.unshift({
19830
- token : "comment", // closing comment
19831
- regex : ".*?\\*\\/",
19832
- next : "start"
19833
- });
19834
-
19835
- var media_comment = lang.copyArray(base_comment);
19836
- media_comment.unshift({
19837
- token : "comment", // closing comment
19838
- regex : ".*?\\*\\/",
19839
- next : "media"
19840
- });
19841
-
19842
- var ruleset_comment = lang.copyArray(base_comment);
19843
- ruleset_comment.unshift({
19844
- token : "comment", // closing comment
19845
- regex : ".*?\\*\\/",
19846
- next : "ruleset"
19847
- });
19848
-
19849
- this.$rules = {
19850
- "start" : [{
19851
- token : "comment", // multi line comment
19852
- merge : true,
19853
- regex : "\\/\\*",
19854
- next : "comment"
19855
- }, {
19856
- token: "lparen",
19857
- regex: "\\{",
19858
- next: "ruleset"
19859
- }, {
19860
- token: "string",
19861
- regex: "@media.*?{",
19862
- next: "media"
19863
- },{
19864
- token: "keyword",
19865
- regex: "#[a-zA-Z0-9-_]+"
19866
- },{
19867
- token: "variable",
19868
- regex: "\\.[a-zA-Z0-9-_]+"
19869
- },{
19870
- token: "string",
19871
- regex: ":[a-zA-Z0-9-_]+"
19872
- },{
19873
- token: "constant",
19874
- regex: "[a-zA-Z0-9-_]+"
19875
- }],
19876
-
19877
- "media" : [ {
19878
- token : "comment", // multi line comment
19879
- merge : true,
19880
- regex : "\\/\\*",
19881
- next : "media_comment"
19882
- }, {
19883
- token: "lparen",
19884
- regex: "\\{",
19885
- next: "media_ruleset"
19886
- },{
19887
- token: "string",
19888
- regex: "\\}",
19889
- next: "start"
19890
- },{
19891
- token: "keyword",
19892
- regex: "#[a-zA-Z0-9-_]+"
19893
- },{
19894
- token: "variable",
19895
- regex: "\\.[a-zA-Z0-9-_]+"
19896
- },{
19897
- token: "string",
19898
- regex: ":[a-zA-Z0-9-_]+"
19899
- },{
19900
- token: "constant",
19901
- regex: "[a-zA-Z0-9-_]+"
19902
- }],
19903
-
19904
- "comment" : comment,
19905
-
19906
- "ruleset" : ruleset,
19907
- "ruleset_comment" : ruleset_comment,
19908
-
19909
- "media_ruleset" : media_ruleset,
19910
- "media_comment" : media_comment
19911
- };
19912
- };
19913
-
19914
- oop.inherits(CssHighlightRules, TextHighlightRules);
19915
-
19916
- exports.CssHighlightRules = CssHighlightRules;
19917
-
19918
- });
19919
- /* ***** BEGIN LICENSE BLOCK *****
19920
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
19921
- *
19922
- * The contents of this file are subject to the Mozilla Public License Version
19923
- * 1.1 (the "License"); you may not use this file except in compliance with
19924
- * the License. You may obtain a copy of the License at
19925
- * http://www.mozilla.org/MPL/
19926
- *
19927
- * Software distributed under the License is distributed on an "AS IS" basis,
19928
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19929
- * for the specific language governing rights and limitations under the
19930
- * License.
19931
- *
19932
- * The Original Code is Ajax.org Code Editor (ACE).
19933
- *
19934
- * The Initial Developer of the Original Code is
19935
- * Ajax.org B.V.
19936
- * Portions created by the Initial Developer are Copyright (C) 2010
19937
- * the Initial Developer. All Rights Reserved.
19938
- *
19939
- * Contributor(s):
19940
- * Fabian Jakobs <fabian AT ajax DOT org>
19941
- *
19942
- * Alternatively, the contents of this file may be used under the terms of
19943
- * either the GNU General Public License Version 2 or later (the "GPL"), or
19944
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
19945
- * in which case the provisions of the GPL or the LGPL are applicable instead
19946
- * of those above. If you wish to allow use of your version of this file only
19947
- * under the terms of either the GPL or the LGPL, and not to allow others to
19948
- * use your version of this file under the terms of the MPL, indicate your
19949
- * decision by deleting the provisions above and replace them with the notice
19950
- * and other provisions required by the GPL or the LGPL. If you do not delete
19951
- * the provisions above, a recipient may use your version of this file under
19952
- * the terms of any one of the MPL, the GPL or the LGPL.
19953
- *
19954
- * ***** END LICENSE BLOCK ***** */
19955
-
19956
- define('ace/mode/scss', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/scss_highlight_rules', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
19957
-
19958
- var oop = require("pilot/oop");
19959
- var TextMode = require("ace/mode/text").Mode;
19960
- var Tokenizer = require("ace/tokenizer").Tokenizer;
19961
- var ScssHighlightRules = require("ace/mode/scss_highlight_rules").ScssHighlightRules;
19962
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
19963
-
19964
- var Mode = function() {
19965
- this.$tokenizer = new Tokenizer(new ScssHighlightRules().getRules());
19966
- this.$outdent = new MatchingBraceOutdent();
19967
- };
19968
- oop.inherits(Mode, TextMode);
19969
-
19970
- (function() {
19971
-
19972
- this.getNextLineIndent = function(state, line, tab) {
19973
- var indent = this.$getIndent(line);
19974
-
19975
- // ignore braces in comments
19976
- var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
19977
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
19978
- return indent;
19979
- }
19980
-
19981
- var match = line.match(/^.*\{\s*$/);
19982
- if (match) {
19983
- indent += tab;
19984
- }
19985
-
19986
- return indent;
19987
- };
19988
-
19989
- this.checkOutdent = function(state, line, input) {
19990
- return this.$outdent.checkOutdent(line, input);
19991
- };
19992
-
19993
- this.autoOutdent = function(state, doc, row) {
19994
- this.$outdent.autoOutdent(doc, row);
19995
- };
19996
-
19997
- }).call(Mode.prototype);
19998
-
19999
- exports.Mode = Mode;
20000
-
20001
- });
20002
- /* ***** BEGIN LICENSE BLOCK *****
20003
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20004
- *
20005
- * The contents of this file are subject to the Mozilla Public License Version
20006
- * 1.1 (the "License"); you may not use this file except in compliance with
20007
- * the License. You may obtain a copy of the License at
20008
- * http://www.mozilla.org/MPL/
20009
- *
20010
- * Software distributed under the License is distributed on an "AS IS" basis,
20011
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20012
- * for the specific language governing rights and limitations under the
20013
- * License.
20014
- *
20015
- * The Original Code is Ajax.org Code Editor (ACE).
20016
- *
20017
- * The Initial Developer of the Original Code is
20018
- * Ajax.org B.V.
20019
- * Portions created by the Initial Developer are Copyright (C) 2010
20020
- * the Initial Developer. All Rights Reserved.
20021
- *
20022
- * Contributor(s):
20023
- * Fabian Jakobs <fabian AT ajax DOT org>
20024
- *
20025
- * Alternatively, the contents of this file may be used under the terms of
20026
- * either the GNU General Public License Version 2 or later (the "GPL"), or
20027
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20028
- * in which case the provisions of the GPL or the LGPL are applicable instead
20029
- * of those above. If you wish to allow use of your version of this file only
20030
- * under the terms of either the GPL or the LGPL, and not to allow others to
20031
- * use your version of this file under the terms of the MPL, indicate your
20032
- * decision by deleting the provisions above and replace them with the notice
20033
- * and other provisions required by the GPL or the LGPL. If you do not delete
20034
- * the provisions above, a recipient may use your version of this file under
20035
- * the terms of any one of the MPL, the GPL or the LGPL.
20036
- *
20037
- * ***** END LICENSE BLOCK ***** */
20038
-
20039
- define('ace/mode/scss_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
20040
-
20041
- var oop = require("pilot/oop");
20042
- var lang = require("pilot/lang");
20043
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
20044
-
20045
- var ScssHighlightRules = function() {
20046
-
20047
- var properties = lang.arrayToMap( (function () {
20048
-
20049
- var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
20050
-
20051
- var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
20052
- "background-size|binding|border-bottom-colors|border-left-colors|" +
20053
- "border-right-colors|border-top-colors|border-end|border-end-color|" +
20054
- "border-end-style|border-end-width|border-image|border-start|" +
20055
- "border-start-color|border-start-style|border-start-width|box-align|" +
20056
- "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
20057
- "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
20058
- "column-rule-width|column-rule-style|column-rule-color|float-edge|" +
20059
- "font-feature-settings|font-language-override|force-broken-image-icon|" +
20060
- "image-region|margin-end|margin-start|opacity|outline|outline-color|" +
20061
- "outline-offset|outline-radius|outline-radius-bottomleft|" +
20062
- "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
20063
- "outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
20064
- "tab-size|text-blink|text-decoration-color|text-decoration-line|" +
20065
- "text-decoration-style|transform|transform-origin|transition|" +
20066
- "transition-delay|transition-duration|transition-property|" +
20067
- "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
20068
- "window-shadow|border-radius").split("|");
20069
-
20070
- var properties = ("azimuth|background-attachment|background-color|background-image|" +
20071
- "background-position|background-repeat|background|border-bottom-color|" +
20072
- "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
20073
- "border-color|border-left-color|border-left-style|border-left-width|" +
20074
- "border-left|border-right-color|border-right-style|border-right-width|" +
20075
- "border-right|border-spacing|border-style|border-top-color|" +
20076
- "border-top-style|border-top-width|border-top|border-width|border|" +
20077
- "bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
20078
- "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
20079
- "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
20080
- "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
20081
- "letter-spacing|line-height|list-style-image|list-style-position|" +
20082
- "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
20083
- "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
20084
- "min-width|opacity|orphans|outline-color|" +
20085
- "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
20086
- "padding-left|padding-right|padding-top|padding|page-break-after|" +
20087
- "page-break-before|page-break-inside|page|pause-after|pause-before|" +
20088
- "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
20089
- "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
20090
- "stress|table-layout|text-align|text-decoration|text-indent|" +
20091
- "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
20092
- "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
20093
- "z-index").split("|");
20094
-
20095
- //The return array
20096
- var ret = [];
20097
-
20098
- //All prefixProperties will get the browserPrefix in
20099
- //the begning by join the prefixProperties array with the value of browserPrefix
20100
- for (var i=0, ln=browserPrefix.length; i<ln; i++) {
20101
- Array.prototype.push.apply(
20102
- ret,
20103
- (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
20104
- );
20105
- }
20106
-
20107
- //Add also prefixProperties and properties without any browser prefix
20108
- Array.prototype.push.apply(ret, prefixProperties);
20109
- Array.prototype.push.apply(ret, properties);
20110
-
20111
- return ret;
20112
-
20113
- })() );
20114
-
20115
-
20116
-
20117
- var functions = lang.arrayToMap(
20118
- ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
20119
- "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" +
20120
- "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" +
20121
- "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
20122
- "scale_color|transparentize|type_of|unit|unitless|unqoute").split("|")
20123
- );
20124
-
20125
- var constants = lang.arrayToMap(
20126
- ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
20127
- "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
20128
- "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
20129
- "decimal-leading-zero|decimal|default|disabled|disc|" +
20130
- "distribute-all-lines|distribute-letter|distribute-space|" +
20131
- "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
20132
- "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
20133
- "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
20134
- "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
20135
- "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
20136
- "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
20137
- "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
20138
- "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
20139
- "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
20140
- "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
20141
- "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
20142
- "solid|square|static|strict|super|sw-resize|table-footer-group|" +
20143
- "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
20144
- "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
20145
- "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
20146
- "zero").split("|")
20147
- );
20148
-
20149
- var colors = lang.arrayToMap(
20150
- ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
20151
- "purple|red|silver|teal|white|yellow").split("|")
20152
- );
20153
-
20154
- var keywords = lang.arrayToMap(
20155
- ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
20156
- )
20157
-
20158
- var tags = lang.arrayToMap(
20159
- ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
20160
- "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
20161
- "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
20162
- "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
20163
- "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
20164
- "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
20165
- "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
20166
- "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
20167
- "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
20168
- );
20169
-
20170
- // regexp must not have capturing parentheses. Use (?:) instead.
20171
- // regexps are ordered -> the first match is used
20172
-
20173
- var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
20174
-
20175
- function ic(str) {
20176
- var re = [];
20177
- var chars = str.split("");
20178
- for (var i=0; i<chars.length; i++) {
20179
- re.push(
20180
- "[",
20181
- chars[i].toLowerCase(),
20182
- chars[i].toUpperCase(),
20183
- "]"
20184
- );
20185
- }
20186
- return re.join("");
20187
- }
20188
-
20189
-
20190
- // regexp must not have capturing parentheses. Use (?:) instead.
20191
- // regexps are ordered -> the first match is used
20192
-
20193
- this.$rules = {
20194
- "start" : [
20195
- {
20196
- token : "comment",
20197
- regex : "\\/\\/.*$"
20198
- },
20199
- {
20200
- token : "comment", // multi line comment
20201
- merge : true,
20202
- regex : "\\/\\*",
20203
- next : "comment"
20204
- }, {
20205
- token : "string", // single line
20206
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
20207
- }, {
20208
- token : "string", // multi line string start
20209
- merge : true,
20210
- regex : '["].*\\\\$',
20211
- next : "qqstring"
20212
- }, {
20213
- token : "string", // single line
20214
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
20215
- }, {
20216
- token : "string", // multi line string start
20217
- merge : true,
20218
- regex : "['].*\\\\$",
20219
- next : "qstring"
20220
- }, {
20221
- token : "constant.numeric",
20222
- regex : numRe + ic("em")
20223
- }, {
20224
- token : "constant.numeric",
20225
- regex : numRe + ic("ex")
20226
- }, {
20227
- token : "constant.numeric",
20228
- regex : numRe + ic("px")
20229
- }, {
20230
- token : "constant.numeric",
20231
- regex : numRe + ic("cm")
20232
- }, {
20233
- token : "constant.numeric",
20234
- regex : numRe + ic("mm")
20235
- }, {
20236
- token : "constant.numeric",
20237
- regex : numRe + ic("in")
20238
- }, {
20239
- token : "constant.numeric",
20240
- regex : numRe + ic("pt")
20241
- }, {
20242
- token : "constant.numeric",
20243
- regex : numRe + ic("pc")
20244
- }, {
20245
- token : "constant.numeric",
20246
- regex : numRe + ic("deg")
20247
- }, {
20248
- token : "constant.numeric",
20249
- regex : numRe + ic("rad")
20250
- }, {
20251
- token : "constant.numeric",
20252
- regex : numRe + ic("grad")
20253
- }, {
20254
- token : "constant.numeric",
20255
- regex : numRe + ic("ms")
20256
- }, {
20257
- token : "constant.numeric",
20258
- regex : numRe + ic("s")
20259
- }, {
20260
- token : "constant.numeric",
20261
- regex : numRe + ic("hz")
20262
- }, {
20263
- token : "constant.numeric",
20264
- regex : numRe + ic("khz")
20265
- }, {
20266
- token : "constant.numeric",
20267
- regex : numRe + "%"
20268
- }, {
20269
- token : "constant.numeric", // hex6 color
20270
- regex : "#[a-fA-F0-9]{6}"
20271
- }, {
20272
- token : "constant.numeric", // hex3 color
20273
- regex : "#[a-fA-F0-9]{3}"
20274
- }, {
20275
- token : "constant.numeric",
20276
- regex : numRe
20277
- }, {
20278
- token : function(value) {
20279
- if (properties.hasOwnProperty(value.toLowerCase()))
20280
- return "support.type";
20281
- if (keywords.hasOwnProperty(value))
20282
- return "keyword";
20283
- else if (constants.hasOwnProperty(value))
20284
- return "constant.language";
20285
- else if (functions.hasOwnProperty(value))
20286
- return "support.function";
20287
- else if (colors.hasOwnProperty(value.toLowerCase()))
20288
- return "support.constant.color";
20289
- else if (tags.hasOwnProperty(value.toLowerCase()))
20290
- return "variable.language";
20291
- else
20292
- return "text";
20293
- },
20294
- regex : "\\-?[@a-zA-Z_][@a-zA-Z0-9_\\-]*"
20295
- }, {
20296
- token : "variable",
20297
- regex : "[a-zA-Z_\\-$][a-zA-Z0-9_\\-$]*\\b"
20298
- }, {
20299
- token: "variable.language",
20300
- regex: "#[a-zA-Z0-9-_]+"
20301
- }, {
20302
- token: "variable.language",
20303
- regex: "\\.[a-zA-Z0-9-_]+"
20304
- }, {
20305
- token: "variable.language",
20306
- regex: ":[a-zA-Z0-9-_]+"
20307
- }, {
20308
- token: "constant",
20309
- regex: "[a-zA-Z0-9-_]+"
20310
- }, {
20311
- token : "keyword.operator",
20312
- regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
20313
- }, {
20314
- token : "lparen",
20315
- regex : "[[({]"
20316
- }, {
20317
- token : "rparen",
20318
- regex : "[\\])}]"
20319
- }, {
20320
- token : "text",
20321
- regex : "\\s+"
20322
- }
20323
- ],
20324
- "comment" : [
20325
- {
20326
- token : "comment", // closing comment
20327
- regex : ".*?\\*\\/",
20328
- next : "start"
20329
- }, {
20330
- token : "comment", // comment spanning whole line
20331
- merge : true,
20332
- regex : ".+"
20333
- }
20334
- ],
20335
- "qqstring" : [
20336
- {
20337
- token : "string",
20338
- regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
20339
- next : "start"
20340
- }, {
20341
- token : "string",
20342
- merge : true,
20343
- regex : '.+'
20344
- }
20345
- ],
20346
- "qstring" : [
20347
- {
20348
- token : "string",
20349
- regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
20350
- next : "start"
20351
- }, {
20352
- token : "string",
20353
- merge : true,
20354
- regex : '.+'
20355
- }
20356
- ]
20357
- };
20358
- };
20359
-
20360
- oop.inherits(ScssHighlightRules, TextHighlightRules);
20361
-
20362
- exports.ScssHighlightRules = ScssHighlightRules;
20363
-
20364
- });
20365
- /* ***** BEGIN LICENSE BLOCK *****
20366
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20367
- *
20368
- * The contents of this file are subject to the Mozilla Public License Version
20369
- * 1.1 (the "License"); you may not use this file except in compliance with
20370
- * the License. You may obtain a copy of the License at
20371
- * http://www.mozilla.org/MPL/
20372
- *
20373
- * Software distributed under the License is distributed on an "AS IS" basis,
20374
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20375
- * for the specific language governing rights and limitations under the
20376
- * License.
20377
- *
20378
- * The Original Code is Ajax.org Code Editor (ACE).
20379
- *
20380
- * The Initial Developer of the Original Code is
20381
- * Ajax.org B.V.
20382
- * Portions created by the Initial Developer are Copyright (C) 2010
20383
- * the Initial Developer. All Rights Reserved.
20384
- *
20385
- * Contributor(s):
20386
- * Fabian Jakobs <fabian AT ajax DOT org>
20387
- *
20388
- * Alternatively, the contents of this file may be used under the terms of
20389
- * either the GNU General Public License Version 2 or later (the "GPL"), or
20390
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20391
- * in which case the provisions of the GPL or the LGPL are applicable instead
20392
- * of those above. If you wish to allow use of your version of this file only
20393
- * under the terms of either the GPL or the LGPL, and not to allow others to
20394
- * use your version of this file under the terms of the MPL, indicate your
20395
- * decision by deleting the provisions above and replace them with the notice
20396
- * and other provisions required by the GPL or the LGPL. If you do not delete
20397
- * the provisions above, a recipient may use your version of this file under
20398
- * the terms of any one of the MPL, the GPL or the LGPL.
20399
- *
20400
- * ***** END LICENSE BLOCK ***** */
20401
-
20402
- define('ace/mode/html', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/xml'], function(require, exports, module) {
20403
-
20404
- var oop = require("pilot/oop");
20405
- var TextMode = require("ace/mode/text").Mode;
20406
- var JavaScriptMode = require("ace/mode/javascript").Mode;
20407
- var CssMode = require("ace/mode/css").Mode;
20408
- var Tokenizer = require("ace/tokenizer").Tokenizer;
20409
- var HtmlHighlightRules = require("ace/mode/html_highlight_rules").HtmlHighlightRules;
20410
- var XmlBehaviour = require("ace/mode/behaviour/xml").XmlBehaviour;
20411
-
20412
- var Mode = function() {
20413
- var highlighter = new HtmlHighlightRules();
20414
- this.$tokenizer = new Tokenizer(highlighter.getRules());
20415
- this.$behaviour = new XmlBehaviour();
20416
-
20417
- this.$embeds = highlighter.getEmbeds();
20418
- this.createModeDelegates({
20419
- "js-": JavaScriptMode,
20420
- "css-": CssMode
20421
- });
20422
- };
20423
- oop.inherits(Mode, TextMode);
20424
-
20425
- (function() {
20426
-
20427
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
20428
- return 0;
20429
- };
20430
-
20431
- this.getNextLineIndent = function(state, line, tab) {
20432
- return this.$getIndent(line);
20433
- };
20434
-
20435
- this.checkOutdent = function(state, line, input) {
20436
- return false;
20437
- };
20438
-
20439
- }).call(Mode.prototype);
20440
-
20441
- exports.Mode = Mode;
20442
- });
20443
- /* ***** BEGIN LICENSE BLOCK *****
20444
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20445
- *
20446
- * The contents of this file are subject to the Mozilla Public License Version
20447
- * 1.1 (the "License"); you may not use this file except in compliance with
20448
- * the License. You may obtain a copy of the License at
20449
- * http://www.mozilla.org/MPL/
20450
- *
20451
- * Software distributed under the License is distributed on an "AS IS" basis,
20452
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20453
- * for the specific language governing rights and limitations under the
20454
- * License.
20455
- *
20456
- * The Original Code is Ajax.org Code Editor (ACE).
20457
- *
20458
- * The Initial Developer of the Original Code is
20459
- * Ajax.org B.V.
20460
- * Portions created by the Initial Developer are Copyright (C) 2010
20461
- * the Initial Developer. All Rights Reserved.
20462
- *
20463
- * Contributor(s):
20464
- * Fabian Jakobs <fabian AT ajax DOT org>
20465
- *
20466
- * Alternatively, the contents of this file may be used under the terms of
20467
- * either the GNU General Public License Version 2 or later (the "GPL"), or
20468
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20469
- * in which case the provisions of the GPL or the LGPL are applicable instead
20470
- * of those above. If you wish to allow use of your version of this file only
20471
- * under the terms of either the GPL or the LGPL, and not to allow others to
20472
- * use your version of this file under the terms of the MPL, indicate your
20473
- * decision by deleting the provisions above and replace them with the notice
20474
- * and other provisions required by the GPL or the LGPL. If you do not delete
20475
- * the provisions above, a recipient may use your version of this file under
20476
- * the terms of any one of the MPL, the GPL or the LGPL.
20477
- *
20478
- * ***** END LICENSE BLOCK ***** */
20479
-
20480
- define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
20481
-
20482
- var oop = require("pilot/oop");
20483
- var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
20484
- var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
20485
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
20486
-
20487
- var HtmlHighlightRules = function() {
20488
-
20489
- // regexp must not have capturing parentheses
20490
- // regexps are ordered -> the first match is used
20491
-
20492
- function string(state) {
20493
- return [
20494
- {
20495
- token : "string",
20496
- regex : '".*?"'
20497
- }, {
20498
- token : "string", // multi line string start
20499
- merge : true,
20500
- regex : '["].*$',
20501
- next : state + "-qqstring"
20502
- }, {
20503
- token : "string",
20504
- regex : "'.*?'"
20505
- }, {
20506
- token : "string", // multi line string start
20507
- merge : true,
20508
- regex : "['].*$",
20509
- next : state + "-qstring"
20510
- }]
20511
- }
20512
-
20513
- function multiLineString(quote, state) {
20514
- return [{
20515
- token : "string",
20516
- merge : true,
20517
- regex : ".*" + quote,
20518
- next : state
20519
- }, {
20520
- token : "string",
20521
- merge : true,
20522
- regex : '.+'
20523
- }]
20524
- }
20525
-
20526
- this.$rules = {
20527
- start : [ {
20528
- token : "text",
20529
- merge : true,
20530
- regex : "<\\!\\[CDATA\\[",
20531
- next : "cdata"
20532
- }, {
20533
- token : "xml_pe",
20534
- regex : "<\\?.*?\\?>"
20535
- }, {
20536
- token : "comment",
20537
- merge : true,
20538
- regex : "<\\!--",
20539
- next : "comment"
20540
- }, {
20541
- token : "text",
20542
- regex : "<(?=\s*script)",
20543
- next : "script"
20544
- }, {
20545
- token : "text",
20546
- regex : "<(?=\s*style)",
20547
- next : "css"
20548
- }, {
20549
- token : "text", // opening tag
20550
- regex : "<\\/?",
20551
- next : "tag"
20552
- }, {
20553
- token : "text",
20554
- regex : "\\s+"
20555
- }, {
20556
- token : "text",
20557
- regex : "[^<]+"
20558
- } ],
20559
-
20560
- script : [ {
20561
- token : "text",
20562
- regex : ">",
20563
- next : "js-start"
20564
- }, {
20565
- token : "keyword",
20566
- regex : "[-_a-zA-Z0-9:]+"
20567
- }, {
20568
- token : "text",
20569
- regex : "\\s+"
20570
- }].concat(string("script")),
20571
-
20572
- css : [ {
20573
- token : "text",
20574
- regex : ">",
20575
- next : "css-start"
20576
- }, {
20577
- token : "keyword",
20578
- regex : "[-_a-zA-Z0-9:]+"
20579
- }, {
20580
- token : "text",
20581
- regex : "\\s+"
20582
- }].concat(string("style")),
20583
-
20584
- tag : [ {
20585
- token : "text",
20586
- regex : ">",
20587
- next : "start"
20588
- }, {
20589
- token : "keyword",
20590
- regex : "[-_a-zA-Z0-9:]+"
20591
- }, {
20592
- token : "text",
20593
- regex : "\\s+"
20594
- }].concat(string("tag")),
20595
-
20596
- "style-qstring": multiLineString("'", "style"),
20597
- "style-qqstring": multiLineString('"', "style"),
20598
- "script-qstring": multiLineString("'", "script"),
20599
- "script-qqstring": multiLineString('"', "script"),
20600
- "tag-qstring": multiLineString("'", "tag"),
20601
- "tag-qqstring": multiLineString('"', "tag"),
20602
-
20603
- cdata : [ {
20604
- token : "text",
20605
- regex : "\\]\\]>",
20606
- next : "start"
20607
- }, {
20608
- token : "text",
20609
- merge : true,
20610
- regex : "\\s+"
20611
- }, {
20612
- token : "text",
20613
- merge : true,
20614
- regex : ".+"
20615
- } ],
20616
-
20617
- comment : [ {
20618
- token : "comment",
20619
- regex : ".*?-->",
20620
- next : "start"
20621
- }, {
20622
- token : "comment",
20623
- merge : true,
20624
- regex : ".+"
20625
- } ]
20626
- };
20627
-
20628
- this.embedRules(JavaScriptHighlightRules, "js-", [{
20629
- token: "comment",
20630
- regex: "\\/\\/.*(?=<\\/script>)",
20631
- next: "tag"
20632
- }, {
20633
- token: "text",
20634
- regex: "<\\/(?=script)",
20635
- next: "tag"
20636
- }]);
20637
-
20638
- this.embedRules(CssHighlightRules, "css-", [{
20639
- token: "text",
20640
- regex: "<\\/(?=style)",
20641
- next: "tag"
20642
- }]);
20643
- };
20644
-
20645
- oop.inherits(HtmlHighlightRules, TextHighlightRules);
20646
-
20647
- exports.HtmlHighlightRules = HtmlHighlightRules;
20648
- });/* vim:ts=4:sts=4:sw=4:
20649
- * ***** BEGIN LICENSE BLOCK *****
20650
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20651
- *
20652
- * The contents of this file are subject to the Mozilla Public License Version
20653
- * 1.1 (the "License"); you may not use this file except in compliance with
20654
- * the License. You may obtain a copy of the License at
20655
- * http://www.mozilla.org/MPL/
20656
- *
20657
- * Software distributed under the License is distributed on an "AS IS" basis,
20658
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20659
- * for the specific language governing rights and limitations under the
20660
- * License.
20661
- *
20662
- * The Original Code is Ajax.org Code Editor (ACE).
20663
- *
20664
- * The Initial Developer of the Original Code is
20665
- * Ajax.org B.V.
20666
- * Portions created by the Initial Developer are Copyright (C) 2010
20667
- * the Initial Developer. All Rights Reserved.
20668
- *
20669
- * Contributor(s):
20670
- * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
20671
- *
20672
- * Alternatively, the contents of this file may be used under the terms of
20673
- * either the GNU General Public License Version 2 or later (the "GPL"), or
20674
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20675
- * in which case the provisions of the GPL or the LGPL are applicable instead
20676
- * of those above. If you wish to allow use of your version of this file only
20677
- * under the terms of either the GPL or the LGPL, and not to allow others to
20678
- * use your version of this file under the terms of the MPL, indicate your
20679
- * decision by deleting the provisions above and replace them with the notice
20680
- * and other provisions required by the GPL or the LGPL. If you do not delete
20681
- * the provisions above, a recipient may use your version of this file under
20682
- * the terms of any one of the MPL, the GPL or the LGPL.
20683
- *
20684
- * ***** END LICENSE BLOCK ***** */
20685
-
20686
- define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
20687
-
20688
- var oop = require("pilot/oop");
20689
- var Behaviour = require('ace/mode/behaviour').Behaviour;
20690
- var CstyleBehaviour = require('ace/mode/behaviour/cstyle').CstyleBehaviour;
20691
-
20692
- var XmlBehaviour = function () {
20693
-
20694
- this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
20695
-
20696
- this.add("brackets", "insertion", function (state, action, editor, session, text) {
20697
- if (text == '<') {
20698
- var selection = editor.getSelectionRange();
20699
- var selected = session.doc.getTextRange(selection);
20700
- if (selected !== "") {
20701
- return false;
20702
- } else {
20703
- return {
20704
- text: '<>',
20705
- selection: [1, 1]
20706
- }
20707
- }
20708
- } else if (text == '>') {
20709
- var cursor = editor.getCursorPosition();
20710
- var line = session.doc.getLine(cursor.row);
20711
- var rightChar = line.substring(cursor.column, cursor.column + 1);
20712
- if (rightChar == '>') { // need some kind of matching check here
20713
- return {
20714
- text: '',
20715
- selection: [1, 1]
20716
- }
20717
- }
20718
- } else if (text == "\n") {
20719
- var cursor = editor.getCursorPosition();
20720
- var line = session.doc.getLine(cursor.row);
20721
- var rightChars = line.substring(cursor.column, cursor.column + 2);
20722
- if (rightChars == '</') {
20723
- var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
20724
- var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
20725
-
20726
- return {
20727
- text: '\n' + indent + '\n' + next_indent,
20728
- selection: [1, indent.length, 1, indent.length]
20729
- }
20730
- }
20731
- }
20732
- return false;
20733
- });
20734
-
20735
- }
20736
- oop.inherits(XmlBehaviour, Behaviour);
20737
-
20738
- exports.XmlBehaviour = XmlBehaviour;
20739
- });/* ***** BEGIN LICENSE BLOCK *****
20740
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20741
- *
20742
- * The contents of this file are subject to the Mozilla Public License Version
20743
- * 1.1 (the "License"); you may not use this file except in compliance with
20744
- * the License. You may obtain a copy of the License at
20745
- * http://www.mozilla.org/MPL/
20746
- *
20747
- * Software distributed under the License is distributed on an "AS IS" basis,
20748
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20749
- * for the specific language governing rights and limitations under the
20750
- * License.
20751
- *
20752
- * The Original Code is Ajax.org Code Editor (ACE).
20753
- *
20754
- * The Initial Developer of the Original Code is
20755
- * Ajax.org B.V.
20756
- * Portions created by the Initial Developer are Copyright (C) 2010
20757
- * the Initial Developer. All Rights Reserved.
20758
- *
20759
- * Contributor(s):
20760
- * Fabian Jakobs <fabian AT ajax DOT org>
20761
- *
20762
- * Alternatively, the contents of this file may be used under the terms of
20763
- * either the GNU General Public License Version 2 or later (the "GPL"), or
20764
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20765
- * in which case the provisions of the GPL or the LGPL are applicable instead
20766
- * of those above. If you wish to allow use of your version of this file only
20767
- * under the terms of either the GPL or the LGPL, and not to allow others to
20768
- * use your version of this file under the terms of the MPL, indicate your
20769
- * decision by deleting the provisions above and replace them with the notice
20770
- * and other provisions required by the GPL or the LGPL. If you do not delete
20771
- * the provisions above, a recipient may use your version of this file under
20772
- * the terms of any one of the MPL, the GPL or the LGPL.
20773
- *
20774
- * ***** END LICENSE BLOCK ***** */
20775
-
20776
- define('ace/mode/xml', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml'], function(require, exports, module) {
20777
-
20778
- var oop = require("pilot/oop");
20779
- var TextMode = require("ace/mode/text").Mode;
20780
- var Tokenizer = require("ace/tokenizer").Tokenizer;
20781
- var XmlHighlightRules = require("ace/mode/xml_highlight_rules").XmlHighlightRules;
20782
- var XmlBehaviour = require("ace/mode/behaviour/xml").XmlBehaviour;
20783
-
20784
- var Mode = function() {
20785
- this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
20786
- this.$behaviour = new XmlBehaviour();
20787
- };
20788
-
20789
- oop.inherits(Mode, TextMode);
20790
-
20791
- (function() {
20792
-
20793
- this.getNextLineIndent = function(state, line, tab) {
20794
- return this.$getIndent(line);
20795
- };
20796
-
20797
- }).call(Mode.prototype);
20798
-
20799
- exports.Mode = Mode;
20800
- });
20801
- /* ***** BEGIN LICENSE BLOCK *****
20802
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20803
- *
20804
- * The contents of this file are subject to the Mozilla Public License Version
20805
- * 1.1 (the "License"); you may not use this file except in compliance with
20806
- * the License. You may obtain a copy of the License at
20807
- * http://www.mozilla.org/MPL/
20808
- *
20809
- * Software distributed under the License is distributed on an "AS IS" basis,
20810
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20811
- * for the specific language governing rights and limitations under the
20812
- * License.
20813
- *
20814
- * The Original Code is Ajax.org Code Editor (ACE).
20815
- *
20816
- * The Initial Developer of the Original Code is
20817
- * Ajax.org B.V.
20818
- * Portions created by the Initial Developer are Copyright (C) 2010
20819
- * the Initial Developer. All Rights Reserved.
20820
- *
20821
- * Contributor(s):
20822
- * Fabian Jakobs <fabian AT ajax DOT org>
20823
- *
20824
- * Alternatively, the contents of this file may be used under the terms of
20825
- * either the GNU General Public License Version 2 or later (the "GPL"), or
20826
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20827
- * in which case the provisions of the GPL or the LGPL are applicable instead
20828
- * of those above. If you wish to allow use of your version of this file only
20829
- * under the terms of either the GPL or the LGPL, and not to allow others to
20830
- * use your version of this file under the terms of the MPL, indicate your
20831
- * decision by deleting the provisions above and replace them with the notice
20832
- * and other provisions required by the GPL or the LGPL. If you do not delete
20833
- * the provisions above, a recipient may use your version of this file under
20834
- * the terms of any one of the MPL, the GPL or the LGPL.
20835
- *
20836
- * ***** END LICENSE BLOCK ***** */
20837
-
20838
- define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
20839
-
20840
- var oop = require("pilot/oop");
20841
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
20842
-
20843
- var XmlHighlightRules = function() {
20844
-
20845
- // regexp must not have capturing parentheses
20846
- // regexps are ordered -> the first match is used
20847
-
20848
- this.$rules = {
20849
- start : [{
20850
- token : "text",
20851
- regex : "<\\!\\[CDATA\\[",
20852
- next : "cdata"
20853
- }, {
20854
- token : "xml_pe",
20855
- regex : "<\\?.*?\\?>"
20856
- }, {
20857
- token : "comment",
20858
- merge : true,
20859
- regex : "<\\!--",
20860
- next : "comment"
20861
- }, {
20862
- token : "text", // opening tag
20863
- regex : "<\\/?",
20864
- next : "tag"
20865
- }, {
20866
- token : "text",
20867
- regex : "\\s+"
20868
- }, {
20869
- token : "text",
20870
- regex : "[^<]+"
20871
- }],
20872
-
20873
- tag : [{
20874
- token : "text",
20875
- regex : ">",
20876
- next : "start"
20877
- }, {
20878
- token : "keyword",
20879
- regex : "[-_a-zA-Z0-9:]+"
20880
- }, {
20881
- token : "text",
20882
- regex : "\\s+"
20883
- }, {
20884
- token : "string",
20885
- regex : '".*?"'
20886
- }, {
20887
- token : "string", // multi line string start
20888
- merge : true,
20889
- regex : '["].*$',
20890
- next : "qqstring"
20891
- }, {
20892
- token : "string",
20893
- regex : "'.*?'"
20894
- }, {
20895
- token : "string", // multi line string start
20896
- merge : true,
20897
- regex : "['].*$",
20898
- next : "qstring"
20899
- }],
20900
-
20901
- qstring: [{
20902
- token : "string",
20903
- regex : ".*'",
20904
- next : "tag"
20905
- }, {
20906
- token : "string",
20907
- merge : true,
20908
- regex : '.+'
20909
- }],
20910
-
20911
- qqstring: [{
20912
- token : "string",
20913
- regex : ".*\"",
20914
- next : "tag"
20915
- }, {
20916
- token : "string",
20917
- merge : true,
20918
- regex : '.+'
20919
- }],
20920
-
20921
- cdata : [{
20922
- token : "text",
20923
- regex : "\\]\\]>",
20924
- next : "start"
20925
- }, {
20926
- token : "text",
20927
- regex : "\\s+"
20928
- }, {
20929
- token : "text",
20930
- regex : "(?:[^\\]]|\\](?!\\]>))+"
20931
- }],
20932
-
20933
- comment : [{
20934
- token : "comment",
20935
- regex : ".*?-->",
20936
- next : "start"
20937
- }, {
20938
- token : "comment",
20939
- merge : true,
20940
- regex : ".+"
20941
- }]
20942
- };
20943
- };
20944
-
20945
- oop.inherits(XmlHighlightRules, TextHighlightRules);
20946
-
20947
- exports.XmlHighlightRules = XmlHighlightRules;
20948
- });
20949
- /* ***** BEGIN LICENSE BLOCK *****
20950
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20951
- *
20952
- * The contents of this file are subject to the Mozilla Public License Version
20953
- * 1.1 (the "License"); you may not use this file except in compliance with
20954
- * the License. You may obtain a copy of the License at
20955
- * http://www.mozilla.org/MPL/
20956
- *
20957
- * Software distributed under the License is distributed on an "AS IS" basis,
20958
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20959
- * for the specific language governing rights and limitations under the
20960
- * License.
20961
- *
20962
- * The Original Code is Ajax.org Code Editor (ACE).
20963
- *
20964
- * The Initial Developer of the Original Code is
20965
- * Ajax.org B.V.
20966
- * Portions created by the Initial Developer are Copyright (C) 2010
20967
- * the Initial Developer. All Rights Reserved.
20968
- *
20969
- * Contributor(s):
20970
- * Fabian Jakobs <fabian AT ajax DOT org>
20971
- * Colin Gourlay <colin DOT j DOT gourlay AT gmail DOT com>
20972
- *
20973
- * Alternatively, the contents of this file may be used under the terms of
20974
- * either the GNU General Public License Version 2 or later (the "GPL"), or
20975
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20976
- * in which case the provisions of the GPL or the LGPL are applicable instead
20977
- * of those above. If you wish to allow use of your version of this file only
20978
- * under the terms of either the GPL or the LGPL, and not to allow others to
20979
- * use your version of this file under the terms of the MPL, indicate your
20980
- * decision by deleting the provisions above and replace them with the notice
20981
- * and other provisions required by the GPL or the LGPL. If you do not delete
20982
- * the provisions above, a recipient may use your version of this file under
20983
- * the terms of any one of the MPL, the GPL or the LGPL.
20984
- *
20985
- * ***** END LICENSE BLOCK ***** */
20986
-
20987
- define('ace/mode/python', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/python_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) {
20988
-
20989
- var oop = require("pilot/oop");
20990
- var TextMode = require("ace/mode/text").Mode;
20991
- var Tokenizer = require("ace/tokenizer").Tokenizer;
20992
- var PythonHighlightRules = require("ace/mode/python_highlight_rules").PythonHighlightRules;
20993
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
20994
- var Range = require("ace/range").Range;
20995
-
20996
- var Mode = function() {
20997
- this.$tokenizer = new Tokenizer(new PythonHighlightRules().getRules());
20998
- this.$outdent = new MatchingBraceOutdent();
20999
- };
21000
- oop.inherits(Mode, TextMode);
21001
-
21002
- (function() {
21003
-
21004
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
21005
- var outdent = true;
21006
- var outentedRows = [];
21007
- var re = /^(\s*)#/;
21008
-
21009
- for (var i=startRow; i<= endRow; i++) {
21010
- if (!re.test(doc.getLine(i))) {
21011
- outdent = false;
21012
- break;
21013
- }
21014
- }
21015
-
21016
- if (outdent) {
21017
- var deleteRange = new Range(0, 0, 0, 0);
21018
- for (var i=startRow; i<= endRow; i++)
21019
- {
21020
- var line = doc.getLine(i);
21021
- var m = line.match(re);
21022
- deleteRange.start.row = i;
21023
- deleteRange.end.row = i;
21024
- deleteRange.end.column = m[0].length;
21025
- doc.replace(deleteRange, m[1]);
21026
- }
21027
- }
21028
- else {
21029
- doc.indentRows(startRow, endRow, "#");
21030
- }
21031
- };
21032
-
21033
- this.getNextLineIndent = function(state, line, tab) {
21034
- var indent = this.$getIndent(line);
21035
-
21036
- var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
21037
- var tokens = tokenizedLine.tokens;
21038
- var endState = tokenizedLine.state;
21039
-
21040
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
21041
- return indent;
21042
- }
21043
-
21044
- if (state == "start") {
21045
- var match = line.match(/^.*[\{\(\[\:]\s*$/);
21046
- if (match) {
21047
- indent += tab;
21048
- }
21049
- }
21050
-
21051
- return indent;
21052
- };
21053
-
21054
- this.checkOutdent = function(state, line, input) {
21055
- return this.$outdent.checkOutdent(line, input);
21056
- };
21057
-
21058
- this.autoOutdent = function(state, doc, row) {
21059
- this.$outdent.autoOutdent(doc, row);
21060
- };
21061
-
21062
- }).call(Mode.prototype);
21063
-
21064
- exports.Mode = Mode;
21065
- });
21066
- /* ***** BEGIN LICENSE BLOCK *****
21067
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
21068
- *
21069
- * The contents of this file are subject to the Mozilla Public License Version
21070
- * 1.1 (the "License"); you may not use this file except in compliance with
21071
- * the License. You may obtain a copy of the License at
21072
- * http://www.mozilla.org/MPL/
21073
- *
21074
- * Software distributed under the License is distributed on an "AS IS" basis,
21075
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
21076
- * for the specific language governing rights and limitations under the
21077
- * License.
21078
- *
21079
- * The Original Code is Ajax.org Code Editor (ACE).
21080
- *
21081
- * The Initial Developer of the Original Code is
21082
- * Ajax.org B.V.
21083
- * Portions created by the Initial Developer are Copyright (C) 2010
21084
- * the Initial Developer. All Rights Reserved.
21085
- *
21086
- * Contributor(s):
21087
- * Fabian Jakobs <fabian AT ajax DOT org>
21088
- * Colin Gourlay <colin DOT j DOT gourlay AT gmail DOT com>
21089
- *
21090
- * Alternatively, the contents of this file may be used under the terms of
21091
- * either the GNU General Public License Version 2 or later (the "GPL"), or
21092
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
21093
- * in which case the provisions of the GPL or the LGPL are applicable instead
21094
- * of those above. If you wish to allow use of your version of this file only
21095
- * under the terms of either the GPL or the LGPL, and not to allow others to
21096
- * use your version of this file under the terms of the MPL, indicate your
21097
- * decision by deleting the provisions above and replace them with the notice
21098
- * and other provisions required by the GPL or the LGPL. If you do not delete
21099
- * the provisions above, a recipient may use your version of this file under
21100
- * the terms of any one of the MPL, the GPL or the LGPL.
21101
- *
21102
- * ***** END LICENSE BLOCK *****
21103
- *
21104
- * TODO: python delimiters
21105
- */
21106
-
21107
- define('ace/mode/python_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
21108
-
21109
- var oop = require("pilot/oop");
21110
- var lang = require("pilot/lang");
21111
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
21112
-
21113
- var PythonHighlightRules = function() {
21114
-
21115
- var keywords = lang.arrayToMap(
21116
- ("and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
21117
- "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
21118
- "raise|return|try|while|with|yield").split("|")
21119
- );
21120
-
21121
- var builtinConstants = lang.arrayToMap(
21122
- ("True|False|None|NotImplemented|Ellipsis|__debug__").split("|")
21123
- );
21124
-
21125
- var builtinFunctions = lang.arrayToMap(
21126
- ("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
21127
- "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
21128
- "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
21129
- "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
21130
- "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
21131
- "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
21132
- "__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
21133
- "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern").split("|")
21134
- );
21135
-
21136
- var futureReserved = lang.arrayToMap(
21137
- ("").split("|")
21138
- );
21139
-
21140
- var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
21141
-
21142
- var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
21143
- var octInteger = "(?:0[oO]?[0-7]+)";
21144
- var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
21145
- var binInteger = "(?:0[bB][01]+)";
21146
- var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
21147
-
21148
- var exponent = "(?:[eE][+-]?\\d+)";
21149
- var fraction = "(?:\\.\\d+)";
21150
- var intPart = "(?:\\d+)";
21151
- var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
21152
- var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
21153
- var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
21154
-
21155
- this.$rules = {
21156
- "start" : [ {
21157
- token : "comment",
21158
- regex : "#.*$"
21159
- }, {
21160
- token : "string", // """ string
21161
- regex : strPre + '"{3}(?:[^\\\\]|\\\\.)*?"{3}'
21162
- }, {
21163
- token : "string", // multi line """ string start
21164
- merge : true,
21165
- regex : strPre + '"{3}.*$',
21166
- next : "qqstring"
21167
- }, {
21168
- token : "string", // " string
21169
- regex : strPre + '"(?:[^\\\\]|\\\\.)*?"'
21170
- }, {
21171
- token : "string", // ''' string
21172
- regex : strPre + "'{3}(?:[^\\\\]|\\\\.)*?'{3}"
21173
- }, {
21174
- token : "string", // multi line ''' string start
21175
- merge : true,
21176
- regex : strPre + "'{3}.*$",
21177
- next : "qstring"
21178
- }, {
21179
- token : "string", // ' string
21180
- regex : strPre + "'(?:[^\\\\]|\\\\.)*?'"
21181
- }, {
21182
- token : "constant.numeric", // imaginary
21183
- regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
21184
- }, {
21185
- token : "constant.numeric", // float
21186
- regex : floatNumber
21187
- }, {
21188
- token : "constant.numeric", // long integer
21189
- regex : integer + "[lL]\\b"
21190
- }, {
21191
- token : "constant.numeric", // integer
21192
- regex : integer + "\\b"
21193
- }, {
21194
- token : function(value) {
21195
- if (keywords.hasOwnProperty(value))
21196
- return "keyword";
21197
- else if (builtinConstants.hasOwnProperty(value))
21198
- return "constant.language";
21199
- else if (futureReserved.hasOwnProperty(value))
21200
- return "invalid.illegal";
21201
- else if (builtinFunctions.hasOwnProperty(value))
21202
- return "support.function";
21203
- else if (value == "debugger")
21204
- return "invalid.deprecated";
21205
- else
21206
- return "identifier";
21207
- },
21208
- regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
21209
- }, {
21210
- token : "keyword.operator",
21211
- regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
21212
- }, {
21213
- token : "lparen",
21214
- regex : "[\\[\\(\\{]"
21215
- }, {
21216
- token : "rparen",
21217
- regex : "[\\]\\)\\}]"
21218
- }, {
21219
- token : "text",
21220
- regex : "\\s+"
21221
- } ],
21222
- "qqstring" : [ {
21223
- token : "string", // multi line """ string end
21224
- regex : '(?:[^\\\\]|\\\\.)*?"{3}',
21225
- next : "start"
21226
- }, {
21227
- token : "string",
21228
- merge : true,
21229
- regex : '.+'
21230
- } ],
21231
- "qstring" : [ {
21232
- token : "string", // multi line ''' string end
21233
- regex : "(?:[^\\\\]|\\\\.)*?'{3}",
21234
- next : "start"
21235
- }, {
21236
- token : "string",
21237
- merge : true,
21238
- regex : '.+'
21239
- } ]
21240
- };
21241
- };
21242
-
21243
- oop.inherits(PythonHighlightRules, TextHighlightRules);
21244
-
21245
- exports.PythonHighlightRules = PythonHighlightRules;
21246
- });/* ***** BEGIN LICENSE BLOCK *****
21247
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
21248
- *
21249
- * The contents of this file are subject to the Mozilla Public License Version
21250
- * 1.1 (the "License"); you may not use this file except in compliance with
21251
- * the License. You may obtain a copy of the License at
21252
- * http://www.mozilla.org/MPL/
21253
- *
21254
- * Software distributed under the License is distributed on an "AS IS" basis,
21255
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
21256
- * for the specific language governing rights and limitations under the
21257
- * License.
21258
- *
21259
- * The Original Code is Ajax.org Code Editor (ACE).
21260
- *
21261
- * The Initial Developer of the Original Code is
21262
- * Ajax.org B.V.
21263
- * Portions created by the Initial Developer are Copyright (C) 2010
21264
- * the Initial Developer. All Rights Reserved.
21265
- *
21266
- * Contributor(s):
21267
- * André Fiedler <fiedler dot andre a t gmail dot com>
21268
- *
21269
- * Alternatively, the contents of this file may be used under the terms of
21270
- * either the GNU General Public License Version 2 or later (the "GPL"), or
21271
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
21272
- * in which case the provisions of the GPL or the LGPL are applicable instead
21273
- * of those above. If you wish to allow use of your version of this file only
21274
- * under the terms of either the GPL or the LGPL, and not to allow others to
21275
- * use your version of this file under the terms of the MPL, indicate your
21276
- * decision by deleting the provisions above and replace them with the notice
21277
- * and other provisions required by the GPL or the LGPL. If you do not delete
21278
- * the provisions above, a recipient may use your version of this file under
21279
- * the terms of any one of the MPL, the GPL or the LGPL.
21280
- *
21281
- * ***** END LICENSE BLOCK ***** */
21282
-
21283
- define('ace/mode/php', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/php_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
21284
-
21285
- var oop = require("pilot/oop");
21286
- var TextMode = require("ace/mode/text").Mode;
21287
- var Tokenizer = require("ace/tokenizer").Tokenizer;
21288
- var PhpHighlightRules = require("ace/mode/php_highlight_rules").PhpHighlightRules;
21289
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
21290
- var Range = require("ace/range").Range;
21291
- var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
21292
-
21293
- var Mode = function() {
21294
- this.$tokenizer = new Tokenizer(new PhpHighlightRules().getRules());
21295
- this.$outdent = new MatchingBraceOutdent();
21296
- this.$behaviour = new CstyleBehaviour();
21297
- };
21298
- oop.inherits(Mode, TextMode);
21299
-
21300
- (function() {
21301
-
21302
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
21303
- var outdent = true;
21304
- var outentedRows = [];
21305
- var re = /^(\s*)#/;
21306
-
21307
- for (var i=startRow; i<= endRow; i++) {
21308
- if (!re.test(doc.getLine(i))) {
21309
- outdent = false;
21310
- break;
21311
- }
21312
- }
21313
-
21314
- if (outdent) {
21315
- var deleteRange = new Range(0, 0, 0, 0);
21316
- for (var i=startRow; i<= endRow; i++)
21317
- {
21318
- var line = doc.getLine(i);
21319
- var m = line.match(re);
21320
- deleteRange.start.row = i;
21321
- deleteRange.end.row = i;
21322
- deleteRange.end.column = m[0].length;
21323
- doc.replace(deleteRange, m[1]);
21324
- }
21325
- }
21326
- else {
21327
- doc.indentRows(startRow, endRow, "#");
21328
- }
21329
- };
21330
-
21331
- this.getNextLineIndent = function(state, line, tab) {
21332
- var indent = this.$getIndent(line);
21333
-
21334
- var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
21335
- var tokens = tokenizedLine.tokens;
21336
- var endState = tokenizedLine.state;
21337
-
21338
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
21339
- return indent;
21340
- }
21341
-
21342
- if (state == "start") {
21343
- var match = line.match(/^.*[\{\(\[\:]\s*$/);
21344
- if (match) {
21345
- indent += tab;
21346
- }
21347
- }
21348
-
21349
- return indent;
21350
- };
21351
-
21352
- this.checkOutdent = function(state, line, input) {
21353
- return this.$outdent.checkOutdent(line, input);
21354
- };
21355
-
21356
- this.autoOutdent = function(state, doc, row) {
21357
- this.$outdent.autoOutdent(doc, row);
21358
- };
21359
-
21360
- }).call(Mode.prototype);
21361
-
21362
- exports.Mode = Mode;
21363
- });
21364
- /* ***** BEGIN LICENSE BLOCK *****
21365
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
21366
- *
21367
- * The contents of this file are subject to the Mozilla Public License Version
21368
- * 1.1 (the "License"); you may not use this file except in compliance with
21369
- * the License. You may obtain a copy of the License at
21370
- * http://www.mozilla.org/MPL/
21371
- *
21372
- * Software distributed under the License is distributed on an "AS IS" basis,
21373
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
21374
- * for the specific language governing rights and limitations under the
21375
- * License.
21376
- *
21377
- * The Original Code is Ajax.org Code Editor (ACE).
21378
- *
21379
- * The Initial Developer of the Original Code is
21380
- * Ajax.org B.V.
21381
- * Portions created by the Initial Developer are Copyright (C) 2010
21382
- * the Initial Developer. All Rights Reserved.
21383
- *
21384
- * Contributor(s):
21385
- * André Fiedler <fiedler dot andre a t gmail dot com>
21386
- *
21387
- * Alternatively, the contents of this file may be used under the terms of
21388
- * either the GNU General Public License Version 2 or later (the "GPL"), or
21389
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
21390
- * in which case the provisions of the GPL or the LGPL are applicable instead
21391
- * of those above. If you wish to allow use of your version of this file only
21392
- * under the terms of either the GPL or the LGPL, and not to allow others to
21393
- * use your version of this file under the terms of the MPL, indicate your
21394
- * decision by deleting the provisions above and replace them with the notice
21395
- * and other provisions required by the GPL or the LGPL. If you do not delete
21396
- * the provisions above, a recipient may use your version of this file under
21397
- * the terms of any one of the MPL, the GPL or the LGPL.
21398
- *
21399
- * ***** END LICENSE BLOCK *****
21400
- */
21401
-
21402
- define('ace/mode/php_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
21403
-
21404
- var oop = require("pilot/oop");
21405
- var lang = require("pilot/lang");
21406
- var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
21407
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
21408
-
21409
- var PhpHighlightRules = function() {
21410
- // http://php.net/quickref.php
21411
- var builtinFunctions = lang.arrayToMap(
21412
- ('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
21413
- 'aggregate_properties|aggregate_properties_by_list|aggregate_properties_by_regexp|aggregation_info|amqpconnection|amqpexchange|amqpqueue|' +
21414
- 'apache_child_terminate|apache_get_modules|apache_get_version|apache_getenv|apache_lookup_uri|apache_note|apache_request_headers|' +
21415
- 'apache_reset_timeout|apache_response_headers|apache_setenv|apc_add|apc_bin_dump|apc_bin_dumpfile|apc_bin_load|apc_bin_loadfile|' +
21416
- 'apc_cache_info|apc_cas|apc_clear_cache|apc_compile_file|apc_dec|apc_define_constants|apc_delete|apc_delete_file|apc_exists|apc_fetch|' +
21417
- 'apc_inc|apc_load_constants|apc_sma_info|apc_store|apciterator|apd_breakpoint|apd_callstack|apd_clunk|apd_continue|apd_croak|' +
21418
- 'apd_dump_function_table|apd_dump_persistent_resources|apd_dump_regular_resources|apd_echo|apd_get_active_symbols|apd_set_pprof_trace|' +
21419
- 'apd_set_session|apd_set_session_trace|apd_set_session_trace_socket|appenditerator|array|array_change_key_case|array_chunk|array_combine|' +
21420
- 'array_count_values|array_diff|array_diff_assoc|array_diff_key|array_diff_uassoc|array_diff_ukey|array_fill|array_fill_keys|array_filter|' +
21421
- 'array_flip|array_intersect|array_intersect_assoc|array_intersect_key|array_intersect_uassoc|array_intersect_ukey|array_key_exists|' +
21422
- 'array_keys|array_map|array_merge|array_merge_recursive|array_multisort|array_pad|array_pop|array_product|array_push|array_rand|' +
21423
- 'array_reduce|array_replace|array_replace_recursive|array_reverse|array_search|array_shift|array_slice|array_splice|array_sum|array_udiff|' +
21424
- 'array_udiff_assoc|array_udiff_uassoc|array_uintersect|array_uintersect_assoc|array_uintersect_uassoc|array_unique|array_unshift|' +
21425
- 'array_values|array_walk|array_walk_recursive|arrayaccess|arrayiterator|arrayobject|arsort|asin|asinh|asort|assert|assert_options|atan|' +
21426
- 'atan2|atanh|audioproperties|badfunctioncallexception|badmethodcallexception|base64_decode|base64_encode|base_convert|basename|' +
21427
- 'bbcode_add_element|bbcode_add_smiley|bbcode_create|bbcode_destroy|bbcode_parse|bbcode_set_arg_parser|bbcode_set_flags|bcadd|bccomp|bcdiv|' +
21428
- 'bcmod|bcmul|bcompiler_load|bcompiler_load_exe|bcompiler_parse_class|bcompiler_read|bcompiler_write_class|bcompiler_write_constant|' +
21429
- 'bcompiler_write_exe_footer|bcompiler_write_file|bcompiler_write_footer|bcompiler_write_function|bcompiler_write_functions_from_file|' +
21430
- 'bcompiler_write_header|bcompiler_write_included_filename|bcpow|bcpowmod|bcscale|bcsqrt|bcsub|bin2hex|bind_textdomain_codeset|bindec|' +
21431
- 'bindtextdomain|bson_decode|bson_encode|bumpValue|bzclose|bzcompress|bzdecompress|bzerrno|bzerror|bzerrstr|bzflush|bzopen|bzread|bzwrite|' +
21432
- 'cachingiterator|cairo|cairo_create|cairo_font_face_get_type|cairo_font_face_status|cairo_font_options_create|cairo_font_options_equal|' +
21433
- 'cairo_font_options_get_antialias|cairo_font_options_get_hint_metrics|cairo_font_options_get_hint_style|' +
21434
- 'cairo_font_options_get_subpixel_order|cairo_font_options_hash|cairo_font_options_merge|cairo_font_options_set_antialias|' +
21435
- 'cairo_font_options_set_hint_metrics|cairo_font_options_set_hint_style|cairo_font_options_set_subpixel_order|cairo_font_options_status|' +
21436
- 'cairo_format_stride_for_width|cairo_image_surface_create|cairo_image_surface_create_for_data|cairo_image_surface_create_from_png|' +
21437
- 'cairo_image_surface_get_data|cairo_image_surface_get_format|cairo_image_surface_get_height|cairo_image_surface_get_stride|' +
21438
- 'cairo_image_surface_get_width|cairo_matrix_create_scale|cairo_matrix_create_translate|cairo_matrix_invert|cairo_matrix_multiply|' +
21439
- 'cairo_matrix_rotate|cairo_matrix_transform_distance|cairo_matrix_transform_point|cairo_matrix_translate|cairo_pattern_add_color_stop_rgb|' +
21440
- 'cairo_pattern_add_color_stop_rgba|cairo_pattern_create_for_surface|cairo_pattern_create_linear|cairo_pattern_create_radial|' +
21441
- 'cairo_pattern_create_rgb|cairo_pattern_create_rgba|cairo_pattern_get_color_stop_count|cairo_pattern_get_color_stop_rgba|' +
21442
- 'cairo_pattern_get_extend|cairo_pattern_get_filter|cairo_pattern_get_linear_points|cairo_pattern_get_matrix|' +
21443
- 'cairo_pattern_get_radial_circles|cairo_pattern_get_rgba|cairo_pattern_get_surface|cairo_pattern_get_type|cairo_pattern_set_extend|' +
21444
- 'cairo_pattern_set_filter|cairo_pattern_set_matrix|cairo_pattern_status|cairo_pdf_surface_create|cairo_pdf_surface_set_size|' +
21445
- 'cairo_ps_get_levels|cairo_ps_level_to_string|cairo_ps_surface_create|cairo_ps_surface_dsc_begin_page_setup|' +
21446
- 'cairo_ps_surface_dsc_begin_setup|cairo_ps_surface_dsc_comment|cairo_ps_surface_get_eps|cairo_ps_surface_restrict_to_level|' +
21447
- 'cairo_ps_surface_set_eps|cairo_ps_surface_set_size|cairo_scaled_font_create|cairo_scaled_font_extents|cairo_scaled_font_get_ctm|' +
21448
- 'cairo_scaled_font_get_font_face|cairo_scaled_font_get_font_matrix|cairo_scaled_font_get_font_options|cairo_scaled_font_get_scale_matrix|' +
21449
- 'cairo_scaled_font_get_type|cairo_scaled_font_glyph_extents|cairo_scaled_font_status|cairo_scaled_font_text_extents|' +
21450
- 'cairo_surface_copy_page|cairo_surface_create_similar|cairo_surface_finish|cairo_surface_flush|cairo_surface_get_content|' +
21451
- 'cairo_surface_get_device_offset|cairo_surface_get_font_options|cairo_surface_get_type|cairo_surface_mark_dirty|' +
21452
- 'cairo_surface_mark_dirty_rectangle|cairo_surface_set_device_offset|cairo_surface_set_fallback_resolution|cairo_surface_show_page|' +
21453
- 'cairo_surface_status|cairo_surface_write_to_png|cairo_svg_surface_create|cairo_svg_surface_restrict_to_version|' +
21454
- 'cairo_svg_version_to_string|cairoantialias|cairocontent|cairocontext|cairoexception|cairoextend|cairofillrule|cairofilter|cairofontface|' +
21455
- 'cairofontoptions|cairofontslant|cairofonttype|cairofontweight|cairoformat|cairogradientpattern|cairohintmetrics|cairohintstyle|' +
21456
- 'cairoimagesurface|cairolineargradient|cairolinecap|cairolinejoin|cairomatrix|cairooperator|cairopath|cairopattern|cairopatterntype|' +
21457
- 'cairopdfsurface|cairopslevel|cairopssurface|cairoradialgradient|cairoscaledfont|cairosolidpattern|cairostatus|cairosubpixelorder|' +
21458
- 'cairosurface|cairosurfacepattern|cairosurfacetype|cairosvgsurface|cairosvgversion|cairotoyfontface|cal_days_in_month|cal_from_jd|cal_info|' +
21459
- 'cal_to_jd|calcul_hmac|calculhmac|call_user_func|call_user_func_array|call_user_method|call_user_method_array|callbackfilteriterator|ceil|' +
21460
- 'chdb|chdb_create|chdir|checkdate|checkdnsrr|chgrp|chmod|chop|chown|chr|chroot|chunk_split|class_alias|class_exists|class_implements|' +
21461
- 'class_parents|classkit_import|classkit_method_add|classkit_method_copy|classkit_method_redefine|classkit_method_remove|' +
21462
- 'classkit_method_rename|clearstatcache|clone|closedir|closelog|collator|com|com_addref|com_create_guid|com_event_sink|com_get|' +
21463
- 'com_get_active_object|com_invoke|com_isenum|com_load|com_load_typelib|com_message_pump|com_print_typeinfo|com_propget|com_propput|' +
21464
- 'com_propset|com_release|com_set|compact|connection_aborted|connection_status|connection_timeout|constant|construct|construct|construct|' +
21465
- 'convert_cyr_string|convert_uudecode|convert_uuencode|copy|cos|cosh|count|count_chars|countable|counter_bump|counter_bump_value|' +
21466
- 'counter_create|counter_get|counter_get_meta|counter_get_named|counter_get_value|counter_reset|counter_reset_value|crack_check|' +
21467
- 'crack_closedict|crack_getlastmessage|crack_opendict|crc32|create_function|crypt|ctype_alnum|ctype_alpha|ctype_cntrl|ctype_digit|' +
21468
- 'ctype_graph|ctype_lower|ctype_print|ctype_punct|ctype_space|ctype_upper|ctype_xdigit|cubrid_affected_rows|cubrid_bind|' +
21469
- 'cubrid_client_encoding|cubrid_close|cubrid_close_prepare|cubrid_close_request|cubrid_col_get|cubrid_col_size|cubrid_column_names|' +
21470
- 'cubrid_column_types|cubrid_commit|cubrid_connect|cubrid_connect_with_url|cubrid_current_oid|cubrid_data_seek|cubrid_db_name|' +
21471
- 'cubrid_disconnect|cubrid_drop|cubrid_errno|cubrid_error|cubrid_error_code|cubrid_error_code_facility|cubrid_error_msg|cubrid_execute|' +
21472
- 'cubrid_fetch|cubrid_fetch_array|cubrid_fetch_assoc|cubrid_fetch_field|cubrid_fetch_lengths|cubrid_fetch_object|cubrid_fetch_row|' +
21473
- 'cubrid_field_flags|cubrid_field_len|cubrid_field_name|cubrid_field_seek|cubrid_field_table|cubrid_field_type|cubrid_free_result|' +
21474
- 'cubrid_get|cubrid_get_autocommit|cubrid_get_charset|cubrid_get_class_name|cubrid_get_client_info|cubrid_get_db_parameter|' +
21475
- 'cubrid_get_server_info|cubrid_insert_id|cubrid_is_instance|cubrid_list_dbs|cubrid_load_from_glo|cubrid_lob_close|cubrid_lob_export|' +
21476
- 'cubrid_lob_get|cubrid_lob_send|cubrid_lob_size|cubrid_lock_read|cubrid_lock_write|cubrid_move_cursor|cubrid_new_glo|cubrid_next_result|' +
21477
- 'cubrid_num_cols|cubrid_num_fields|cubrid_num_rows|cubrid_ping|cubrid_prepare|cubrid_put|cubrid_query|cubrid_real_escape_string|' +
21478
- 'cubrid_result|cubrid_rollback|cubrid_save_to_glo|cubrid_schema|cubrid_send_glo|cubrid_seq_drop|cubrid_seq_insert|cubrid_seq_put|' +
21479
- 'cubrid_set_add|cubrid_set_autocommit|cubrid_set_db_parameter|cubrid_set_drop|cubrid_unbuffered_query|cubrid_version|curl_close|' +
21480
- 'curl_copy_handle|curl_errno|curl_error|curl_exec|curl_getinfo|curl_init|curl_multi_add_handle|curl_multi_close|curl_multi_exec|' +
21481
- 'curl_multi_getcontent|curl_multi_info_read|curl_multi_init|curl_multi_remove_handle|curl_multi_select|curl_setopt|curl_setopt_array|' +
21482
- 'curl_version|current|cyrus_authenticate|cyrus_bind|cyrus_close|cyrus_connect|cyrus_query|cyrus_unbind|date|date_add|date_create|' +
21483
- 'date_create_from_format|date_date_set|date_default_timezone_get|date_default_timezone_set|date_diff|date_format|date_get_last_errors|' +
21484
- 'date_interval_create_from_date_string|date_interval_format|date_isodate_set|date_modify|date_offset_get|date_parse|date_parse_from_format|' +
21485
- 'date_sub|date_sun_info|date_sunrise|date_sunset|date_time_set|date_timestamp_get|date_timestamp_set|date_timezone_get|date_timezone_set|' +
21486
- 'dateinterval|dateperiod|datetime|datetimezone|db2_autocommit|db2_bind_param|db2_client_info|db2_close|db2_column_privileges|db2_columns|' +
21487
- 'db2_commit|db2_conn_error|db2_conn_errormsg|db2_connect|db2_cursor_type|db2_escape_string|db2_exec|db2_execute|db2_fetch_array|' +
21488
- 'db2_fetch_assoc|db2_fetch_both|db2_fetch_object|db2_fetch_row|db2_field_display_size|db2_field_name|db2_field_num|db2_field_precision|' +
21489
- 'db2_field_scale|db2_field_type|db2_field_width|db2_foreign_keys|db2_free_result|db2_free_stmt|db2_get_option|db2_last_insert_id|' +
21490
- 'db2_lob_read|db2_next_result|db2_num_fields|db2_num_rows|db2_pclose|db2_pconnect|db2_prepare|db2_primary_keys|db2_procedure_columns|' +
21491
- 'db2_procedures|db2_result|db2_rollback|db2_server_info|db2_set_option|db2_special_columns|db2_statistics|db2_stmt_error|db2_stmt_errormsg|' +
21492
- 'db2_table_privileges|db2_tables|dba_close|dba_delete|dba_exists|dba_fetch|dba_firstkey|dba_handlers|dba_insert|dba_key_split|dba_list|' +
21493
- 'dba_nextkey|dba_open|dba_optimize|dba_popen|dba_replace|dba_sync|dbase_add_record|dbase_close|dbase_create|dbase_delete_record|' +
21494
- 'dbase_get_header_info|dbase_get_record|dbase_get_record_with_names|dbase_numfields|dbase_numrecords|dbase_open|dbase_pack|' +
21495
- 'dbase_replace_record|dbplus_add|dbplus_aql|dbplus_chdir|dbplus_close|dbplus_curr|dbplus_errcode|dbplus_errno|dbplus_find|dbplus_first|' +
21496
- 'dbplus_flush|dbplus_freealllocks|dbplus_freelock|dbplus_freerlocks|dbplus_getlock|dbplus_getunique|dbplus_info|dbplus_last|dbplus_lockrel|' +
21497
- 'dbplus_next|dbplus_open|dbplus_prev|dbplus_rchperm|dbplus_rcreate|dbplus_rcrtexact|dbplus_rcrtlike|dbplus_resolve|dbplus_restorepos|' +
21498
- 'dbplus_rkeys|dbplus_ropen|dbplus_rquery|dbplus_rrename|dbplus_rsecindex|dbplus_runlink|dbplus_rzap|dbplus_savepos|dbplus_setindex|' +
21499
- 'dbplus_setindexbynumber|dbplus_sql|dbplus_tcl|dbplus_tremove|dbplus_undo|dbplus_undoprepare|dbplus_unlockrel|dbplus_unselect|' +
21500
- 'dbplus_update|dbplus_xlockrel|dbplus_xunlockrel|dbx_close|dbx_compare|dbx_connect|dbx_error|dbx_escape_string|dbx_fetch_row|dbx_query|' +
21501
- 'dbx_sort|dcgettext|dcngettext|deaggregate|debug_backtrace|debug_print_backtrace|debug_zval_dump|decbin|dechex|decoct|define|' +
21502
- 'define_syslog_variables|defined|deg2rad|delete|dgettext|die|dio_close|dio_fcntl|dio_open|dio_read|dio_seek|dio_stat|dio_tcsetattr|' +
21503
- 'dio_truncate|dio_write|dir|directoryiterator|dirname|disk_free_space|disk_total_space|diskfreespace|dl|dngettext|dns_check_record|' +
21504
- 'dns_get_mx|dns_get_record|dom_import_simplexml|domainexception|domattr|domattribute_name|domattribute_set_value|domattribute_specified|' +
21505
- 'domattribute_value|domcharacterdata|domcomment|domdocument|domdocument_add_root|domdocument_create_attribute|' +
21506
- 'domdocument_create_cdata_section|domdocument_create_comment|domdocument_create_element|domdocument_create_element_ns|' +
21507
- 'domdocument_create_entity_reference|domdocument_create_processing_instruction|domdocument_create_text_node|domdocument_doctype|' +
21508
- 'domdocument_document_element|domdocument_dump_file|domdocument_dump_mem|domdocument_get_element_by_id|domdocument_get_elements_by_tagname|' +
21509
- 'domdocument_html_dump_mem|domdocument_xinclude|domdocumentfragment|domdocumenttype|domdocumenttype_entities|' +
21510
- 'domdocumenttype_internal_subset|domdocumenttype_name|domdocumenttype_notations|domdocumenttype_public_id|domdocumenttype_system_id|' +
21511
- 'domelement|domelement_get_attribute|domelement_get_attribute_node|domelement_get_elements_by_tagname|domelement_has_attribute|' +
21512
- 'domelement_remove_attribute|domelement_set_attribute|domelement_set_attribute_node|domelement_tagname|domentity|domentityreference|' +
21513
- 'domexception|domimplementation|domnamednodemap|domnode|domnode_add_namespace|domnode_append_child|domnode_append_sibling|' +
21514
- 'domnode_attributes|domnode_child_nodes|domnode_clone_node|domnode_dump_node|domnode_first_child|domnode_get_content|' +
21515
- 'domnode_has_attributes|domnode_has_child_nodes|domnode_insert_before|domnode_is_blank_node|domnode_last_child|domnode_next_sibling|' +
21516
- 'domnode_node_name|domnode_node_type|domnode_node_value|domnode_owner_document|domnode_parent_node|domnode_prefix|domnode_previous_sibling|' +
21517
- 'domnode_remove_child|domnode_replace_child|domnode_replace_node|domnode_set_content|domnode_set_name|domnode_set_namespace|' +
21518
- 'domnode_unlink_node|domnodelist|domnotation|domprocessinginstruction|domprocessinginstruction_data|domprocessinginstruction_target|' +
21519
- 'domtext|domxml_new_doc|domxml_open_file|domxml_open_mem|domxml_version|domxml_xmltree|domxml_xslt_stylesheet|domxml_xslt_stylesheet_doc|' +
21520
- 'domxml_xslt_stylesheet_file|domxml_xslt_version|domxpath|domxsltstylesheet_process|domxsltstylesheet_result_dump_file|' +
21521
- 'domxsltstylesheet_result_dump_mem|dotnet|dotnet_load|doubleval|each|easter_date|easter_days|echo|empty|emptyiterator|' +
21522
- 'enchant_broker_describe|enchant_broker_dict_exists|enchant_broker_free|enchant_broker_free_dict|enchant_broker_get_error|' +
21523
- 'enchant_broker_init|enchant_broker_list_dicts|enchant_broker_request_dict|enchant_broker_request_pwl_dict|enchant_broker_set_ordering|' +
21524
- 'enchant_dict_add_to_personal|enchant_dict_add_to_session|enchant_dict_check|enchant_dict_describe|enchant_dict_get_error|' +
21525
- 'enchant_dict_is_in_session|enchant_dict_quick_check|enchant_dict_store_replacement|enchant_dict_suggest|end|ereg|ereg_replace|eregi|' +
21526
- 'eregi_replace|error_get_last|error_log|error_reporting|errorexception|escapeshellarg|escapeshellcmd|eval|event_add|event_base_free|' +
21527
- 'event_base_loop|event_base_loopbreak|event_base_loopexit|event_base_new|event_base_priority_init|event_base_set|event_buffer_base_set|' +
21528
- 'event_buffer_disable|event_buffer_enable|event_buffer_fd_set|event_buffer_free|event_buffer_new|event_buffer_priority_set|' +
21529
- 'event_buffer_read|event_buffer_set_callback|event_buffer_timeout_set|event_buffer_watermark_set|event_buffer_write|event_del|event_free|' +
21530
- 'event_new|event_set|exception|exec|exif_imagetype|exif_read_data|exif_tagname|exif_thumbnail|exit|exp|expect_expectl|expect_popen|explode|' +
21531
- 'expm1|export|export|extension_loaded|extract|ezmlm_hash|fam_cancel_monitor|fam_close|fam_monitor_collection|fam_monitor_directory|' +
21532
- 'fam_monitor_file|fam_next_event|fam_open|fam_pending|fam_resume_monitor|fam_suspend_monitor|fbsql_affected_rows|fbsql_autocommit|' +
21533
- 'fbsql_blob_size|fbsql_change_user|fbsql_clob_size|fbsql_close|fbsql_commit|fbsql_connect|fbsql_create_blob|fbsql_create_clob|' +
21534
- 'fbsql_create_db|fbsql_data_seek|fbsql_database|fbsql_database_password|fbsql_db_query|fbsql_db_status|fbsql_drop_db|fbsql_errno|' +
21535
- 'fbsql_error|fbsql_fetch_array|fbsql_fetch_assoc|fbsql_fetch_field|fbsql_fetch_lengths|fbsql_fetch_object|fbsql_fetch_row|' +
21536
- 'fbsql_field_flags|fbsql_field_len|fbsql_field_name|fbsql_field_seek|fbsql_field_table|fbsql_field_type|fbsql_free_result|' +
21537
- 'fbsql_get_autostart_info|fbsql_hostname|fbsql_insert_id|fbsql_list_dbs|fbsql_list_fields|fbsql_list_tables|fbsql_next_result|' +
21538
- 'fbsql_num_fields|fbsql_num_rows|fbsql_password|fbsql_pconnect|fbsql_query|fbsql_read_blob|fbsql_read_clob|fbsql_result|fbsql_rollback|' +
21539
- 'fbsql_rows_fetched|fbsql_select_db|fbsql_set_characterset|fbsql_set_lob_mode|fbsql_set_password|fbsql_set_transaction|fbsql_start_db|' +
21540
- 'fbsql_stop_db|fbsql_table_name|fbsql_tablename|fbsql_username|fbsql_warnings|fclose|fdf_add_doc_javascript|fdf_add_template|fdf_close|' +
21541
- 'fdf_create|fdf_enum_values|fdf_errno|fdf_error|fdf_get_ap|fdf_get_attachment|fdf_get_encoding|fdf_get_file|fdf_get_flags|fdf_get_opt|' +
21542
- 'fdf_get_status|fdf_get_value|fdf_get_version|fdf_header|fdf_next_field_name|fdf_open|fdf_open_string|fdf_remove_item|fdf_save|' +
21543
- 'fdf_save_string|fdf_set_ap|fdf_set_encoding|fdf_set_file|fdf_set_flags|fdf_set_javascript_action|fdf_set_on_import_javascript|fdf_set_opt|' +
21544
- 'fdf_set_status|fdf_set_submit_form_action|fdf_set_target_frame|fdf_set_value|fdf_set_version|feof|fflush|fgetc|fgetcsv|fgets|fgetss|file|' +
21545
- 'file_exists|file_get_contents|file_put_contents|fileatime|filectime|filegroup|fileinode|filemtime|fileowner|fileperms|filepro|' +
21546
- 'filepro_fieldcount|filepro_fieldname|filepro_fieldtype|filepro_fieldwidth|filepro_retrieve|filepro_rowcount|filesize|filesystemiterator|' +
21547
- 'filetype|filter_has_var|filter_id|filter_input|filter_input_array|filter_list|filter_var|filter_var_array|filteriterator|finfo_buffer|' +
21548
- 'finfo_close|finfo_file|finfo_open|finfo_set_flags|floatval|flock|floor|flush|fmod|fnmatch|fopen|forward_static_call|' +
21549
- 'forward_static_call_array|fpassthru|fprintf|fputcsv|fputs|fread|frenchtojd|fribidi_log2vis|fscanf|fseek|fsockopen|fstat|ftell|ftok|' +
21550
- 'ftp_alloc|ftp_cdup|ftp_chdir|ftp_chmod|ftp_close|ftp_connect|ftp_delete|ftp_exec|ftp_fget|ftp_fput|ftp_get|ftp_get_option|ftp_login|' +
21551
- 'ftp_mdtm|ftp_mkdir|ftp_nb_continue|ftp_nb_fget|ftp_nb_fput|ftp_nb_get|ftp_nb_put|ftp_nlist|ftp_pasv|ftp_put|ftp_pwd|ftp_quit|ftp_raw|' +
21552
- 'ftp_rawlist|ftp_rename|ftp_rmdir|ftp_set_option|ftp_site|ftp_size|ftp_ssl_connect|ftp_systype|ftruncate|func_get_arg|func_get_args|' +
21553
- 'func_num_args|function_exists|fwrite|gc_collect_cycles|gc_disable|gc_enable|gc_enabled|gd_info|gearmanclient|gearmanjob|gearmantask|' +
21554
- 'gearmanworker|geoip_continent_code_by_name|geoip_country_code3_by_name|geoip_country_code_by_name|geoip_country_name_by_name|' +
21555
- 'geoip_database_info|geoip_db_avail|geoip_db_filename|geoip_db_get_all_info|geoip_id_by_name|geoip_isp_by_name|geoip_org_by_name|' +
21556
- 'geoip_record_by_name|geoip_region_by_name|geoip_region_name_by_code|geoip_time_zone_by_country_and_region|getMeta|getNamed|getValue|' +
21557
- 'get_browser|get_called_class|get_cfg_var|get_class|get_class_methods|get_class_vars|get_current_user|get_declared_classes|' +
21558
- 'get_declared_interfaces|get_defined_constants|get_defined_functions|get_defined_vars|get_extension_funcs|get_headers|' +
21559
- 'get_html_translation_table|get_include_path|get_included_files|get_loaded_extensions|get_magic_quotes_gpc|get_magic_quotes_runtime|' +
21560
- 'get_meta_tags|get_object_vars|get_parent_class|get_required_files|get_resource_type|getallheaders|getconstant|getconstants|getconstructor|' +
21561
- 'getcwd|getdate|getdefaultproperties|getdoccomment|getendline|getenv|getextension|getextensionname|getfilename|gethostbyaddr|gethostbyname|' +
21562
- 'gethostbynamel|gethostname|getimagesize|getinterfacenames|getinterfaces|getlastmod|getmethod|getmethods|getmodifiers|getmxrr|getmygid|' +
21563
- 'getmyinode|getmypid|getmyuid|getname|getnamespacename|getopt|getparentclass|getproperties|getproperty|getprotobyname|getprotobynumber|' +
21564
- 'getrandmax|getrusage|getservbyname|getservbyport|getshortname|getstartline|getstaticproperties|getstaticpropertyvalue|gettext|' +
21565
- 'gettimeofday|gettype|glob|globiterator|gmagick|gmagickdraw|gmagickpixel|gmdate|gmmktime|gmp_abs|gmp_add|gmp_and|gmp_clrbit|gmp_cmp|' +
21566
- 'gmp_com|gmp_div|gmp_div_q|gmp_div_qr|gmp_div_r|gmp_divexact|gmp_fact|gmp_gcd|gmp_gcdext|gmp_hamdist|gmp_init|gmp_intval|gmp_invert|' +
21567
- 'gmp_jacobi|gmp_legendre|gmp_mod|gmp_mul|gmp_neg|gmp_nextprime|gmp_or|gmp_perfect_square|gmp_popcount|gmp_pow|gmp_powm|gmp_prob_prime|' +
21568
- 'gmp_random|gmp_scan0|gmp_scan1|gmp_setbit|gmp_sign|gmp_sqrt|gmp_sqrtrem|gmp_strval|gmp_sub|gmp_testbit|gmp_xor|gmstrftime|' +
21569
- 'gnupg_adddecryptkey|gnupg_addencryptkey|gnupg_addsignkey|gnupg_cleardecryptkeys|gnupg_clearencryptkeys|gnupg_clearsignkeys|gnupg_decrypt|' +
21570
- 'gnupg_decryptverify|gnupg_encrypt|gnupg_encryptsign|gnupg_export|gnupg_geterror|gnupg_getprotocol|gnupg_import|gnupg_init|gnupg_keyinfo|' +
21571
- 'gnupg_setarmor|gnupg_seterrormode|gnupg_setsignmode|gnupg_sign|gnupg_verify|gopher_parsedir|grapheme_extract|grapheme_stripos|' +
21572
- 'grapheme_stristr|grapheme_strlen|grapheme_strpos|grapheme_strripos|grapheme_strrpos|grapheme_strstr|grapheme_substr|gregoriantojd|' +
21573
- 'gupnp_context_get_host_ip|gupnp_context_get_port|gupnp_context_get_subscription_timeout|gupnp_context_host_path|gupnp_context_new|' +
21574
- 'gupnp_context_set_subscription_timeout|gupnp_context_timeout_add|gupnp_context_unhost_path|gupnp_control_point_browse_start|' +
21575
- 'gupnp_control_point_browse_stop|gupnp_control_point_callback_set|gupnp_control_point_new|gupnp_device_action_callback_set|' +
21576
- 'gupnp_device_info_get|gupnp_device_info_get_service|gupnp_root_device_get_available|gupnp_root_device_get_relative_location|' +
21577
- 'gupnp_root_device_new|gupnp_root_device_set_available|gupnp_root_device_start|gupnp_root_device_stop|gupnp_service_action_get|' +
21578
- 'gupnp_service_action_return|gupnp_service_action_return_error|gupnp_service_action_set|gupnp_service_freeze_notify|gupnp_service_info_get|' +
21579
- 'gupnp_service_info_get_introspection|gupnp_service_introspection_get_state_variable|gupnp_service_notify|gupnp_service_proxy_action_get|' +
21580
- 'gupnp_service_proxy_action_set|gupnp_service_proxy_add_notify|gupnp_service_proxy_callback_set|gupnp_service_proxy_get_subscribed|' +
21581
- 'gupnp_service_proxy_remove_notify|gupnp_service_proxy_set_subscribed|gupnp_service_thaw_notify|gzclose|gzcompress|gzdecode|gzdeflate|' +
21582
- 'gzencode|gzeof|gzfile|gzgetc|gzgets|gzgetss|gzinflate|gzopen|gzpassthru|gzputs|gzread|gzrewind|gzseek|gztell|gzuncompress|gzwrite|' +
21583
- 'halt_compiler|haruannotation|haruannotation_setborderstyle|haruannotation_sethighlightmode|haruannotation_seticon|' +
21584
- 'haruannotation_setopened|harudestination|harudestination_setfit|harudestination_setfitb|harudestination_setfitbh|harudestination_setfitbv|' +
21585
- 'harudestination_setfith|harudestination_setfitr|harudestination_setfitv|harudestination_setxyz|harudoc|harudoc_addpage|' +
21586
- 'harudoc_addpagelabel|harudoc_construct|harudoc_createoutline|harudoc_getcurrentencoder|harudoc_getcurrentpage|harudoc_getencoder|' +
21587
- 'harudoc_getfont|harudoc_getinfoattr|harudoc_getpagelayout|harudoc_getpagemode|harudoc_getstreamsize|harudoc_insertpage|harudoc_loadjpeg|' +
21588
- 'harudoc_loadpng|harudoc_loadraw|harudoc_loadttc|harudoc_loadttf|harudoc_loadtype1|harudoc_output|harudoc_readfromstream|' +
21589
- 'harudoc_reseterror|harudoc_resetstream|harudoc_save|harudoc_savetostream|harudoc_setcompressionmode|harudoc_setcurrentencoder|' +
21590
- 'harudoc_setencryptionmode|harudoc_setinfoattr|harudoc_setinfodateattr|harudoc_setopenaction|harudoc_setpagelayout|harudoc_setpagemode|' +
21591
- 'harudoc_setpagesconfiguration|harudoc_setpassword|harudoc_setpermission|harudoc_usecnsencodings|harudoc_usecnsfonts|' +
21592
- 'harudoc_usecntencodings|harudoc_usecntfonts|harudoc_usejpencodings|harudoc_usejpfonts|harudoc_usekrencodings|harudoc_usekrfonts|' +
21593
- 'haruencoder|haruencoder_getbytetype|haruencoder_gettype|haruencoder_getunicode|haruencoder_getwritingmode|haruexception|harufont|' +
21594
- 'harufont_getascent|harufont_getcapheight|harufont_getdescent|harufont_getencodingname|harufont_getfontname|harufont_gettextwidth|' +
21595
- 'harufont_getunicodewidth|harufont_getxheight|harufont_measuretext|haruimage|haruimage_getbitspercomponent|haruimage_getcolorspace|' +
21596
- 'haruimage_getheight|haruimage_getsize|haruimage_getwidth|haruimage_setcolormask|haruimage_setmaskimage|haruoutline|' +
21597
- 'haruoutline_setdestination|haruoutline_setopened|harupage|harupage_arc|harupage_begintext|harupage_circle|harupage_closepath|' +
21598
- 'harupage_concat|harupage_createdestination|harupage_createlinkannotation|harupage_createtextannotation|harupage_createurlannotation|' +
21599
- 'harupage_curveto|harupage_curveto2|harupage_curveto3|harupage_drawimage|harupage_ellipse|harupage_endpath|harupage_endtext|' +
21600
- 'harupage_eofill|harupage_eofillstroke|harupage_fill|harupage_fillstroke|harupage_getcharspace|harupage_getcmykfill|harupage_getcmykstroke|' +
21601
- 'harupage_getcurrentfont|harupage_getcurrentfontsize|harupage_getcurrentpos|harupage_getcurrenttextpos|harupage_getdash|' +
21602
- 'harupage_getfillingcolorspace|harupage_getflatness|harupage_getgmode|harupage_getgrayfill|harupage_getgraystroke|harupage_getheight|' +
21603
- 'harupage_gethorizontalscaling|harupage_getlinecap|harupage_getlinejoin|harupage_getlinewidth|harupage_getmiterlimit|harupage_getrgbfill|' +
21604
- 'harupage_getrgbstroke|harupage_getstrokingcolorspace|harupage_gettextleading|harupage_gettextmatrix|harupage_gettextrenderingmode|' +
21605
- 'harupage_gettextrise|harupage_gettextwidth|harupage_gettransmatrix|harupage_getwidth|harupage_getwordspace|harupage_lineto|' +
21606
- 'harupage_measuretext|harupage_movetextpos|harupage_moveto|harupage_movetonextline|harupage_rectangle|harupage_setcharspace|' +
21607
- 'harupage_setcmykfill|harupage_setcmykstroke|harupage_setdash|harupage_setflatness|harupage_setfontandsize|harupage_setgrayfill|' +
21608
- 'harupage_setgraystroke|harupage_setheight|harupage_sethorizontalscaling|harupage_setlinecap|harupage_setlinejoin|harupage_setlinewidth|' +
21609
- 'harupage_setmiterlimit|harupage_setrgbfill|harupage_setrgbstroke|harupage_setrotate|harupage_setsize|harupage_setslideshow|' +
21610
- 'harupage_settextleading|harupage_settextmatrix|harupage_settextrenderingmode|harupage_settextrise|harupage_setwidth|harupage_setwordspace|' +
21611
- 'harupage_showtext|harupage_showtextnextline|harupage_stroke|harupage_textout|harupage_textrect|hasconstant|hash|hash_algos|hash_copy|' +
21612
- 'hash_file|hash_final|hash_hmac|hash_hmac_file|hash_init|hash_update|hash_update_file|hash_update_stream|hasmethod|hasproperty|header|' +
21613
- 'header_register_callback|header_remove|headers_list|headers_sent|hebrev|hebrevc|hex2bin|hexdec|highlight_file|highlight_string|' +
21614
- 'html_entity_decode|htmlentities|htmlspecialchars|htmlspecialchars_decode|http_build_cookie|http_build_query|http_build_str|http_build_url|' +
21615
- 'http_cache_etag|http_cache_last_modified|http_chunked_decode|http_date|http_deflate|http_get|http_get_request_body|' +
21616
- 'http_get_request_body_stream|http_get_request_headers|http_head|http_inflate|http_match_etag|http_match_modified|' +
21617
- 'http_match_request_header|http_negotiate_charset|http_negotiate_content_type|http_negotiate_language|http_parse_cookie|http_parse_headers|' +
21618
- 'http_parse_message|http_parse_params|http_persistent_handles_clean|http_persistent_handles_count|http_persistent_handles_ident|' +
21619
- 'http_post_data|http_post_fields|http_put_data|http_put_file|http_put_stream|http_redirect|http_request|http_request_body_encode|' +
21620
- 'http_request_method_exists|http_request_method_name|http_request_method_register|http_request_method_unregister|http_response_code|' +
21621
- 'http_send_content_disposition|http_send_content_type|http_send_data|http_send_file|http_send_last_modified|http_send_status|' +
21622
- 'http_send_stream|http_support|http_throttle|httpdeflatestream|httpdeflatestream_construct|httpdeflatestream_factory|' +
21623
- 'httpdeflatestream_finish|httpdeflatestream_flush|httpdeflatestream_update|httpinflatestream|httpinflatestream_construct|' +
21624
- 'httpinflatestream_factory|httpinflatestream_finish|httpinflatestream_flush|httpinflatestream_update|httpmessage|httpmessage_addheaders|' +
21625
- 'httpmessage_construct|httpmessage_detach|httpmessage_factory|httpmessage_fromenv|httpmessage_fromstring|httpmessage_getbody|' +
21626
- 'httpmessage_getheader|httpmessage_getheaders|httpmessage_gethttpversion|httpmessage_getparentmessage|httpmessage_getrequestmethod|' +
21627
- 'httpmessage_getrequesturl|httpmessage_getresponsecode|httpmessage_getresponsestatus|httpmessage_gettype|httpmessage_guesscontenttype|' +
21628
- 'httpmessage_prepend|httpmessage_reverse|httpmessage_send|httpmessage_setbody|httpmessage_setheaders|httpmessage_sethttpversion|' +
21629
- 'httpmessage_setrequestmethod|httpmessage_setrequesturl|httpmessage_setresponsecode|httpmessage_setresponsestatus|httpmessage_settype|' +
21630
- 'httpmessage_tomessagetypeobject|httpmessage_tostring|httpquerystring|httpquerystring_construct|httpquerystring_get|httpquerystring_mod|' +
21631
- 'httpquerystring_set|httpquerystring_singleton|httpquerystring_toarray|httpquerystring_tostring|httpquerystring_xlate|httprequest|' +
21632
- 'httprequest_addcookies|httprequest_addheaders|httprequest_addpostfields|httprequest_addpostfile|httprequest_addputdata|' +
21633
- 'httprequest_addquerydata|httprequest_addrawpostdata|httprequest_addssloptions|httprequest_clearhistory|httprequest_construct|' +
21634
- 'httprequest_enablecookies|httprequest_getcontenttype|httprequest_getcookies|httprequest_getheaders|httprequest_gethistory|' +
21635
- 'httprequest_getmethod|httprequest_getoptions|httprequest_getpostfields|httprequest_getpostfiles|httprequest_getputdata|' +
21636
- 'httprequest_getputfile|httprequest_getquerydata|httprequest_getrawpostdata|httprequest_getrawrequestmessage|' +
21637
- 'httprequest_getrawresponsemessage|httprequest_getrequestmessage|httprequest_getresponsebody|httprequest_getresponsecode|' +
21638
- 'httprequest_getresponsecookies|httprequest_getresponsedata|httprequest_getresponseheader|httprequest_getresponseinfo|' +
21639
- 'httprequest_getresponsemessage|httprequest_getresponsestatus|httprequest_getssloptions|httprequest_geturl|httprequest_resetcookies|' +
21640
- 'httprequest_send|httprequest_setcontenttype|httprequest_setcookies|httprequest_setheaders|httprequest_setmethod|httprequest_setoptions|' +
21641
- 'httprequest_setpostfields|httprequest_setpostfiles|httprequest_setputdata|httprequest_setputfile|httprequest_setquerydata|' +
21642
- 'httprequest_setrawpostdata|httprequest_setssloptions|httprequest_seturl|httprequestpool|httprequestpool_attach|httprequestpool_construct|' +
21643
- 'httprequestpool_destruct|httprequestpool_detach|httprequestpool_getattachedrequests|httprequestpool_getfinishedrequests|' +
21644
- 'httprequestpool_reset|httprequestpool_send|httprequestpool_socketperform|httprequestpool_socketselect|httpresponse|httpresponse_capture|' +
21645
- 'httpresponse_getbuffersize|httpresponse_getcache|httpresponse_getcachecontrol|httpresponse_getcontentdisposition|' +
21646
- 'httpresponse_getcontenttype|httpresponse_getdata|httpresponse_getetag|httpresponse_getfile|httpresponse_getgzip|httpresponse_getheader|' +
21647
- 'httpresponse_getlastmodified|httpresponse_getrequestbody|httpresponse_getrequestbodystream|httpresponse_getrequestheaders|' +
21648
- 'httpresponse_getstream|httpresponse_getthrottledelay|httpresponse_guesscontenttype|httpresponse_redirect|httpresponse_send|' +
21649
- 'httpresponse_setbuffersize|httpresponse_setcache|httpresponse_setcachecontrol|httpresponse_setcontentdisposition|' +
21650
- 'httpresponse_setcontenttype|httpresponse_setdata|httpresponse_setetag|httpresponse_setfile|httpresponse_setgzip|httpresponse_setheader|' +
21651
- 'httpresponse_setlastmodified|httpresponse_setstream|httpresponse_setthrottledelay|httpresponse_status|hw_array2objrec|hw_changeobject|' +
21652
- 'hw_children|hw_childrenobj|hw_close|hw_connect|hw_connection_info|hw_cp|hw_deleteobject|hw_docbyanchor|hw_docbyanchorobj|' +
21653
- 'hw_document_attributes|hw_document_bodytag|hw_document_content|hw_document_setcontent|hw_document_size|hw_dummy|hw_edittext|hw_error|' +
21654
- 'hw_errormsg|hw_free_document|hw_getanchors|hw_getanchorsobj|hw_getandlock|hw_getchildcoll|hw_getchildcollobj|hw_getchilddoccoll|' +
21655
- 'hw_getchilddoccollobj|hw_getobject|hw_getobjectbyquery|hw_getobjectbyquerycoll|hw_getobjectbyquerycollobj|hw_getobjectbyqueryobj|' +
21656
- 'hw_getparents|hw_getparentsobj|hw_getrellink|hw_getremote|hw_getremotechildren|hw_getsrcbydestobj|hw_gettext|hw_getusername|hw_identify|' +
21657
- 'hw_incollections|hw_info|hw_inscoll|hw_insdoc|hw_insertanchors|hw_insertdocument|hw_insertobject|hw_mapid|hw_modifyobject|hw_mv|' +
21658
- 'hw_new_document|hw_objrec2array|hw_output_document|hw_pconnect|hw_pipedocument|hw_root|hw_setlinkroot|hw_stat|hw_unlock|hw_who|' +
21659
- 'hwapi_attribute|hwapi_attribute_key|hwapi_attribute_langdepvalue|hwapi_attribute_value|hwapi_attribute_values|hwapi_checkin|' +
21660
- 'hwapi_checkout|hwapi_children|hwapi_content|hwapi_content_mimetype|hwapi_content_read|hwapi_copy|hwapi_dbstat|hwapi_dcstat|' +
21661
- 'hwapi_dstanchors|hwapi_dstofsrcanchor|hwapi_error_count|hwapi_error_reason|hwapi_find|hwapi_ftstat|hwapi_hgcsp|hwapi_hwstat|' +
21662
- 'hwapi_identify|hwapi_info|hwapi_insert|hwapi_insertanchor|hwapi_insertcollection|hwapi_insertdocument|hwapi_link|hwapi_lock|hwapi_move|' +
21663
- 'hwapi_new_content|hwapi_object|hwapi_object_assign|hwapi_object_attreditable|hwapi_object_count|hwapi_object_insert|hwapi_object_new|' +
21664
- 'hwapi_object_remove|hwapi_object_title|hwapi_object_value|hwapi_objectbyanchor|hwapi_parents|hwapi_reason_description|hwapi_reason_type|' +
21665
- 'hwapi_remove|hwapi_replace|hwapi_setcommittedversion|hwapi_srcanchors|hwapi_srcsofdst|hwapi_unlock|hwapi_user|hwapi_userlist|hypot|' +
21666
- 'ibase_add_user|ibase_affected_rows|ibase_backup|ibase_blob_add|ibase_blob_cancel|ibase_blob_close|ibase_blob_create|ibase_blob_echo|' +
21667
- 'ibase_blob_get|ibase_blob_import|ibase_blob_info|ibase_blob_open|ibase_close|ibase_commit|ibase_commit_ret|ibase_connect|ibase_db_info|' +
21668
- 'ibase_delete_user|ibase_drop_db|ibase_errcode|ibase_errmsg|ibase_execute|ibase_fetch_assoc|ibase_fetch_object|ibase_fetch_row|' +
21669
- 'ibase_field_info|ibase_free_event_handler|ibase_free_query|ibase_free_result|ibase_gen_id|ibase_maintain_db|ibase_modify_user|' +
21670
- 'ibase_name_result|ibase_num_fields|ibase_num_params|ibase_param_info|ibase_pconnect|ibase_prepare|ibase_query|ibase_restore|' +
21671
- 'ibase_rollback|ibase_rollback_ret|ibase_server_info|ibase_service_attach|ibase_service_detach|ibase_set_event_handler|ibase_timefmt|' +
21672
- 'ibase_trans|ibase_wait_event|iconv|iconv_get_encoding|iconv_mime_decode|iconv_mime_decode_headers|iconv_mime_encode|iconv_set_encoding|' +
21673
- 'iconv_strlen|iconv_strpos|iconv_strrpos|iconv_substr|id3_get_frame_long_name|id3_get_frame_short_name|id3_get_genre_id|id3_get_genre_list|' +
21674
- 'id3_get_genre_name|id3_get_tag|id3_get_version|id3_remove_tag|id3_set_tag|id3v2attachedpictureframe|id3v2frame|id3v2tag|idate|' +
21675
- 'idn_to_ascii|idn_to_unicode|idn_to_utf8|ifx_affected_rows|ifx_blobinfile_mode|ifx_byteasvarchar|ifx_close|ifx_connect|ifx_copy_blob|' +
21676
- 'ifx_create_blob|ifx_create_char|ifx_do|ifx_error|ifx_errormsg|ifx_fetch_row|ifx_fieldproperties|ifx_fieldtypes|ifx_free_blob|' +
21677
- 'ifx_free_char|ifx_free_result|ifx_get_blob|ifx_get_char|ifx_getsqlca|ifx_htmltbl_result|ifx_nullformat|ifx_num_fields|ifx_num_rows|' +
21678
- 'ifx_pconnect|ifx_prepare|ifx_query|ifx_textasvarchar|ifx_update_blob|ifx_update_char|ifxus_close_slob|ifxus_create_slob|ifxus_free_slob|' +
21679
- 'ifxus_open_slob|ifxus_read_slob|ifxus_seek_slob|ifxus_tell_slob|ifxus_write_slob|ignore_user_abort|iis_add_server|iis_get_dir_security|' +
21680
- 'iis_get_script_map|iis_get_server_by_comment|iis_get_server_by_path|iis_get_server_rights|iis_get_service_state|iis_remove_server|' +
21681
- 'iis_set_app_settings|iis_set_dir_security|iis_set_script_map|iis_set_server_rights|iis_start_server|iis_start_service|iis_stop_server|' +
21682
- 'iis_stop_service|image2wbmp|image_type_to_extension|image_type_to_mime_type|imagealphablending|imageantialias|imagearc|imagechar|' +
21683
- 'imagecharup|imagecolorallocate|imagecolorallocatealpha|imagecolorat|imagecolorclosest|imagecolorclosestalpha|imagecolorclosesthwb|' +
21684
- 'imagecolordeallocate|imagecolorexact|imagecolorexactalpha|imagecolormatch|imagecolorresolve|imagecolorresolvealpha|imagecolorset|' +
21685
- 'imagecolorsforindex|imagecolorstotal|imagecolortransparent|imageconvolution|imagecopy|imagecopymerge|imagecopymergegray|' +
21686
- 'imagecopyresampled|imagecopyresized|imagecreate|imagecreatefromgd|imagecreatefromgd2|imagecreatefromgd2part|imagecreatefromgif|' +
21687
- 'imagecreatefromjpeg|imagecreatefrompng|imagecreatefromstring|imagecreatefromwbmp|imagecreatefromxbm|imagecreatefromxpm|' +
21688
- 'imagecreatetruecolor|imagedashedline|imagedestroy|imageellipse|imagefill|imagefilledarc|imagefilledellipse|imagefilledpolygon|' +
21689
- 'imagefilledrectangle|imagefilltoborder|imagefilter|imagefontheight|imagefontwidth|imageftbbox|imagefttext|imagegammacorrect|imagegd|' +
21690
- 'imagegd2|imagegif|imagegrabscreen|imagegrabwindow|imageinterlace|imageistruecolor|imagejpeg|imagelayereffect|imageline|imageloadfont|' +
21691
- 'imagepalettecopy|imagepng|imagepolygon|imagepsbbox|imagepsencodefont|imagepsextendfont|imagepsfreefont|imagepsloadfont|imagepsslantfont|' +
21692
- 'imagepstext|imagerectangle|imagerotate|imagesavealpha|imagesetbrush|imagesetpixel|imagesetstyle|imagesetthickness|imagesettile|' +
21693
- 'imagestring|imagestringup|imagesx|imagesy|imagetruecolortopalette|imagettfbbox|imagettftext|imagetypes|imagewbmp|imagexbm|imagick|' +
21694
- 'imagick_adaptiveblurimage|imagick_adaptiveresizeimage|imagick_adaptivesharpenimage|imagick_adaptivethresholdimage|imagick_addimage|' +
21695
- 'imagick_addnoiseimage|imagick_affinetransformimage|imagick_animateimages|imagick_annotateimage|imagick_appendimages|imagick_averageimages|' +
21696
- 'imagick_blackthresholdimage|imagick_blurimage|imagick_borderimage|imagick_charcoalimage|imagick_chopimage|imagick_clear|imagick_clipimage|' +
21697
- 'imagick_clippathimage|imagick_clone|imagick_clutimage|imagick_coalesceimages|imagick_colorfloodfillimage|imagick_colorizeimage|' +
21698
- 'imagick_combineimages|imagick_commentimage|imagick_compareimagechannels|imagick_compareimagelayers|imagick_compareimages|' +
21699
- 'imagick_compositeimage|imagick_construct|imagick_contrastimage|imagick_contraststretchimage|imagick_convolveimage|imagick_cropimage|' +
21700
- 'imagick_cropthumbnailimage|imagick_current|imagick_cyclecolormapimage|imagick_decipherimage|imagick_deconstructimages|' +
21701
- 'imagick_deleteimageartifact|imagick_despeckleimage|imagick_destroy|imagick_displayimage|imagick_displayimages|imagick_distortimage|' +
21702
- 'imagick_drawimage|imagick_edgeimage|imagick_embossimage|imagick_encipherimage|imagick_enhanceimage|imagick_equalizeimage|' +
21703
- 'imagick_evaluateimage|imagick_extentimage|imagick_flattenimages|imagick_flipimage|imagick_floodfillpaintimage|imagick_flopimage|' +
21704
- 'imagick_frameimage|imagick_fximage|imagick_gammaimage|imagick_gaussianblurimage|imagick_getcolorspace|imagick_getcompression|' +
21705
- 'imagick_getcompressionquality|imagick_getcopyright|imagick_getfilename|imagick_getfont|imagick_getformat|imagick_getgravity|' +
21706
- 'imagick_gethomeurl|imagick_getimage|imagick_getimagealphachannel|imagick_getimageartifact|imagick_getimagebackgroundcolor|' +
21707
- 'imagick_getimageblob|imagick_getimageblueprimary|imagick_getimagebordercolor|imagick_getimagechanneldepth|' +
21708
- 'imagick_getimagechanneldistortion|imagick_getimagechanneldistortions|imagick_getimagechannelextrema|imagick_getimagechannelmean|' +
21709
- 'imagick_getimagechannelrange|imagick_getimagechannelstatistics|imagick_getimageclipmask|imagick_getimagecolormapcolor|' +
21710
- 'imagick_getimagecolors|imagick_getimagecolorspace|imagick_getimagecompose|imagick_getimagecompression|imagick_getimagecompressionquality|' +
21711
- 'imagick_getimagedelay|imagick_getimagedepth|imagick_getimagedispose|imagick_getimagedistortion|imagick_getimageextrema|' +
21712
- 'imagick_getimagefilename|imagick_getimageformat|imagick_getimagegamma|imagick_getimagegeometry|imagick_getimagegravity|' +
21713
- 'imagick_getimagegreenprimary|imagick_getimageheight|imagick_getimagehistogram|imagick_getimageindex|imagick_getimageinterlacescheme|' +
21714
- 'imagick_getimageinterpolatemethod|imagick_getimageiterations|imagick_getimagelength|imagick_getimagemagicklicense|imagick_getimagematte|' +
21715
- 'imagick_getimagemattecolor|imagick_getimageorientation|imagick_getimagepage|imagick_getimagepixelcolor|imagick_getimageprofile|' +
21716
- 'imagick_getimageprofiles|imagick_getimageproperties|imagick_getimageproperty|imagick_getimageredprimary|imagick_getimageregion|' +
21717
- 'imagick_getimagerenderingintent|imagick_getimageresolution|imagick_getimagesblob|imagick_getimagescene|imagick_getimagesignature|' +
21718
- 'imagick_getimagesize|imagick_getimagetickspersecond|imagick_getimagetotalinkdensity|imagick_getimagetype|imagick_getimageunits|' +
21719
- 'imagick_getimagevirtualpixelmethod|imagick_getimagewhitepoint|imagick_getimagewidth|imagick_getinterlacescheme|imagick_getiteratorindex|' +
21720
- 'imagick_getnumberimages|imagick_getoption|imagick_getpackagename|imagick_getpage|imagick_getpixeliterator|imagick_getpixelregioniterator|' +
21721
- 'imagick_getpointsize|imagick_getquantumdepth|imagick_getquantumrange|imagick_getreleasedate|imagick_getresource|imagick_getresourcelimit|' +
21722
- 'imagick_getsamplingfactors|imagick_getsize|imagick_getsizeoffset|imagick_getversion|imagick_hasnextimage|imagick_haspreviousimage|' +
21723
- 'imagick_identifyimage|imagick_implodeimage|imagick_labelimage|imagick_levelimage|imagick_linearstretchimage|imagick_liquidrescaleimage|' +
21724
- 'imagick_magnifyimage|imagick_mapimage|imagick_mattefloodfillimage|imagick_medianfilterimage|imagick_mergeimagelayers|imagick_minifyimage|' +
21725
- 'imagick_modulateimage|imagick_montageimage|imagick_morphimages|imagick_mosaicimages|imagick_motionblurimage|imagick_negateimage|' +
21726
- 'imagick_newimage|imagick_newpseudoimage|imagick_nextimage|imagick_normalizeimage|imagick_oilpaintimage|imagick_opaquepaintimage|' +
21727
- 'imagick_optimizeimagelayers|imagick_orderedposterizeimage|imagick_paintfloodfillimage|imagick_paintopaqueimage|' +
21728
- 'imagick_painttransparentimage|imagick_pingimage|imagick_pingimageblob|imagick_pingimagefile|imagick_polaroidimage|imagick_posterizeimage|' +
21729
- 'imagick_previewimages|imagick_previousimage|imagick_profileimage|imagick_quantizeimage|imagick_quantizeimages|imagick_queryfontmetrics|' +
21730
- 'imagick_queryfonts|imagick_queryformats|imagick_radialblurimage|imagick_raiseimage|imagick_randomthresholdimage|imagick_readimage|' +
21731
- 'imagick_readimageblob|imagick_readimagefile|imagick_recolorimage|imagick_reducenoiseimage|imagick_removeimage|imagick_removeimageprofile|' +
21732
- 'imagick_render|imagick_resampleimage|imagick_resetimagepage|imagick_resizeimage|imagick_rollimage|imagick_rotateimage|' +
21733
- 'imagick_roundcorners|imagick_sampleimage|imagick_scaleimage|imagick_separateimagechannel|imagick_sepiatoneimage|' +
21734
- 'imagick_setbackgroundcolor|imagick_setcolorspace|imagick_setcompression|imagick_setcompressionquality|imagick_setfilename|' +
21735
- 'imagick_setfirstiterator|imagick_setfont|imagick_setformat|imagick_setgravity|imagick_setimage|imagick_setimagealphachannel|' +
21736
- 'imagick_setimageartifact|imagick_setimagebackgroundcolor|imagick_setimagebias|imagick_setimageblueprimary|imagick_setimagebordercolor|' +
21737
- 'imagick_setimagechanneldepth|imagick_setimageclipmask|imagick_setimagecolormapcolor|imagick_setimagecolorspace|imagick_setimagecompose|' +
21738
- 'imagick_setimagecompression|imagick_setimagecompressionquality|imagick_setimagedelay|imagick_setimagedepth|imagick_setimagedispose|' +
21739
- 'imagick_setimageextent|imagick_setimagefilename|imagick_setimageformat|imagick_setimagegamma|imagick_setimagegravity|' +
21740
- 'imagick_setimagegreenprimary|imagick_setimageindex|imagick_setimageinterlacescheme|imagick_setimageinterpolatemethod|' +
21741
- 'imagick_setimageiterations|imagick_setimagematte|imagick_setimagemattecolor|imagick_setimageopacity|imagick_setimageorientation|' +
21742
- 'imagick_setimagepage|imagick_setimageprofile|imagick_setimageproperty|imagick_setimageredprimary|imagick_setimagerenderingintent|' +
21743
- 'imagick_setimageresolution|imagick_setimagescene|imagick_setimagetickspersecond|imagick_setimagetype|imagick_setimageunits|' +
21744
- 'imagick_setimagevirtualpixelmethod|imagick_setimagewhitepoint|imagick_setinterlacescheme|imagick_setiteratorindex|imagick_setlastiterator|' +
21745
- 'imagick_setoption|imagick_setpage|imagick_setpointsize|imagick_setresolution|imagick_setresourcelimit|imagick_setsamplingfactors|' +
21746
- 'imagick_setsize|imagick_setsizeoffset|imagick_settype|imagick_shadeimage|imagick_shadowimage|imagick_sharpenimage|imagick_shaveimage|' +
21747
- 'imagick_shearimage|imagick_sigmoidalcontrastimage|imagick_sketchimage|imagick_solarizeimage|imagick_spliceimage|imagick_spreadimage|' +
21748
- 'imagick_steganoimage|imagick_stereoimage|imagick_stripimage|imagick_swirlimage|imagick_textureimage|imagick_thresholdimage|' +
21749
- 'imagick_thumbnailimage|imagick_tintimage|imagick_transformimage|imagick_transparentpaintimage|imagick_transposeimage|' +
21750
- 'imagick_transverseimage|imagick_trimimage|imagick_uniqueimagecolors|imagick_unsharpmaskimage|imagick_valid|imagick_vignetteimage|' +
21751
- 'imagick_waveimage|imagick_whitethresholdimage|imagick_writeimage|imagick_writeimagefile|imagick_writeimages|imagick_writeimagesfile|' +
21752
- 'imagickdraw|imagickdraw_affine|imagickdraw_annotation|imagickdraw_arc|imagickdraw_bezier|imagickdraw_circle|imagickdraw_clear|' +
21753
- 'imagickdraw_clone|imagickdraw_color|imagickdraw_comment|imagickdraw_composite|imagickdraw_construct|imagickdraw_destroy|' +
21754
- 'imagickdraw_ellipse|imagickdraw_getclippath|imagickdraw_getcliprule|imagickdraw_getclipunits|imagickdraw_getfillcolor|' +
21755
- 'imagickdraw_getfillopacity|imagickdraw_getfillrule|imagickdraw_getfont|imagickdraw_getfontfamily|imagickdraw_getfontsize|' +
21756
- 'imagickdraw_getfontstyle|imagickdraw_getfontweight|imagickdraw_getgravity|imagickdraw_getstrokeantialias|imagickdraw_getstrokecolor|' +
21757
- 'imagickdraw_getstrokedasharray|imagickdraw_getstrokedashoffset|imagickdraw_getstrokelinecap|imagickdraw_getstrokelinejoin|' +
21758
- 'imagickdraw_getstrokemiterlimit|imagickdraw_getstrokeopacity|imagickdraw_getstrokewidth|imagickdraw_gettextalignment|' +
21759
- 'imagickdraw_gettextantialias|imagickdraw_gettextdecoration|imagickdraw_gettextencoding|imagickdraw_gettextundercolor|' +
21760
- 'imagickdraw_getvectorgraphics|imagickdraw_line|imagickdraw_matte|imagickdraw_pathclose|imagickdraw_pathcurvetoabsolute|' +
21761
- 'imagickdraw_pathcurvetoquadraticbezierabsolute|imagickdraw_pathcurvetoquadraticbezierrelative|' +
21762
- 'imagickdraw_pathcurvetoquadraticbeziersmoothabsolute|imagickdraw_pathcurvetoquadraticbeziersmoothrelative|imagickdraw_pathcurvetorelative|' +
21763
- 'imagickdraw_pathcurvetosmoothabsolute|imagickdraw_pathcurvetosmoothrelative|imagickdraw_pathellipticarcabsolute|' +
21764
- 'imagickdraw_pathellipticarcrelative|imagickdraw_pathfinish|imagickdraw_pathlinetoabsolute|imagickdraw_pathlinetohorizontalabsolute|' +
21765
- 'imagickdraw_pathlinetohorizontalrelative|imagickdraw_pathlinetorelative|imagickdraw_pathlinetoverticalabsolute|' +
21766
- 'imagickdraw_pathlinetoverticalrelative|imagickdraw_pathmovetoabsolute|imagickdraw_pathmovetorelative|imagickdraw_pathstart|' +
21767
- 'imagickdraw_point|imagickdraw_polygon|imagickdraw_polyline|imagickdraw_pop|imagickdraw_popclippath|imagickdraw_popdefs|' +
21768
- 'imagickdraw_poppattern|imagickdraw_push|imagickdraw_pushclippath|imagickdraw_pushdefs|imagickdraw_pushpattern|imagickdraw_rectangle|' +
21769
- 'imagickdraw_render|imagickdraw_rotate|imagickdraw_roundrectangle|imagickdraw_scale|imagickdraw_setclippath|imagickdraw_setcliprule|' +
21770
- 'imagickdraw_setclipunits|imagickdraw_setfillalpha|imagickdraw_setfillcolor|imagickdraw_setfillopacity|imagickdraw_setfillpatternurl|' +
21771
- 'imagickdraw_setfillrule|imagickdraw_setfont|imagickdraw_setfontfamily|imagickdraw_setfontsize|imagickdraw_setfontstretch|' +
21772
- 'imagickdraw_setfontstyle|imagickdraw_setfontweight|imagickdraw_setgravity|imagickdraw_setstrokealpha|imagickdraw_setstrokeantialias|' +
21773
- 'imagickdraw_setstrokecolor|imagickdraw_setstrokedasharray|imagickdraw_setstrokedashoffset|imagickdraw_setstrokelinecap|' +
21774
- 'imagickdraw_setstrokelinejoin|imagickdraw_setstrokemiterlimit|imagickdraw_setstrokeopacity|imagickdraw_setstrokepatternurl|' +
21775
- 'imagickdraw_setstrokewidth|imagickdraw_settextalignment|imagickdraw_settextantialias|imagickdraw_settextdecoration|' +
21776
- 'imagickdraw_settextencoding|imagickdraw_settextundercolor|imagickdraw_setvectorgraphics|imagickdraw_setviewbox|imagickdraw_skewx|' +
21777
- 'imagickdraw_skewy|imagickdraw_translate|imagickpixel|imagickpixel_clear|imagickpixel_construct|imagickpixel_destroy|imagickpixel_getcolor|' +
21778
- 'imagickpixel_getcolorasstring|imagickpixel_getcolorcount|imagickpixel_getcolorvalue|imagickpixel_gethsl|imagickpixel_issimilar|' +
21779
- 'imagickpixel_setcolor|imagickpixel_setcolorvalue|imagickpixel_sethsl|imagickpixeliterator|imagickpixeliterator_clear|' +
21780
- 'imagickpixeliterator_construct|imagickpixeliterator_destroy|imagickpixeliterator_getcurrentiteratorrow|' +
21781
- 'imagickpixeliterator_getiteratorrow|imagickpixeliterator_getnextiteratorrow|imagickpixeliterator_getpreviousiteratorrow|' +
21782
- 'imagickpixeliterator_newpixeliterator|imagickpixeliterator_newpixelregioniterator|imagickpixeliterator_resetiterator|' +
21783
- 'imagickpixeliterator_setiteratorfirstrow|imagickpixeliterator_setiteratorlastrow|imagickpixeliterator_setiteratorrow|' +
21784
- 'imagickpixeliterator_synciterator|imap_8bit|imap_alerts|imap_append|imap_base64|imap_binary|imap_body|imap_bodystruct|imap_check|' +
21785
- 'imap_clearflag_full|imap_close|imap_create|imap_createmailbox|imap_delete|imap_deletemailbox|imap_errors|imap_expunge|imap_fetch_overview|' +
21786
- 'imap_fetchbody|imap_fetchheader|imap_fetchmime|imap_fetchstructure|imap_fetchtext|imap_gc|imap_get_quota|imap_get_quotaroot|imap_getacl|' +
21787
- 'imap_getmailboxes|imap_getsubscribed|imap_header|imap_headerinfo|imap_headers|imap_last_error|imap_list|imap_listmailbox|imap_listscan|' +
21788
- 'imap_listsubscribed|imap_lsub|imap_mail|imap_mail_compose|imap_mail_copy|imap_mail_move|imap_mailboxmsginfo|imap_mime_header_decode|' +
21789
- 'imap_msgno|imap_num_msg|imap_num_recent|imap_open|imap_ping|imap_qprint|imap_rename|imap_renamemailbox|imap_reopen|' +
21790
- 'imap_rfc822_parse_adrlist|imap_rfc822_parse_headers|imap_rfc822_write_address|imap_savebody|imap_scan|imap_scanmailbox|imap_search|' +
21791
- 'imap_set_quota|imap_setacl|imap_setflag_full|imap_sort|imap_status|imap_subscribe|imap_thread|imap_timeout|imap_uid|imap_undelete|' +
21792
- 'imap_unsubscribe|imap_utf7_decode|imap_utf7_encode|imap_utf8|implementsinterface|implode|import_request_variables|in_array|include|' +
21793
- 'include_once|inclued_get_data|inet_ntop|inet_pton|infiniteiterator|ingres_autocommit|ingres_autocommit_state|ingres_charset|ingres_close|' +
21794
- 'ingres_commit|ingres_connect|ingres_cursor|ingres_errno|ingres_error|ingres_errsqlstate|ingres_escape_string|ingres_execute|' +
21795
- 'ingres_fetch_array|ingres_fetch_assoc|ingres_fetch_object|ingres_fetch_proc_return|ingres_fetch_row|ingres_field_length|ingres_field_name|' +
21796
- 'ingres_field_nullable|ingres_field_precision|ingres_field_scale|ingres_field_type|ingres_free_result|ingres_next_error|ingres_num_fields|' +
21797
- 'ingres_num_rows|ingres_pconnect|ingres_prepare|ingres_query|ingres_result_seek|ingres_rollback|ingres_set_environment|' +
21798
- 'ingres_unbuffered_query|ini_alter|ini_get|ini_get_all|ini_restore|ini_set|innamespace|inotify_add_watch|inotify_init|inotify_queue_len|' +
21799
- 'inotify_read|inotify_rm_watch|interface_exists|intl_error_name|intl_get_error_code|intl_get_error_message|intl_is_failure|' +
21800
- 'intldateformatter|intval|invalidargumentexception|invoke|invokeargs|ip2long|iptcembed|iptcparse|is_a|is_array|is_bool|is_callable|is_dir|' +
21801
- 'is_double|is_executable|is_file|is_finite|is_float|is_infinite|is_int|is_integer|is_link|is_long|is_nan|is_null|is_numeric|is_object|' +
21802
- 'is_readable|is_real|is_resource|is_scalar|is_soap_fault|is_string|is_subclass_of|is_uploaded_file|is_writable|is_writeable|isabstract|' +
21803
- 'iscloneable|isdisabled|isfinal|isinstance|isinstantiable|isinterface|isinternal|isiterateable|isset|issubclassof|isuserdefined|iterator|' +
21804
- 'iterator_apply|iterator_count|iterator_to_array|iteratoraggregate|iteratoriterator|java_last_exception_clear|java_last_exception_get|' +
21805
- 'jddayofweek|jdmonthname|jdtofrench|jdtogregorian|jdtojewish|jdtojulian|jdtounix|jewishtojd|join|jpeg2wbmp|json_decode|json_encode|' +
21806
- 'json_last_error|jsonserializable|judy|judy_type|judy_version|juliantojd|kadm5_chpass_principal|kadm5_create_principal|' +
21807
- 'kadm5_delete_principal|kadm5_destroy|kadm5_flush|kadm5_get_policies|kadm5_get_principal|kadm5_get_principals|kadm5_init_with_password|' +
21808
- 'kadm5_modify_principal|key|krsort|ksort|lcfirst|lcg_value|lchgrp|lchown|ldap_8859_to_t61|ldap_add|ldap_bind|ldap_close|ldap_compare|' +
21809
- 'ldap_connect|ldap_count_entries|ldap_delete|ldap_dn2ufn|ldap_err2str|ldap_errno|ldap_error|ldap_explode_dn|ldap_first_attribute|' +
21810
- 'ldap_first_entry|ldap_first_reference|ldap_free_result|ldap_get_attributes|ldap_get_dn|ldap_get_entries|ldap_get_option|ldap_get_values|' +
21811
- 'ldap_get_values_len|ldap_list|ldap_mod_add|ldap_mod_del|ldap_mod_replace|ldap_modify|ldap_next_attribute|ldap_next_entry|' +
21812
- 'ldap_next_reference|ldap_parse_reference|ldap_parse_result|ldap_read|ldap_rename|ldap_sasl_bind|ldap_search|ldap_set_option|' +
21813
- 'ldap_set_rebind_proc|ldap_sort|ldap_start_tls|ldap_t61_to_8859|ldap_unbind|lengthexception|levenshtein|libxml_clear_errors|' +
21814
- 'libxml_disable_entity_loader|libxml_get_errors|libxml_get_last_error|libxml_set_streams_context|libxml_use_internal_errors|libxmlerror|' +
21815
- 'limititerator|link|linkinfo|list|locale|localeconv|localtime|log|log10|log1p|logicexception|long2ip|lstat|ltrim|lzf_compress|' +
21816
- 'lzf_decompress|lzf_optimized_for|m_checkstatus|m_completeauthorizations|m_connect|m_connectionerror|m_deletetrans|m_destroyconn|' +
21817
- 'm_destroyengine|m_getcell|m_getcellbynum|m_getcommadelimited|m_getheader|m_initconn|m_initengine|m_iscommadelimited|m_maxconntimeout|' +
21818
- 'm_monitor|m_numcolumns|m_numrows|m_parsecommadelimited|m_responsekeys|m_responseparam|m_returnstatus|m_setblocking|m_setdropfile|m_setip|' +
21819
- 'm_setssl|m_setssl_cafile|m_setssl_files|m_settimeout|m_sslcert_gen_hash|m_transactionssent|m_transinqueue|m_transkeyval|m_transnew|' +
21820
- 'm_transsend|m_uwait|m_validateidentifier|m_verifyconnection|m_verifysslcert|magic_quotes_runtime|mail|' +
21821
- 'mailparse_determine_best_xfer_encoding|mailparse_msg_create|mailparse_msg_extract_part|mailparse_msg_extract_part_file|' +
21822
- 'mailparse_msg_extract_whole_part_file|mailparse_msg_free|mailparse_msg_get_part|mailparse_msg_get_part_data|mailparse_msg_get_structure|' +
21823
- 'mailparse_msg_parse|mailparse_msg_parse_file|mailparse_rfc822_parse_addresses|mailparse_stream_encode|mailparse_uudecode_all|main|max|' +
21824
- 'maxdb_affected_rows|maxdb_autocommit|maxdb_bind_param|maxdb_bind_result|maxdb_change_user|maxdb_character_set_name|maxdb_client_encoding|' +
21825
- 'maxdb_close|maxdb_close_long_data|maxdb_commit|maxdb_connect|maxdb_connect_errno|maxdb_connect_error|maxdb_data_seek|maxdb_debug|' +
21826
- 'maxdb_disable_reads_from_master|maxdb_disable_rpl_parse|maxdb_dump_debug_info|maxdb_embedded_connect|maxdb_enable_reads_from_master|' +
21827
- 'maxdb_enable_rpl_parse|maxdb_errno|maxdb_error|maxdb_escape_string|maxdb_execute|maxdb_fetch|maxdb_fetch_array|maxdb_fetch_assoc|' +
21828
- 'maxdb_fetch_field|maxdb_fetch_field_direct|maxdb_fetch_fields|maxdb_fetch_lengths|maxdb_fetch_object|maxdb_fetch_row|maxdb_field_count|' +
21829
- 'maxdb_field_seek|maxdb_field_tell|maxdb_free_result|maxdb_get_client_info|maxdb_get_client_version|maxdb_get_host_info|maxdb_get_metadata|' +
21830
- 'maxdb_get_proto_info|maxdb_get_server_info|maxdb_get_server_version|maxdb_info|maxdb_init|maxdb_insert_id|maxdb_kill|maxdb_master_query|' +
21831
- 'maxdb_more_results|maxdb_multi_query|maxdb_next_result|maxdb_num_fields|maxdb_num_rows|maxdb_options|maxdb_param_count|maxdb_ping|' +
21832
- 'maxdb_prepare|maxdb_query|maxdb_real_connect|maxdb_real_escape_string|maxdb_real_query|maxdb_report|maxdb_rollback|' +
21833
- 'maxdb_rpl_parse_enabled|maxdb_rpl_probe|maxdb_rpl_query_type|maxdb_select_db|maxdb_send_long_data|maxdb_send_query|maxdb_server_end|' +
21834
- 'maxdb_server_init|maxdb_set_opt|maxdb_sqlstate|maxdb_ssl_set|maxdb_stat|maxdb_stmt_affected_rows|maxdb_stmt_bind_param|' +
21835
- 'maxdb_stmt_bind_result|maxdb_stmt_close|maxdb_stmt_close_long_data|maxdb_stmt_data_seek|maxdb_stmt_errno|maxdb_stmt_error|' +
21836
- 'maxdb_stmt_execute|maxdb_stmt_fetch|maxdb_stmt_free_result|maxdb_stmt_init|maxdb_stmt_num_rows|maxdb_stmt_param_count|maxdb_stmt_prepare|' +
21837
- 'maxdb_stmt_reset|maxdb_stmt_result_metadata|maxdb_stmt_send_long_data|maxdb_stmt_sqlstate|maxdb_stmt_store_result|maxdb_store_result|' +
21838
- 'maxdb_thread_id|maxdb_thread_safe|maxdb_use_result|maxdb_warning_count|mb_check_encoding|mb_convert_case|mb_convert_encoding|' +
21839
- 'mb_convert_kana|mb_convert_variables|mb_decode_mimeheader|mb_decode_numericentity|mb_detect_encoding|mb_detect_order|mb_encode_mimeheader|' +
21840
- 'mb_encode_numericentity|mb_encoding_aliases|mb_ereg|mb_ereg_match|mb_ereg_replace|mb_ereg_search|mb_ereg_search_getpos|' +
21841
- 'mb_ereg_search_getregs|mb_ereg_search_init|mb_ereg_search_pos|mb_ereg_search_regs|mb_ereg_search_setpos|mb_eregi|mb_eregi_replace|' +
21842
- 'mb_get_info|mb_http_input|mb_http_output|mb_internal_encoding|mb_language|mb_list_encodings|mb_output_handler|mb_parse_str|' +
21843
- 'mb_preferred_mime_name|mb_regex_encoding|mb_regex_set_options|mb_send_mail|mb_split|mb_strcut|mb_strimwidth|mb_stripos|mb_stristr|' +
21844
- 'mb_strlen|mb_strpos|mb_strrchr|mb_strrichr|mb_strripos|mb_strrpos|mb_strstr|mb_strtolower|mb_strtoupper|mb_strwidth|' +
21845
- 'mb_substitute_character|mb_substr|mb_substr_count|mcrypt_cbc|mcrypt_cfb|mcrypt_create_iv|mcrypt_decrypt|mcrypt_ecb|' +
21846
- 'mcrypt_enc_get_algorithms_name|mcrypt_enc_get_block_size|mcrypt_enc_get_iv_size|mcrypt_enc_get_key_size|mcrypt_enc_get_modes_name|' +
21847
- 'mcrypt_enc_get_supported_key_sizes|mcrypt_enc_is_block_algorithm|mcrypt_enc_is_block_algorithm_mode|mcrypt_enc_is_block_mode|' +
21848
- 'mcrypt_enc_self_test|mcrypt_encrypt|mcrypt_generic|mcrypt_generic_deinit|mcrypt_generic_end|mcrypt_generic_init|mcrypt_get_block_size|' +
21849
- 'mcrypt_get_cipher_name|mcrypt_get_iv_size|mcrypt_get_key_size|mcrypt_list_algorithms|mcrypt_list_modes|mcrypt_module_close|' +
21850
- 'mcrypt_module_get_algo_block_size|mcrypt_module_get_algo_key_size|mcrypt_module_get_supported_key_sizes|mcrypt_module_is_block_algorithm|' +
21851
- 'mcrypt_module_is_block_algorithm_mode|mcrypt_module_is_block_mode|mcrypt_module_open|mcrypt_module_self_test|mcrypt_ofb|md5|md5_file|' +
21852
- 'mdecrypt_generic|memcache|memcache_debug|memcached|memory_get_peak_usage|memory_get_usage|messageformatter|metaphone|method_exists|mhash|' +
21853
- 'mhash_count|mhash_get_block_size|mhash_get_hash_name|mhash_keygen_s2k|microtime|mime_content_type|min|ming_keypress|' +
21854
- 'ming_setcubicthreshold|ming_setscale|ming_setswfcompression|ming_useconstants|ming_useswfversion|mkdir|mktime|money_format|mongo|' +
21855
- 'mongobindata|mongocode|mongocollection|mongoconnectionexception|mongocursor|mongocursorexception|mongocursortimeoutexception|mongodate|' +
21856
- 'mongodb|mongodbref|mongoexception|mongogridfs|mongogridfscursor|mongogridfsexception|mongogridfsfile|mongoid|mongoint32|mongoint64|' +
21857
- 'mongomaxkey|mongominkey|mongoregex|mongotimestamp|move_uploaded_file|mpegfile|mqseries_back|mqseries_begin|mqseries_close|mqseries_cmit|' +
21858
- 'mqseries_conn|mqseries_connx|mqseries_disc|mqseries_get|mqseries_inq|mqseries_open|mqseries_put|mqseries_put1|mqseries_set|' +
21859
- 'mqseries_strerror|msession_connect|msession_count|msession_create|msession_destroy|msession_disconnect|msession_find|msession_get|' +
21860
- 'msession_get_array|msession_get_data|msession_inc|msession_list|msession_listvar|msession_lock|msession_plugin|msession_randstr|' +
21861
- 'msession_set|msession_set_array|msession_set_data|msession_timeout|msession_uniq|msession_unlock|msg_get_queue|msg_queue_exists|' +
21862
- 'msg_receive|msg_remove_queue|msg_send|msg_set_queue|msg_stat_queue|msql|msql_affected_rows|msql_close|msql_connect|msql_create_db|' +
21863
- 'msql_createdb|msql_data_seek|msql_db_query|msql_dbname|msql_drop_db|msql_error|msql_fetch_array|msql_fetch_field|msql_fetch_object|' +
21864
- 'msql_fetch_row|msql_field_flags|msql_field_len|msql_field_name|msql_field_seek|msql_field_table|msql_field_type|msql_fieldflags|' +
21865
- 'msql_fieldlen|msql_fieldname|msql_fieldtable|msql_fieldtype|msql_free_result|msql_list_dbs|msql_list_fields|msql_list_tables|' +
21866
- 'msql_num_fields|msql_num_rows|msql_numfields|msql_numrows|msql_pconnect|msql_query|msql_regcase|msql_result|msql_select_db|msql_tablename|' +
21867
- 'mssql_bind|mssql_close|mssql_connect|mssql_data_seek|mssql_execute|mssql_fetch_array|mssql_fetch_assoc|mssql_fetch_batch|' +
21868
- 'mssql_fetch_field|mssql_fetch_object|mssql_fetch_row|mssql_field_length|mssql_field_name|mssql_field_seek|mssql_field_type|' +
21869
- 'mssql_free_result|mssql_free_statement|mssql_get_last_message|mssql_guid_string|mssql_init|mssql_min_error_severity|' +
21870
- 'mssql_min_message_severity|mssql_next_result|mssql_num_fields|mssql_num_rows|mssql_pconnect|mssql_query|mssql_result|mssql_rows_affected|' +
21871
- 'mssql_select_db|mt_getrandmax|mt_rand|mt_srand|multipleiterator|mysql_affected_rows|mysql_client_encoding|mysql_close|mysql_connect|' +
21872
- 'mysql_create_db|mysql_data_seek|mysql_db_name|mysql_db_query|mysql_drop_db|mysql_errno|mysql_error|mysql_escape_string|mysql_fetch_array|' +
21873
- 'mysql_fetch_assoc|mysql_fetch_field|mysql_fetch_lengths|mysql_fetch_object|mysql_fetch_row|mysql_field_flags|mysql_field_len|' +
21874
- 'mysql_field_name|mysql_field_seek|mysql_field_table|mysql_field_type|mysql_free_result|mysql_get_client_info|mysql_get_host_info|' +
21875
- 'mysql_get_proto_info|mysql_get_server_info|mysql_info|mysql_insert_id|mysql_list_dbs|mysql_list_fields|mysql_list_processes|' +
21876
- 'mysql_list_tables|mysql_num_fields|mysql_num_rows|mysql_pconnect|mysql_ping|mysql_query|mysql_real_escape_string|mysql_result|' +
21877
- 'mysql_select_db|mysql_set_charset|mysql_stat|mysql_tablename|mysql_thread_id|mysql_unbuffered_query|mysqli|mysqli_bind_param|' +
21878
- 'mysqli_bind_result|mysqli_client_encoding|mysqli_connect|mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_driver|' +
21879
- 'mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_escape_string|mysqli_execute|mysqli_fetch|mysqli_get_metadata|' +
21880
- 'mysqli_master_query|mysqli_param_count|mysqli_report|mysqli_result|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|' +
21881
- 'mysqli_send_long_data|mysqli_send_query|mysqli_set_opt|mysqli_slave_query|mysqli_stmt|mysqli_warning|mysqlnd_ms_get_stats|' +
21882
- 'mysqlnd_ms_query_is_select|mysqlnd_ms_set_user_pick_server|mysqlnd_qc_change_handler|mysqlnd_qc_clear_cache|mysqlnd_qc_get_cache_info|' +
21883
- 'mysqlnd_qc_get_core_stats|mysqlnd_qc_get_handler|mysqlnd_qc_get_query_trace_log|mysqlnd_qc_set_user_handlers|natcasesort|natsort|' +
21884
- 'ncurses_addch|ncurses_addchnstr|ncurses_addchstr|ncurses_addnstr|ncurses_addstr|ncurses_assume_default_colors|ncurses_attroff|' +
21885
- 'ncurses_attron|ncurses_attrset|ncurses_baudrate|ncurses_beep|ncurses_bkgd|ncurses_bkgdset|ncurses_border|ncurses_bottom_panel|' +
21886
- 'ncurses_can_change_color|ncurses_cbreak|ncurses_clear|ncurses_clrtobot|ncurses_clrtoeol|ncurses_color_content|ncurses_color_set|' +
21887
- 'ncurses_curs_set|ncurses_def_prog_mode|ncurses_def_shell_mode|ncurses_define_key|ncurses_del_panel|ncurses_delay_output|ncurses_delch|' +
21888
- 'ncurses_deleteln|ncurses_delwin|ncurses_doupdate|ncurses_echo|ncurses_echochar|ncurses_end|ncurses_erase|ncurses_erasechar|ncurses_filter|' +
21889
- 'ncurses_flash|ncurses_flushinp|ncurses_getch|ncurses_getmaxyx|ncurses_getmouse|ncurses_getyx|ncurses_halfdelay|ncurses_has_colors|' +
21890
- 'ncurses_has_ic|ncurses_has_il|ncurses_has_key|ncurses_hide_panel|ncurses_hline|ncurses_inch|ncurses_init|ncurses_init_color|' +
21891
- 'ncurses_init_pair|ncurses_insch|ncurses_insdelln|ncurses_insertln|ncurses_insstr|ncurses_instr|ncurses_isendwin|ncurses_keyok|' +
21892
- 'ncurses_keypad|ncurses_killchar|ncurses_longname|ncurses_meta|ncurses_mouse_trafo|ncurses_mouseinterval|ncurses_mousemask|ncurses_move|' +
21893
- 'ncurses_move_panel|ncurses_mvaddch|ncurses_mvaddchnstr|ncurses_mvaddchstr|ncurses_mvaddnstr|ncurses_mvaddstr|ncurses_mvcur|' +
21894
- 'ncurses_mvdelch|ncurses_mvgetch|ncurses_mvhline|ncurses_mvinch|ncurses_mvvline|ncurses_mvwaddstr|ncurses_napms|ncurses_new_panel|' +
21895
- 'ncurses_newpad|ncurses_newwin|ncurses_nl|ncurses_nocbreak|ncurses_noecho|ncurses_nonl|ncurses_noqiflush|ncurses_noraw|' +
21896
- 'ncurses_pair_content|ncurses_panel_above|ncurses_panel_below|ncurses_panel_window|ncurses_pnoutrefresh|ncurses_prefresh|ncurses_putp|' +
21897
- 'ncurses_qiflush|ncurses_raw|ncurses_refresh|ncurses_replace_panel|ncurses_reset_prog_mode|ncurses_reset_shell_mode|ncurses_resetty|' +
21898
- 'ncurses_savetty|ncurses_scr_dump|ncurses_scr_init|ncurses_scr_restore|ncurses_scr_set|ncurses_scrl|ncurses_show_panel|ncurses_slk_attr|' +
21899
- 'ncurses_slk_attroff|ncurses_slk_attron|ncurses_slk_attrset|ncurses_slk_clear|ncurses_slk_color|ncurses_slk_init|ncurses_slk_noutrefresh|' +
21900
- 'ncurses_slk_refresh|ncurses_slk_restore|ncurses_slk_set|ncurses_slk_touch|ncurses_standend|ncurses_standout|ncurses_start_color|' +
21901
- 'ncurses_termattrs|ncurses_termname|ncurses_timeout|ncurses_top_panel|ncurses_typeahead|ncurses_ungetch|ncurses_ungetmouse|' +
21902
- 'ncurses_update_panels|ncurses_use_default_colors|ncurses_use_env|ncurses_use_extended_names|ncurses_vidattr|ncurses_vline|ncurses_waddch|' +
21903
- 'ncurses_waddstr|ncurses_wattroff|ncurses_wattron|ncurses_wattrset|ncurses_wborder|ncurses_wclear|ncurses_wcolor_set|ncurses_werase|' +
21904
- 'ncurses_wgetch|ncurses_whline|ncurses_wmouse_trafo|ncurses_wmove|ncurses_wnoutrefresh|ncurses_wrefresh|ncurses_wstandend|' +
21905
- 'ncurses_wstandout|ncurses_wvline|newinstance|newinstanceargs|newt_bell|newt_button|newt_button_bar|newt_centered_window|newt_checkbox|' +
21906
- 'newt_checkbox_get_value|newt_checkbox_set_flags|newt_checkbox_set_value|newt_checkbox_tree|newt_checkbox_tree_add_item|' +
21907
- 'newt_checkbox_tree_find_item|newt_checkbox_tree_get_current|newt_checkbox_tree_get_entry_value|newt_checkbox_tree_get_multi_selection|' +
21908
- 'newt_checkbox_tree_get_selection|newt_checkbox_tree_multi|newt_checkbox_tree_set_current|newt_checkbox_tree_set_entry|' +
21909
- 'newt_checkbox_tree_set_entry_value|newt_checkbox_tree_set_width|newt_clear_key_buffer|newt_cls|newt_compact_button|' +
21910
- 'newt_component_add_callback|newt_component_takes_focus|newt_create_grid|newt_cursor_off|newt_cursor_on|newt_delay|newt_draw_form|' +
21911
- 'newt_draw_root_text|newt_entry|newt_entry_get_value|newt_entry_set|newt_entry_set_filter|newt_entry_set_flags|newt_finished|newt_form|' +
21912
- 'newt_form_add_component|newt_form_add_components|newt_form_add_hot_key|newt_form_destroy|newt_form_get_current|newt_form_run|' +
21913
- 'newt_form_set_background|newt_form_set_height|newt_form_set_size|newt_form_set_timer|newt_form_set_width|newt_form_watch_fd|' +
21914
- 'newt_get_screen_size|newt_grid_add_components_to_form|newt_grid_basic_window|newt_grid_free|newt_grid_get_size|newt_grid_h_close_stacked|' +
21915
- 'newt_grid_h_stacked|newt_grid_place|newt_grid_set_field|newt_grid_simple_window|newt_grid_v_close_stacked|newt_grid_v_stacked|' +
21916
- 'newt_grid_wrapped_window|newt_grid_wrapped_window_at|newt_init|newt_label|newt_label_set_text|newt_listbox|newt_listbox_append_entry|' +
21917
- 'newt_listbox_clear|newt_listbox_clear_selection|newt_listbox_delete_entry|newt_listbox_get_current|newt_listbox_get_selection|' +
21918
- 'newt_listbox_insert_entry|newt_listbox_item_count|newt_listbox_select_item|newt_listbox_set_current|newt_listbox_set_current_by_key|' +
21919
- 'newt_listbox_set_data|newt_listbox_set_entry|newt_listbox_set_width|newt_listitem|newt_listitem_get_data|newt_listitem_set|' +
21920
- 'newt_open_window|newt_pop_help_line|newt_pop_window|newt_push_help_line|newt_radio_get_current|newt_radiobutton|newt_redraw_help_line|' +
21921
- 'newt_reflow_text|newt_refresh|newt_resize_screen|newt_resume|newt_run_form|newt_scale|newt_scale_set|newt_scrollbar_set|' +
21922
- 'newt_set_help_callback|newt_set_suspend_callback|newt_suspend|newt_textbox|newt_textbox_get_num_lines|newt_textbox_reflowed|' +
21923
- 'newt_textbox_set_height|newt_textbox_set_text|newt_vertical_scrollbar|newt_wait_for_key|newt_win_choice|newt_win_entries|newt_win_menu|' +
21924
- 'newt_win_message|newt_win_messagev|newt_win_ternary|next|ngettext|nl2br|nl_langinfo|norewinditerator|normalizer|notes_body|notes_copy_db|' +
21925
- 'notes_create_db|notes_create_note|notes_drop_db|notes_find_note|notes_header_info|notes_list_msgs|notes_mark_read|notes_mark_unread|' +
21926
- 'notes_nav_create|notes_search|notes_unread|notes_version|nsapi_request_headers|nsapi_response_headers|nsapi_virtual|nthmac|number_format|' +
21927
- 'numberformatter|oauth|oauth_get_sbs|oauth_urlencode|oauthexception|oauthprovider|ob_clean|ob_deflatehandler|ob_end_clean|ob_end_flush|' +
21928
- 'ob_etaghandler|ob_flush|ob_get_clean|ob_get_contents|ob_get_flush|ob_get_length|ob_get_level|ob_get_status|ob_gzhandler|ob_iconv_handler|' +
21929
- 'ob_implicit_flush|ob_inflatehandler|ob_list_handlers|ob_start|ob_tidyhandler|oci_bind_array_by_name|oci_bind_by_name|oci_cancel|' +
21930
- 'oci_client_version|oci_close|oci_collection_append|oci_collection_assign|oci_collection_element_assign|oci_collection_element_get|' +
21931
- 'oci_collection_free|oci_collection_max|oci_collection_size|oci_collection_trim|oci_commit|oci_connect|oci_define_by_name|oci_error|' +
21932
- 'oci_execute|oci_fetch|oci_fetch_all|oci_fetch_array|oci_fetch_assoc|oci_fetch_object|oci_fetch_row|oci_field_is_null|oci_field_name|' +
21933
- 'oci_field_precision|oci_field_scale|oci_field_size|oci_field_type|oci_field_type_raw|oci_free_statement|oci_internal_debug|oci_lob_append|' +
21934
- 'oci_lob_close|oci_lob_copy|oci_lob_eof|oci_lob_erase|oci_lob_export|oci_lob_flush|oci_lob_free|oci_lob_getbuffering|oci_lob_import|' +
21935
- 'oci_lob_is_equal|oci_lob_load|oci_lob_read|oci_lob_rewind|oci_lob_save|oci_lob_savefile|oci_lob_seek|oci_lob_setbuffering|oci_lob_size|' +
21936
- 'oci_lob_tell|oci_lob_truncate|oci_lob_write|oci_lob_writetemporary|oci_lob_writetofile|oci_new_collection|oci_new_connect|oci_new_cursor|' +
21937
- 'oci_new_descriptor|oci_num_fields|oci_num_rows|oci_parse|oci_password_change|oci_pconnect|oci_result|oci_rollback|oci_server_version|' +
21938
- 'oci_set_action|oci_set_client_identifier|oci_set_client_info|oci_set_edition|oci_set_module_name|oci_set_prefetch|oci_statement_type|' +
21939
- 'ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|' +
21940
- 'ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|' +
21941
- 'ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|' +
21942
- 'ociloadlob|ocilogoff|ocilogon|ocinewcollection|ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|' +
21943
- 'ocirollback|ocirowcount|ocisavelob|ocisavelobfile|ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|' +
21944
- 'octdec|odbc_autocommit|odbc_binmode|odbc_close|odbc_close_all|odbc_columnprivileges|odbc_columns|odbc_commit|odbc_connect|odbc_cursor|' +
21945
- 'odbc_data_source|odbc_do|odbc_error|odbc_errormsg|odbc_exec|odbc_execute|odbc_fetch_array|odbc_fetch_into|odbc_fetch_object|' +
21946
- 'odbc_fetch_row|odbc_field_len|odbc_field_name|odbc_field_num|odbc_field_precision|odbc_field_scale|odbc_field_type|odbc_foreignkeys|' +
21947
- 'odbc_free_result|odbc_gettypeinfo|odbc_longreadlen|odbc_next_result|odbc_num_fields|odbc_num_rows|odbc_pconnect|odbc_prepare|' +
21948
- 'odbc_primarykeys|odbc_procedurecolumns|odbc_procedures|odbc_result|odbc_result_all|odbc_rollback|odbc_setoption|odbc_specialcolumns|' +
21949
- 'odbc_statistics|odbc_tableprivileges|odbc_tables|openal_buffer_create|openal_buffer_data|openal_buffer_destroy|openal_buffer_get|' +
21950
- 'openal_buffer_loadwav|openal_context_create|openal_context_current|openal_context_destroy|openal_context_process|openal_context_suspend|' +
21951
- 'openal_device_close|openal_device_open|openal_listener_get|openal_listener_set|openal_source_create|openal_source_destroy|' +
21952
- 'openal_source_get|openal_source_pause|openal_source_play|openal_source_rewind|openal_source_set|openal_source_stop|openal_stream|opendir|' +
21953
- 'openlog|openssl_cipher_iv_length|openssl_csr_export|openssl_csr_export_to_file|openssl_csr_get_public_key|openssl_csr_get_subject|' +
21954
- 'openssl_csr_new|openssl_csr_sign|openssl_decrypt|openssl_dh_compute_key|openssl_digest|openssl_encrypt|openssl_error_string|' +
21955
- 'openssl_free_key|openssl_get_cipher_methods|openssl_get_md_methods|openssl_get_privatekey|openssl_get_publickey|openssl_open|' +
21956
- 'openssl_pkcs12_export|openssl_pkcs12_export_to_file|openssl_pkcs12_read|openssl_pkcs7_decrypt|openssl_pkcs7_encrypt|openssl_pkcs7_sign|' +
21957
- 'openssl_pkcs7_verify|openssl_pkey_export|openssl_pkey_export_to_file|openssl_pkey_free|openssl_pkey_get_details|openssl_pkey_get_private|' +
21958
- 'openssl_pkey_get_public|openssl_pkey_new|openssl_private_decrypt|openssl_private_encrypt|openssl_public_decrypt|openssl_public_encrypt|' +
21959
- 'openssl_random_pseudo_bytes|openssl_seal|openssl_sign|openssl_verify|openssl_x509_check_private_key|openssl_x509_checkpurpose|' +
21960
- 'openssl_x509_export|openssl_x509_export_to_file|openssl_x509_free|openssl_x509_parse|openssl_x509_read|ord|outeriterator|' +
21961
- 'outofboundsexception|outofrangeexception|output_add_rewrite_var|output_reset_rewrite_vars|overflowexception|overload|override_function|' +
21962
- 'ovrimos_close|ovrimos_commit|ovrimos_connect|ovrimos_cursor|ovrimos_exec|ovrimos_execute|ovrimos_fetch_into|ovrimos_fetch_row|' +
21963
- 'ovrimos_field_len|ovrimos_field_name|ovrimos_field_num|ovrimos_field_type|ovrimos_free_result|ovrimos_longreadlen|ovrimos_num_fields|' +
21964
- 'ovrimos_num_rows|ovrimos_prepare|ovrimos_result|ovrimos_result_all|ovrimos_rollback|pack|parentiterator|parse_ini_file|parse_ini_string|' +
21965
- 'parse_str|parse_url|parsekit_compile_file|parsekit_compile_string|parsekit_func_arginfo|passthru|pathinfo|pclose|pcntl_alarm|pcntl_exec|' +
21966
- 'pcntl_fork|pcntl_getpriority|pcntl_setpriority|pcntl_signal|pcntl_signal_dispatch|pcntl_sigprocmask|pcntl_sigtimedwait|pcntl_sigwaitinfo|' +
21967
- 'pcntl_wait|pcntl_waitpid|pcntl_wexitstatus|pcntl_wifexited|pcntl_wifsignaled|pcntl_wifstopped|pcntl_wstopsig|pcntl_wtermsig|' +
21968
- 'pdf_activate_item|pdf_add_annotation|pdf_add_bookmark|pdf_add_launchlink|pdf_add_locallink|pdf_add_nameddest|pdf_add_note|pdf_add_outline|' +
21969
- 'pdf_add_pdflink|pdf_add_table_cell|pdf_add_textflow|pdf_add_thumbnail|pdf_add_weblink|pdf_arc|pdf_arcn|pdf_attach_file|pdf_begin_document|' +
21970
- 'pdf_begin_font|pdf_begin_glyph|pdf_begin_item|pdf_begin_layer|pdf_begin_page|pdf_begin_page_ext|pdf_begin_pattern|pdf_begin_template|' +
21971
- 'pdf_begin_template_ext|pdf_circle|pdf_clip|pdf_close|pdf_close_image|pdf_close_pdi|pdf_close_pdi_page|pdf_closepath|' +
21972
- 'pdf_closepath_fill_stroke|pdf_closepath_stroke|pdf_concat|pdf_continue_text|pdf_create_3dview|pdf_create_action|pdf_create_annotation|' +
21973
- 'pdf_create_bookmark|pdf_create_field|pdf_create_fieldgroup|pdf_create_gstate|pdf_create_pvf|pdf_create_textflow|pdf_curveto|' +
21974
- 'pdf_define_layer|pdf_delete|pdf_delete_pvf|pdf_delete_table|pdf_delete_textflow|pdf_encoding_set_char|pdf_end_document|pdf_end_font|' +
21975
- 'pdf_end_glyph|pdf_end_item|pdf_end_layer|pdf_end_page|pdf_end_page_ext|pdf_end_pattern|pdf_end_template|pdf_endpath|pdf_fill|' +
21976
- 'pdf_fill_imageblock|pdf_fill_pdfblock|pdf_fill_stroke|pdf_fill_textblock|pdf_findfont|pdf_fit_image|pdf_fit_pdi_page|pdf_fit_table|' +
21977
- 'pdf_fit_textflow|pdf_fit_textline|pdf_get_apiname|pdf_get_buffer|pdf_get_errmsg|pdf_get_errnum|pdf_get_font|pdf_get_fontname|' +
21978
- 'pdf_get_fontsize|pdf_get_image_height|pdf_get_image_width|pdf_get_majorversion|pdf_get_minorversion|pdf_get_parameter|' +
21979
- 'pdf_get_pdi_parameter|pdf_get_pdi_value|pdf_get_value|pdf_info_font|pdf_info_matchbox|pdf_info_table|pdf_info_textflow|pdf_info_textline|' +
21980
- 'pdf_initgraphics|pdf_lineto|pdf_load_3ddata|pdf_load_font|pdf_load_iccprofile|pdf_load_image|pdf_makespotcolor|pdf_moveto|pdf_new|' +
21981
- 'pdf_open_ccitt|pdf_open_file|pdf_open_gif|pdf_open_image|pdf_open_image_file|pdf_open_jpeg|pdf_open_memory_image|pdf_open_pdi|' +
21982
- 'pdf_open_pdi_document|pdf_open_pdi_page|pdf_open_tiff|pdf_pcos_get_number|pdf_pcos_get_stream|pdf_pcos_get_string|pdf_place_image|' +
21983
- 'pdf_place_pdi_page|pdf_process_pdi|pdf_rect|pdf_restore|pdf_resume_page|pdf_rotate|pdf_save|pdf_scale|pdf_set_border_color|' +
21984
- 'pdf_set_border_dash|pdf_set_border_style|pdf_set_char_spacing|pdf_set_duration|pdf_set_gstate|pdf_set_horiz_scaling|pdf_set_info|' +
21985
- 'pdf_set_info_author|pdf_set_info_creator|pdf_set_info_keywords|pdf_set_info_subject|pdf_set_info_title|pdf_set_layer_dependency|' +
21986
- 'pdf_set_leading|pdf_set_parameter|pdf_set_text_matrix|pdf_set_text_pos|pdf_set_text_rendering|pdf_set_text_rise|pdf_set_value|' +
21987
- 'pdf_set_word_spacing|pdf_setcolor|pdf_setdash|pdf_setdashpattern|pdf_setflat|pdf_setfont|pdf_setgray|pdf_setgray_fill|pdf_setgray_stroke|' +
21988
- 'pdf_setlinecap|pdf_setlinejoin|pdf_setlinewidth|pdf_setmatrix|pdf_setmiterlimit|pdf_setpolydash|pdf_setrgbcolor|pdf_setrgbcolor_fill|' +
21989
- 'pdf_setrgbcolor_stroke|pdf_shading|pdf_shading_pattern|pdf_shfill|pdf_show|pdf_show_boxed|pdf_show_xy|pdf_skew|pdf_stringwidth|pdf_stroke|' +
21990
- 'pdf_suspend_page|pdf_translate|pdf_utf16_to_utf8|pdf_utf32_to_utf16|pdf_utf8_to_utf16|pdo|pdo_cubrid_schema|pdo_pgsqllobcreate|' +
21991
- 'pdo_pgsqllobopen|pdo_pgsqllobunlink|pdo_sqlitecreateaggregate|pdo_sqlitecreatefunction|pdoexception|pdostatement|pfsockopen|' +
21992
- 'pg_affected_rows|pg_cancel_query|pg_client_encoding|pg_close|pg_connect|pg_connection_busy|pg_connection_reset|pg_connection_status|' +
21993
- 'pg_convert|pg_copy_from|pg_copy_to|pg_dbname|pg_delete|pg_end_copy|pg_escape_bytea|pg_escape_string|pg_execute|pg_fetch_all|' +
21994
- 'pg_fetch_all_columns|pg_fetch_array|pg_fetch_assoc|pg_fetch_object|pg_fetch_result|pg_fetch_row|pg_field_is_null|pg_field_name|' +
21995
- 'pg_field_num|pg_field_prtlen|pg_field_size|pg_field_table|pg_field_type|pg_field_type_oid|pg_free_result|pg_get_notify|pg_get_pid|' +
21996
- 'pg_get_result|pg_host|pg_insert|pg_last_error|pg_last_notice|pg_last_oid|pg_lo_close|pg_lo_create|pg_lo_export|pg_lo_import|pg_lo_open|' +
21997
- 'pg_lo_read|pg_lo_read_all|pg_lo_seek|pg_lo_tell|pg_lo_unlink|pg_lo_write|pg_meta_data|pg_num_fields|pg_num_rows|pg_options|' +
21998
- 'pg_parameter_status|pg_pconnect|pg_ping|pg_port|pg_prepare|pg_put_line|pg_query|pg_query_params|pg_result_error|pg_result_error_field|' +
21999
- 'pg_result_seek|pg_result_status|pg_select|pg_send_execute|pg_send_prepare|pg_send_query|pg_send_query_params|pg_set_client_encoding|' +
22000
- 'pg_set_error_verbosity|pg_trace|pg_transaction_status|pg_tty|pg_unescape_bytea|pg_untrace|pg_update|pg_version|php_check_syntax|' +
22001
- 'php_ini_loaded_file|php_ini_scanned_files|php_logo_guid|php_sapi_name|php_strip_whitespace|php_uname|phpcredits|phpinfo|phpversion|pi|' +
22002
- 'png2wbmp|popen|pos|posix_access|posix_ctermid|posix_errno|posix_get_last_error|posix_getcwd|posix_getegid|posix_geteuid|posix_getgid|' +
22003
- 'posix_getgrgid|posix_getgrnam|posix_getgroups|posix_getlogin|posix_getpgid|posix_getpgrp|posix_getpid|posix_getppid|posix_getpwnam|' +
22004
- 'posix_getpwuid|posix_getrlimit|posix_getsid|posix_getuid|posix_initgroups|posix_isatty|posix_kill|posix_mkfifo|posix_mknod|posix_setegid|' +
22005
- 'posix_seteuid|posix_setgid|posix_setpgid|posix_setsid|posix_setuid|posix_strerror|posix_times|posix_ttyname|posix_uname|pow|preg_filter|' +
22006
- 'preg_grep|preg_last_error|preg_match|preg_match_all|preg_quote|preg_replace|preg_replace_callback|preg_split|prev|print|print_r|' +
22007
- 'printer_abort|printer_close|printer_create_brush|printer_create_dc|printer_create_font|printer_create_pen|printer_delete_brush|' +
22008
- 'printer_delete_dc|printer_delete_font|printer_delete_pen|printer_draw_bmp|printer_draw_chord|printer_draw_elipse|printer_draw_line|' +
22009
- 'printer_draw_pie|printer_draw_rectangle|printer_draw_roundrect|printer_draw_text|printer_end_doc|printer_end_page|printer_get_option|' +
22010
- 'printer_list|printer_logical_fontheight|printer_open|printer_select_brush|printer_select_font|printer_select_pen|printer_set_option|' +
22011
- 'printer_start_doc|printer_start_page|printer_write|printf|proc_close|proc_get_status|proc_nice|proc_open|proc_terminate|property_exists|' +
22012
- 'ps_add_bookmark|ps_add_launchlink|ps_add_locallink|ps_add_note|ps_add_pdflink|ps_add_weblink|ps_arc|ps_arcn|ps_begin_page|' +
22013
- 'ps_begin_pattern|ps_begin_template|ps_circle|ps_clip|ps_close|ps_close_image|ps_closepath|ps_closepath_stroke|ps_continue_text|ps_curveto|' +
22014
- 'ps_delete|ps_end_page|ps_end_pattern|ps_end_template|ps_fill|ps_fill_stroke|ps_findfont|ps_get_buffer|ps_get_parameter|ps_get_value|' +
22015
- 'ps_hyphenate|ps_include_file|ps_lineto|ps_makespotcolor|ps_moveto|ps_new|ps_open_file|ps_open_image|ps_open_image_file|' +
22016
- 'ps_open_memory_image|ps_place_image|ps_rect|ps_restore|ps_rotate|ps_save|ps_scale|ps_set_border_color|ps_set_border_dash|' +
22017
- 'ps_set_border_style|ps_set_info|ps_set_parameter|ps_set_text_pos|ps_set_value|ps_setcolor|ps_setdash|ps_setflat|ps_setfont|ps_setgray|' +
22018
- 'ps_setlinecap|ps_setlinejoin|ps_setlinewidth|ps_setmiterlimit|ps_setoverprintmode|ps_setpolydash|ps_shading|ps_shading_pattern|ps_shfill|' +
22019
- 'ps_show|ps_show2|ps_show_boxed|ps_show_xy|ps_show_xy2|ps_string_geometry|ps_stringwidth|ps_stroke|ps_symbol|ps_symbol_name|' +
22020
- 'ps_symbol_width|ps_translate|pspell_add_to_personal|pspell_add_to_session|pspell_check|pspell_clear_session|pspell_config_create|' +
22021
- 'pspell_config_data_dir|pspell_config_dict_dir|pspell_config_ignore|pspell_config_mode|pspell_config_personal|pspell_config_repl|' +
22022
- 'pspell_config_runtogether|pspell_config_save_repl|pspell_new|pspell_new_config|pspell_new_personal|pspell_save_wordlist|' +
22023
- 'pspell_store_replacement|pspell_suggest|putenv|px_close|px_create_fp|px_date2string|px_delete|px_delete_record|px_get_field|px_get_info|' +
22024
- 'px_get_parameter|px_get_record|px_get_schema|px_get_value|px_insert_record|px_new|px_numfields|px_numrecords|px_open_fp|px_put_record|' +
22025
- 'px_retrieve_record|px_set_blob_file|px_set_parameter|px_set_tablename|px_set_targetencoding|px_set_value|px_timestamp2string|' +
22026
- 'px_update_record|qdom_error|qdom_tree|quoted_printable_decode|quoted_printable_encode|quotemeta|rad2deg|radius_acct_open|' +
22027
- 'radius_add_server|radius_auth_open|radius_close|radius_config|radius_create_request|radius_cvt_addr|radius_cvt_int|radius_cvt_string|' +
22028
- 'radius_demangle|radius_demangle_mppe_key|radius_get_attr|radius_get_vendor_attr|radius_put_addr|radius_put_attr|radius_put_int|' +
22029
- 'radius_put_string|radius_put_vendor_addr|radius_put_vendor_attr|radius_put_vendor_int|radius_put_vendor_string|' +
22030
- 'radius_request_authenticator|radius_send_request|radius_server_secret|radius_strerror|rand|range|rangeexception|rar_wrapper_cache_stats|' +
22031
- 'rararchive|rarentry|rarexception|rawurldecode|rawurlencode|read_exif_data|readdir|readfile|readgzfile|readline|readline_add_history|' +
22032
- 'readline_callback_handler_install|readline_callback_handler_remove|readline_callback_read_char|readline_clear_history|' +
22033
- 'readline_completion_function|readline_info|readline_list_history|readline_on_new_line|readline_read_history|readline_redisplay|' +
22034
- 'readline_write_history|readlink|realpath|realpath_cache_get|realpath_cache_size|recode|recode_file|recode_string|recursivearrayiterator|' +
22035
- 'recursivecachingiterator|recursivecallbackfilteriterator|recursivedirectoryiterator|recursivefilteriterator|recursiveiterator|' +
22036
- 'recursiveiteratoriterator|recursiveregexiterator|recursivetreeiterator|reflection|reflectionclass|reflectionexception|reflectionextension|' +
22037
- 'reflectionfunction|reflectionfunctionabstract|reflectionmethod|reflectionobject|reflectionparameter|reflectionproperty|reflector|' +
22038
- 'regexiterator|register_shutdown_function|register_tick_function|rename|rename_function|require|require_once|reset|resetValue|' +
22039
- 'resourcebundle|restore_error_handler|restore_exception_handler|restore_include_path|return|rewind|rewinddir|rmdir|round|rpm_close|' +
22040
- 'rpm_get_tag|rpm_is_valid|rpm_open|rpm_version|rrd_create|rrd_error|rrd_fetch|rrd_first|rrd_graph|rrd_info|rrd_last|rrd_lastupdate|' +
22041
- 'rrd_restore|rrd_tune|rrd_update|rrd_xport|rrdcreator|rrdgraph|rrdupdater|rsort|rtrim|runkit_class_adopt|runkit_class_emancipate|' +
22042
- 'runkit_constant_add|runkit_constant_redefine|runkit_constant_remove|runkit_function_add|runkit_function_copy|runkit_function_redefine|' +
22043
- 'runkit_function_remove|runkit_function_rename|runkit_import|runkit_lint|runkit_lint_file|runkit_method_add|runkit_method_copy|' +
22044
- 'runkit_method_redefine|runkit_method_remove|runkit_method_rename|runkit_return_value_used|runkit_sandbox_output_handler|' +
22045
- 'runkit_superglobals|runtimeexception|samconnection_commit|samconnection_connect|samconnection_constructor|samconnection_disconnect|' +
22046
- 'samconnection_errno|samconnection_error|samconnection_isconnected|samconnection_peek|samconnection_peekall|samconnection_receive|' +
22047
- 'samconnection_remove|samconnection_rollback|samconnection_send|samconnection_setDebug|samconnection_subscribe|samconnection_unsubscribe|' +
22048
- 'sammessage_body|sammessage_constructor|sammessage_header|sca_createdataobject|sca_getservice|sca_localproxy_createdataobject|' +
22049
- 'sca_soapproxy_createdataobject|scandir|sdo_das_changesummary_beginlogging|sdo_das_changesummary_endlogging|' +
22050
- 'sdo_das_changesummary_getchangeddataobjects|sdo_das_changesummary_getchangetype|sdo_das_changesummary_getoldcontainer|' +
22051
- 'sdo_das_changesummary_getoldvalues|sdo_das_changesummary_islogging|sdo_das_datafactory_addpropertytotype|sdo_das_datafactory_addtype|' +
22052
- 'sdo_das_datafactory_getdatafactory|sdo_das_dataobject_getchangesummary|sdo_das_relational_applychanges|sdo_das_relational_construct|' +
22053
- 'sdo_das_relational_createrootdataobject|sdo_das_relational_executepreparedquery|sdo_das_relational_executequery|' +
22054
- 'sdo_das_setting_getlistindex|sdo_das_setting_getpropertyindex|sdo_das_setting_getpropertyname|sdo_das_setting_getvalue|' +
22055
- 'sdo_das_setting_isset|sdo_das_xml_addtypes|sdo_das_xml_create|sdo_das_xml_createdataobject|sdo_das_xml_createdocument|' +
22056
- 'sdo_das_xml_document_getrootdataobject|sdo_das_xml_document_getrootelementname|sdo_das_xml_document_getrootelementuri|' +
22057
- 'sdo_das_xml_document_setencoding|sdo_das_xml_document_setxmldeclaration|sdo_das_xml_document_setxmlversion|sdo_das_xml_loadfile|' +
22058
- 'sdo_das_xml_loadstring|sdo_das_xml_savefile|sdo_das_xml_savestring|sdo_datafactory_create|sdo_dataobject_clear|' +
22059
- 'sdo_dataobject_createdataobject|sdo_dataobject_getcontainer|sdo_dataobject_getsequence|sdo_dataobject_gettypename|' +
22060
- 'sdo_dataobject_gettypenamespaceuri|sdo_exception_getcause|sdo_list_insert|sdo_model_property_getcontainingtype|' +
22061
- 'sdo_model_property_getdefault|sdo_model_property_getname|sdo_model_property_gettype|sdo_model_property_iscontainment|' +
22062
- 'sdo_model_property_ismany|sdo_model_reflectiondataobject_construct|sdo_model_reflectiondataobject_export|' +
22063
- 'sdo_model_reflectiondataobject_getcontainmentproperty|sdo_model_reflectiondataobject_getinstanceproperties|' +
22064
- 'sdo_model_reflectiondataobject_gettype|sdo_model_type_getbasetype|sdo_model_type_getname|sdo_model_type_getnamespaceuri|' +
22065
- 'sdo_model_type_getproperties|sdo_model_type_getproperty|sdo_model_type_isabstracttype|sdo_model_type_isdatatype|sdo_model_type_isinstance|' +
22066
- 'sdo_model_type_isopentype|sdo_model_type_issequencedtype|sdo_sequence_getproperty|sdo_sequence_insert|sdo_sequence_move|seekableiterator|' +
22067
- 'sem_acquire|sem_get|sem_release|sem_remove|serializable|serialize|session_cache_expire|session_cache_limiter|session_commit|' +
22068
- 'session_decode|session_destroy|session_encode|session_get_cookie_params|session_id|session_is_registered|session_module_name|session_name|' +
22069
- 'session_pgsql_add_error|session_pgsql_get_error|session_pgsql_get_field|session_pgsql_reset|session_pgsql_set_field|session_pgsql_status|' +
22070
- 'session_regenerate_id|session_register|session_save_path|session_set_cookie_params|session_set_save_handler|session_start|' +
22071
- 'session_unregister|session_unset|session_write_close|setCounterClass|set_error_handler|set_exception_handler|set_file_buffer|' +
22072
- 'set_include_path|set_magic_quotes_runtime|set_socket_blocking|set_time_limit|setcookie|setlocale|setproctitle|setrawcookie|' +
22073
- 'setstaticpropertyvalue|setthreadtitle|settype|sha1|sha1_file|shell_exec|shm_attach|shm_detach|shm_get_var|shm_has_var|shm_put_var|' +
22074
- 'shm_remove|shm_remove_var|shmop_close|shmop_delete|shmop_open|shmop_read|shmop_size|shmop_write|show_source|shuffle|signeurlpaiement|' +
22075
- 'similar_text|simplexml_import_dom|simplexml_load_file|simplexml_load_string|simplexmlelement|simplexmliterator|sin|sinh|sizeof|sleep|snmp|' +
22076
- 'snmp2_get|snmp2_getnext|snmp2_real_walk|snmp2_set|snmp2_walk|snmp3_get|snmp3_getnext|snmp3_real_walk|snmp3_set|snmp3_walk|' +
22077
- 'snmp_get_quick_print|snmp_get_valueretrieval|snmp_read_mib|snmp_set_enum_print|snmp_set_oid_numeric_print|snmp_set_oid_output_format|' +
22078
- 'snmp_set_quick_print|snmp_set_valueretrieval|snmpget|snmpgetnext|snmprealwalk|snmpset|snmpwalk|snmpwalkoid|soapclient|soapfault|' +
22079
- 'soapheader|soapparam|soapserver|soapvar|socket_accept|socket_bind|socket_clear_error|socket_close|socket_connect|socket_create|' +
22080
- 'socket_create_listen|socket_create_pair|socket_get_option|socket_get_status|socket_getpeername|socket_getsockname|socket_last_error|' +
22081
- 'socket_listen|socket_read|socket_recv|socket_recvfrom|socket_select|socket_send|socket_sendto|socket_set_block|socket_set_blocking|' +
22082
- 'socket_set_nonblock|socket_set_option|socket_set_timeout|socket_shutdown|socket_strerror|socket_write|solr_get_version|solrclient|' +
22083
- 'solrclientexception|solrdocument|solrdocumentfield|solrexception|solrgenericresponse|solrillegalargumentexception|' +
22084
- 'solrillegaloperationexception|solrinputdocument|solrmodifiableparams|solrobject|solrparams|solrpingresponse|solrquery|solrqueryresponse|' +
22085
- 'solrresponse|solrupdateresponse|solrutils|sort|soundex|sphinxclient|spl_autoload|spl_autoload_call|spl_autoload_extensions|' +
22086
- 'spl_autoload_functions|spl_autoload_register|spl_autoload_unregister|spl_classes|spl_object_hash|splbool|spldoublylinkedlist|splenum|' +
22087
- 'splfileinfo|splfileobject|splfixedarray|splfloat|splheap|splint|split|spliti|splmaxheap|splminheap|splobjectstorage|splobserver|' +
22088
- 'splpriorityqueue|splqueue|splstack|splstring|splsubject|spltempfileobject|spoofchecker|sprintf|sql_regcase|sqlite3|sqlite3result|' +
22089
- 'sqlite3stmt|sqlite_array_query|sqlite_busy_timeout|sqlite_changes|sqlite_close|sqlite_column|sqlite_create_aggregate|' +
22090
- 'sqlite_create_function|sqlite_current|sqlite_error_string|sqlite_escape_string|sqlite_exec|sqlite_factory|sqlite_fetch_all|' +
22091
- 'sqlite_fetch_array|sqlite_fetch_column_types|sqlite_fetch_object|sqlite_fetch_single|sqlite_fetch_string|sqlite_field_name|' +
22092
- 'sqlite_has_more|sqlite_has_prev|sqlite_key|sqlite_last_error|sqlite_last_insert_rowid|sqlite_libencoding|sqlite_libversion|sqlite_next|' +
22093
- 'sqlite_num_fields|sqlite_num_rows|sqlite_open|sqlite_popen|sqlite_prev|sqlite_query|sqlite_rewind|sqlite_seek|sqlite_single_query|' +
22094
- 'sqlite_udf_decode_binary|sqlite_udf_encode_binary|sqlite_unbuffered_query|sqlite_valid|sqrt|srand|sscanf|ssdeep_fuzzy_compare|' +
22095
- 'ssdeep_fuzzy_hash|ssdeep_fuzzy_hash_filename|ssh2_auth_hostbased_file|ssh2_auth_none|ssh2_auth_password|ssh2_auth_pubkey_file|' +
22096
- 'ssh2_connect|ssh2_exec|ssh2_fetch_stream|ssh2_fingerprint|ssh2_methods_negotiated|ssh2_publickey_add|ssh2_publickey_init|' +
22097
- 'ssh2_publickey_list|ssh2_publickey_remove|ssh2_scp_recv|ssh2_scp_send|ssh2_sftp|ssh2_sftp_lstat|ssh2_sftp_mkdir|ssh2_sftp_readlink|' +
22098
- 'ssh2_sftp_realpath|ssh2_sftp_rename|ssh2_sftp_rmdir|ssh2_sftp_stat|ssh2_sftp_symlink|ssh2_sftp_unlink|ssh2_shell|ssh2_tunnel|stat|' +
22099
- 'stats_absolute_deviation|stats_cdf_beta|stats_cdf_binomial|stats_cdf_cauchy|stats_cdf_chisquare|stats_cdf_exponential|stats_cdf_f|' +
22100
- 'stats_cdf_gamma|stats_cdf_laplace|stats_cdf_logistic|stats_cdf_negative_binomial|stats_cdf_noncentral_chisquare|stats_cdf_noncentral_f|' +
22101
- 'stats_cdf_poisson|stats_cdf_t|stats_cdf_uniform|stats_cdf_weibull|stats_covariance|stats_den_uniform|stats_dens_beta|stats_dens_cauchy|' +
22102
- 'stats_dens_chisquare|stats_dens_exponential|stats_dens_f|stats_dens_gamma|stats_dens_laplace|stats_dens_logistic|' +
22103
- 'stats_dens_negative_binomial|stats_dens_normal|stats_dens_pmf_binomial|stats_dens_pmf_hypergeometric|stats_dens_pmf_poisson|stats_dens_t|' +
22104
- 'stats_dens_weibull|stats_harmonic_mean|stats_kurtosis|stats_rand_gen_beta|stats_rand_gen_chisquare|stats_rand_gen_exponential|' +
22105
- 'stats_rand_gen_f|stats_rand_gen_funiform|stats_rand_gen_gamma|stats_rand_gen_ibinomial|stats_rand_gen_ibinomial_negative|' +
22106
- 'stats_rand_gen_int|stats_rand_gen_ipoisson|stats_rand_gen_iuniform|stats_rand_gen_noncenral_chisquare|stats_rand_gen_noncentral_f|' +
22107
- 'stats_rand_gen_noncentral_t|stats_rand_gen_normal|stats_rand_gen_t|stats_rand_get_seeds|stats_rand_phrase_to_seeds|stats_rand_ranf|' +
22108
- 'stats_rand_setall|stats_skew|stats_standard_deviation|stats_stat_binomial_coef|stats_stat_correlation|stats_stat_gennch|' +
22109
- 'stats_stat_independent_t|stats_stat_innerproduct|stats_stat_noncentral_t|stats_stat_paired_t|stats_stat_percentile|stats_stat_powersum|' +
22110
- 'stats_variance|stomp|stomp_connect_error|stomp_version|stompexception|stompframe|str_getcsv|str_ireplace|str_pad|str_repeat|str_replace|' +
22111
- 'str_rot13|str_shuffle|str_split|str_word_count|strcasecmp|strchr|strcmp|strcoll|strcspn|stream_bucket_append|stream_bucket_make_writeable|' +
22112
- 'stream_bucket_new|stream_bucket_prepend|stream_context_create|stream_context_get_default|stream_context_get_options|' +
22113
- 'stream_context_get_params|stream_context_set_default|stream_context_set_option|stream_context_set_params|stream_copy_to_stream|' +
22114
- 'stream_encoding|stream_filter_append|stream_filter_prepend|stream_filter_register|stream_filter_remove|stream_get_contents|' +
22115
- 'stream_get_filters|stream_get_line|stream_get_meta_data|stream_get_transports|stream_get_wrappers|stream_is_local|' +
22116
- 'stream_notification_callback|stream_register_wrapper|stream_resolve_include_path|stream_select|stream_set_blocking|stream_set_read_buffer|' +
22117
- 'stream_set_timeout|stream_set_write_buffer|stream_socket_accept|stream_socket_client|stream_socket_enable_crypto|stream_socket_get_name|' +
22118
- 'stream_socket_pair|stream_socket_recvfrom|stream_socket_sendto|stream_socket_server|stream_socket_shutdown|stream_supports_lock|' +
22119
- 'stream_wrapper_register|stream_wrapper_restore|stream_wrapper_unregister|streamwrapper|strftime|strip_tags|stripcslashes|stripos|' +
22120
- 'stripslashes|stristr|strlen|strnatcasecmp|strnatcmp|strncasecmp|strncmp|strpbrk|strpos|strptime|strrchr|strrev|strripos|strrpos|strspn|' +
22121
- 'strstr|strtok|strtolower|strtotime|strtoupper|strtr|strval|substr|substr_compare|substr_count|substr_replace|svm|svmmodel|svn_add|' +
22122
- 'svn_auth_get_parameter|svn_auth_set_parameter|svn_blame|svn_cat|svn_checkout|svn_cleanup|svn_client_version|svn_commit|svn_delete|' +
22123
- 'svn_diff|svn_export|svn_fs_abort_txn|svn_fs_apply_text|svn_fs_begin_txn2|svn_fs_change_node_prop|svn_fs_check_path|' +
22124
- 'svn_fs_contents_changed|svn_fs_copy|svn_fs_delete|svn_fs_dir_entries|svn_fs_file_contents|svn_fs_file_length|svn_fs_is_dir|svn_fs_is_file|' +
22125
- 'svn_fs_make_dir|svn_fs_make_file|svn_fs_node_created_rev|svn_fs_node_prop|svn_fs_props_changed|svn_fs_revision_prop|svn_fs_revision_root|' +
22126
- 'svn_fs_txn_root|svn_fs_youngest_rev|svn_import|svn_log|svn_ls|svn_mkdir|svn_repos_create|svn_repos_fs|svn_repos_fs_begin_txn_for_commit|' +
22127
- 'svn_repos_fs_commit_txn|svn_repos_hotcopy|svn_repos_open|svn_repos_recover|svn_revert|svn_status|svn_update|swf_actiongeturl|' +
22128
- 'swf_actiongotoframe|swf_actiongotolabel|swf_actionnextframe|swf_actionplay|swf_actionprevframe|swf_actionsettarget|swf_actionstop|' +
22129
- 'swf_actiontogglequality|swf_actionwaitforframe|swf_addbuttonrecord|swf_addcolor|swf_closefile|swf_definebitmap|swf_definefont|' +
22130
- 'swf_defineline|swf_definepoly|swf_definerect|swf_definetext|swf_endbutton|swf_enddoaction|swf_endshape|swf_endsymbol|swf_fontsize|' +
22131
- 'swf_fontslant|swf_fonttracking|swf_getbitmapinfo|swf_getfontinfo|swf_getframe|swf_labelframe|swf_lookat|swf_modifyobject|swf_mulcolor|' +
22132
- 'swf_nextid|swf_oncondition|swf_openfile|swf_ortho|swf_ortho2|swf_perspective|swf_placeobject|swf_polarview|swf_popmatrix|swf_posround|' +
22133
- 'swf_pushmatrix|swf_removeobject|swf_rotate|swf_scale|swf_setfont|swf_setframe|swf_shapearc|swf_shapecurveto|swf_shapecurveto3|' +
22134
- 'swf_shapefillbitmapclip|swf_shapefillbitmaptile|swf_shapefilloff|swf_shapefillsolid|swf_shapelinesolid|swf_shapelineto|swf_shapemoveto|' +
22135
- 'swf_showframe|swf_startbutton|swf_startdoaction|swf_startshape|swf_startsymbol|swf_textwidth|swf_translate|swf_viewport|swfaction|' +
22136
- 'swfbitmap|swfbutton|swfdisplayitem|swffill|swffont|swffontchar|swfgradient|swfmorph|swfmovie|swfprebuiltclip|swfshape|swfsound|' +
22137
- 'swfsoundinstance|swfsprite|swftext|swftextfield|swfvideostream|swish_construct|swish_getmetalist|swish_getpropertylist|swish_prepare|' +
22138
- 'swish_query|swishresult_getmetalist|swishresult_stem|swishresults_getparsedwords|swishresults_getremovedstopwords|swishresults_nextresult|' +
22139
- 'swishresults_seekresult|swishsearch_execute|swishsearch_resetlimit|swishsearch_setlimit|swishsearch_setphrasedelimiter|' +
22140
- 'swishsearch_setsort|swishsearch_setstructure|sybase_affected_rows|sybase_close|sybase_connect|sybase_data_seek|' +
22141
- 'sybase_deadlock_retry_count|sybase_fetch_array|sybase_fetch_assoc|sybase_fetch_field|sybase_fetch_object|sybase_fetch_row|' +
22142
- 'sybase_field_seek|sybase_free_result|sybase_get_last_message|sybase_min_client_severity|sybase_min_error_severity|' +
22143
- 'sybase_min_message_severity|sybase_min_server_severity|sybase_num_fields|sybase_num_rows|sybase_pconnect|sybase_query|sybase_result|' +
22144
- 'sybase_select_db|sybase_set_message_handler|sybase_unbuffered_query|symlink|sys_get_temp_dir|sys_getloadavg|syslog|system|tag|tan|tanh|' +
22145
- 'tcpwrap_check|tempnam|textdomain|tidy|tidy_access_count|tidy_config_count|tidy_diagnose|tidy_error_count|tidy_get_error_buffer|' +
22146
- 'tidy_get_output|tidy_load_config|tidy_reset_config|tidy_save_config|tidy_set_encoding|tidy_setopt|tidy_warning_count|tidynode|time|' +
22147
- 'time_nanosleep|time_sleep_until|timezone_abbreviations_list|timezone_identifiers_list|timezone_location_get|timezone_name_from_abbr|' +
22148
- 'timezone_name_get|timezone_offset_get|timezone_open|timezone_transitions_get|timezone_version_get|tmpfile|token_get_all|token_name|' +
22149
- 'tokyotyrant|tokyotyrantquery|tokyotyranttable|tostring|tostring|touch|transliterator|traversable|trigger_error|trim|uasort|ucfirst|' +
22150
- 'ucwords|udm_add_search_limit|udm_alloc_agent|udm_alloc_agent_array|udm_api_version|udm_cat_list|udm_cat_path|udm_check_charset|' +
22151
- 'udm_check_stored|udm_clear_search_limits|udm_close_stored|udm_crc32|udm_errno|udm_error|udm_find|udm_free_agent|udm_free_ispell_data|' +
22152
- 'udm_free_res|udm_get_doc_count|udm_get_res_field|udm_get_res_param|udm_hash32|udm_load_ispell_data|udm_open_stored|udm_set_agent_param|' +
22153
- 'uksort|umask|underflowexception|unexpectedvalueexception|uniqid|unixtojd|unlink|unpack|unregister_tick_function|unserialize|unset|' +
22154
- 'urldecode|urlencode|use_soap_error_handler|user_error|usleep|usort|utf8_decode|utf8_encode|v8js|v8jsexception|var_dump|var_export|variant|' +
22155
- 'variant_abs|variant_add|variant_and|variant_cast|variant_cat|variant_cmp|variant_date_from_timestamp|variant_date_to_timestamp|' +
22156
- 'variant_div|variant_eqv|variant_fix|variant_get_type|variant_idiv|variant_imp|variant_int|variant_mod|variant_mul|variant_neg|variant_not|' +
22157
- 'variant_or|variant_pow|variant_round|variant_set|variant_set_type|variant_sub|variant_xor|version_compare|vfprintf|virtual|' +
22158
- 'vpopmail_add_alias_domain|vpopmail_add_alias_domain_ex|vpopmail_add_domain|vpopmail_add_domain_ex|vpopmail_add_user|vpopmail_alias_add|' +
22159
- 'vpopmail_alias_del|vpopmail_alias_del_domain|vpopmail_alias_get|vpopmail_alias_get_all|vpopmail_auth_user|vpopmail_del_domain|' +
22160
- 'vpopmail_del_domain_ex|vpopmail_del_user|vpopmail_error|vpopmail_passwd|vpopmail_set_user_quota|vprintf|vsprintf|w32api_deftype|' +
22161
- 'w32api_init_dtype|w32api_invoke_function|w32api_register_function|w32api_set_call_method|wddx_add_vars|wddx_deserialize|wddx_packet_end|' +
22162
- 'wddx_packet_start|wddx_serialize_value|wddx_serialize_vars|win32_continue_service|win32_create_service|win32_delete_service|' +
22163
- 'win32_get_last_control_message|win32_pause_service|win32_ps_list_procs|win32_ps_stat_mem|win32_ps_stat_proc|win32_query_service_status|' +
22164
- 'win32_set_service_status|win32_start_service|win32_start_service_ctrl_dispatcher|win32_stop_service|wincache_fcache_fileinfo|' +
22165
- 'wincache_fcache_meminfo|wincache_lock|wincache_ocache_fileinfo|wincache_ocache_meminfo|wincache_refresh_if_changed|' +
22166
- 'wincache_rplist_fileinfo|wincache_rplist_meminfo|wincache_scache_info|wincache_scache_meminfo|wincache_ucache_add|wincache_ucache_cas|' +
22167
- 'wincache_ucache_clear|wincache_ucache_dec|wincache_ucache_delete|wincache_ucache_exists|wincache_ucache_get|wincache_ucache_inc|' +
22168
- 'wincache_ucache_info|wincache_ucache_meminfo|wincache_ucache_set|wincache_unlock|wordwrap|xattr_get|xattr_list|xattr_remove|xattr_set|' +
22169
- 'xattr_supported|xdiff_file_bdiff|xdiff_file_bdiff_size|xdiff_file_bpatch|xdiff_file_diff|xdiff_file_diff_binary|xdiff_file_merge3|' +
22170
- 'xdiff_file_patch|xdiff_file_patch_binary|xdiff_file_rabdiff|xdiff_string_bdiff|xdiff_string_bdiff_size|xdiff_string_bpatch|' +
22171
- 'xdiff_string_diff|xdiff_string_diff_binary|xdiff_string_merge3|xdiff_string_patch|xdiff_string_patch_binary|xdiff_string_rabdiff|' +
22172
- 'xhprof_disable|xhprof_enable|xhprof_sample_disable|xhprof_sample_enable|xml_error_string|xml_get_current_byte_index|' +
22173
- 'xml_get_current_column_number|xml_get_current_line_number|xml_get_error_code|xml_parse|xml_parse_into_struct|xml_parser_create|' +
22174
- 'xml_parser_create_ns|xml_parser_free|xml_parser_get_option|xml_parser_set_option|xml_set_character_data_handler|xml_set_default_handler|' +
22175
- 'xml_set_element_handler|xml_set_end_namespace_decl_handler|xml_set_external_entity_ref_handler|xml_set_notation_decl_handler|' +
22176
- 'xml_set_object|xml_set_processing_instruction_handler|xml_set_start_namespace_decl_handler|xml_set_unparsed_entity_decl_handler|xmlreader|' +
22177
- 'xmlrpc_decode|xmlrpc_decode_request|xmlrpc_encode|xmlrpc_encode_request|xmlrpc_get_type|xmlrpc_is_fault|xmlrpc_parse_method_descriptions|' +
22178
- 'xmlrpc_server_add_introspection_data|xmlrpc_server_call_method|xmlrpc_server_create|xmlrpc_server_destroy|' +
22179
- 'xmlrpc_server_register_introspection_callback|xmlrpc_server_register_method|xmlrpc_set_type|xmlwriter_end_attribute|xmlwriter_end_cdata|' +
22180
- 'xmlwriter_end_comment|xmlwriter_end_document|xmlwriter_end_dtd|xmlwriter_end_dtd_attlist|xmlwriter_end_dtd_element|' +
22181
- 'xmlwriter_end_dtd_entity|xmlwriter_end_element|xmlwriter_end_pi|xmlwriter_flush|xmlwriter_full_end_element|xmlwriter_open_memory|' +
22182
- 'xmlwriter_open_uri|xmlwriter_output_memory|xmlwriter_set_indent|xmlwriter_set_indent_string|xmlwriter_start_attribute|' +
22183
- 'xmlwriter_start_attribute_ns|xmlwriter_start_cdata|xmlwriter_start_comment|xmlwriter_start_document|xmlwriter_start_dtd|' +
22184
- 'xmlwriter_start_dtd_attlist|xmlwriter_start_dtd_element|xmlwriter_start_dtd_entity|xmlwriter_start_element|xmlwriter_start_element_ns|' +
22185
- 'xmlwriter_start_pi|xmlwriter_text|xmlwriter_write_attribute|xmlwriter_write_attribute_ns|xmlwriter_write_cdata|xmlwriter_write_comment|' +
22186
- 'xmlwriter_write_dtd|xmlwriter_write_dtd_attlist|xmlwriter_write_dtd_element|xmlwriter_write_dtd_entity|xmlwriter_write_element|' +
22187
- 'xmlwriter_write_element_ns|xmlwriter_write_pi|xmlwriter_write_raw|xpath_eval|xpath_eval_expression|xpath_new_context|xpath_register_ns|' +
22188
- 'xpath_register_ns_auto|xptr_eval|xptr_new_context|xslt_backend_info|xslt_backend_name|xslt_backend_version|xslt_create|xslt_errno|' +
22189
- 'xslt_error|xslt_free|xslt_getopt|xslt_process|xslt_set_base|xslt_set_encoding|xslt_set_error_handler|xslt_set_log|xslt_set_object|' +
22190
- 'xslt_set_sax_handler|xslt_set_sax_handlers|xslt_set_scheme_handler|xslt_set_scheme_handlers|xslt_setopt|xsltprocessor|yaml_emit|' +
22191
- 'yaml_emit_file|yaml_parse|yaml_parse_file|yaml_parse_url|yaz_addinfo|yaz_ccl_conf|yaz_ccl_parse|yaz_close|yaz_connect|yaz_database|' +
22192
- 'yaz_element|yaz_errno|yaz_error|yaz_es|yaz_es_result|yaz_get_option|yaz_hits|yaz_itemorder|yaz_present|yaz_range|yaz_record|yaz_scan|' +
22193
- 'yaz_scan_result|yaz_schema|yaz_search|yaz_set_option|yaz_sort|yaz_syntax|yaz_wait|yp_all|yp_cat|yp_err_string|yp_errno|yp_first|' +
22194
- 'yp_get_default_domain|yp_master|yp_match|yp_next|yp_order|zend_logo_guid|zend_thread_id|zend_version|zip_close|zip_entry_close|' +
22195
- 'zip_entry_compressedsize|zip_entry_compressionmethod|zip_entry_filesize|zip_entry_name|zip_entry_open|zip_entry_read|zip_open|zip_read|' +
22196
- 'ziparchive|ziparchive_addemptydir|ziparchive_addfile|ziparchive_addfromstring|ziparchive_close|ziparchive_deleteindex|' +
22197
- 'ziparchive_deletename|ziparchive_extractto|ziparchive_getarchivecomment|ziparchive_getcommentindex|ziparchive_getcommentname|' +
22198
- 'ziparchive_getfromindex|ziparchive_getfromname|ziparchive_getnameindex|ziparchive_getstatusstring|ziparchive_getstream|' +
22199
- 'ziparchive_locatename|ziparchive_open|ziparchive_renameindex|ziparchive_renamename|ziparchive_setCommentName|ziparchive_setarchivecomment|' +
22200
- 'ziparchive_setcommentindex|ziparchive_statindex|ziparchive_statname|ziparchive_unchangeall|ziparchive_unchangearchive|' +
22201
- 'ziparchive_unchangeindex|ziparchive_unchangename|zlib_get_coding_type').split('|')
22202
- );
22203
-
22204
- // http://php.net/manual/en/reserved.keywords.php
22205
- var keywords = lang.arrayToMap(
22206
- ('abstract|and|array|as|break|case|catch|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|endif|' +
22207
- 'endswitch|endwhile|extends|final|for|foreach|function|global|goto|if|implements|interface|instanceof|namespace|new|or|private|protected|' +
22208
- 'public|static|switch|throw|try|use|var|while|xor').split('|')
22209
- );
22210
-
22211
- // http://php.net/manual/en/reserved.keywords.php
22212
- var languageConstructs = lang.arrayToMap(
22213
- ('die|echo|empty|exit|eval|include|include_once|isset|list|require|require_once|return|print|unset').split('|')
22214
- );
22215
-
22216
- var builtinConstants = lang.arrayToMap(
22217
- ('true|false|null|__CLASS__|__DIR__|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__NAMESPACE__').split('|')
22218
- );
22219
-
22220
- var builtinVariables = lang.arrayToMap(
22221
- ('$GLOBALS|$_SERVER|$_GET|$_POST|$_FILES|$_REQUEST|$_SESSION|$_ENV|$_COOKIE|$php_errormsg|$HTTP_RAW_POST_DATA|' +
22222
- '$http_response_header|$argc|$argv').split('|')
22223
- );
22224
-
22225
- // Discovery done by downloading 'Many HTML files' from: http://php.net/download-docs.php
22226
- // Then search for files containing 'deprecated' (case-insensitive) and look at each file that turns up.
22227
- var builtinFunctionsDeprecated = lang.arrayToMap(
22228
- ('key_exists|cairo_matrix_create_scale|cairo_matrix_create_translate|call_user_method|call_user_method_array|com_addref|com_get|' +
22229
- 'com_invoke|com_isenum|com_load|com_release|com_set|connection_timeout|cubrid_load_from_glo|cubrid_new_glo|cubrid_save_to_glo|' +
22230
- 'cubrid_send_glo|define_syslog_variables|dl|ereg|ereg_replace|eregi|eregi_replace|hw_documentattributes|hw_documentbodytag|' +
22231
- 'hw_documentsize|hw_outputdocument|imagedashedline|maxdb_bind_param|maxdb_bind_result|maxdb_client_encoding|maxdb_close_long_data|' +
22232
- 'maxdb_execute|maxdb_fetch|maxdb_get_metadata|maxdb_param_count|maxdb_send_long_data|mcrypt_ecb|mcrypt_generic_end|mime_content_type|' +
22233
- 'mysql_createdb|mysql_dbname|mysql_db_query|mysql_drop_db|mysql_dropdb|mysql_escape_string|mysql_fieldflags|mysql_fieldflags|' +
22234
- 'mysql_fieldname|mysql_fieldtable|mysql_fieldtype|mysql_freeresult|mysql_listdbs|mysql_list_fields|mysql_listfields|mysql_list_tables|' +
22235
- 'mysql_listtables|mysql_numfields|mysql_numrows|mysql_selectdb|mysql_tablename|mysqli_bind_param|mysqli_bind_result|' +
22236
- 'mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_execute|' +
22237
- 'mysqli_fetch|mysqli_get_metadata|mysqli_master_query|mysqli_param_count|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|' +
22238
- 'mysqli_send_long_data|mysqli_send_query|mysqli_slave_query|ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|' +
22239
- 'ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|' +
22240
- 'ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|' +
22241
- 'ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|ociloadlob|ocilogoff|ocilogon|ocinewcollection|' +
22242
- 'ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|ocirollback|ocirowcount|ocisavelob|ocisavelobfile|' +
22243
- 'ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|PDF_add_annotation|PDF_add_bookmark|' +
22244
- 'PDF_add_launchlink|PDF_add_locallink|PDF_add_note|PDF_add_outline|PDF_add_pdflink|PDF_add_weblink|PDF_attach_file|PDF_begin_page|' +
22245
- 'PDF_begin_template|PDF_close_pdi|PDF_close|PDF_findfont|PDF_get_font|PDF_get_fontname|PDF_get_fontsize|PDF_get_image_height|' +
22246
- 'PDF_get_image_width|PDF_get_majorversion|PDF_get_minorversion|PDF_get_pdi_parameter|PDF_get_pdi_value|PDF_open_ccitt|PDF_open_file|' +
22247
- 'PDF_open_gif|PDF_open_image_file|PDF_open_image|PDF_open_jpeg|PDF_open_pdi|PDF_open_tiff|PDF_place_image|PDF_place_pdi_page|' +
22248
- 'PDF_set_border_color|PDF_set_border_dash|PDF_set_border_style|PDF_set_char_spacing|PDF_set_duration|PDF_set_horiz_scaling|' +
22249
- 'PDF_set_info_author|PDF_set_info_creator|PDF_set_info_keywords|PDF_set_info_subject|PDF_set_info_title|PDF_set_leading|' +
22250
- 'PDF_set_text_matrix|PDF_set_text_rendering|PDF_set_text_rise|PDF_set_word_spacing|PDF_setgray_fill|PDF_setgray_stroke|PDF_setgray|' +
22251
- 'PDF_setpolydash|PDF_setrgbcolor_fill|PDF_setrgbcolor_stroke|PDF_setrgbcolor|PDF_show_boxed|php_check_syntax|px_set_tablename|' +
22252
- 'px_set_targetencoding|runkit_sandbox_output_handler|session_is_registered|session_register|session_unregister' +
22253
- 'set_magic_quotes_runtime|magic_quotes_runtime|set_socket_blocking|socket_set_blocking|set_socket_timeout|socket_set_timeout|split|spliti|' +
22254
- 'sql_regcase').split('|')
22255
- );
22256
-
22257
- var keywordsDeprecated = lang.arrayToMap(
22258
- ('cfunction|old_function').split('|')
22259
- );
22260
-
22261
- var futureReserved = lang.arrayToMap([]);
22262
-
22263
- // regexp must not have capturing parentheses. Use (?:) instead.
22264
- // regexps are ordered -> the first match is used
22265
-
22266
- this.$rules = {
22267
- "start" : [
22268
- {
22269
- token : "support", // php open tag
22270
- regex : "<\\?(?:php|\\=)"
22271
- },
22272
- {
22273
- token : "support", // php close tag
22274
- regex : "\\?>"
22275
- },
22276
- {
22277
- token : "comment",
22278
- regex : "\\/\\/.*$"
22279
- },
22280
- {
22281
- token : "comment",
22282
- regex : "#.*$"
22283
- },
22284
- new DocCommentHighlightRules().getStartRule("doc-start"),
22285
- {
22286
- token : "comment", // multi line comment
22287
- merge : true,
22288
- regex : "\\/\\*",
22289
- next : "comment"
22290
- }, {
22291
- token : "string.regexp",
22292
- regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"
22293
- }, {
22294
- token : "string", // single line
22295
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
22296
- }, {
22297
- token : "string", // multi line string start
22298
- merge : true,
22299
- regex : '["].*\\\\$',
22300
- next : "qqstring"
22301
- }, {
22302
- token : "string", // single line
22303
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
22304
- }, {
22305
- token : "string", // multi line string start
22306
- merge : true,
22307
- regex : "['].*\\\\$",
22308
- next : "qstring"
22309
- }, {
22310
- token : "constant.numeric", // hex
22311
- regex : "0[xX][0-9a-fA-F]+\\b"
22312
- }, {
22313
- token : "constant.numeric", // float
22314
- regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
22315
- }, {
22316
- token : "constant.language", // constants
22317
- regex : "\\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|" +
22318
- "ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|" +
22319
- "HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|" +
22320
- "L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|" +
22321
- "VERSION))|__COMPILER_HALT_OFFSET__)\\b"
22322
- }, {
22323
- token : "constant.language", // constants
22324
- regex : "\\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|" +
22325
- "SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|" +
22326
- "O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|" +
22327
- "R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|" +
22328
- "YPT_(?:BLOWFISH|EXT_DES|MD5|S(?:ALT_LENGTH|TD_DES)))|URRENCY_SYMBOL)|D(?:AY_(?:1|2|3|4|5|6|7)|" +
22329
- "ECIMAL_POINT|IRECTORY_SEPARATOR|_(?:FMT|T_FMT))|E(?:NT_(?:COMPAT|NOQUOTES|QUOTES)|RA(?:_(?:D_(?:FMT|T_FMT)|" +
22330
- "T_FMT|YEAR)|)|XTR_(?:IF_EXISTS|OVERWRITE|PREFIX_(?:ALL|I(?:F_EXISTS|NVALID)|SAME)|SKIP))|FRAC_DIGITS|GROUPING|" +
22331
- "HTML_(?:ENTITIES|SPECIALCHARS)|IN(?:FO_(?:ALL|C(?:ONFIGURATION|REDITS)|ENVIRONMENT|GENERAL|LICENSE|MODULES|VARIABLES)|" +
22332
- "I_(?:ALL|PERDIR|SYSTEM|USER)|T_(?:CURR_SYMBOL|FRAC_DIGITS))|L(?:C_(?:ALL|C(?:OLLATE|TYPE)|M(?:ESSAGES|ONETARY)|NUMERIC|TIME)|" +
22333
- "O(?:CK_(?:EX|NB|SH|UN)|G_(?:A(?:LERT|UTH(?:PRIV|))|C(?:ONS|R(?:IT|ON))|D(?:AEMON|EBUG)|E(?:MERG|RR)|INFO|KERN|" +
22334
- "L(?:OCAL(?:0|1|2|3|4|5|6|7)|PR)|MAIL|N(?:DELAY|EWS|O(?:TICE|WAIT))|ODELAY|P(?:ERROR|ID)|SYSLOG|U(?:SER|UCP)|WARNING)))|" +
22335
- "M(?:ON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9|DECIMAL_POINT|GROUPING|THOUSANDS_SEP)|_(?:1_PI|2_(?:PI|SQRTPI)|E|L(?:N(?:10|2)|" +
22336
- "OG(?:10E|2E))|PI(?:_(?:2|4)|)|SQRT(?:1_2|2)))|N(?:EGATIVE_SIGN|O(?:EXPR|STR)|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|" +
22337
- "P(?:ATH(?:INFO_(?:BASENAME|DIRNAME|EXTENSION)|_SEPARATOR)|M_STR|OSITIVE_SIGN|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|" +
22338
- "RADIXCHAR|S(?:EEK_(?:CUR|END|SET)|ORT_(?:ASC|DESC|NUMERIC|REGULAR|STRING)|TR_PAD_(?:BOTH|LEFT|RIGHT))|" +
22339
- "T(?:HOUS(?:ANDS_SEP|EP)|_FMT(?:_AMPM|))|YES(?:EXPR|STR)|STD(?:IN|OUT|ERR))\\b"
22340
- }, {
22341
- token : function(value) {
22342
- if (keywordsDeprecated.hasOwnProperty(value))
22343
- return "invalid.deprecated";
22344
- else if (keywords.hasOwnProperty(value))
22345
- return "keyword";
22346
- else if (languageConstructs.hasOwnProperty(value))
22347
- return "keyword";
22348
- else if (builtinConstants.hasOwnProperty(value))
22349
- return "constant.language";
22350
- else if (builtinVariables.hasOwnProperty(value))
22351
- return "variable.language";
22352
- else if (futureReserved.hasOwnProperty(value))
22353
- return "invalid.illegal";
22354
- else if (builtinFunctionsDeprecated.hasOwnProperty(value))
22355
- return "invalid.deprecated";
22356
- else if (builtinFunctions.hasOwnProperty(value))
22357
- return "support.function";
22358
- else
22359
- if(value.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|self|parent)$/))
22360
- return "variable";
22361
- return "identifier";
22362
- },
22363
- // TODO: Unicode escape sequences
22364
- // TODO: Unicode identifiers
22365
- regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
22366
- }, {
22367
- token : "keyword.operator",
22368
- regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
22369
- }, {
22370
- token : "lparen",
22371
- regex : "[[({]"
22372
- }, {
22373
- token : "rparen",
22374
- regex : "[\\])}]"
22375
- }, {
22376
- token : "text",
22377
- regex : "\\s+"
22378
- }
22379
- ],
22380
- "comment" : [
22381
- {
22382
- token : "comment", // closing comment
22383
- regex : ".*?\\*\\/",
22384
- next : "start"
22385
- }, {
22386
- token : "comment", // comment spanning whole line
22387
- merge : true,
22388
- regex : ".+"
22389
- }
22390
- ],
22391
- "qqstring" : [
22392
- {
22393
- token : "string",
22394
- regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
22395
- next : "start"
22396
- }, {
22397
- token : "string",
22398
- merge : true,
22399
- regex : '.+'
22400
- }
22401
- ],
22402
- "qstring" : [
22403
- {
22404
- token : "string",
22405
- regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
22406
- next : "start"
22407
- }, {
22408
- token : "string",
22409
- merge : true,
22410
- regex : '.+'
22411
- }
22412
- ]
22413
- };
22414
-
22415
- this.embedRules(DocCommentHighlightRules, "doc-",
22416
- [ new DocCommentHighlightRules().getEndRule("start") ]);
22417
- };
22418
-
22419
- oop.inherits(PhpHighlightRules, TextHighlightRules);
22420
-
22421
- exports.PhpHighlightRules = PhpHighlightRules;
22422
- });
22423
- define('ace/mode/java', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/java_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
22424
-
22425
- var oop = require("pilot/oop");
22426
- var JavaScriptMode = require("ace/mode/javascript").Mode;
22427
- var Tokenizer = require("ace/tokenizer").Tokenizer;
22428
- var JavaHighlightRules = require("ace/mode/java_highlight_rules").JavaHighlightRules;
22429
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
22430
- var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
22431
-
22432
- var Mode = function() {
22433
- this.$tokenizer = new Tokenizer(new JavaHighlightRules().getRules());
22434
- this.$outdent = new MatchingBraceOutdent();
22435
- this.$behaviour = new CstyleBehaviour();
22436
- };
22437
- oop.inherits(Mode, JavaScriptMode);
22438
-
22439
- (function() {
22440
-
22441
- this.createWorker = function(session) {
22442
- return null;
22443
- };
22444
-
22445
- }).call(Mode.prototype);
22446
-
22447
- exports.Mode = Mode;
22448
- });
22449
- define('ace/mode/java_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
22450
-
22451
- var oop = require("pilot/oop");
22452
- var lang = require("pilot/lang");
22453
- var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
22454
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
22455
-
22456
- var JavaHighlightRules = function() {
22457
-
22458
- // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html
22459
- var keywords = lang.arrayToMap(
22460
- ("abstract|continue|for|new|switch|" +
22461
- "assert|default|goto|package|synchronized|" +
22462
- "boolean|do|if|private|this|" +
22463
- "break|double|implements|protected|throw|" +
22464
- "byte|else|import|public|throws|" +
22465
- "case|enum|instanceof|return|transient|" +
22466
- "catch|extends|int|short|try|" +
22467
- "char|final|interface|static|void|" +
22468
- "class|finally|long|strictfp|volatile|" +
22469
- "const|float|native|super|while").split("|")
22470
- );
22471
-
22472
- var buildinConstants = lang.arrayToMap(
22473
- ("null|Infinity|NaN|undefined").split("|")
22474
- );
22475
-
22476
- var langClasses = lang.arrayToMap(
22477
- ("AbstractMethodError|AssertionError|ClassCircularityError|"+
22478
- "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
22479
- "ExceptionInInitializerError|IllegalAccessError|"+
22480
- "IllegalThreadStateException|InstantiationError|InternalError|"+
22481
- "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
22482
- "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
22483
- "SuppressWarnings|TypeNotPresentException|UnknownError|"+
22484
- "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
22485
- "InstantiationException|IndexOutOfBoundsException|"+
22486
- "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
22487
- "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
22488
- "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
22489
- "InterruptedException|NoSuchMethodException|IllegalAccessException|"+
22490
- "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
22491
- "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
22492
- "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
22493
- "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
22494
- "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
22495
- "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
22496
- "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
22497
- "ArrayStoreException|ClassCastException|LinkageError|"+
22498
- "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
22499
- "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
22500
- "Cloneable|Class|CharSequence|Comparable|String|Object").split("|")
22501
- );
22502
-
22503
- var importClasses = lang.arrayToMap(
22504
- ("").split("|")
22505
- );
22506
- // regexp must not have capturing parentheses. Use (?:) instead.
22507
- // regexps are ordered -> the first match is used
22508
-
22509
- this.$rules = {
22510
- "start" : [
22511
- {
22512
- token : "comment",
22513
- regex : "\\/\\/.*$"
22514
- },
22515
- new DocCommentHighlightRules().getStartRule("doc-start"),
22516
- {
22517
- token : "comment", // multi line comment
22518
- merge : true,
22519
- regex : "\\/\\*",
22520
- next : "comment"
22521
- }, {
22522
- token : "string.regexp",
22523
- regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
22524
- }, {
22525
- token : "string", // single line
22526
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
22527
- }, {
22528
- token : "string", // single line
22529
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
22530
- }, {
22531
- token : "constant.numeric", // hex
22532
- regex : "0[xX][0-9a-fA-F]+\\b"
22533
- }, {
22534
- token : "constant.numeric", // float
22535
- regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
22536
- }, {
22537
- token : "constant.language.boolean",
22538
- regex : "(?:true|false)\\b"
22539
- }, {
22540
- token : function(value) {
22541
- if (value == "this")
22542
- return "variable.language";
22543
- else if (keywords.hasOwnProperty(value))
22544
- return "keyword";
22545
- else if (langClasses.hasOwnProperty(value))
22546
- return "support.function";
22547
- else if (importClasses.hasOwnProperty(value))
22548
- return "support.function";
22549
- else if (buildinConstants.hasOwnProperty(value))
22550
- return "constant.language";
22551
- else
22552
- return "identifier";
22553
- },
22554
- // TODO: Unicode escape sequences
22555
- // TODO: Unicode identifiers
22556
- regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
22557
- }, {
22558
- token : "keyword.operator",
22559
- regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
22560
- }, {
22561
- token : "lparen",
22562
- regex : "[[({]"
22563
- }, {
22564
- token : "rparen",
22565
- regex : "[\\])}]"
22566
- }, {
22567
- token : "text",
22568
- regex : "\\s+"
22569
- }
22570
- ],
22571
- "comment" : [
22572
- {
22573
- token : "comment", // closing comment
22574
- regex : ".*?\\*\\/",
22575
- next : "start"
22576
- }, {
22577
- token : "comment", // comment spanning whole line
22578
- merge : true,
22579
- regex : ".+"
22580
- }
22581
- ]
22582
- };
22583
-
22584
- this.embedRules(DocCommentHighlightRules, "doc-",
22585
- [ new DocCommentHighlightRules().getEndRule("start") ]);
22586
- };
22587
-
22588
- oop.inherits(JavaHighlightRules, TextHighlightRules);
22589
-
22590
- exports.JavaHighlightRules = JavaHighlightRules;
22591
- });
22592
- define('ace/mode/csharp', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/csharp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
22593
-
22594
- var oop = require("pilot/oop");
22595
- var TextMode = require("ace/mode/text").Mode;
22596
- var Tokenizer = require("ace/tokenizer").Tokenizer;
22597
- var CSharpHighlightRules = require("ace/mode/csharp_highlight_rules").CSharpHighlightRules;
22598
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
22599
- var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
22600
-
22601
- var Mode = function() {
22602
- this.$tokenizer = new Tokenizer(new CSharpHighlightRules().getRules());
22603
- this.$outdent = new MatchingBraceOutdent();
22604
- this.$behaviour = new CstyleBehaviour();
22605
- };
22606
- oop.inherits(Mode, TextMode);
22607
-
22608
- (function() {
22609
-
22610
- this.getNextLineIndent = function(state, line, tab) {
22611
- var indent = this.$getIndent(line);
22612
-
22613
- var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
22614
- var tokens = tokenizedLine.tokens;
22615
- var endState = tokenizedLine.state;
22616
-
22617
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
22618
- return indent;
22619
- }
22620
-
22621
- if (state == "start") {
22622
- var match = line.match(/^.*[\{\(\[]\s*$/);
22623
- if (match) {
22624
- indent += tab;
22625
- }
22626
- }
22627
-
22628
- return indent;
22629
- };
22630
-
22631
- this.checkOutdent = function(state, line, input) {
22632
- return this.$outdent.checkOutdent(line, input);
22633
- };
22634
-
22635
- this.autoOutdent = function(state, doc, row) {
22636
- this.$outdent.autoOutdent(doc, row);
22637
- };
22638
-
22639
-
22640
- this.createWorker = function(session) {
22641
- return null;
22642
- };
22643
-
22644
- }).call(Mode.prototype);
22645
-
22646
- exports.Mode = Mode;
22647
- });
22648
- define('ace/mode/csharp_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
22649
-
22650
- var oop = require("pilot/oop");
22651
- var lang = require("pilot/lang");
22652
- var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
22653
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
22654
-
22655
- var CSharpHighlightRules = function() {
22656
-
22657
- var keywords = lang.arrayToMap(
22658
- ("abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic").split("|")
22659
- );
22660
-
22661
- var buildinConstants = lang.arrayToMap(
22662
- ("null|true|false").split("|")
22663
- );
22664
-
22665
-
22666
- // regexp must not have capturing parentheses. Use (?:) instead.
22667
- // regexps are ordered -> the first match is used
22668
-
22669
- this.$rules = {
22670
- "start" : [
22671
- {
22672
- token : "comment",
22673
- regex : "\\/\\/.*$"
22674
- },
22675
- new DocCommentHighlightRules().getStartRule("doc-start"),
22676
- {
22677
- token : "comment", // multi line comment
22678
- regex : "\\/\\*",
22679
- merge : true,
22680
- next : "comment"
22681
- }, {
22682
- token : "string.regexp",
22683
- regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
22684
- }, {
22685
- token : "string", // single line
22686
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
22687
- }, {
22688
- token : "string", // single line
22689
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
22690
- }, {
22691
- token : "constant.numeric", // hex
22692
- regex : "0[xX][0-9a-fA-F]+\\b"
22693
- }, {
22694
- token : "constant.numeric", // float
22695
- regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
22696
- }, {
22697
- token : "constant.language.boolean",
22698
- regex : "(?:true|false)\\b"
22699
- }, {
22700
- token : function(value) {
22701
- if (value == "this")
22702
- return "variable.language";
22703
- else if (keywords.hasOwnProperty(value))
22704
- return "keyword";
22705
- else if (buildinConstants.hasOwnProperty(value))
22706
- return "constant.language";
22707
- else
22708
- return "identifier";
22709
- },
22710
- // TODO: Unicode escape sequences
22711
- // TODO: Unicode identifiers
22712
- regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
22713
- }, {
22714
- token : "keyword.operator",
22715
- regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
22716
- }, {
22717
- token : "lparen",
22718
- regex : "[[({]"
22719
- }, {
22720
- token : "rparen",
22721
- regex : "[\\])}]"
22722
- }, {
22723
- token : "text",
22724
- regex : "\\s+"
22725
- }
22726
- ],
22727
- "comment" : [
22728
- {
22729
- token : "comment", // closing comment
22730
- regex : ".*?\\*\\/",
22731
- next : "start"
22732
- }, {
22733
- token : "comment", // comment spanning whole line
22734
- merge : true,
22735
- regex : ".+"
22736
- }
22737
- ]
22738
- };
22739
-
22740
- this.embedRules(DocCommentHighlightRules, "doc-",
22741
- [ new DocCommentHighlightRules().getEndRule("start") ]);
22742
- };
22743
-
22744
- oop.inherits(CSharpHighlightRules, TextHighlightRules);
22745
-
22746
- exports.CSharpHighlightRules = CSharpHighlightRules;
22747
- });
22748
- /* ***** BEGIN LICENSE BLOCK *****
22749
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
22750
- *
22751
- * The contents of this file are subject to the Mozilla Public License Version
22752
- * 1.1 (the "License"); you may not use this file except in compliance with
22753
- * the License. You may obtain a copy of the License at
22754
- * http://www.mozilla.org/MPL/
22755
- *
22756
- * Software distributed under the License is distributed on an "AS IS" basis,
22757
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
22758
- * for the specific language governing rights and limitations under the
22759
- * License.
22760
- *
22761
- * The Original Code is Ajax.org Code Editor (ACE).
22762
- *
22763
- * The Initial Developer of the Original Code is
22764
- * Ajax.org B.V.
22765
- * Portions created by the Initial Developer are Copyright (C) 2010
22766
- * the Initial Developer. All Rights Reserved.
22767
- *
22768
- * Contributor(s):
22769
- * Fabian Jakobs <fabian AT ajax DOT org>
22770
- * Shlomo Zalman Heigh <shlomozalmanheigh AT gmail DOT com>
22771
- *
22772
- * Alternatively, the contents of this file may be used under the terms of
22773
- * either the GNU General Public License Version 2 or later (the "GPL"), or
22774
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
22775
- * in which case the provisions of the GPL or the LGPL are applicable instead
22776
- * of those above. If you wish to allow use of your version of this file only
22777
- * under the terms of either the GPL or the LGPL, and not to allow others to
22778
- * use your version of this file under the terms of the MPL, indicate your
22779
- * decision by deleting the provisions above and replace them with the notice
22780
- * and other provisions required by the GPL or the LGPL. If you do not delete
22781
- * the provisions above, a recipient may use your version of this file under
22782
- * the terms of any one of the MPL, the GPL or the LGPL.
22783
- *
22784
- * ***** END LICENSE BLOCK ***** */
22785
-
22786
- define('ace/mode/ruby', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ruby_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) {
22787
-
22788
- var oop = require("pilot/oop");
22789
- var TextMode = require("ace/mode/text").Mode;
22790
- var Tokenizer = require("ace/tokenizer").Tokenizer;
22791
- var RubyHighlightRules = require("ace/mode/ruby_highlight_rules").RubyHighlightRules;
22792
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
22793
- var Range = require("ace/range").Range;
22794
-
22795
- var Mode = function() {
22796
- this.$tokenizer = new Tokenizer(new RubyHighlightRules().getRules());
22797
- this.$outdent = new MatchingBraceOutdent();
22798
- };
22799
- oop.inherits(Mode, TextMode);
22800
-
22801
- (function() {
22802
-
22803
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
22804
- var outdent = true;
22805
- var outentedRows = [];
22806
- var re = /^(\s*)#/;
22807
-
22808
- for (var i=startRow; i<= endRow; i++) {
22809
- if (!re.test(doc.getLine(i))) {
22810
- outdent = false;
22811
- break;
22812
- }
22813
- }
22814
-
22815
- if (outdent) {
22816
- var deleteRange = new Range(0, 0, 0, 0);
22817
- for (var i=startRow; i<= endRow; i++)
22818
- {
22819
- var line = doc.getLine(i);
22820
- var m = line.match(re);
22821
- deleteRange.start.row = i;
22822
- deleteRange.end.row = i;
22823
- deleteRange.end.column = m[0].length;
22824
- doc.replace(deleteRange, m[1]);
22825
- }
22826
- }
22827
- else {
22828
- doc.indentRows(startRow, endRow, "#");
22829
- }
22830
- };
22831
-
22832
- this.getNextLineIndent = function(state, line, tab) {
22833
- var indent = this.$getIndent(line);
22834
-
22835
- var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
22836
- var tokens = tokenizedLine.tokens;
22837
- var endState = tokenizedLine.state;
22838
-
22839
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
22840
- return indent;
22841
- }
22842
-
22843
- if (state == "start") {
22844
- var match = line.match(/^.*[\{\(\[]\s*$/);
22845
- if (match) {
22846
- indent += tab;
22847
- }
22848
- }
22849
-
22850
- return indent;
22851
- };
22852
-
22853
- this.checkOutdent = function(state, line, input) {
22854
- return this.$outdent.checkOutdent(line, input);
22855
- };
22856
-
22857
- this.autoOutdent = function(state, doc, row) {
22858
- this.$outdent.autoOutdent(doc, row);
22859
- };
22860
-
22861
- }).call(Mode.prototype);
22862
-
22863
- exports.Mode = Mode;
22864
- });
22865
- /* ***** BEGIN LICENSE BLOCK *****
22866
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
22867
- *
22868
- * The contents of this file are subject to the Mozilla Public License Version
22869
- * 1.1 (the "License"); you may not use this file except in compliance with
22870
- * the License. You may obtain a copy of the License at
22871
- * http://www.mozilla.org/MPL/
22872
- *
22873
- * Software distributed under the License is distributed on an "AS IS" basis,
22874
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
22875
- * for the specific language governing rights and limitations under the
22876
- * License.
22877
- *
22878
- * The Original Code is Ajax.org Code Editor (ACE).
22879
- *
22880
- * The Initial Developer of the Original Code is
22881
- * Ajax.org B.V.
22882
- * Portions created by the Initial Developer are Copyright (C) 2010
22883
- * the Initial Developer. All Rights Reserved.
22884
- *
22885
- * Contributor(s):
22886
- * Fabian Jakobs <fabian AT ajax DOT org>
22887
- * Shlomo Zalman Heigh <shlomozalmanheigh AT gmail DOT com>
22888
- *
22889
- * Alternatively, the contents of this file may be used under the terms of
22890
- * either the GNU General Public License Version 2 or later (the "GPL"), or
22891
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
22892
- * in which case the provisions of the GPL or the LGPL are applicable instead
22893
- * of those above. If you wish to allow use of your version of this file only
22894
- * under the terms of either the GPL or the LGPL, and not to allow others to
22895
- * use your version of this file under the terms of the MPL, indicate your
22896
- * decision by deleting the provisions above and replace them with the notice
22897
- * and other provisions required by the GPL or the LGPL. If you do not delete
22898
- * the provisions above, a recipient may use your version of this file under
22899
- * the terms of any one of the MPL, the GPL or the LGPL.
22900
- *
22901
- * ***** END LICENSE BLOCK ***** */
22902
-
22903
- define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
22904
-
22905
- var oop = require("pilot/oop");
22906
- var lang = require("pilot/lang");
22907
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
22908
-
22909
- var RubyHighlightRules = function() {
22910
-
22911
- var builtinFunctions = lang.arrayToMap(
22912
- ("abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
22913
- "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
22914
- "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
22915
- "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
22916
- "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
22917
- "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
22918
- "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
22919
- "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
22920
- "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
22921
- "gsub!|get_via_redirect|h|host!|https?|https!|include|Integer|lambda|link_to|" +
22922
- "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
22923
- "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
22924
- "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
22925
- "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
22926
- "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
22927
- "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
22928
- "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
22929
- "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
22930
- "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
22931
- "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
22932
- "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
22933
- "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
22934
- "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
22935
- "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
22936
- "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
22937
- "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
22938
- "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
22939
- "translate|localize|extract_locale_from_tld|t|l|caches_page|expire_page|caches_action|expire_action|" +
22940
- "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
22941
- "has_many|has_one|belongs_to|has_and_belongs_to_many").split("|")
22942
- );
22943
-
22944
- var keywords = lang.arrayToMap(
22945
- ("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
22946
- "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
22947
- "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield").split("|")
22948
- );
22949
-
22950
- var buildinConstants = lang.arrayToMap(
22951
- ("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
22952
- "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING").split("|")
22953
- );
22954
-
22955
- var builtinVariables = lang.arrayToMap(
22956
- ("\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
22957
- "$!|root_url|flash|session|cookies|params|request|response|logger").split("|")
22958
- );
22959
-
22960
- // regexp must not have capturing parentheses. Use (?:) instead.
22961
- // regexps are ordered -> the first match is used
22962
-
22963
- this.$rules = {
22964
- "start" : [
22965
- {
22966
- token : "comment",
22967
- regex : "#.*$"
22968
- }, {
22969
- token : "comment", // multi line comment
22970
- merge : true,
22971
- regex : "^\=begin$",
22972
- next : "comment"
22973
- }, {
22974
- token : "string.regexp",
22975
- regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
22976
- }, {
22977
- token : "string", // single line
22978
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
22979
- }, {
22980
- token : "string", // single line
22981
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
22982
- }, {
22983
- token : "string", // backtick string
22984
- regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
22985
- }, {
22986
- token : "text", // namespaces aren't symbols
22987
- regex : "::"
22988
- }, {
22989
- token : "variable.instancce", // instance variable
22990
- regex : "@{1,2}(?:[a-zA-Z_]|\d)+"
22991
- }, {
22992
- token : "variable.class", // class name
22993
- regex : "[A-Z](?:[a-zA-Z_]|\d)+"
22994
- }, {
22995
- token : "string", // symbol
22996
- regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
22997
- }, {
22998
- token : "constant.numeric", // hex
22999
- regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
23000
- }, {
23001
- token : "constant.numeric", // float
23002
- regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
23003
- }, {
23004
- token : "constant.language.boolean",
23005
- regex : "(?:true|false)\\b"
23006
- }, {
23007
- token : function(value) {
23008
- if (value == "self")
23009
- return "variable.language";
23010
- else if (keywords.hasOwnProperty(value))
23011
- return "keyword";
23012
- else if (buildinConstants.hasOwnProperty(value))
23013
- return "constant.language";
23014
- else if (builtinVariables.hasOwnProperty(value))
23015
- return "variable.language";
23016
- else if (builtinFunctions.hasOwnProperty(value))
23017
- return "support.function";
23018
- else if (value == "debugger")
23019
- return "invalid.deprecated";
23020
- else
23021
- return "identifier";
23022
- },
23023
- // TODO: Unicode escape sequences
23024
- // TODO: Unicode identifiers
23025
- regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
23026
- }, {
23027
- token : "keyword.operator",
23028
- regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
23029
- }, {
23030
- token : "lparen",
23031
- regex : "[[({]"
23032
- }, {
23033
- token : "rparen",
23034
- regex : "[\\])}]"
23035
- }, {
23036
- token : "text",
23037
- regex : "\\s+"
23038
- }
23039
- ],
23040
- "comment" : [
23041
- {
23042
- token : "comment", // closing comment
23043
- regex : "^\=end$",
23044
- next : "start"
23045
- }, {
23046
- token : "comment", // comment spanning whole line
23047
- merge : true,
23048
- regex : ".+"
23049
- }
23050
- ]
23051
- };
23052
- };
23053
-
23054
- oop.inherits(RubyHighlightRules, TextHighlightRules);
23055
-
23056
- exports.RubyHighlightRules = RubyHighlightRules;
23057
- });
23058
- /* ***** BEGIN LICENSE BLOCK *****
23059
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
23060
- *
23061
- * The contents of this file are subject to the Mozilla Public License Version
23062
- * 1.1 (the "License"); you may not use this file except in compliance with
23063
- * the License. You may obtain a copy of the License at
23064
- * http://www.mozilla.org/MPL/
23065
- *
23066
- * Software distributed under the License is distributed on an "AS IS" basis,
23067
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
23068
- * for the specific language governing rights and limitations under the
23069
- * License.
23070
- *
23071
- * The Original Code is Ajax.org Code Editor (ACE).
23072
- *
23073
- * The Initial Developer of the Original Code is
23074
- * Ajax.org B.V.
23075
- * Portions created by the Initial Developer are Copyright (C) 2010
23076
- * the Initial Developer. All Rights Reserved.
23077
- *
23078
- * Contributor(s):
23079
- * Fabian Jakobs <fabian AT ajax DOT org>
23080
- * Gastón Kleiman <gaston.kleiman AT gmail DOT com>
23081
- *
23082
- * Alternatively, the contents of this file may be used under the terms of
23083
- * either the GNU General Public License Version 2 or later (the "GPL"), or
23084
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
23085
- * in which case the provisions of the GPL or the LGPL are applicable instead
23086
- * of those above. If you wish to allow use of your version of this file only
23087
- * under the terms of either the GPL or the LGPL, and not to allow others to
23088
- * use your version of this file under the terms of the MPL, indicate your
23089
- * decision by deleting the provisions above and replace them with the notice
23090
- * and other provisions required by the GPL or the LGPL. If you do not delete
23091
- * the provisions above, a recipient may use your version of this file under
23092
- * the terms of any one of the MPL, the GPL or the LGPL.
23093
- *
23094
- * ***** END LICENSE BLOCK ***** */
23095
-
23096
- define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'pilot/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
23097
-
23098
- var oop = require("pilot/oop");
23099
- var TextMode = require("ace/mode/text").Mode;
23100
- var Tokenizer = require("ace/tokenizer").Tokenizer;
23101
- var c_cppHighlightRules = require("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules;
23102
- var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
23103
- var Range = require("ace/range").Range;
23104
- var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
23105
-
23106
- var Mode = function() {
23107
- this.$tokenizer = new Tokenizer(new c_cppHighlightRules().getRules());
23108
- this.$outdent = new MatchingBraceOutdent();
23109
- this.$behaviour = new CstyleBehaviour();
23110
- };
23111
- oop.inherits(Mode, TextMode);
23112
-
23113
- (function() {
23114
-
23115
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
23116
- var outdent = true;
23117
- var outentedRows = [];
23118
- var re = /^(\s*)\/\//;
23119
-
23120
- for (var i=startRow; i<= endRow; i++) {
23121
- if (!re.test(doc.getLine(i))) {
23122
- outdent = false;
23123
- break;
23124
- }
23125
- }
23126
-
23127
- if (outdent) {
23128
- var deleteRange = new Range(0, 0, 0, 0);
23129
- for (var i=startRow; i<= endRow; i++)
23130
- {
23131
- var line = doc.getLine(i);
23132
- var m = line.match(re);
23133
- deleteRange.start.row = i;
23134
- deleteRange.end.row = i;
23135
- deleteRange.end.column = m[0].length;
23136
- doc.replace(deleteRange, m[1]);
23137
- }
23138
- }
23139
- else {
23140
- doc.indentRows(startRow, endRow, "//");
23141
- }
23142
- };
23143
-
23144
- this.getNextLineIndent = function(state, line, tab) {
23145
- var indent = this.$getIndent(line);
23146
-
23147
- var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
23148
- var tokens = tokenizedLine.tokens;
23149
- var endState = tokenizedLine.state;
23150
-
23151
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
23152
- return indent;
23153
- }
23154
-
23155
- if (state == "start") {
23156
- var match = line.match(/^.*[\{\(\[]\s*$/);
23157
- if (match) {
23158
- indent += tab;
23159
- }
23160
- } else if (state == "doc-start") {
23161
- if (endState == "start") {
23162
- return "";
23163
- }
23164
- var match = line.match(/^\s*(\/?)\*/);
23165
- if (match) {
23166
- if (match[1]) {
23167
- indent += " ";
23168
- }
23169
- indent += "* ";
23170
- }
23171
- }
23172
-
23173
- return indent;
23174
- };
23175
-
23176
- this.checkOutdent = function(state, line, input) {
23177
- return this.$outdent.checkOutdent(line, input);
23178
- };
23179
-
23180
- this.autoOutdent = function(state, doc, row) {
23181
- this.$outdent.autoOutdent(doc, row);
23182
- };
23183
-
23184
- }).call(Mode.prototype);
23185
-
23186
- exports.Mode = Mode;
23187
- });
23188
- /* ***** BEGIN LICENSE BLOCK *****
23189
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
23190
- *
23191
- * The contents of this file are subject to the Mozilla Public License Version
23192
- * 1.1 (the "License"); you may not use this file except in compliance with
23193
- * the License. You may obtain a copy of the License at
23194
- * http://www.mozilla.org/MPL/
23195
- *
23196
- * Software distributed under the License is distributed on an "AS IS" basis,
23197
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
23198
- * for the specific language governing rights and limitations under the
23199
- * License.
23200
- *
23201
- * The Original Code is Ajax.org Code Editor (ACE).
23202
- *
23203
- * The Initial Developer of the Original Code is
23204
- * Ajax.org B.V.
23205
- * Portions created by the Initial Developer are Copyright (C) 2010
23206
- * the Initial Developer. All Rights Reserved.
23207
- *
23208
- * Contributor(s):
23209
- * Fabian Jakobs <fabian AT ajax DOT org>
23210
- * Gastón Kleiman <gaston.kleiman AT gmail DOT com>
23211
- *
23212
- * Based on Bespin's C/C++ Syntax Plugin by Marc McIntyre.
23213
- *
23214
- * Alternatively, the contents of this file may be used under the terms of
23215
- * either the GNU General Public License Version 2 or later (the "GPL"), or
23216
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
23217
- * in which case the provisions of the GPL or the LGPL are applicable instead
23218
- * of those above. If you wish to allow use of your version of this file only
23219
- * under the terms of either the GPL or the LGPL, and not to allow others to
23220
- * use your version of this file under the terms of the MPL, indicate your
23221
- * decision by deleting the provisions above and replace them with the notice
23222
- * and other provisions required by the GPL or the LGPL. If you do not delete
23223
- * the provisions above, a recipient may use your version of this file under
23224
- * the terms of any one of the MPL, the GPL or the LGPL.
23225
- *
23226
- * ***** END LICENSE BLOCK ***** */
23227
-
23228
- define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/lang', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
23229
-
23230
- var oop = require("pilot/oop");
23231
- var lang = require("pilot/lang");
23232
- var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
23233
- var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
23234
-
23235
- var c_cppHighlightRules = function() {
23236
-
23237
- var keywords = lang.arrayToMap(
23238
- ("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|" +
23239
- "asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|" +
23240
- "typeid|bitor|extern|protected|typename|bool|false|public|union|" +
23241
- "break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|" +
23242
- "friend|return|virtual|char|goto|short|void|class|if|signed|volatile|" +
23243
- "compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|" +
23244
- "static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|" +
23245
- "switch|delete|new|template|do|not|this|for").split("|")
23246
- );
23247
-
23248
- var buildinConstants = lang.arrayToMap(
23249
- ("NULL").split("|")
23250
- );
23251
-
23252
- // regexp must not have capturing parentheses. Use (?:) instead.
23253
- // regexps are ordered -> the first match is used
23254
-
23255
- this.$rules = {
23256
- "start" : [
23257
- {
23258
- token : "comment",
23259
- regex : "\\/\\/.*$"
23260
- },
23261
- new DocCommentHighlightRules().getStartRule("doc-start"),
23262
- {
23263
- token : "comment", // multi line comment
23264
- merge : true,
23265
- regex : "\\/\\*",
23266
- next : "comment"
23267
- }, {
23268
- token : "string", // single line
23269
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
23270
- }, {
23271
- token : "string", // multi line string start
23272
- merge : true,
23273
- regex : '["].*\\\\$',
23274
- next : "qqstring"
23275
- }, {
23276
- token : "string", // single line
23277
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
23278
- }, {
23279
- token : "string", // multi line string start
23280
- merge : true,
23281
- regex : "['].*\\\\$",
23282
- next : "qstring"
23283
- }, {
23284
- token : "constant.numeric", // hex